slm-select

5.0.10 • Public • Published

📖 Implementation

Copy the following code in the entry point of your application for example: main.ts or main.js.

import 'slm-select/dist/slm-select.min.css'
import SlmSelect from 'slm-select'

Vue.use(SlmSelect, {
  applicationServer: 'the server of the SLM API from where your are trying to get the translations',
  applicationCode: 'your application code',
  fallbackLocale: 'your default locale',
  loadOnMount: 'by default is true'
})

Your entry point should look like this:

import Vue from 'vue'
import App from './App.vue'
import 'slm-select/dist/slm-select.min.css'
import SlmSelect from 'slm-select'

Vue.config.productionTip = false

Vue.use(SlmSelect, {
  applicationServer: 'the server of the SLM API from where your are trying to get the translations',
  applicationCode: 'your application code',
  fallbackLocale: 'your default locale'
})

new Vue({
  render: h => h(App),
}).$mount('#app')

🔥 Usage

In your vue template you need to put your key and label as you specified in SLM and the filter sx-translate

<template>
  <div>
    <p>{{ "placeholder.value" | sx-translate }}</p>
  </div>
</template>

To change the language globally, just add the slm-select component where you want

<template>
  <div>
    <slm-select/>
  </div>
</template>

In the prototype $slmAdapter we have: setLanguage, getCurrentLocale

Readme

Keywords

none

Package Sidebar

Install

npm i slm-select

Weekly Downloads

0

Version

5.0.10

License

none

Unpacked Size

48.5 kB

Total Files

9

Last publish

Collaborators

  • angelreyes