如何在ios中为初学者本地化标签字符串 [英] how to localize label strings in ios for a beginner
问题描述
嗨我非常关注ios上的本地化过程。
Hi im very much stuck on the process of localisation on ios .
继承人我的理解,如何去项目浏览器并设置不同的基本本地化国家/地区,
heres what i do understand , how to go to the project explorer and set base localizations for diferent countries,
如何制作字符串文件并将其设置为本地化为基本本地化中选择的某个特定国家/地区
how to make a string file and set it to be localized to one of the particular countries chosen within base localisation
如简体中文
键值对以及如何对应单词
HELLO WORLD=其他语言;在本地化的字符串文件中有
key value pairs and how to correspond the word "HELLO WORLD" = " some other language"; with in the localized string file
在编译时,具有写入hello世界的简单标签的应用程序在中文模拟器中不会更改为中文。
how ever the app which has a simple label with the writing hello world when compiled doesnt change to chinese in a chinese simulator.
heres我认为我出错了。
heres where i think im going wrong.
我想我需要将屏幕上的字符串连接到我的本地化字符串文件中包含的字符串。
i think i need to connect the strings on the screen to the strings contained with in my localized string file.
我是否为每种语言制作一个单独的字符串文件?
and do i make a seperate string file for each language?
我希望能够做到非常简单一个应用程序的存根只包含一些标签,这些标签被翻译成dif语言,所以我可以学习如何使它连接和工作,所以我可以在其他地方使用它。
im looking to make a very very simple stub of an app containing nothing but a few labels which are translated into dif languages, so i can learn how to make it connect and work so i can use it else where.
有一个中文故事板,我必须做任何工作吗?或者它是空白的吗?
there is a storyboard for chinese, do i have to do any work to that ? or is it left blank?
经过几个小时的阅读文件后,我似乎要绕圈子,我对这个问题的苹果文档印象不深,认为它遗漏了一些东西,
after hours of reading documents i seem to be going around in circles , im not impressed with apples documentation on this issue think its missing something,
推荐答案
对于本地化,您需要这样做:
For localization, you need to do:
- 为每种语言添加不同的.strings文件
- 为每个语言文件添加键值
- 使用:
NSLocalizedString(yourKey,nil);
或
[[NSBundle mainBundle] localizedStringForKey:(yourKey) value:@"" table:nil]
获取传递密钥的本地化字符串。
For getting the localized string of passed key.
教程:
- Localization in iOS apps made simple
- iPhone Apps Localization Guide
- Preparing your iOS app for localization in Xcode
这篇关于如何在ios中为初学者本地化标签字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!