Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Pull all StringTableCollection from a MenuItem

Discussion in 'Localization Tools' started by Racines, Dec 3, 2021.

  1. Racines

    Racines

    Joined:
    Jan 20, 2014
    Posts:
    31
    I want to create a MenuItem that will pull all StringTableCollection from google sheets.
    But I can't find a way to do it. Here is my code so far:
    Code (CSharp):
    1.  
    2. var tableCollections = LocalizationEditorSettings.GetStringTableCollections();
    3. foreach (var tableCollection in tableCollections)
    4. {
    5.     foreach (var ext in tableCollection.Extensions)
    6.     {
    7.         // TODO: How to get GoogleSheets from extensions?
    8.         var googleSheetService = ext as IGoogleSheetsService;
    9.         if (googleSheetService != null)
    10.         {
    11.             var googleSheets = new GoogleSheets(googleSheetService);
    12.             foreach (var sheet in googleSheets.GetSheets())
    13.             {
    14.                 googleSheets.PullIntoStringTableCollection(sheet.id, tableCollection, new List<SheetColumn>()
    15.                 {
    16.                     // TODO: retrieve mapping from TableCollection settings
    17.                 });
    18.             }
    19.         }
    20.     }
    21. }
    22.  
    I can't find a way to retrieve googleSheets data from tableCollection.Extensions, and I can't find the mapping from TableCollection.

    Any clues on how to achieve this?
     
  2. Racines

    Racines

    Joined:
    Jan 20, 2014
    Posts:
    31