有哪些好的非英语短语单复数形式,可以用于测试国际化和本地化库? [英] What are some good non-English phrases with singular and plural forms that can be used to test an internationalization and localization library?

查看:248
本文介绍了有哪些好的非英语短语单复数形式,可以用于测试国际化和本地化库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直工作在一个.NET库,以协助应用程序的国际化。这是写在C#中,呼吁在GitHub上的 SmartFormat ,然后是开源的。

I've been working on a .NET library to assist with internationalization of an application. It's written in C#, called SmartFormat, and is open-source on GitHub.

它包含了确定的基础上的正确单/复数形式多种语言语法数规则模板和语言环境。从统一code语言获得的规则复数规则的。

It contains Grammatical Number rules for multiple languages that determine the correct singular/plural form based on the template and locale. The rules were obtained from Unicode Language Plural Rules.

当翻译,有依赖于量词(如名词,动词和形容词),您所指定的多种形式短语和格式化会根据这些规则的正确形式。

When translating a phrase that has words that depend on a quantity (such as nouns, verbs, and adjectives), you specify the multiple forms and the formatter chooses the correct form based on these rules.

在英国的一个例子:(注意语法几乎是相同的的String.Format

An example in English: (notice the syntax is nearly identical to String.Format)

var message = "There {0:is:are} {0} {0:item:items} remaining.";
var output = Smart.Format(culture, message, items.Count);

我想编写单元测试了很多支持的语言。不过,我只说英语和西班牙语(两者具有相同的语法,数规则)。

I would like to write unit tests for many of the supported languages. However, I only speak English and Spanish (which both have the same grammatical-number rules).

什么是可用于这些单元测试的一些好的非英语测试短语? 我在寻找类似短语有{0:是:是} {0} {0:项目:项目}剩下的。。请注意这个例子中需要特定的动词和名词的基础上的数量。

What are some good non-English test phrases that can be used for these unit tests? I am looking for phrases similar to "There {0:is:are} {0} {0:item:items} remaining.". Notice how this example requires a specific verb and noun based on the quantity.

有关语法的说明

该库中查找分隔的单词,并选择基础上的区域设置定义的规则正确的单词。例如,在波兰,有3个复数形式的单词文件:1plik,2-4pliki,5-21plików。所以,你会指定所有3种形式的格式字符串:{0} {0:plik:pliki:plików}

This library looks for : delimited words and chooses the correct word based on the rules defined for the locale. For example, in Polish, there are 3 plural forms for the word "File" : 1 "plik", 2-4 "pliki", 5-21 "plików". So, you would specify all 3 forms in the format string: "{0} {0:plik:pliki:plików}".

这句话通常是有序的,从最小的值最大,如{0:零:一:二:几个:很多:其他},定义由统一code语言复数规则

The words are typically ordered from smallest possible value to largest, such as "{0:zero:one:two:few:many:other}", as defined by the Unicode Language Plural Rules.

这个code更多信息已经在这里讨论:<一href="http://stackoverflow.com/questions/7136627/localization-of-singular-plural-words-what-are-the-different-language-rules-for">Localization奇异/复数的话 - 什么是语法数的不同语言规则

Additional information about this code has been discussed here: Localization of singular/plural words - what are the different language rules for grammatical numbers?

推荐答案

我想用你的样品词组的近似土耳其语翻译做出贡献,这样你就可以测试,其中的可能形式数量等于1的情况下)

I'd like to contribute with the approximate Turkish translation of your sample phrase, so you can test for the case where number of possible forms equals 1. ;)

{0} nesnekaldı。 = ({0}项目余下的。)

{0} nesne kaldı. = ({0} items remaining.)

虽然土耳其字以后缀定期复数,复数形式从未被指定的项目数时使用。因此,上述应呈现同样在每种情况下:

Although Turkish words are pluralized regularly with suffixes, the plural forms are never used when the number of items are specified. So the above should be rendered the same in each case:

1 nesnekaldı。

2 nesnekaldı。

42 nesnekaldı。

然而,当未明确指定计数,它可能会成为重要的语法来表示,如果我们谈论的是一个或多个项目。因此,消息是否要删除所选的项目(S)?应该是这样的呈现:

However, when the count is not explicitly specified, it may become grammatically important to indicate if we are talking about one or more items. So the message "Do you want to delete the selected item(s)?" should be rendered like this:

Seçilinesneyi silmek istiyor musunuz?(当项目数= 1)

Seçilinesneleri silmek istiyor musunuz?(当项目计数> 1)

Seçili nesneleri silmek istiyor musunuz? (when item count>1)

所以我想这样做的格式是:

So I guess the format for this would be:

Seçili{0:nesneyi:nesneleri}?silmek istiyor musunuz

这篇关于有哪些好的非英语短语单复数形式,可以用于测试国际化和本地化库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆