i18next / i18next-parser

Parse your code to extract translation keys/values and manage your catalog files
MIT License
482 stars 196 forks source link

Config to remove key/value, if key=value #1036

Open omid opened 2 months ago

omid commented 2 months ago

🚀 Feature Proposal

A config to not add or remove a key/value from the translation files.

  1. First, there is a need to define a default language.
  2. Then in default, if key = value or value = "", then it can be removed from the translation file. (except plurals)

Basically the first point is not required, but I think it makes sense to limit users to have a structure to always have keys in one language, not different languages! If the second option, is "false", then the library can add "key" as "value" by default. For example, if key is "Yes", instead of adding "Yes": "" it will either remove it or add it like "Yes": "Yes"

Motivation

In some cases, it doesn't make sense to have a diff key, and you have the "value" as the "key" (like gettext) Some apps are loaded mostly with a default language, so there is no need to load a language file at all.