几个本地化仍然只显示英语 [英] Several localizations yet still showing English only

查看:107
本文介绍了几个本地化仍然只显示英语的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我决定使用相同的代码库将我的几个项目合并到一个项目中,并为我的应用程序的不同版本使用不同的目标。

I decided to merge several of my projects into one project using the same code base and use different targets for the different versions of my application.

我的应用程序已翻译7种语言,默认为英语。其他语言包括:瑞典语,荷兰语,德语,法语,波兰语和西班牙语。翻译之前就像一个魅力。我正在使用 NSLocalizedString 并将我的 Localizable.strings 翻译过来。
但是,现在我将我的项目合并在一起,并且还添加了 InfoPlist.strings 文件,该应用程序会使用默认文本(英语)。当我启动应用程序并获得共享位置问题时,我会以本地化语言提出问题(因此操作系统确实获得了本地化),但应用程序的其余部分仍然是英语。

My application is translated to 7 languages with English as default. The other languages are: Swedish, Dutch, German, French, Polish and Spanish. The translations worked like a charm before. I am using the NSLocalizedString and have my Localizable.strings which is translated. However, now that I merged my projects together, and also added the InfoPlist.strings file, the application incists on using the default texts (English). When I start the application and get the "share location" question, I get the question in the localized language (So the OS does get the localization), but the rest of the application is still in English.

文件正确翻译且没有错误。我测试了几种语言,但都是英文的。
如果我将 CFBundleDevelopmentRegion 设置为例如瑞典语,整个应用程序都是瑞典语。所以本地化工作,但应用程序忽略系统设置。

The files are correctly translation and have no errors. I have tested several languages, but all are in English. If I set the CFBundleDevelopmentRegion to e.g. Swedish, the whole app is in Swedish instead. So the localizations work, but the app ignores the system setting.

我错过了什么?

推荐答案

我找到了问题的答案。我有几个字符串文件,一个用于我的应用程序翻译,一个用于每个目标,名为 InfoPlist.strings ,其中只包含 CFBundleDisplayName CFBundleName 用于本地化的应用名称。这些不能包含在 Localizable.strings 中,因为每个目标都有所不同。

I found the answer to my problem. I have several strings files, one for my app translation, and one for each target called InfoPlist.strings which contains just CFBundleDisplayName and CFBundleName for localized app name. These cannot be included into the Localizable.strings since these are different for each target.

我删除了 InfoPlist.strings 我项目中的文件,现在应用程序再次本地化。

I removed the InfoPlist.strings files from my project and now the app is localized again.

这篇关于几个本地化仍然只显示英语的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆