mirror of
https://github.com/devcode-it/openstamanager.git
synced 2025-02-24 23:37:51 +01:00
Il nuovo sistema si basa sul sistema nativo di Laravel. Le traduzioni e la lingua dell'utente vengono passati a JS (mithril) tramite Inertia. C'è anche una route per modificare la lingua.
23 lines
468 B
JavaScript
Vendored
23 lines
468 B
JavaScript
Vendored
import Component from './Component';
|
|
|
|
/**
|
|
* The `Page` component
|
|
*
|
|
* @abstract
|
|
*/
|
|
export default class Page extends Component {
|
|
page = JSON.parse($('#app').attr('data-page'));
|
|
|
|
__(key: string, replace: Object = {}) {
|
|
let translation = this.page.language[key]
|
|
? this.page.language[key]
|
|
: key;
|
|
|
|
Object.keys(replace).forEach((k: string) => {
|
|
translation = translation.replace(`:${k}`, replace[k]);
|
|
});
|
|
|
|
return translation;
|
|
}
|
|
}
|