Welcome, Guest
Username: Password: Remember me

TOPIC: Info.plist - CameraUsageDescription a.o.

Info.plist - CameraUsageDescription a.o. 6 months 1 week ago #2830

  • tstrooba
  • tstrooba's Avatar
  • Offline
  • New Member
  • Posts: 1
  • Karma: 0
Hi,

Is there any way to localize camera usage description and other strings which are built into the Info.plist string on iOS?
They can be set from the player settings, but I could not find a way to localize them.

Thx,
Tim
The administrator has disabled public write access.

Info.plist - CameraUsageDescription a.o. 6 months 1 week ago #2832

  • Frank
  • Frank's Avatar
  • Offline
  • Administrator
  • Posts: 1123
  • Thank you received: 240
  • Karma: 70
Hi,
One of my tasks for the release after this one (2.8.5) its to allow localizing all of the native messages.

In the meantime, you can "hack" this by:
1- create a term for each of the native texts you want to change
2- Make each of those terms be in an specific category (e.g. "NativeLocalization")
3- modify the file Assets\I2\Localization\Scripts\Editor\PostProcessBuild_IOS.cs
-Add this function to get all translations in that category
	public static List<string> GetNativeLocalizations(string code, string category="NativeLocalization")
        {
            if (LocalizationManager.Sources.Count <= 0)
                LocalizationManager.UpdateSources();

            var contents = new List<string>();
            var pushTerms = LocalizationManager.GetTermsList(category);
            var lang = LocalizationManager.GetLanguageFromCode(code, false);
            foreach (var pushTerm in pushTerms)
            {
                var term = pushTerm.Replace(category+"/", "");
                var loco = LocalizationManager.GetTermTranslation(pushTerm, true, 0, true, false, null, lang);
                contents.Add($"\"{term}\"=\"{loco}\";");
            }

            return contents;
        }
-Instead of writing an empty file in line 85, write the result of that function
// File.WriteAllText(stringPaths, "");
File.WriteAllLines(stringPaths, GetNativeLocalizations(code));

Hope that helps,
Frank
Are you :-) Give I2L 5 stars!
Are you :-( Please lets us know how to improve it!
To get the betas as soon as they are ready, check this out
The administrator has disabled public write access.

Info.plist - CameraUsageDescription a.o. 5 months 5 days ago #2955

  • enghoff
  • enghoff's Avatar
  • Offline
  • Junior Member
  • Posts: 20
  • Thank you received: 1
  • Karma: 1
To my experience, the usage descriptions need to go in localised InfoPlist.strings rather than Localizable.strings
The administrator has disabled public write access.

Info.plist - CameraUsageDescription a.o. 5 months 5 days ago #2956

  • Frank
  • Frank's Avatar
  • Offline
  • Administrator
  • Posts: 1123
  • Thank you received: 240
  • Karma: 70
Indeed,
I2 Localization already sets the app name in InfoPList, and will set there the other "common" strings.
The strings file example I gave in the previous post was for other strings used directly from the app.

I will try boosting the priority of that task and add it to the beta as soon as I finish these fixes I'm doing currently!
Are you :-) Give I2L 5 stars!
Are you :-( Please lets us know how to improve it!
To get the betas as soon as they are ready, check this out
The administrator has disabled public write access.
Time to create page: 0.248 seconds
Colors