Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Exporting / Importing metadata with google sheets

Discussion in 'Localization Tools' started by AndrewBR7, Jul 23, 2021.

  1. AndrewBR7

    AndrewBR7

    Joined:
    Jun 18, 2019
    Posts:
    11
    Greetings,

    Unity version: 2020.3.11f1
    Package: com.unity.localization@1.0.0-pre.9

    I am looking at importing/exporting my localisation to google sheets with metadata.
    I have added a comment metadata to cells in the en-GB and also shared entry metadata too.
    upload_2021-7-23_16-40-36.png

    When I export to google I get new columns for the metadata and all is correct.
    upload_2021-7-23_16-42-8.png

    But when I import, the "Shared entry" gets imported with the changes, but the cell metadata get cleared losing all the data we have added.
    upload_2021-7-23_16-44-50.png

    I am using the basic pull string into table collection.
    Code (CSharp):
    1. lGoogleSheets.PullIntoStringTableCollection( lSheetList[lSheetIndex].id, lStringTableCollection, lColumnMappings );
    Do I need to do anything else to get this to work?
    Anyone else seeing this issue?

    Cheers

    Andrew
     
  2. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,225
    What's the settings on your locale columns in the column mapping? Do you have comments enabled?
    It may be a bug.
     
  3. AndrewBR7

    AndrewBR7

    Joined:
    Jun 18, 2019
    Posts:
    11
    Greetings,

    Here is the code for setting up the Column mappings

    Column A = Key
    Column B = Key Comments
    Column C = English (United Kingdom)(en-GB) Comments
    Column D = English (United Kingdom)(en-GB)

    Code (CSharp):
    1.         private SheetColumn[] SheetSetup()
    2.         {
    3.             StringTableCollection lStringTableCollection = LocalizationEditorSettings.GetStringTableCollection( _DEFAULT_STRING_TABLE );
    4.             if( lStringTableCollection != null )
    5.             {
    6.                 List<SheetColumn> lGoogleSheet = new List<SheetColumn>();
    7.  
    8.                 lGoogleSheet.Add( new KeyColumn { Column = "A" } );
    9.                 lGoogleSheet.Add( new KeyCommentColumn { Column = "B" } );
    10.  
    11.                 char lColumn = 'E';
    12.                 foreach( StringTable lStringTable in lStringTableCollection.StringTables )
    13.                 {
    14.                     if( lStringTable.name.Contains( "en-GB" ) == true )
    15.                     {
    16.                         lGoogleSheet.Insert( 2, new LocaleCommentColumn { Column = "C", LocaleIdentifier = lStringTable.LocaleIdentifier.Code } );
    17.                         lGoogleSheet.Insert( 3, new LocaleColumn { Column = "D", LocaleIdentifier = lStringTable.LocaleIdentifier.Code, IncludeComments = false } );
    18.                     }
    19.                     else
    20.                     {
    21.                         lGoogleSheet.Add( new LocaleColumn { Column = lColumn.ToString(), LocaleIdentifier = lStringTable.LocaleIdentifier.Code, IncludeComments = false } );
    22.                         lColumn++;
    23.                     }
    24.                 }
    25.                 return lGoogleSheet.ToArray();
    26.             }
    27.             return null;
    28.         }
     
  4. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,225
    This looks like a bug then. Could you please file a bug report?
     
  5. AndrewBR7

    AndrewBR7

    Joined:
    Jun 18, 2019
    Posts:
    11
    After a bit more playing it looks like you have to have the comments column after the language column it supposed to attach to.

    Works
    upload_2021-7-23_17-35-27.png

    Not working
    upload_2021-7-23_17-36-14.png

    Thanks for you help
     
  6. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,225
    That does sound like a bug. Can you file a bug report so we can look into it?