不同的语言对数量的定义有不同的语法规则。例如,在英语中,1个指的是一种特殊情况。其他时候我们说n个。这种单数和复数的情况非常的普通。但其他语言却有明显的区别。Android中设置了0,1,2,"很少",“许多”和“其他”做为数量表述。
对于给定的语言和数量,决定使用那种情况是非常的困难和复杂的。Android提供了getQuantityString()来帮助我们决定选择适当的资源。
语法:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<plurals
name="plural_name">
<item
quantity=["zero" | "one" | "two" | "few" | "many" | "other"]
>text_string</item>
</plurals>
</resources>
文件位置:res/values/filename.xml
如何引用:R.plurals.plural_name
例子:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<plurals name="numberOfSongsAvailable">
<item quantity="one">One song found.</item>
<item quantity="other">%d songs found.</item>
</plurals>
</resources>
分享到:
相关推荐
它在 API 参考的这一部分中有详细记录。 不幸的是,似乎在早期的 Android 版本(API 级别 10 及以下)上,复数支持并未涵盖所有语言。 例如,如果您在 strings.xml 文件中为俄语指定以下块 < plurals xss=removed...
Android字符串资源的测试Demo,包括String、String Array、Plurals类型。 String类型通过例子测试了字符串格式化和带HTML标记的各种使用情况。
android经过时间 一个微型库,用于显示给定时间戳(适用于Android OS)的经过时间。...用法val resources = context.resources // All strings are stored in the Android plurals res directory.val dateTime =
前端开源库-typographic-apostrophes-for-possessive-plurals为所有格复数排印撇号,确保它们卷曲并向下指向,即使是为所有格复数
因此,您可以反编译原始的Spotify应用程序,打开语言文件(位于res/values-de/strings.xml或plurals.xml )和这种极富创意的语言结构: < string xss=removed>Das ist ein neues Musikupdate zu einem/einer Kün
该库中的不规则复数定义为名词,不能应用以下规则将其复数: 如果名词以“ s”,“ x”,“ z”,“ ch”或“ sh”结尾,请添加“ es” 如果名词以“ y”结尾并且以辅音开头,则删除“ y”并添加“ ies” 如果...
ResourcesPoet:Kotlin API,用于生成Android XML资源
这是穆罕默德·阿提亚(Mohammed Attia)从一个大型当代语料库中自动提取的阿拉伯语破碎复数列表,同时提供了单数形式和复数形式的形态模式。 它包含2562个破碎的复数形式。
复数Monorepo 这是一个monorepo,提供以下npm软件包: 将复数为可执行JavaScript 编译器的命令行界面 ...请注意,在v5版本中,编译器和CLI从规范的make-plural软件包中分离出来,并且现在使用管理项目。
Translate the name of your game to all languages and show in the Android/IOS store which languages your game support Simple yet Powerful Editors Intuitive inspectors allow you Preview, Edit, ...
Translate the name of your game to all languages and show in the Android/IOS store which languages your game support Simple yet Powerful Editors Intuitive inspectors allow you Preview, Edit, ...
开源项目-iafan-Plurr.zip,Plurr (plurals/gender/conditional rendering library) ported to Go
New: Generate R2 constants for animation, layout, menu, plurals, styles, and styleables. Fix: Properly catch and re-throw type cast exceptions when method binding arguments do not match.
Covering topics such as plurals and literary technique, distinctions among like words (homonyms and synonyms), and the use of foreign terms, the dictionary became the standard for other guides to ...
PluralityNET_Integrating_Banyan:万物的榕树–顶层存储库目录中的许多根,主干和互连文件夹
该软件包将帮助您在应用程序中进行语法上准确的翻译。 以下框架的分支可用: 提供了 的一些附加功能(也有旧的Kohana版本的分支,尽管不再受支持)。 要与其他框架一起使用或单独使用,您需要做一些工作,以实现...
由于许多原因,对于程序员来说,处理字符串中的复数形式,性别和条件并不是一个特别喜欢的任务。 对于如何处理此类变体没有达成共识,因此所有现有方法要么是特定于平台的(例如gettext / po),要么是有局限性的...
L10n-swift是一个简单的框架,可改善swift应用程序的本地化,提供更简洁的语法和应用程序内语言切换。 总览 :glowing_star: 产品特点 即时更改应用程序的语言。 用于Xcode Interface Builder的IBInspectable...
该库的主要目标是在Next.js环境中使翻译尽可能简单。 next-translate有两个部分: Next.js插件+ i18n API 。 产品特点 :sparkles: :rocket:・与自动页面优化效果很好。 :unicorn_face:・易于使用和配置。 :...
可靠且正确-包含,并在Node.js和浏览器中运行。 通用和现代-支持复数形式索引(0-5)和复数形式规则( zero , one , two , few , many和other ),并包括声明。 如果您正在寻找一个编译并执行声明性,请参见。 ...