本文介绍了如何为初学者在iOS中本地化标签字符串?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我非常迷恋iOS上的本地化过程.

Hi I'm very much stuck on the process of localization on iOS.

这是我的理解:

  • 如何前往项目浏览器并设置不同国家/地区的基本本地化
  • 如何制作字符串文件并将其设置为在基本本地化中选择的某个特定国家/地区进行本地化,例如简体中文
  • 键值对以及如何对应单词"HELLO WORLD" ="一些其他语言";在本地化的字符串文件中
  • How to go to the project explorer and set base localizations for different countries
  • How to make a string file and set it to be localized to one of the particular countries chosen within base localization, such as simplified Chinese
  • key value pairs and how to correspond the word"HELLO WORLD" = " some other language";with in the localized string file

然而,带有简单标签的应用程序的文字为"hello world".在中文模拟器中编译后不会更改为中文.

However the app, which has a simple label, with the writing "hello world" when compiled doesn't change to Chinese in a Chinese simulator.

这是我认为我要出错的地方:

Here's where I think I'm going wrong:

我认为我需要将屏幕上的字符串连接到本地化的字符串文件中包含的字符串.

I think I need to connect the strings on the screen to the strings contained within my localized strings file.

我是否为每种语言制作一个单独的字符串文件?

And do I make a separate string file for each language?

我正在寻找一个非常简单的应用程序存根,其中只包含几个标签,这些标签被翻译成不同的语言,所以我可以学习如何使其连接和工作,以便可以在其他地方使用它.

I'm looking to make a very very simple stub of an app containing nothing but a few labels which are translated into different 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, I'm not impressed with Apples documentation on this issue think its missing something.

推荐答案

对于本地化,您需要执行以下操作:

For localization, you need to do:

  1. 为每种语言添加不同的.strings文件
  2. 为每个语言文件添加键值
  3. 使用:

NSLocalizedString(yourKey, nil);

[[NSBundle mainBundle] localizedStringForKey:(yourKey) value:@"" table:nil]

用于获取所传递密钥的本地化字符串.

For getting the localized string of passed key.

教程:

  1. iOS应用中的本地化变得简单
  2. iPhone应用程序本地化指南
  3. 准备要在Xcode中进行本地化的iOS应用
  1. Localization in iOS apps made simple
  2. iPhone Apps Localization Guide
  3. Preparing your iOS app for localization in Xcode

这篇关于如何为初学者在iOS中本地化标签字符串?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-29 11:36