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?
[[136011]] Apple will share a little-known succes...
Author's opinion As of December 2017, the use...
This article outlines: 1. How to place Soul ads 2...
Author: Li Haijie, School of Public Health, North...
Recently I heard a lot of people talking about pr...
The recently popular "Frog Princess" Gu...
2019 has passed by quickly, but it has left many ...
The latest sales data from the Passenger Car Asso...
As the global demographic dividend wave rapidly d...
Today (June 14), heavy rainfall continues in the ...
High-quality cases cannot be hidden. I will updat...
[[164907]] Apple has always been resolute about c...
Destined to be unfriendly "The predecessors ...
This year's Double 11 was a huge success. Acc...