The way to handle plural nouns in the internationalization process of iOS projects is somewhat different from the way to handle other texts. This article will explain how to handle plural nouns in the project from the following aspects.
Go to the official account [iOS Development Stack] to learn more about SwiftUI and iOS development. Wrong way of handling plural nounsThe internationalization of iOS projects mainly involves localizing the text used in the project. This aspect of knowledge has been covered in the previous articles, such as Apple's official iOS App internationalization workflow and using Xib to make the App internationalized. Ordinary text can be roughly regarded as a one-to-one translation, for example "iOS development stack" -> "iOS developers stack", this one-to-one translation can be handled by .strings files. The multilingual processing of plural nouns is a more complex translation, because different languages have different ways of expressing different quantities. Take the English and Chinese expressions of the number of followers of the [iOS Development Stack] public account as an example: For different expressions of different quantities in different languages, please refer to Language Plural Rules If you want to use a .strings file to handle noun pluralization, you might write code like this:
If every place where a noun is used is written like this, the project will be full of glue code, which is very difficult to maintain. To avoid this practice, we can use the .stringsdict file that comes with Xcode. stringsdictThe .stringsdict file is a plist file specifically used to handle noun pluralization. Create a .stringsdict file
stringsdict file parsingOn the left is an empty stringsdict file, and on the right is a stringsdict file using the number of public account followers as an example.
Practical experience
The above are the translations of iOS development stack has n fans and iOS development stack has n articles and m shares in Chinese and English. The usage of these two translations is as follows:
Go to the official account [iOS Development Stack] to learn more about SwiftUI and iOS development. SummarizeThrough this article, we have learned why we need to handle the internationalization of plural nouns separately, and the usage of stringsdict files. I believe you have learned about the internationalization of plural nouns. Now let's try it. |
<<: Apple product system comprehensive upgrade IOS15 is coming
>>: As 5G mobile phones become more popular, sales are declining. What’s the problem?
Samsung's new flagship Galaxy S8 is scheduled ...
Chapter 1: Basic Concepts 1.1: What is informatio...
In recent years, traditional home furnishing and ...
Course Contents: 1. Preparations for newcomers to...
This week, the iPhone XR, which is known as the &...
Many businesses will add some gold foil to foods ...
Excerpted from: "Inside and Outside the Clas...
This plan was made after I recently had an interv...
Since the first appearance of Win10 system, there...
Whether it is operating a full-platform self-medi...
Hi, Marketing Officers: As an editor of a marketi...
Guizhou Sky Eye is the nickname of the 500-meter ...
This article mainly introduces how to get likes o...
A recent study has attracted a lot of attention b...
A bird's eye view of science Quanzhou Associa...