ddubrava / angular-yandex-maps

πŸ—ΊοΈ Yandex.Maps Angular components that implement the Yandex.Maps JavaScript API
https://ddubrava.github.io/angular8-yandex-maps/#/
MIT License
57 stars 7 forks source link

Support language change at runtime #183

Closed ddubrava closed 1 year ago

ddubrava commented 1 year ago

πŸš€ Feature Request

✍️ Description

type YaConfigLang =  'ru_RU' | 'en_US' | 'en_RU' | 'ru_UA' | 'uk_UA' | 'tr_TR';

interface YaConfig {
  lang?: YaConfigLang | Observable<YaConfigLang>;
}
ddubrava commented 1 year ago

well, it's pretty complicated to implement.

notes:

  1. We need a namespace for each language, e.g. ymaps_en, ymaps_ru etc. So I guess we need to create an injection token with this string instead of a hardcoded window.ymaps. It requires a lot of changes
  2. YaApiLoaderService should work with different languages. I mean a script variable is not enough. We need a map (Map<string, HTMLElementScript)
  3. We need to destroy a map. Somehow components should know about config changes.

I'll give it a try. but for now, there is a hack - https://stackblitz.com/edit/change-language-at-runtime