SpringAll icon indicating copy to clipboard operation
SpringAll copied to clipboard

Strings to translate contain incomplete sentences

Open gunchleoc opened this issue 3 years ago • 2 comments

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.

gunchleoc avatar Jul 14 '21 21:07 gunchleoc

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."

weex avatar Jul 29 '21 00:07 weex

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

jhass avatar Jul 31 '21 14:07 jhass