WISE-Community / WISE-VLE--Deprecated--

Virtual Learning Environment (VLE) for the Web-based Inquiry Science Environment (WISE). *Note: deprecated and has been merged into the main 'WISE' repository*
8 stars 8 forks source link

Remove English-focused phrasing from i18n text #307

Closed breity closed 10 years ago

breity commented 11 years ago

There are many text items in the VLE where phrases are broken up into multiple parts with variables in between.

For example, see the MultipleChoice i18n file: https://github.com/WISE-Community/WISE-VLE/blob/master/src/main/webapp/vle/node/multiplechoice/i18n/i18n_en_US.json#L34.

For a phrase like "This is your 1st attempt.", we build a string in the code using view.getI18NString("this_is_your","MultipleChoiceNode") + the number of the next attempt + view.getI18NString("attempt","MultipleChoiceNode"). There are several more examples in the MultipleChoice step type like this, as well as in many other step types and other VLE items.

Not all languages will have the same order and phrasing structure. So we need to replace this type of broken phrasing with view.getI18NStringWithParams, which we have for exactly this purpose. i18n strings need to be full phrases. For example, the above item should be changed to something like:

view.getI18NStringWithParams("numberOfAttempts", [nextAttemptNum], "MultipleChoiceNode")

And the corresponding English i18n entry would be something like:

"numberOfAttempts": {
    "value":"This is your {0} attempt.",
    "description":"Text telling users the current number of attempts"
}
hirokiterashima commented 11 years ago

Good point. Yes, we should be replacing these partial translation calls with one view.getI18NStringWithParams function call instead. MatchSequence does this correctly.

hirokiterashima commented 10 years ago

I'm looking at this now for ChallengeQuestionNode.

"This is your {0} attempt." still requires a mapping from a number to ordinal number phrases, like "1" to "first" or "1st" "2" to "second" or "2nd" "3" to "third" or "3rd" ...etc

and use the ordinal numbers as the parameter to the view.getI18NStringWithParams function. This is okay, but would require spelling out "first", "second", "third",...Xth, etc in each language.

Another solution is to change the phrase from "This is your {0} attempt" to "This is attempt #{0}". This phrasing feels less friendly so we probably don't want to do this, but it spares us from having to map numbers to ordinal numbers.

breity commented 10 years ago

I think your second option is definitely best. We want to make it as easy as possible to translate. So being able to use numbers in the parameters without having to spell out different formats in all the languages is preferable. Having to map the numbers to ordinal numbers is totally impractical. It may be a bit less friendly, but I don't think that's too big a deal.

On Wed, Dec 11, 2013 at 3:04 PM, Hiroki Terashima notifications@github.comwrote:

I'm looking at this now for ChallengeQuestionNode.

"This is your {0} attempt." still requires a mapping from a number to ordinal number phrases, like "1" to "first" or "1st" "2" to "second" or "2nd" "3" to "third" or "3rd" ...etc

and use the ordinal numbers as the parameter to the view.getI18NStringWithParams function. This is okay, but would require spelling out "first", "second", "third",...Xth, etc in each language.

Another solution is to change the phrase from "This is your {0} attempt" to "This is attempt #{0}". This phrasing feels less friendly so we probably don't want to do this, but it spares us from having to map numbers to ordinal numbers.

— Reply to this email directly or view it on GitHubhttps://github.com/WISE-Community/WISE-VLE/issues/307#issuecomment-30373850 .

Jonathan Lim-Breitbart Feature Developer and Lead Designer Web-based Integrated Science Environment (WISE) http://wise.berkeley.edu

hirokiterashima commented 10 years ago

Good point. Geoff also votes for the second option. This will also make the code more simple. I'll go ahead and make the change.

breity commented 10 years ago

Cool, sounds good. Thanks.

On Wed, Dec 11, 2013 at 3:27 PM, Hiroki Terashima notifications@github.comwrote:

Good point. Geoff also votes for the second option. This will also make the code more simple. I'll go ahead and make the change.

— Reply to this email directly or view it on GitHubhttps://github.com/WISE-Community/WISE-VLE/issues/307#issuecomment-30375476 .

Jonathan Lim-Breitbart Feature Developer and Lead Designer Web-based Integrated Science Environment (WISE) http://wise.berkeley.edu

hirokiterashima commented 10 years ago

Done, committed: https://github.com/WISE-Community/WISE/commit/e3e42616760127c871084cee6f84903687878393