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?
As WeChat and Weibo operations become increasingl...
Today, I will explain to you in a simple and in-d...
The phone memory is always insufficient, and clea...
Currently, the main languages for modeling in t...
During festivals and gatherings with friends Many...
Mr. Cao, 45 years old, has had light red blood on...
In marketing psychology, herd mentality, greed fo...
Before the launch of Juleliang Qianchuan, the Dou...
Table of contents: 02 How to draw the folds of cl...
In the Chinese and even global mobile phone market...
Dairy products counter in supermarket There are s...
This article is selected from the Hunzhi comic se...
About six years ago, when Samsung's first gen...
Recently, the question of whether fireworks shoul...
Millions of animals around the world follow the s...