XCode: Show all localized files for one language (IOS project)
Asked Answered
W

7

10

I have been searching XCode and Google all over, but I just can't find out how to do it:

I am using Base localization and it shows 4 Files Localized for English. I have no idea why it's 4 and I would like to find out why. But how? How can I get a list of all localized files (and where these files are located)?

Is this such an uncommon task that I can't find any answer to it? Or is it that obvious and I am just unable to find it?

I realized that when I am trying to add another language (like Japanase), I will see there are 4x InfoPlist.strings-files for English and 1x file for Base Localization (Storyboard), but I still don't know why and where are these files and how to remove them.

Checking the en.lproj Folder, there is only 1 InfoPlist.strings-file. Why XCode is telling me that I have 4 of them?

Werewolf answered 27/9, 2013 at 7:35 Comment(0)
C
9

There is a way to delete the localized files. If you are using version control, you can make sure your work is committed and your tree is clean. Then when you delete the localized files, you can just check the status of your tree and see what files they were, and recover them a figure out what you need to do from there.

I agree that it is a pretty terrible developer experience. Just add it to the list of ways in which mobile developers are abused.

enter image description here

Careerist answered 2/6, 2015 at 17:39 Comment(1)
This is really an excellent idea. I agree it's a terrible solution, but seems to be the only one.Werewolf
P
2

Xcode is deriving this information from your project file. So if you can't deduce it by looking at your lproj folder, you can open up pbxproj file (under your .xcodeproj folder) and search for the locale in there.

Pitterpatter answered 23/2, 2017 at 22:37 Comment(1)
Interesting suggestion, thanks! The .pbxproj file can be pretty big though, I still think this https://mcmap.net/q/1072818/-xcode-show-all-localized-files-for-one-language-ios-project is the most feasible solution at the moment.Werewolf
B
2

Just had the same issue. Here is a really easy way to get a list of all localized files, by going through the motions of adding a new language (and cancelling):

  1. Project -> Localizations
  2. Hit the plus button to add a new language.
  3. Select any language.
  4. The "Choose files and reference language to create ... localization" dialogue will appear. This is a list of all localized files.
  5. Hit cancel (don't add the new language).
Befog answered 22/8, 2018 at 16:0 Comment(1)
This actually show the list of the files and event the "file path' in Xcode 10.2.Cornetist
H
1

use this answer manual language selection in an iOS-App (iPhone and iPad)

You can set any language you want, remember "Localizable.strings" for containing language text

Hema answered 30/9, 2013 at 9:34 Comment(1)
Thanks for the answer, I am looking for a the localized files in XCode though.Werewolf
R
1

The easiest way is to open een finder screen in the root of your project. After that enter en.lproj (or your main language) in the search bar.

Select to only search in the folder

Now you have a list with all the files which are localized.

Search for localized files in xCode project

Retaretable answered 15/4, 2015 at 13:27 Comment(1)
Thank you for your suggestion, this is actually a good idea. The thing is, using this method I find 1 file (Localizable.strings), but Xcode is telling me that 2 files are localized. But which is the second one?Werewolf
S
0

You can check your files selecting them in Project Navigator and then looking at File Inspector on the right of Xcode.

Here, if your file is localized, you can see what languages are present and select/deselect them.

enter image description here

You can also use Finder: go to your project folder, there there are folders named like ja.lproj or it.lproj (the actual name changes as per Xcode version). In these folders you'll find all the files that are localized for that language (e.g. in ja.lproj you'll see al file localized in Japanese).

Stenotype answered 27/9, 2013 at 7:52 Comment(1)
Thanks for your quick answer. It's true, I could check every single file in my project, if localization is enabled. As it is a pretty big one, I would like to find another way. The second option you mention: Yes, I have tried that. The funny thing is, there is only 1 file inside, even though XCode says "4 Files Localized".Werewolf
R
0

I was wondering the same myself. I had not started the localization process and Xcode was already telling me I had "2 Files Localized".

You might want to check the targets in your project. I had one InfoPlist.strings file for my main target and a second InfoPlist.strings file for my unit test target.

By trying to add a new localization, a confirmation screen shows up with a table listing all Resource Files and a dropdown for each Reference Language associated with those Resource Files.

Resource File != Localized File.

Reference Language = Localized File.

For every language you see in the Reference Language drop-down the "Files Localized" counter goes up by one.

In my case this confirmation screen had shown two identical entries corresponding to the InfoPlit.strings resource files in each target with English being the only language referenced for each, making it "2 Files Localized".

Funny thing about all this is that the "Resource Files" don't technically exist in the file system, only the localized files do in those .lproj folders.

"Resource Files", as far as I can tell, are Xcode nonsense.

Reinforce answered 7/12, 2016 at 23:45 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.