You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Presently, a project that uses linguist needs to provide all the translations for all the languages that it supports. It would be more convenient to fall back to a default language when a translation has not been made.
For example, we could declare the translations like this:
I'm against a default locale because it doesn't make sense, imo, to fallback to a different language when a given translation is unavailable. That said, here's my plan for the next release:
Introduce a t! function that raises if the translation is missing, and update t to return {:ok, translation} or {:error :no_translation}. This would let the caller implement the interface that you'd like to see by doing:
I think this is a good way to handle the "problem" described! It will be to the developer to choose what they want to do in case of a missing translation.
Presently, a project that uses linguist needs to provide all the translations for all the languages that it supports. It would be more convenient to fall back to a default language when a translation has not been made.
For example, we could declare the translations like this:
Then, if we call
I18n.t("fr", "users.title")
, it should return"Users"
. Optionally, we could log a message indicating that a translation is missing.The text was updated successfully, but these errors were encountered: