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?
1. Feeling unwell: This is the most common reason...
Today we will talk about the last element of the ...
Popular Science Times (Intern Wang Yuke) Engineer...
When I was browsing PMCAFF Q&A, I saw a quest...
Apple held its 2019 spring conference again, and ...
Recently, there has been a wave of "slimming...
The year 2018 has passed by in a flash. The prosp...
1. Introduction This article is mainly based on A...
Many people have been saying that "SEO"...
With the rapid development of Bilibili, both ente...
App stores are the main platform for app promotio...
You have been sitting on the toilet for a long ti...
Everyone probably has their favorite. A special s...
GAC Aion’s super-fast charging technology is arri...
Nowadays, video ads are no longer exclusive to vi...