mirror of
https://github.com/chatwoot/chatwoot.git
synced 2026-06-04 21:02:35 +08:00
Loads Rails locale-specific pluralization rules so languages with an `other`-only plural model can safely use Crowdin exports without maintaining duplicate `one` keys. ## Closes None ## Why Crowdin exports Rails YAML pluralized strings using each target language's plural categories. These categories come from Unicode CLDR and represent grammatical forms, not a literal "number is 1" bucket. Some languages need separate forms such as `one` and `other`, but languages like Japanese, Korean, Indonesian, Thai, Vietnamese, and Chinese use the same form for `1`, `2`, `5`, and larger counts in these strings. For those locales, CLDR correctly models the plural category as `other` only. Before this change, Chatwoot still relied on Rails' default English-style plural behavior for these locales. That meant a valid Crowdin export containing only `other` could fail at runtime when Rails received `count: 1` and looked for a missing `one` branch. Keeping duplicate `one` keys would only fight Crowdin on every translation sync. The runtime should instead follow the locale's plural rules. ## What changed - Added `rails-i18n` and enabled only its pluralization module. - Added explicit `other`-only plural rules for Chatwoot's underscore Chinese locale aliases, `zh_CN` and `zh_TW`. - Removed redundant `one` keys from the affected Devise and `time_units` translations. ## Validation - Ran a Rails runner check across `id`, `ja`, `ko`, `ms`, `th`, `vi`, `zh_CN`, and `zh_TW` to verify `errors.messages.not_saved` and `time_units.days` resolve with only `other` for `count: 1`. - Ran YAML parse validation for all edited locale files. - Ran `bundle exec rubocop Gemfile config/application.rb config/initializers/i18n_pluralization.rb`. |
||
|---|---|---|
| .. | ||
| agents | ||
| environments | ||
| initializers | ||
| integration | ||
| languages | ||
| locales | ||
| app.yml | ||
| application.rb | ||
| boot.rb | ||
| cable.yml | ||
| database.yml | ||
| elastic_apm.yml | ||
| environment.rb | ||
| features.yml | ||
| installation_config.yml | ||
| llm_models.json | ||
| llm.yml | ||
| markdown_embeds.yml | ||
| newrelic.yml | ||
| puma.rb | ||
| rds-ca-2019-root.pem | ||
| routes.rb | ||
| schedule.yml | ||
| scout_apm.yml | ||
| secrets.yml | ||
| sidekiq.yml | ||
| spring.rb | ||
| storage.yml | ||
| vite.json | ||