IOS String Localization stops working when adding additional localization

I created a new Xcode project and try to set up string localization.

I added a new file called "localization.strings" with the following contents.

"Login" = "English text2";

I added a second localization to the Project> Info section in the latest version of Xcode.

Then I'll check the box on the right to add French for the localization.strings file. When this is added, I can start / create the application, but the lines no longer reference this file.

For example, if I update the original English version above, for example, for "text testing", it still shows the source text in English.

Any idea why this might happen? The application is too large for publication and assembly errors, the file is not damaged, missing, incorrect encoding.

0
source share
2 answers

You need to do a clean build and uninstall of the application from the simulator and / or your device, and then everything should work. You only need to do this once.

Before adding any localizations, your line file will appear in the root directory of your application, for example. MyApp.app/Localizable.strings . After that, the application will be copied to Simulator and / or your device.

After adding localization, the contents of the file are moved to subdirectories specific to localization, such as MyApp.app/en.lproj/Localization.strings and MyApp.app/fr.lproj/Localization.strings . But the old file in the root package is still hanging around in the simulator and on your device, and it shows up in front of others. So do a clean build, uninstall the application from Simulator and your devices and this old file will be deleted.

+5
source

This is not the only problem that may arise. I meet another case: two files with the same name: "Localizable.strings". I had one in the library folder and one in the main project folder. The localization system used only one of them, and not both. I solved the problem by deleting the one that is not needed.

0
source

Source: https://habr.com/ru/post/1436452/


All Articles