marengo-language
v2.0.1
Published
#### Settings API | Prop | Description | Default | ------------- | ------------- | ------------- | | current | Set current language to display | pt_BR | | packages | Object to store languages packages | {} |
Downloads
11
Readme
Marengo Language
Settings API
| Prop | Description | Default | ------------- | ------------- | ------------- | | current | Set current language to display | pt_BR | | packages | Object to store languages packages | {} |
Method: $
Render a language string
| Param | Description | Example | | ------------- | ------------- | ------------- | | word | key from language package to be renderized | $('foo') | | data | customize renderization, replacing variables, or even activating DOM events | $('foo {x}', {x: 'bar'}) |
Draft Example
settings.js
import pt_BR from './lang/pt_BR.json'
import en_US from './lang/en_US.json'
export default {
language: {
current: 'en_ES',
packages: {
pt_BR,
en_US,
es_ES: {
'example': 'ejemplo'
}
}
}
}
plugins.js
import language from 'marengo-language'
export default {
language
}
component.vue
<template>
<div>
{{ $('example') }}
</div>
</template>
<script>
import m from 'marengo'
import s from './settings'
import p from './plugins'
export default m({
// ...
}, s, p)
</script>