简体   繁体   English

iOS模拟器上缺少语言

[英]Missing languages on iOS simulator

When I run my application, my iPhone/iPad simulator only gives me 6 language choices (English, German, Japanese, Italian, Spanish, and Hungarian). 当我运行应用程序时,我的iPhone / iPad模拟器仅给我6种语言选择(英语,德语,日语,意大利语,西班牙语和匈牙利语)。 After having Googled this it seems like there should be at least 18 language choices available. 用Google搜索后,似乎应该至少有18种语言可供选择。

I've reinstalled Xcode 4.3.1, and installed the iOS 5.1 simulator, and it has the same issues, same languages. 我重新安装了Xcode 4.3.1,并安装了iOS 5.1模拟器,它具有相同的问题,相同的语言。

Does anyone know where these languages are defined, and why a simulator wouldn't have all available options? 有谁知道这些语言的定义位置,以及为什么模拟器没有所有可用选项? Google and the Apple Dev forums are of no help. Google和Apple Dev论坛无济于事。

Here's a screenshot: 这是屏幕截图:

iOS模拟器

Update: I decided to install the slightly older 5.0 simulator (instead of 5.1), and whenever I'm using the 5.0 simulator it appears I have all of the languages. 更新:我决定安装稍旧的5.0模拟器(而不是5.1),并且每当我使用5.0模拟器时,我都拥有所有的语言。 If I switch back to the 5.1 simulator I still only have the 6 languages shown in the above screenshot. 如果我切换回5.1模拟器,我仍然只有上面的屏幕截图中显示的6种语言。

I think something bad has happened to your simulator installation, not that Apple removed languages. 我认为您的模拟器安装发生了一些问题,而不是苹果删除了语言。 If they were to cut down on the number of languages in the simulator to only 6 Magyar would be an odd choice (with only 12.5M or so speakers). 如果将模拟器中的语言数量减少到只有6种,则是一个奇怪的选择(只有12.5M左右的扬声器)。

I also checked my Xcode 4.3.3/iPhone 5.1 simulator and I have what I assume the full complement of languages. 我还检查了我的Xcode 4.3.3 / iPhone 5.1模拟器,并假设了全部语言。 Might be worth trying to reinstall your simulator! 可能值得尝试重新安装模拟器!

The list of languages presented by the simulator in the Settings app can be found in 模拟器在“设置”应用中显示的语言列表可在以下位置找到

/Applications/Xcode-4.3.3.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.1.sdk/System/Library/PrivateFrameworks/Preferences.framework/GlobalPreferences.plist . /Applications/Xcode-4.3.3.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.1.sdk/System/Library/PrivateFrameworks/Preferences.framework/GlobalPreferences.plist

It's in binary format so you would need to copy it away to a temp directory and use plutil -convert xml1 <file_name> to convert it to something you can read. 它采用二进制格式,因此您需要将其复制到temp目录中,并使用plutil -convert xml1 <file_name>将其转换为可以读取的内容。 You could check and see if the languages are missing from this list. 您可以检查一下列表中是否缺少语言。

For reference here's what mine looks like 供参考,这是我的样子

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
        <key>AppleLanguages</key>
        <array>
                <string>en</string>
                <string>fr</string>
                <string>de</string>
                <string>ja</string>
                <string>nl</string>
                <string>it</string>
                <string>es</string>
                <string>pt</string>
                <string>pt-PT</string>
                <string>da</string>
                <string>fi</string>
                <string>nb</string>
                <string>sv</string>
                <string>ko</string>
                <string>zh-Hans</string>
                <string>zh-Hant</string>
                <string>ru</string>
                <string>pl</string>
                <string>tr</string>
                <string>uk</string>
                <string>ar</string>
                <string>hr</string>
                <string>cs</string>
                <string>el</string>
                <string>he</string>
                <string>ro</string>
                <string>sk</string>
                <string>th</string>
                <string>id</string>
                <string>ms</string>
                <string>en-GB</string>
                <string>ca</string>
                <string>hu</string>
                <string>vi</string>
        </array>
        <key>AppleLocale</key>
        <string>en_US</string>
</dict>
</plist>

Based on information in the answer posted the user named idz, located in this same question, I was able to figure out how to fix this. 根据位于同一问题中的名为idz的用户发布的答案中的信息,我能够弄清楚如何解决此问题。

I was using 5.1, I had to install the previous version of my simulator (5.0), then locate the language directories from 5.0 and copy them into the proper location for 5.1, and then restart the iPhone Simulator. 我使用的是5.1,必须安装以前版本的模拟器(5.0),然后从5.0找到语言目录,并将其复制到5.1的正确位置,然后重新启动iPhone模拟器。 Here are some detailed steps: 以下是一些详细步骤:

  1. Locate the language .lproj directores for the 5.0 simulator. 找到5.0模拟器的语言.lproj目录。 /Applications/Xcode-4.3.3.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.0.sdk/System/Library/PrivateFrameworks/Preferences.framework/
  2. Within this folder you will see many folders with the .lproj extension, eg English.lproj . 在此文件夹中,您将看到许多扩展名为.lproj的文件夹,例如English.lproj Copy all of the .lproj folders that you find here. 复制您在此处找到的所有.lproj文件夹。
  3. Locate the folder with the .lproj directories for the 5.1 simulator. 找到带有5.1模拟器的.lproj目录的文件夹。 /Applications/Xcode-4.3.3.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.1.sdk/System/Library/PrivateFrameworks/Preferences.framework/
  4. Paste the folders you copied into this directory. 将复制的文件夹粘贴到此目录中。 I chose not to overwrite any existing folders when I did this. 执行此操作时,我选择不覆盖任何现有文件夹。
  5. Restart your iPhone Simulator. 重新启动iPhone模拟器。
  6. Make sure your iPhone Simulator is set to 5.1. 确保您的iPhone Simulator设置为5.1。 While the iPhone Simulator is selected, go to Hardware -> Version -> 5.1 . 选择iPhone模拟器后,转到Hardware -> Version -> 5.1 Now when you go to choose the language for the simulator you should have all of the languages available that you copied over from the 5.0 folder. 现在,当您选择模拟器的语言时,您应该拥有从5.0文件夹复制过来的所有可用语言。

Alternatively some have said that you might be able to fix this by simply uninstalling the Xcode SDK and reinstalling it, but I've found this way to be much faster. 另外,有人说您可以通过简单地卸载Xcode SDK并重新安装它来解决此问题,但是我发现这种方法要快得多。

I submitted a bug report to Apple for this, and after a week had no response. 我为此提交了一个错误报告给Apple,一周后没有任何反应。 I've directed them to this page for the fix to the problem, but I'm still not sure how this happened in the first place. 我已将他们定向到此页面以解决此问题,但是我仍然不确定这是如何发生的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM