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. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Question Get localized string at runtime and remotely update localization

Discussion in 'Localization Tools' started by charles-everyrealm, Jul 17, 2022.

  1. charles-everyrealm

    charles-everyrealm

    Joined:
    Jun 30, 2022
    Posts:
    11
    Hey all - is there no API for just getting a localized string based on a key? I didn't see anything from a cursory look through the documentation. I must be missing it. Secondly, can you sync Google Sheets at runtime to be able to update localization strings remotely without requiring client updates? I'm evaluating the new localization package and these are two requirements. Thanks in advance.
     
  2. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    7,876
    invictvs1 likes this.
  3. invictvs1

    invictvs1

    Joined:
    Mar 7, 2014
    Posts:
    51
    Nice! Thanks for the quick reply. I see, so the addressables just get updated remotely which contain the localization files. Awesome.
     
  4. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    7,876
    Yes. Addressables can be split to be local and remote. You can even distribute them locally and then update them remotely in the future etc. You can also split things so you distribute with English for example and provide the other languages remotely.
     
    invictvs1 likes this.
  5. charles-everyrealm

    charles-everyrealm

    Joined:
    Jun 30, 2022
    Posts:
    11
    Good to know! @karl_jones I do have an issue I'm hitting though - I've added a `LocalizeStringEvent` to a TextMeshPro UI text component and set the table entry it should display during play mode however it's only showing English even if I try to default it to another language or change it at runtime using the GUI. What's going on? This seems like a bug to me. Please see screenshot attached.
     

    Attached Files:

  6. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    7,876
    You have not connected the event up to the tmp object.
    You need to connect the update string event. Simplest thing to do is to right click on the tmp component header and select Localize to do it automatically.
     
  7. charles-everyrealm

    charles-everyrealm

    Joined:
    Jun 30, 2022
    Posts:
    11
    Ah thank you! I thought the Localize option was only for Text components (might be worth updating the docs on that)
     
  8. charles-everyrealm

    charles-everyrealm

    Joined:
    Jun 30, 2022
    Posts:
    11
    That keeps resetting my string reference selection - I'm under the impression it will localize automatically even if a reference is not set if the text matches one of the strings in the table but that didn't work.
     
  9. charles-everyrealm

    charles-everyrealm

    Joined:
    Jun 30, 2022
    Posts:
    11
    I had to re-apply the string table reference again before it worked - IMO localize shouldn't be clearing this reference if it's set.
     
  10. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    7,876
    The Localize option is available on multiple different components. We do mention this here https://docs.unity3d.com/Packages/c...nual/ComponentLocalizers.html#automatic-setup
    Maybe we can add a list of the components it supports to make it clearer.

    Ah yes, I think it adds a new component each time. We should really check to see if one exists already. Ill add a task to look into it.
     
  11. charles-everyrealm

    charles-everyrealm

    Joined:
    Jun 30, 2022
    Posts:
    11
    Ah I missed that, thanks for your help!
     
    karl_jones likes this.
  12. Till_LeFx

    Till_LeFx

    Joined:
    Dec 1, 2016
    Posts:
    9
    Hey everyone,

    first of all, I am a big fan of the localization package, because of its clear and clever implementation, striking documentation and most of all, its reliable help and contact section.

    Currently, I am struggeling to find a solution on how to pull entries out of a google (spread)sheet document within a build (standalone, webgl and iOS are my target platforms).

    My goal is to have multiple sheets in one spreadsheet, each identifiable by the speadsheet ID and its sheet ID. In Unity, I have one string table collection, which is filled via pull-command for a specific, given sheet ID.

    Everything works as expected, thanks to the localization documentation:
    (https://docs.unity3d.com/Packages/c...Localization.Plugins.Google.GoogleSheets.html)

    But as @karl_jones mentioned, it is editor-only.

    So my Question is:
    I don't understand on how the solution to activate remote distribution for the addressables solve my problem. Or did I understand anything fundamentally wrong? How can I pull from a sheet ID this way?

    These are my settings, maybe I did anything wrong already here:
    upload_2023-2-13_22-9-12.png
    upload_2023-2-13_22-9-23.png

    Thank you all in advance!
     

    Attached Files:

  13. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    7,876
    Thanks for the kind words about the package :)


    You can't pull from a Google sheet in the player, addressables does not support this. You would need to implement runtime Google sheets support into addressables, perhaps as a custom addressables provider. It's quite a lot of work and I wouldn't recommend it. Instead you can use the addressables content update workflow https://docs.unity3d.com/Packages/com.unity.addressables@1.21/manual/ContentUpdateWorkflow.html

    You can still use Google sheets, for example you could:

    1. Pull from Google sheets in editor to update the collection
    2. Generate a content update with the changes and push to a server.
    3. In the player check for content updates and pull them if needed.

    You will need somewhere to host the contents
    https://docs.unity3d.com/Packages/com.unity.addressables@1.21/manual/RemoteContentDistribution.html
    https://docs.unity3d.com/Packages/com.unity.addressables@1.21/manual/AddressablesCCD.html

    We also have some alternatives to addressables remote content, you can create a table post processor with ITablePostProcessor to update an existing table. You would still need to figure out how to get this data from a server, so I would suggest remote content updates.
     
  14. Till_LeFx

    Till_LeFx

    Joined:
    Dec 1, 2016
    Posts:
    9
    Thank you very much, as I said, outstanding support :)
     
    karl_jones likes this.