Xcode configuration and localization for App development process, appxcode

Source: Internet
Author: User
Tags custom name

Xcode configuration and localization for App development process, appxcode

Add a missing Xcode configuration.

1. preference settings. Xcode-> Preference

Fonts & Colors can customize the Encoding Area and the background and font of the console.

Text Editing: Line numbers: displays the number of lines. Code folding ribbon enables Code to be folded. page guide at column prompts the maximum width set for each Line of Code.

 

2. Configure scheme. Menu Bar Product> Scheme> Edit Scheme

Archive: the Archive Name can be customized and will be reflected in Organizer.

 

3. Install Plugin. If you want to add a plug-in, we recommend that you use Alcatraz. Https://github.com/alcatraz/Alcatraz

After installing the SDK on github, restart Xcode. A prompt box is displayed, and select Load Bundle. Choose Window> Package Manager on the menu bar to install the plug-in.

 

Some plug-ins are recommended:

Vv1_enter-Xcode: Enter "//" on the method or attribute to automatically generate a comment template.

KSImageNamed: After the imageNamed method name appears, the system automatically displays the image name and thumbnail in the project.

SCXcodeSwitchExpander: Enter switch (x). After you modify x, all optional values of x are automatically listed and automatically completed.

FKConsole: the Unicode-encoded decode Chinese plug-in the Xcode console. The Unicode ins button on the menu bar is displayed.

Kzw.console: Find the source code location through reverse log

RegX: select the code to be aligned, and select Edit-> RegX-> Macros/ObjC Property/Variables/Assignments from the menu. The shortcut keys are Command + F1/Command + F2/Command + F3/Command + F4.

 

We recommend another powerful Installation tool:

ActivatePowerMode: screen jitter sparks splash when you tap the code. You can control the effect under the Plugins sub-menu in the menu bar.

This is recommended for common plug-ins. In addition, Xcode may have performance problems or even crashes.

If too many plug-ins are installed, resulting in reduced Xcode performance, You Need To uninstall unnecessary plug-ins in the Package Manager.

 

Localization

It mainly involves the localization of Info. plist files and string files.

Localized Info. plist File

1. In the Xcode File directory, right-click the Supporting Files folder and choose New File> Resource> Strings File.

 

The name must be "Info. plist"

 

Click "Localize..." on the right... "button, in the pop-up box, first select the language" English ", OK, that is, the local file corresponding to English is generated, You can see en in the Finder. the lproj folder contains InfoPlist. strings

 

Select base-> Info in the Project column of the Project file.

Click "+" in the Localizations column and select Simplified Chinese (hans)

Ignore the two storyboard files, select InfoPlist. strings, and click Finish to complete the configuration of the Info. plist file localization.

Click InfoPlist. strings (English) to add the code CFBundleDisplayName = "Base ";

Click InfoPlist. strings (Simplified) to add the code: CFBundleDisplayName = "";

The above code completes the localization of the application display name.

If you have run this project on the simulator (you can note the code to run it once), the application name should always be "base" in lower case and re-run the project, you can see different application names corresponding to different system languages on the simulator.

 

String Localization

1. as in the first step above, create the Strings File in the Supporting Files directory, but this time the File must be named "Localizable". The other steps are the same, except that after the English localized File is generated this time, you can see that there are simplified Chinese localized files to be selected.

2. After the configuration is complete, add similar code to the Localizable. strings (English) file: "hello world" = "hello world! ";

Add code similar to Localizable. strings (Simplified): "hello world" = "hello, world! ";

3. Add the following code to the didfinishlaunchingwitexceptions method of the AppDelegate. m file: NSLog (@ "% @", NSLocalizedString (@ "hello world", @ "hello world "));

4. Run on the simulator and switch the system language to view the different output content of the Xcode console.

 

Note:

1. NSLocalizedString macro definition automatically recognizes the Strings File named Localizable.

2. Use a Strings File with a non-Localizable name. You must use the NSLocalizedStringFromTable (key, tbl, comment) macro to define the Strings File with the custom name (tbl parameter)

By using this method, you can use code control to display localized content in a specific language, without being limited by the current system language.

3. The comment parameter has no practical effect and is only used to describe

 

The above is the record of the localization operation.

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.