Search Unity

Question Best practice to handle platform specific localization?

Discussion in 'Localization Tools' started by Peter77, Sep 27, 2022.

  1. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    6,618
    Console vendors are picky when it comes to terminology. For example, for some it's called "Rumble" and for others "Vibration". Now I would like to avoid that the game code has to deal with a different localization string for each supported platform.

    In previous projects, pre-Unity time, our localization system supported to suffix a localization string with "xbox360" or "ps3" for example and if such localization string existed, the system would pick the platform specific one. Otherwise fallback to the localization string without suffix. This allowed that a non-programmer was able to add localization strings where needed.

    I'm wondering whether the localization package is providing similar functionality?
     
    Last edited: Oct 12, 2022
  2. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,292
    Peter77 likes this.
  3. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    6,618
    I can't find the Platform Override. According to the documentation, I presume I would add a new shared metadata entry, but I can't find "Platform Override" in the list.

    How can I add a platform override? I'm using Localization 1.3.2 and Unity 2021.3.11f1.

    upload_2022-11-18_7-21-36.png
     
  4. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    6,618
    Sorry to ping you again, but I can't figure out how to add a PlatformOverride. I simply don't have it in the dropdown-list (see screenshot above).

    Any idea what I'm missing here?
     
  5. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,292
    Sorry, I was away last week so missed some messages.
    It looks like you are editing the table metadata, you need to edit the entry metadata. Platform overrides are done per entry, not table.
    upload_2022-11-21_9-24-39.png
     
    Peter77 likes this.
  6. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    6,618
    Ahhh... you're correct. Thank you! I didn't even know that's a button for additional entry settings. :D
     
    karl_jones likes this.
  7. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,292
    :)
    We just finished a UX review so hopefully, this will become more clear in the future once we make the changes.
     
    Peter77 likes this.
  8. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    6,618
    How can I "simulate" a platform in the editor? The problem for me is that in order to see the platform override texts, I have to deploy a target player. This is very very inconvenient and takes a significant amount of time.

    How can I tell the Localization system that it should display texts for a particular platform? I'd prefer some kind of such API:
    Code (CSharp):
    1. Localization.platformOverride = RuntimePlatform.Switch;
    The Localization system should then use the specified platformOverride instead of the actual platform it's currently running on. This would allow me to easily test all platform texts in the editor.
     
  9. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,292
    We do have support for this in Editor but it's internal at the moment, used for our tests.
    LocalizationSettings.Instance.Platform =

    You could give yourself internal access by using an Assembly definition reference file asmref.
    The plan is to provide a platform option in the scene controls in the future.
     
    Peter77 likes this.
  10. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    6,618
    Thank you for the reply, I'll take a look at LocalizationSettings.Instance.Platform on Monday :)

    Regarding "scene controls". This can still be controlled via code, I assume? Because we have various systems that depend on a simulated platform and we usually specify the simulated platform via CommandLine. Therefore it would be most useful for me to have an API for the Localization platform too.
     
    karl_jones likes this.
  11. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,292
    Yes the scene controls have an API.
     
    Peter77 likes this.