XCode:显示一种语言的所有本地化文件(IOS项目)

时间:2022-09-02 15:17:02

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

我一直在搜索XCode和Google,但我无法找到如何做到这一点:

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)?

我正在使用Base本地化,它显示4个本地化为英语的文件。我不知道为什么它是4,我想找出原因。但是怎么样?如何获取所有本地化文件的列表(以及这些文件所在的位置)?

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.

我意识到,当我尝试添加另一种语言(如Japanase)时,我会看到有4x InfoPlist.strings文件用于英文,1x文件用于Base Localization(Storyboard),但我仍然不知道为什么以及在哪里这些文件以及如何删除它们。

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

检查en.lproj文件夹,只有1个InfoPlist.strings文件。为什么XCode告诉我我有4个?

6 个解决方案

#1


5  

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.

我同意这是一个非常可怕的开发者体验。只需将其添加到移动开发人员滥用的方式列表中即可。

XCode:显示一种语言的所有本地化文件(IOS项目)

#2


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.

Xcode从您的项目文件中获取此信息。因此,如果您无法通过查看您的lproj文件夹来推断它,您可以打开pbxproj文件(在.xcodeproj文件夹下)并在那里搜索区域设置。

#3


1  

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

在iOS-App(iPhone和iPad)中使用此答案手册语言选择

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

您可以设置任何所需的语言,记住“Localizable.strings”包含语言文本

#4


0  

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

您可以检查文件在Project Navigator中选择它们,然后查看Xcode右侧的File Inspector。

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

在这里,如果您的文件已本地化,您可以查看存在的语言并选择/取消选择它们。

XCode:显示一种语言的所有本地化文件(IOS项目)

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).

您也可以使用Finder:转到项目文件夹,其中有名为ja.lproj或it.lproj的文件夹(实际名称根据Xcode版本更改)。在这些文件夹中,您将找到为该语言本地化的所有文件(例如,在ja.lproj中,您将看到本地化为日语的文件)。

#5


0  

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.

最简单的方法是在项目的根目录中打开een finder屏幕。之后,在搜索栏中输入en.lproj(或您的主要语言)。

Select to only search in the folder

选择仅在文件夹中搜索

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

现在您有一个包含所有本地化文件的列表。

XCode:显示一种语言的所有本地化文件(IOS项目)

#6


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".

我自己也在想这个。我没有开始本地化过程,Xcode已经告诉我,我有“2个文件本地化”。

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.

您可能想要检查项目中的目标。我有一个InfoPlist.strings文件用于我的主目标,另一个InfoPlist.strings文件用于我的单元测试目标。

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".

在我的情况下,这个确认屏幕显示了两个相同的条目,对应于每个目标中的InfoPlit.strings资源文件,其中英语是每个引用的唯一语言,使其成为“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.

所有这一切的有趣之处在于,“资源文件”在技术上并不存在于文件系统中,只有本地化文件存在于那些.lproj文件夹中。

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

据我所知,“资源文件”是Xcode的废话。

#1


5  

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.

我同意这是一个非常可怕的开发者体验。只需将其添加到移动开发人员滥用的方式列表中即可。

XCode:显示一种语言的所有本地化文件(IOS项目)

#2


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.

Xcode从您的项目文件中获取此信息。因此,如果您无法通过查看您的lproj文件夹来推断它,您可以打开pbxproj文件(在.xcodeproj文件夹下)并在那里搜索区域设置。

#3


1  

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

在iOS-App(iPhone和iPad)中使用此答案手册语言选择

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

您可以设置任何所需的语言,记住“Localizable.strings”包含语言文本

#4


0  

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

您可以检查文件在Project Navigator中选择它们,然后查看Xcode右侧的File Inspector。

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

在这里,如果您的文件已本地化,您可以查看存在的语言并选择/取消选择它们。

XCode:显示一种语言的所有本地化文件(IOS项目)

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).

您也可以使用Finder:转到项目文件夹,其中有名为ja.lproj或it.lproj的文件夹(实际名称根据Xcode版本更改)。在这些文件夹中,您将找到为该语言本地化的所有文件(例如,在ja.lproj中,您将看到本地化为日语的文件)。

#5


0  

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.

最简单的方法是在项目的根目录中打开een finder屏幕。之后,在搜索栏中输入en.lproj(或您的主要语言)。

Select to only search in the folder

选择仅在文件夹中搜索

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

现在您有一个包含所有本地化文件的列表。

XCode:显示一种语言的所有本地化文件(IOS项目)

#6


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".

我自己也在想这个。我没有开始本地化过程,Xcode已经告诉我,我有“2个文件本地化”。

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.

您可能想要检查项目中的目标。我有一个InfoPlist.strings文件用于我的主目标,另一个InfoPlist.strings文件用于我的单元测试目标。

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".

在我的情况下,这个确认屏幕显示了两个相同的条目,对应于每个目标中的InfoPlit.strings资源文件,其中英语是每个引用的唯一语言,使其成为“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.

所有这一切的有趣之处在于,“资源文件”在技术上并不存在于文件系统中,只有本地化文件存在于那些.lproj文件夹中。

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

据我所知,“资源文件”是Xcode的废话。