Best practice to handle platform specific localization?

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?

We have PlatformOverrides. They kind of work in a similar way. If an entry has a platform override metadata attached and it contains an override for that particular platform it will redirect to the alternative value instead of using the default.
You can also create your own custom overrides by implementing IEntryOverride. Platform Overrides | Localization | 1.3.2
You have the ability to override the table, entry or both.

1 Like

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.

8595532--1152733--upload_2022-11-18_7-21-36.png

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?

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.

1 Like

Ahhh… you’re correct. Thank you! I didn’t even know that’s a button for additional entry settings. :smile:

1 Like

:slight_smile:
We just finished a UX review so hopefully, this will become more clear in the future once we make the changes.

1 Like

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:

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.

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.

1 Like

Thank you for the reply, I’ll take a look at LocalizationSettings.Instance.Platform on Monday :slight_smile:

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.

1 Like

Yes the scene controls have an API.

1 Like

Hey Karl, years later, new project, same problem :sweat_smile:

I’m using metadata platform overrides and I wonder if there is now support to override the “localization platform” and how I would do it? I would need this functionality in both, editor and player.

Most recent case I ran into: The “Username” column header in a Leaderboard screen should display “Gamertag” when targeting GameCore (Windows/Xbox) and in other stores/platforms just “Name”.

I’m using Unity 6.0.28 and Localization 1.5.3

Hi,
Unfortunatly we still dont have this support. Ill add it to out backlog as a seperate task so we can look at it sooner.
Would this be what we discussed earlier, the ability to override the platform, similiar to LocalizationSettings.Instance.Platform?

Yes, the ability to override the platform that allows me to call in both, the editor and player:

LocalizationSettings.Instance.PlatformOverride = RuntimePlatform.GameCoreXboxSeries;

or

LocalizationSettings.Instance.PlatformOverride = RuntimePlatform.PS5;

and the Localization system acts like it would run on Xbox or PS5, regardless of the actual platform it’s running on.

2 Likes

Would it be possible to make

internal virtual RuntimePlatform Platform => Application.platform;

to this

internal virtual RuntimePlatform Platform => UnityEngine.Device.Application.platform;

So we can preview in the Device Simulator?

Hey,
Thanks for bringing this API to my attention. It looks suitable, ill see if we can get the change into the next release.

1 Like