Search Unity

How set translation in editor?

Discussion in 'Localization Tools' started by ms502040, May 8, 2021.

  1. ms502040

    ms502040

    Joined:
    Jan 9, 2019
    Posts:
    18
    I can create new entry in editor:
    var newSharedTableEntry = LocalizationEditorSettings.GetStringTableCollection("table name").SharedData.AddKey("key name");

    How I can set / change translation for this entry?
     
  2. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,288
    Hi,
    We have an editor API for this.

    Get the collection with
    https://docs.unity3d.com/Packages/c...ityEngine_Localization_Tables_TableReference_

    e.g

    Code (csharp):
    1.  
    2. var collection = LocalizationEditorSettings.GetStringTableCollection("table name");
    3. var table = collection.GetTable("en") as StringTable;
    4. table.AddEntry("key name", "some localized value");
    5.  
    6. // Mark the table and shared table data dirty or changes wont be saved
    7. EditorUtility.SetDirty(table);
    8. EditorUtility.SetDirty(table.SharedData);