Internationalization of iOS Development Chapter III: Internationalization of story version text

Source: Internet
Author: User

In the development of iOS, many times the components are dragged out, directly in the story version (storyboard) directly to use, and did not do output association, or some Uilabel only display, will not be modified. So in this case, it will not be modified in the code, you need to use the story version of internationalization,

Before xcode4.5, if the story version of internationalization, is to maintain a number of storyboard, but after xcode4.5, internationalization storyboard internationalization, it becomes a storyboard, multiple language configuration files

Where Main.storyboard is the real story version of the file, Main.strings (Chinese (Simplified)) and the Main.strings (English) file for the profile, depending on the language version supported, there will be different translations

Take a look at the following example:

Main.storyboard (Base):

Here we need to make the kiss of the text internationalization, here is a UIButton, click on the need for internationalization of the control, and then select the right side of the property, you can see the space object ID, this ID is equal to the component's internationalization key, and then in the corresponding internationalization file, Modify its value to

Main.strings (中文版) file

Main.strings (Chinese (Simplified)) file

Where the object ID in the internationalized text file is followed by the Normaltitle as the component's property name

Here I share the use of the story version of the shortcomings of the internationalization, if there is a supplement can be in the message to me, learn from each other, see below I said the drawbacks there is no way to improve

    • The internationalization of the story version temporarily does not have a synchronization mechanism, that is, when you add a new component, you button, the corresponding internationalization file, no synchronization update, you need to manually review the object ID, and then add
    • Reusability is not strong, if there are more than the same worth of time, repeated writing multiple times, for example, I now have two buttons, the text of the button is browse, but I need to add two object ID in the internationalization file
    • There is no document that describes the attribute names of all internationalized session components, and if normaltitle, this property does not indicate what the name of this property is

This gives a suggestion that can solve the above 3 malpractice problems

    • Method One: You can do the whole process after the basic completion of the story version of the internationalization
    • Method Two: You can re-create the internationalized file

Internationalization of iOS Development Chapter III: Internationalization of story version text

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.