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

Conversation

@friedbunny
Copy link
Contributor

@friedbunny friedbunny commented Nov 30, 2018

Addresses the simple automatic localization case from #11867.

This enables automatic localization of Mapbox Streets source v8 and the forthcoming Streets v11 style, but does not yet implement a solution to the relocalization issues explained in #12164 (comment) — that’ll be handled as tail work, tracked by #11867.

/cc @1ec5

@friedbunny friedbunny added iOS Mapbox Maps SDK for iOS macOS Mapbox Maps SDK for macOS ⚠️ DO NOT MERGE Work in progress, proof of concept, or on hold localization Human language support and internationalization labels Nov 30, 2018
@friedbunny friedbunny added this to the release-iowaska milestone Nov 30, 2018
@friedbunny friedbunny self-assigned this Nov 30, 2018
@friedbunny friedbunny requested a review from 1ec5 as a code owner November 30, 2018 01:02
@friedbunny friedbunny force-pushed the friedbunny-updates-localization-for-streets-v8 branch from 20bd0e3 to ebd0074 Compare November 30, 2018 01:05
@friedbunny
Copy link
Contributor Author

How to avoid relocalization?

The suggestion in #12164 (comment) is:

We could append a dummy key path expression to the end of the coalescing array

... but I’m unsure where (-[MGLStyle localizeLabelsIntoLocale:] or during the massive recursive web that is -[NSExpression mgl_expressionLocalizedIntoLocale:]?) or how to do this (expression syntax is... yeah).

- (void)testv11Localization {
{
NSExpression *original = [NSExpression expressionWithFormat:@"mgl_coalesce({%K, %K})", @"name_en", @"name"];
NSExpression *expected = [NSExpression expressionWithFormat:@"mgl_coalesce:({name_en, name})"];
Copy link
Contributor Author

@friedbunny friedbunny Nov 30, 2018

Choose a reason for hiding this comment

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

This is the ideal result, but we current get mgl_coalesce:({mgl_coalesce:({name_en, name}), mgl_coalesce:({name_en, name})}) instead.

@friedbunny friedbunny force-pushed the friedbunny-updates-localization-for-streets-v8 branch from ebd0074 to d58e72f Compare December 4, 2018 23:20
@friedbunny friedbunny removed the ⚠️ DO NOT MERGE Work in progress, proof of concept, or on hold label Dec 4, 2018
@friedbunny
Copy link
Contributor Author

friedbunny commented Dec 4, 2018

After conferring with @1ec5 , I reduced the scope of this PR to only making localization functional with the new data/styles — ready for review. 🙇

@friedbunny friedbunny force-pushed the friedbunny-updates-localization-for-streets-v8 branch from d58e72f to f292cbe Compare December 7, 2018 18:55
}
NSArray *identifiers = [url.host componentsSeparatedByString:@","];
return [identifiers containsObject:@"mapbox.mapbox-streets-v7"] || [identifiers containsObject:@"mapbox.mapbox-streets-v6"];
return [identifiers containsObject:@"mapbox.mapbox-streets-v8"] || [identifiers containsObject:@"mapbox.mapbox-streets-v7"];
Copy link
Contributor

Choose a reason for hiding this comment

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

For what it’s worth, @friedbunny and I determined that it’s very unlikely for any v6-dependent styles to have been used with runtime styling in the first place.

// https://www.mapbox.com/vector-tiles/mapbox-streets-v7/#overview
NSArray *supportedLanguages = @[ @"ar", @"en", @"es", @"fr", @"de", @"pt", @"ru", @"zh", @"zh-Hans" ];
// https://www.mapbox.com/vector-tiles/mapbox-streets-v8/#name-text--name_lang-code-text
NSArray *supportedLanguages = @[ @"ar", @"de", @"en", @"es", @"fr", @"ja", @"ko", @"pt", @"ru", @"zh", @"zh-Hans", @"zh-Hant" ];
Copy link
Contributor

Choose a reason for hiding this comment

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

I think it’s OK that we have only one list of supported languages. It looks like the only language code that’s in v8 but not v7 is zh-Hant, but #12387 already added a special case to ensure that zh-Hant falls back to zh-Hans, which v7 does (mostly) support.

:squints:

Co-Authored-By: friedbunny <[email protected]>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

iOS Mapbox Maps SDK for iOS localization Human language support and internationalization macOS Mapbox Maps SDK for macOS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants