Skip to content

Respect locale when capitalizing #164

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 25, 2017
Merged

Respect locale when capitalizing #164

merged 1 commit into from
Sep 25, 2017

Conversation

1ec5
Copy link
Member

@1ec5 1ec5 commented Sep 23, 2017

#158 added a localization in Turkish, which has capitalization rules that differ from the C locale used by String.prototype.toUpperCase(). This change uses String.prototype.toLocaleUpperCase() to respect the instruction language’s capitalization rules.

A number of strings in the Turkish localization are affected because a token appears at the beginning of the string. For example, this change:

diff --git a/test/fixtures/v5/arrive_waypoint/left.json b/test/fixtures/v5/arrive_waypoint/left.json
index 4723017..6e8752c 100644
--- a/test/fixtures/v5/arrive_waypoint/left.json
+++ b/test/fixtures/v5/arrive_waypoint/left.json
@@ -25,7 +25,7 @@
         "zh-Hans": "您已经到达您的第一个目的地,在道路左侧"
     },
     "options": {
-        "legIndex": 0,
-        "legCount": 2
+        "legIndex": 1,
+        "legCount": 3
     }
 }

causes {nth} to be replaced by “ikinci”. When capitalized, the output string now becomes:

İkinci hedefinize ulaştınız, hedefiniz solunuzdadır

rather than this misspelling (which is thus mispronounced):

Ikinci hedefinize ulaştınız, hedefiniz solunuzdadır

/cc @malte777 @allierowan @mcwhittemore

@1ec5 1ec5 added the bug label Sep 23, 2017
@1ec5 1ec5 self-assigned this Sep 23, 2017
Copy link

@allierowan allierowan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

@1ec5 1ec5 merged commit e06fca7 into master Sep 25, 2017
@1ec5 1ec5 deleted the 1ec5-locale-upper branch September 25, 2017 17:19
1ec5 added a commit that referenced this pull request Sep 26, 2017
- Added Castilian Spanish localization. #163
- Added Esperanto localization. #162
- Added Romanian localization. #105
- Added Turkish localization. #158
- Added a `language` argument to `capitalizeFirstLetter`, which capitalizes according to that language’s rules. #164
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants