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?
The temple of Ta Prohm in Angkor Wat, Cambodia, b...
In October 2023, the Federal Communications Commi...
The main business of the new company, Aifengpai, ...
Modern corporate socialism is all about the Inter...
The fifth Global Mobile Game Conference GMGC2016, ...
All gatherings of people formed because of content...
Artist's impression of the Europa Clipper pro...
The situation of overseas shopping products has b...
List of all JS interfaces Version 1.0.0 Interface...
Ô´Âë¼ò½é ¿ ÉÒÔʵÏÖÈ«¾ÖÅú×¢£¬ÔÚÈκνçÃ涼¿ ÉÒÔ½«Åú...
Recently, Li Xiang said: "The new version of...
Since May this year, monkeypox has broken out in ...
The iPhone is criticized every year, so why does ...
Previously, Ueeshop introduced YouTube channel ex...
Since Redmi used QQ Space as a sales platform, mo...