View | Details | Raw Unified | Return to bug 39061
Collapse All | Expand All

(-)a/koha-tmpl/intranet-tmpl/prog/js/vue/i18n/index.js (-10 / +19 lines)
Lines 1-14 Link Here
1
export const $__ = key => {
1
const methods = ["__", "__x", "__n", "__nx", "__p", "__px", "__np", "__npx"];
2
    return window["__"](key);
3
};
4
2
5
export const $__p = (ctx, key) => {
3
const translators = Object.fromEntries(
6
    return window["__p"](ctx, key);
4
    methods.map(method => [method, (...args) => window[method](...args)])
7
};
5
);
6
7
export const {
8
    __: $__,
9
    __x: $__x,
10
    __n: $__n,
11
    __nx: $__nx,
12
    __p: $__p,
13
    __px: $__px,
14
    __np: $__np,
15
    __npx: $__npx,
16
} = translators;
8
17
9
export default {
18
export default {
10
    install: (app, options) => {
19
    install: app => {
11
        app.config.globalProperties.$__ = $__;
20
        Object.entries(translators).forEach(([key, func]) => {
12
        app.config.globalProperties.$__p = $__p;
21
            app.config.globalProperties[`$${key}`] = func;
22
        });
13
    },
23
    },
14
};
24
};
15
- 

Return to bug 39061