public static void PullEnglish() { // Setup the connection to Google var sheetServiceProvider = GetServiceProvider(); var googleSheets = new GoogleSheets(sheetServiceProvider); googleSheets.SpreadSheetId = "My spread sheet id"; // We need to provide the Spreadsheet id. This can be found in the url. See docs for further info. // You should provide your String Table Collection name here var tableCollection = LocalizationEditorSettings.GetStringTableCollection("My Strings"); // We need configure what each column contains in the sheet var columnMappings = new SheetColumn[] { // Column A contains the Key new KeyColumn { Column = "A" }, // Column B contains any shared comments. These are Comment Metadata in the Shared category. new KeyCommentColumn { Column = "B" }, // Column C contains the English Locale and any comments that are just for this Locale. new LocaleColumn { Column = "C", LocaleIdentifier = "en", IncludeComments = true }, }; int mySheetId = 123456; // This it the id of the sheet in the Google Spreadsheet. it will be in the url after `gid=`. googleSheets.PullIntoStringTableCollection(mySheetId, tableCollection, columnMappings); }
static void PullExtension(GoogleSheetsExtension googleExtension) { // Setup the connection to Google var googleSheets = new GoogleSheets(googleExtension.SheetsServiceProvider); googleSheets.SpreadSheetId = googleExtension.SpreadsheetId; // Now update the collection. We can pass in an optional ProgressBarReporter so that we can updates in the Editor. googleSheets.PullIntoStringTableCollection(googleExtension.SheetId, googleExtension.TargetCollection as StringTableCollection, googleExtension.Columns, reporter: new ProgressBarReporter()); }
public static void PullProjectLocales() { // Setup the connection to Google var sheetServiceProvider = GetServiceProvider(); var googleSheets = new GoogleSheets(sheetServiceProvider); googleSheets.SpreadSheetId = "My spread sheet id"; // We need to provide the Spreadsheet id. This can be found in the url. See docs for further info. // You should provide your String Table Collection name here var tableCollection = LocalizationEditorSettings.GetStringTableCollection("My Strings"); // CreateDefaultMapping will create a KeyColumn and a LocaleColumn for each Locale in the project. // This assumes that the table was created and pushed to using the same column mappings. var columnMappings = ColumnMapping.CreateDefaultMapping(); int mySheetId = 123456; // This it the id of the sheet in the Google Spreadsheet. it will be in the url after `gid=`. // Now pull. // removeMissingEntries will remove any Keys that we have in the String Table Collection that do not exist in the Pull update. // reporter is an optional reporter that can be used to povide feedback in the editor during the Pull. googleSheets.PullIntoStringTableCollection(mySheetId, tableCollection, columnMappings, removeMissingEntries: true, reporter: new ProgressBarReporter()); }