Search Unity

What's the best way to disable a language while it's being translated but still usable in editor?

Discussion in 'Localization Tools' started by ManuelRauber, Sep 5, 2021.

  1. ManuelRauber

    ManuelRauber

    Joined:
    Apr 3, 2015
    Posts:
    122
    Hi!

    I'm close to releasing a little game using the Localization package.

    I know, that some of the translations will not be finished before the release, but close after.

    So, I added all the locales in the system and pushed everything to the google spreadsheet for the translators.

    However, that means that the application will be automatically translated if it recognizes the system's language (we do not have a language selector for the user, we just use the system's language with fallback to English).

    Currently, the issue is, that the app will show uncompleted translations.

    I'm looking for a way to use the Localization Package as described in the documentation, but on release I may want to spare out some not yet completed locales.
    I was thinking of manually removing the table from the string table collection, but not sure, if that's the best way.

    Are there other possibilities to only allow certain locales to be used in the player, but within the editor I have access to all locales?

    Thanks!
     
  2. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,281
    We don't have a simple way to support the editor but not the player. One way would be to put the locale into a separate addressable group and set that group to not be exported in the player. Another way would be to remove the locale from the settings when building and then add it back afterwards.
     
  3. ManuelRauber

    ManuelRauber

    Joined:
    Apr 3, 2015
    Posts:
    122
    Can I simply change the "Include in Build" from the addressables group created by the package?
    upload_2021-9-5_13-57-29.png

    Or do I need to create a new group (or in my case, put it into my "ExcludeFromBuild" group which has turned off the mentioned setting)?
     
  4. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,281
    Oh yes that's fine since the language is already in a single group. If you drag the locale from the locales group and put it in to the same group then you should be all set to exclude that language.
     
    ManuelRauber likes this.
  5. ManuelRauber

    ManuelRauber

    Joined:
    Apr 3, 2015
    Posts:
    122
    Nice, thanks! I will try that. That's a solution I actually like :)
     
    karl_jones likes this.
  6. ManuelRauber

    ManuelRauber

    Joined:
    Apr 3, 2015
    Posts:
    122
    Oh well, you can not move addressables into a greyed out addressables group. I can move it into my own created group, but I can not move it back anymore. Hmm
     
  7. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,281
    Ah yes because we marked it as read only. Click on the group, change the inspector to debug mode by right clicking it's header, now deselect the read-only flag. It should now work.
     
    ManuelRauber likes this.
  8. ManuelRauber

    ManuelRauber

    Joined:
    Apr 3, 2015
    Posts:
    122
    You are a wizard, Karl!
    Removing read only let's me move it, then I can try it out if it works as expected.
     
    karl_jones likes this.
  9. CrowbarSka

    CrowbarSka

    Joined:
    Dec 15, 2009
    Posts:
    192
    Hey, apologies for hijacking/resurrecting this old thread but I've been grappling with this today.

    I'm working on localisation for my released game in the background alongside other updates. So I need to keep making patches, but I'm not ready to release any additional languages yet. But I've started implementing localisation because it takes time and it's something I can do while translation occurs.

    So, I'm looking for a quick and simple way to disable specific languages from the game entirely.

    The method of disabling the addressable assets from the build simply didn't work for me. The languages are still automatically selected in a build if I change my system language. I followed all the steps listed in this thread. ‍♂️

    The method of removing locales from this list then adding them back in afterwards is quite impractical every time I need to make a build. It relies on keeping changes uncommitted in version control and I have to remember to revert them later too. It doesn't seem possible to add them back in any other way, since adding locales generates NEW ones, resulting in duplicate assets.

    Request:
    Could we please have a simple check-box for disabling locales somewhere? Maybe in the Available Locales list in Localization Settings? Something that just prevents certain locales from being automatically selected when the game starts.
     
  10. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,281
    Yeah, this sounds fine. I'll make a record of the request so we can look into adding this.
     
  11. CrowbarSka

    CrowbarSka

    Joined:
    Dec 15, 2009
    Posts:
    192
    Amazing. Thanks for the quick reply!
     
    karl_jones likes this.
  12. ManuelRauber

    ManuelRauber

    Joined:
    Apr 3, 2015
    Posts:
    122
    Hi Karl!

    Any news on this?

    I've found another thing where this could be useful. Currently, all languages, even if they are excluded from build, will end up in the iOS' Info.plist file. Due to that, the App Store will display that the App is available for certain languages but it is not been translated yet.

    Currently using Localization 1.0.5 which is the recommended version for Unity 2021 LTS.

    Thanks!
     
  13. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,281
    It's on our roadmap but not implemented yet.
    I have made some suggestions to the addressables team which would help us handle this in a much simpler way. I want to be able to enable/disable addressable labels so you can exclude certain assets. I'm waiting to see how this goes. If not then we will need to handle it in a different way. As for disabling them when exporting to the plist file, I'll also make a note so we don't miss that.

    Also 1.3.1 is now the latest version although that won't solve your problem, it does have a lot of bug fixes since 1.0.5
     
  14. ManuelRauber

    ManuelRauber

    Joined:
    Apr 3, 2015
    Posts:
    122
    Thanks! That sounds good, I hope it something that will be implemented soon. :)

    Also regarding 1.3.1. In Unity 2021.3.0f1 it's not visible in the package manager:

    upload_2022-5-30_20-44-15.png

    I guess I need to upgrade my Unity version to latest 2021 LTS first?
     
  15. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,281
    No, you can edit the manifest.json file in the Packages folder to just update the package. Just change the version number.
     
    ManuelRauber likes this.
  16. alexboost222

    alexboost222

    Joined:
    Jul 1, 2018
    Posts:
    11
    Hello! I'm also interested in the functionality to include/exclude locales that are included in build. But i want to do it from script. Is there a possibility at the moment?
     
  17. alexboost222

    alexboost222

    Joined:
    Jul 1, 2018
    Posts:
    11
    I think i solved my problem. I'm using SuperUnityBuild tool for automating some pre build stage actions and i simply made a pre build action for setting specific locales.
    Code (CSharp):
    1. public class SetLocales : BuildAction, IPreBuildPerPlatformAction, IPreBuildPerPlatformActionCanConfigureEditor
    2. {
    3.     [SerializeField] private List<Locale> locales = new();
    4.    
    5.     public override void PerBuildExecute(BuildReleaseType releaseType, BuildPlatform platform, BuildArchitecture architecture,
    6.         BuildDistribution distribution, DateTime buildTime, ref BuildOptions options, string configKey, string buildPath)
    7.     {
    8.         base.PerBuildExecute(releaseType, platform, architecture, distribution, buildTime, ref options, configKey, buildPath);
    9.  
    10.         foreach (var locale in LocalizationSettings.AvailableLocales.Locales)
    11.         {
    12.             LocalizationEditorSettings.RemoveLocale(locale);
    13.         }
    14.  
    15.         foreach (var locale in locales)
    16.         {
    17.             LocalizationEditorSettings.AddLocale(locale);
    18.         }
    19.     }
    20. }
     
  18. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,281
    That's one way to do it however this won't remove the assets and strings for the language, just hide them.