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.

String localization does not work when using the static framework #9072

Closed

Description

@friedbunny

Our replacement NSLocalizedString methods rely on +[NSBundle mgl_frameworkBundle] to provide the Mapbox bundle that contains the localizations.

When using the static Mapbox.framework:

  1. Localizations live in a separate Mapbox.bundle.
  2. +[NSBundle mgl_frameworkBundle] returns the app bundle (not Mapbox.framework or Mapbox.bundle).

This means that localizations never load because we’re looking for them in the base app bundle, not Mapbox.bundle.

(Mapbox.bundle has existed for static builds since #4455.)

Why do images and such work?

For other resources that we load from the bundle, like images or SSL certificates, we manually append Mapbox.bundle to the path using -[NSBundle mgl_resourcesDirectory]:

NSBundle *frameworkBundle = [NSBundle mgl_frameworkBundle];
NSString *resource = [frameworkBundle pathForResource:@"somefile"
                                               ofType:@"extension"
                                          inDirectory:frameworkBundle.mgl_resourcesDirectory];
[NSData dataWithContentsOfFile:resource];

This works, but seems like incorrect behavior: shouldn’t we be treating Mapbox.bundle as the bundle and not just a directory?

/cc @boundsj @1ec5

Activity

  1. added
    iOS
    localization
    on May 22, 2017
  2. self-assigned this
    on May 22, 2017
  3. added this to the ios-v3.6.0 milestone on May 22, 2017
  4. friedbunny commented on May 23, 2017

    @friedbunny
    ContributorAuthor

    Fixed by #9074, will be in v3.6.0-beta.1.

  5. dungi commented on Dec 11, 2017

    @dungi

    So does localization no work with MapboxStatic?

  6. 1ec5 commented on Dec 11, 2017

    @1ec5
    Contributor

    @dunqi, this issue was tracking a bug affecting the localization of UI strings within the iOS map SDK, not map labels.

    MapboxStatic.swift doesn’t have a localizesLabels option as the iOS map SDK does, but it does allow you to specify a custom style URL. In Mapbox Studio, create a new style based on one of the templates, then change the language of each layer containing labels. Finally, click the “Share, develop & use” button to get the style URL that you can set on SnapshotOptions.

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

Metadata

Metadata

Assignees

Labels

bugiOSlocalization

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions