java - GWT i8n 复数(在一个段落中使用 2 个复数形式不起作用 -> GWT 编译器中的错误?)

标签 java gwt

我的 Message 类中有以下 Message 定义:

@DefaultMessage("{0,number} preceding items, and {1,number} " +
"followup items.")
@Description("Label showing the number of preceding items and " +
"follow-up items")
@AlternateMessage({
"none|one", "One follow-up item.",
"one|none", "One preceding item.",
"one|one", "One preceding item, and one follow-up item.",
"none|other", "{1,number} follow-up items.",
"other|none", "{0,number} preceding items.",
"one|other", "One preceding item, and {1,number} follow-up" +
" items.",
"other|one", "{0,number} preceding items, and one follow-up " +
"item."
})
String precedingAndFollowupItemCount(
@PluralCount(PluralRuleNoneOne.class) int precedingItemsCount,
@PluralCount(PluralRuleNoneOne.class) int followUpItemssCount);

我定义了 PluralRuleNonOne.class 如下

import com.google.gwt.i18n.client.impl.plurals.DefaultRule;
import com.google.gwt.i18n.client.impl.plurals.DefaultRule_0_1_n;

public final class PluralRuleNoneOne extends DefaultRule {
@Override
public PluralForm[] pluralForms() {
    return DefaultRule_0_1_n.pluralForms();
}

@Override
public int select(final int n) {
    return DefaultRule_0_1_n.select(n);
}

现在 gwt 编译器(带有 -extra)生成(除其他外)以下属性文件:

# Description: Label showing the number of preceding items and follow-up     
items
# 0=precedingItemssCount (Plural Count), 1=followUpItemsCount (Plural Count)
# - Default plural form
BE52173166487BB95708A7E45EB0752B={0,number} preceding items, and {1,number}    
follow-up items.
*# - plural form 'none': Count is 0
BE52173166487BB95708A7E45EB0752B[none]=
# - plural form 'one': Count is 1
BE52173166487BB95708A7E45EB0752B[one]=*

现在我想知道突出显示的属性代表什么。由于有两个参数,因此似乎不可能拥有像 BE52173166487BB95708A7E45EB0752B[none]=?

这样的属性

此外,备用消息去了哪里,例如:

BE52173166487BB95708A7E45EB0752B[none|one]=一个后续项目。

这是 GWT 编译器中的错误还是我对 Message 类有一些误解?

感谢您的任何建议。

汉内斯

最佳答案

刚刚找到以下帖子:https://github.com/gwtproject/gwt/issues/7032解决了这个问题:

您需要在 Message 类中使用 @Generate(format = "com.google.gwt.i18n.server.PropertyCatalogFactory")。

关于java - GWT i8n 复数(在一个段落中使用 2 个复数形式不起作用 -> GWT 编译器中的错误?),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46417401/

相关文章:

java - Maven - Java 1.7 的目标版本 1.7 无效

java - ListView 可以在 Android 中有两种或多种不同类型的行布局吗?

java - 使 GWT 可抓取 (SEO)

java - 为什么简单的 “capture of ?” 不能编译甚至可以在编译时推断出类型安全?

java - 保存类对象而不进行序列化

gwt - 使用 GWT 中内置的 RPC 序列化/反序列化机制

java - 请求访问 Google App Engine 有时会获取以下信息并且进程未正确执行

java - 如何使依赖项目的源代码可供gwt编译器使用?

javascript - 如何打造类似魔兽世界的冷却效果?

java - 使用 "raw types"作为静态字段/返回类型时如何避免泛型警告?