Skip to content
This repository was archived by the owner on Aug 8, 2023. It is now read-only.
This repository was archived by the owner on Aug 8, 2023. It is now read-only.

Label localization prioritizes other languages over English despite user preference #11906

Closed

Description

@1ec5

As of #11651, if the Preferred Languages setting lists English followed by another language that the Mapbox Streets source includes, such as French, -[MGLStyle localizeLabelsIntoLocale:] prefers that other language instead of English.

The following code will only ever resolve to English if none of the languages in MGLMapboxStreetsAlternativeLanguages (which swaps out en for mul) match the preference:

NSArray<NSString *> *preferredLanguages = [NSBundle preferredLocalizationsFromArray:MGLMapboxStreetsAlternativeLanguages
forPreferences:preferencesArray];
NSString *mostSpecificLanguage;
for (NSString *language in preferredLanguages) {
if (language.length > mostSpecificLanguage.length) {
mostSpecificLanguage = language;
}
}
if ([mostSpecificLanguage isEqualToString:@"mul"]) {
return acceptsEnglish ? @"en" : nil;
}

This logic was introduced because NSBundle prefers English over mul as a last resort. We should add a special case for English being above mostSpecificLanguage in preferencesArray.

/cc @bsudekum @friedbunny

Activity

  1. added
    iOS
    macOS
    localization
    on May 14, 2018
  2. modified the milestones: ios-v4.0.2, ios-v4.0.1 on May 14, 2018
  3. 1ec5 commented on May 14, 2018

    @1ec5
    ContributorAuthor

    Fixed in #11907 on the release-boba branch for iOS map SDK v4.0.1 and macOS map SDK v0.7.1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugiOSlocalizationmacOS

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions