Internationalization

Vue Maplibre components are using English by default, if you wish you use other languages, you can get you answer by keep reading.

Global configuration

Vue Maplibre provides global configurations

import VueMaplibre from '@meteosci/vue-maplibre'
import zhCn from '@meteosci/vue-maplibre/es/locale/lang/zh-cn'

app.use(VueMaplibre, {
  locale: zhCn
})

ConfigProvider

Vue Maplibre also provides a Vue component ConfigProvider for globally configuring locale and other settings.

<template>
  <vm-config-provider :locale="locale">
    <app />
  </vm-config-provider>
</template>

<script setup>
  import { VmConfigProvider } from '@meteosci/vue-maplibre'
  import zhCn from '@meteosci/vue-maplibre/es/locale/lang/zh-cn'

  const locale = zhCn
</script>

CDN Usage

If you are using Vue Maplibre via CDN, then you need to do this, let's again take unpkg as an example

<script src="//unpkg.com/@meteosci/vue-maplibre/dist/locale/zh-cn"></script>
<script>
  app.use(VueMaplibre, {
    locale: VueMaplibreLocaleZhCn
  })
</script>

Full documentation refer to: ConfigProvider

Supported Language List

  • Simplified Chinese (zh-cn)
  • American English (en-us)

If you need any other languages, PR is always welcomed, you only need to add a language file at here.