mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-06-01 20:29:29 +00:00
modify Phrasen.js so that it can be used by composition api and does not use legacy categories at all
This commit is contained in:
@@ -44,6 +44,7 @@ function getValueForLoadedPhrase(category, phrase, params) {
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
const phrasen = {
|
||||
t_ref(category, phrase, params) {
|
||||
if (params === undefined && (
|
||||
@@ -58,8 +59,9 @@ const phrasen = {
|
||||
return '';
|
||||
}
|
||||
if (!categories[category]) {
|
||||
if (window.FHC_JS_PHRASES_STORAGE_OBJECT !== undefined)
|
||||
categories[category] = extractCategory(FHC_JS_PHRASES_STORAGE_OBJECT, category);
|
||||
|
||||
//if (window.FHC_JS_PHRASES_STORAGE_OBJECT !== undefined)
|
||||
// categories[category] = extractCategory(FHC_JS_PHRASES_STORAGE_OBJECT, category);
|
||||
|
||||
if (!categories[category] || Object.keys(categories[category]).length === 0) {
|
||||
categories[category] = undefined;
|
||||
@@ -83,3 +85,16 @@ export default {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Composable (wrapper for mixin)
|
||||
export function usePhrasen() {
|
||||
|
||||
function t(category, phrase, params) {
|
||||
return phrasen.t(category, phrase, params);
|
||||
}
|
||||
|
||||
return {
|
||||
t,
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user