SpringAll
SpringAll copied to clipboard
Strings to translate contain incomplete sentences
Some examples of incomplete sentences to translate that I found in the translation project:
is already taken.
is invalid.
Some languages cannot start a sentence with a noun - this forces grammar errors on the translations (not pretty sentences this will make). What we need here is to use a place holder, so we can translate e.g.:
%s is already taken.
%s is invalid.
as
Tha %s mì-dhligheach.
Tha %s ’ga chleachdadh mu thràth.
The good thing about this particular problem is that there aren't that many of this particular form. Also, it may be possible solve without code changes. For example in https://github.com/diaspora/diaspora/blob/develop/app/models/user.rb#L501:
errors.add(:unconfirmed_email, I18n.t("errors.messages.taken"))
can stay the same and the english version could change to something like.
"[email protected] This email address is already taken."
The proper solution is to use the full per key translations instead of the generic scopes. See https://guides.rubyonrails.org/i18n.html#error-message-scopes