Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Document the `use-explicit-plural-values` gen-l10n option

未关闭 适合新手
#13,993 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
82/100
Issue 类型
文档
描述清晰度
描述清楚
活跃度
活跃
技术栈
dart, flutter
领域
documentation

调研方向

从 sites/docs/src/content/ui/internationalization/index.md 开始,重点查看“Configuring the l10n.yaml file”表格和“Placeholders, plurals, and selects”部分。说明该选项如何改变对 =N 的精确匹配,并补充其默认值以及 CLI/配置名称;阐明显式值与 locale 复数类别的区别。完成标准是两个部分都准确描述该选项,且示例与链接的 Flutter 更改保持一致。

由索引模型根据 Issue 内容生成。

描述

Related code pull request or issue

https://github.com/flutter/flutter/pull/194816

Feature summary

flutter/flutter#194816 adds an opt-in use-explicit-plural-values option to flutter gen-l10n (l10n.yaml and --use-explicit-plural-values).

Today, gen-l10n maps the explicit plural values =0, =1 and =2 to the plural categories zero, one and two. In many locales those categories cover more than the exact number, so =1{1 item} is also shown for 21, 31 and 101 in Ukrainian, and for 0 in French. With the option enabled, explicit values match only that exact number and take precedence over the categories, as specified by ICU. Any non-negative integer can be used (=3, =10), and =1 and one can be used in the same message. The option defaults to false.

Type of documentation needed
  • New conceptual page or guide
  • Update to an existing guide on docs.flutter.dev
  • Cookbook recipe or practical code sample
  • CLI or tooling documentation
  • Platform support or integration guide
  • Breaking change migration guide
Code snippet or usage example
// l10n.yaml
// use-explicit-plural-values: true
//
// app_uk.arb
// "items": "{count, plural, =0{Немає елементів} =1{Рівно один елемент} one{{count} елемент} few{{count} елементи} many{{count} елементів} other{{count} елемента}}"
//
// Generated code:
String _temp0 = count == 0
    ? 'Немає елементів'
    : count == 1
    ? 'Рівно один елемент'
    : intl.Intl.pluralLogic(
        count,
        locale: localeName,
        other: '$count елемента',
        one: '$count елемент',
        few: '$count елементи',
        many: '$count елементів',
      );
Additional context or resources

Pages to update in sites/docs/src/content/ui/internationalization/index.md:

  • The "Configuring the l10n.yaml file" table: add a [no-]use-explicit-plural-values row, for example: "Whether explicit plural cases such as =1 match only that exact value and take precedence over plural categories such as one, as specified by ICU. When false (the default), =0, =1 and =2 are treated as zero, one and two."
  • The "Placeholders, plurals, and selects" section currently presents =0, =1 and =2 alongside few and many as if they were the same kind of case. It would help to explain the difference between explicit values (=N, exact match) and plural categories (zero, one, two, few, many, other, chosen by the locale's plural rules), and mention the new option.
Volunteer to help write this documentation
  • Draft the documentation PR on docs.flutter.dev.
主要语言
Dart
星标
3.1k
派生
3.5k
平均合并
2 天 2 小时
30 天内合并 PR
45

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

flutter/website 的其他 Issue

查看 flutter/website 的全部 Issue

相似的 Issue

更多 Dart Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。