Commit 7994385a authored by Jungshik Shin's avatar Jungshik Shin Committed by Commit Bot

Fix a message to work with the translation infra.

IDS_EXTENSION_PROMPT_RATING_ACCESSIBLE_TEXT is compliant to the ICU
message format spec (so, the unittest passes), but it's rejected
by the translation infra's ICU msg syntax checker because it has
additional constraints on the ICU syntax: A plural selector should be
at the outer most level.

Rewrite it to work with the translation infra.

Bug: 791716
Test: browser_test --gtest_filter=Extensi*.RatingsSectionA11y
Change-Id: Id88bad4554b106acebe20064fab8870e03a44843
Reviewed-on: https://chromium-review.googlesource.com/807353
Commit-Queue: Jungshik Shin <jshin@chromium.org>
Reviewed-by: default avatarDevlin <rdevlin.cronin@chromium.org>
Reviewed-by: default avatarMark Mentovai <mark@chromium.org>
Cr-Commit-Position: refs/heads/master@{#521799}
parent bc270e07
......@@ -70,8 +70,23 @@ class BASE_I18N_EXPORT MessageArg {
// http://userguide.icu-project.org/formatparse/messages
// message_formatter_unittest.cc
// go/plurals inside Google.
// TODO(jshin): Document this API at sites.chromium.org and add a reference
// here.
// TODO(jshin): Document this API in md format docs.
// Caveat:
// When plural/select/gender is used along with other format specifiers such
// as date or number, plural/select/gender should be at the top level. It's
// not an ICU restriction but a constraint imposed by Google's translation
// infrastructure. Message A does not work. It must be revised to Message B.
//
// A.
// Rated <ph name="RATING">{0, number,0.0}<ex>3.2</ex></ph>
// by {1, plural, =1{a user} other{# users}}
//
// B.
// {1, plural,
// =1{Rated <ph name="RATING">{0, number,0.0}<ex>3.2</ex></ph>
// by a user.}
// other{Rated <ph name="RATING">{0, number,0.0}<ex>3.2</ex></ph>
// by # users.}}
class BASE_I18N_EXPORT MessageFormatter {
public:
......
......@@ -3508,7 +3508,9 @@ From <ph name="DOWNLOAD_DOMAIN">$3<ex>example.com</ex></ph>
(<ph name="RATING_COUNT">$1<ex>46</ex></ph>)
</message>
<message name="IDS_EXTENSION_PROMPT_RATING_ACCESSIBLE_TEXT" desc="The text read by a screen reader for the ratings section of an extension prompt, indicating to the user what the average rating for an extension is and how many times it has been rated. [ICU Syntax]">
Rated <ph name="AVERAGE_RATING">{0, number,0.0}<ex>3.2</ex></ph> by <ph name="NUMBER_OF_RATINGS">{1, plural, =1 {one user} other {# users}}<ex>400 users</ex></ph>.
{1, plural,
=1 {Rated <ph name="AVERAGE_RATING">{0, number,0.0}<ex>3.2</ex></ph> by one user.}
other{Rated <ph name="AVERAGE_RATING">{0, number,0.0}<ex>3.2</ex></ph> by # users.}}
</message>
<message name="IDS_EXTENSION_PROMPT_NO_RATINGS_ACCESSIBLE_TEXT" desc="The text read by a screen reader for the ratings section of an extension prompt when there haven't been any user ratings for the extension.">
Not yet rated by any users.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment