Disable English localization with Xcode 5

帅比萌擦擦* 提交于 2020-01-23 07:55:14

问题


I have searched related questions and tried many suggested methods but none seems to work.

I have a japanese-only App that when run on an english device gets UI items such as back buttons translated ("Back").

To achieve this I have:

  • Deleted the English from "Localizations" from my project and chose to delete localized files (was a single *.strings file).

  • Changed CFBundleDevelopmentRegion in my Info.plist from jp_JPto jp as I read it should match the name of the *.lproj folder.

  • Cleaned, deleted, closed Xcode, etc. But default UI items are still getting translated to english.

Also I get some weird behavior in Xcode 5 now:

  • Checking the "Use Base Internationalization" checkbook presents an empty "Choose files and reference language to create Base localization". Choosing either Cancel or Finish has no effect and nothing happens.

  • Clicking on the "+" button to add the Other > "Base (Base)" localization does nothing.

I thing that my problem seems to be that my Base localization is still somehow english but I can't find a way to change that. Any ideas?


回答1:


I found that to truly remove English support I have to properly set the CFBundleDevelopmentRegion into a full valid region (e.g. ja_JP) and not just a language (just ja still resulted in English showing up).

When you have a valid region Xcode will show you the name of your country instead of the raw value in the Plist editor.


Seems like some modules, such as MFMailComposeViewController, get localized to English no matter what (tested on iOS 6 and 7).




回答2:


I encountered the same issue. Here are the steps I did to get past them.

  1. Localize your storyboard file.
    1. Select your Storyboard file in Xcode.
    2. In the “File Inspector”, under the “Localization” sub header, press the “Localize…” button.
    3. A dialog appears that says “Do you want to localize this file? The file will be moved into the lproj folder for the following language.” It lists a language. For me it was “English” and I chose that. For you, I suspect it will be “Japanese”.
    4. Press the “Localize” button.
  2. If it warns you that your storyboard file has changed outside of the project, choose “Save anyway”. If you don't it deletes the storyboard from your project. This happened to me with a source controlled project, but not with a new empty project.
  3. Go back to your project and check the “Use Base Internationalization” checkbox. Your storyboard should show up in the "Choose files and reference language to create Base localization" sheet.

If you go back to your storyboard, you will see “Base” as the checked localization. I had my language (English) show up as an option. When I checked it, a storyboard.strings file was created. Since my base was already in my preferred language, I didn’t need a strings file so I removed it. I presume that if I had another language, I could select that and get a storyboard.strings file for that language.



来源:https://stackoverflow.com/questions/21327951/disable-english-localization-with-xcode-5

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!