Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

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

Đang mở Phù hợp với người mới
#13,993 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
82/100
Loại issue
Tài liệu
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
dart, flutter
Lĩnh vực
documentation

Hướng nghiên cứu

Bắt đầu với sites/docs/src/content/ui/internationalization/index.md, đặc biệt là bảng “Configuring the l10n.yaml file” và mục “Placeholders, plurals, and selects”. Giải thích tùy chọn thay đổi việc khớp chính xác =N như thế nào, đồng thời bổ sung giá trị mặc định và tên CLI/cấu hình; làm rõ sự khác nhau giữa các giá trị tường minh và các danh mục số nhiều của locale. Công việc hoàn tất khi cả hai mục mô tả chính xác tùy chọn và các ví dụ vẫn nhất quán với thay đổi Flutter được liên kết.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

act.await-dev-pr d.enhancement e0-minutes p2-medium t.cli-tools t.i18n t.l10n
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.
Ngôn ngữ chính
Dart
Star
3.1k
Fork
3.5k
Merge trung bình
2 ngày 1 giờ
Pull request đã merge (30 ngày)
46

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của flutter/website

Tất cả issue của flutter/website

Issue tương tự

Thêm issue về Dart

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.