Bugzilla – Attachment 180237 Details for
Bug 39061
Allow translation context in vue files
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 39061: Export all functions from i18n.js
Bug-39061-Export-all-functions-from-i18njs.patch (text/plain), 1.52 KB, created by
Martin Renvoize (ashimema)
on 2025-04-02 07:24:19 UTC
(
hide
)
Description:
Bug 39061: Export all functions from i18n.js
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2025-04-02 07:24:19 UTC
Size:
1.52 KB
patch
obsolete
>From a8e174f132da48e8db34be4d9eaf25739c44dc4c Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Mon, 10 Feb 2025 14:31:23 +0100 >Subject: [PATCH] Bug 39061: Export all functions from i18n.js > >Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk> >--- > .../intranet-tmpl/prog/js/vue/i18n/index.js | 28 +++++++++++++------ > 1 file changed, 19 insertions(+), 9 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/i18n/index.js b/koha-tmpl/intranet-tmpl/prog/js/vue/i18n/index.js >index 4c36558b48e..b196078d0f7 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/vue/i18n/index.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/vue/i18n/index.js >@@ -1,14 +1,24 @@ >-export const $__ = key => { >- return window["__"](key); >-}; >+const methods = ["__", "__x", "__n", "__nx", "__p", "__px", "__np", "__npx"]; > >-export const $__p = (ctx, key) => { >- return window["__p"](ctx, key); >-}; >+const translators = Object.fromEntries( >+ methods.map(method => [method, (...args) => window[method](...args)]) >+); >+ >+export const { >+ __: $__, >+ __x: $__x, >+ __n: $__n, >+ __nx: $__nx, >+ __p: $__p, >+ __px: $__px, >+ __np: $__np, >+ __npx: $__npx, >+} = translators; > > export default { >- install: (app, options) => { >- app.config.globalProperties.$__ = $__; >- app.config.globalProperties.$__p = $__p; >+ install: app => { >+ Object.entries(translators).forEach(([key, func]) => { >+ app.config.globalProperties[`$${key}`] = func; >+ }); > }, > }; >-- >2.49.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 39061
:
177600
|
177693
|
180236
| 180237