Skip to content
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

Improve ease of language localization #440

Open
rfriberg opened this issue Oct 10, 2017 · 2 comments
Open

Improve ease of language localization #440

rfriberg opened this issue Oct 10, 2017 · 2 comments
Milestone

Comments

@rfriberg
Copy link
Contributor

Goal: mapzen.js should make it easy for users to set a default language for all components.

Mapzen Basemaps, Search (geocoder), and Turn-by-turn (routing) all individually allow for language localization. However, these parameters are somewhat buried and not shared across components.

For example, to change the basemap, search, and routing directions to German, you must set a parameter in three different places:

// Add map
var map = L.Mapzen.map('map', {
  tangramOptions: {
    scene: {
      import: L.Mapzen.BasemapStyles.Refill,
      global: {
        ux_language: 'de'
      }
    }
  }
});

// Add search box
var geocoder = L.Mapzen.geocoder({
  params: {
    lang: 'de'
  }
}).addTo(map);

// Add routing
var routingControl = L.Mapzen.routing.control({
  waypoints: [
    L.latLng(37.752, -122.418),
    L.latLng(37.779, -122.391)
  ],
  geocoder: L.Mapzen.routing.geocoder(),
  reverseWaypoints: true,
  router: L.Mapzen.routing.router({
    directions_options: {
      language: 'de'
    }
  })
}).addTo(map);

There are a few ways we could make this easier for the user:

  1. Set up a global variable on L.Mapzen (e.g., L.Mapzen.language) to be used by all components (similar to how we handle api keys)

  2. Set up an attribute on the MapControl object and pass to all components

  3. Improve documentation for changing the default language on all three components

Other things to consider:

  • Are we planning to change the structure of Basemaps to handle the growing number of available parameters (language, transit, bike overlay, etc.)?
  • (Especially if we do change the structure) This seems like a good candidate for v1.0 release.

@hanbyul-here thoughts?

@rfriberg rfriberg added this to the Release v1.0 milestone Oct 10, 2017
@hanbyul-here
Copy link
Contributor

hanbyul-here commented Oct 13, 2017

This is an awesome idea. I am bit biased to passing this options to maps. It would be better not to have too many globals going on? If we are going to set this option up, we probably have to offer a way to change the language on the map too.

( one thing that comes up to my mind now: if we update the language of Tangram, it would reflect it right away, but others (routing machine and geocoder) would hold the changes until they get something to execute. 🤔 )

@rfriberg
Copy link
Contributor Author

I'm leaning towards # 2, as well (set up attribute on MapControl rather than on L.Mapzen).

I'm going to bump this up to a more near-term milestone because "We Can Do It!" 💪

@rfriberg rfriberg modified the milestones: Release v1.0, v0.9.0 Oct 16, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants