Move all "edit.js" functions into Modules

Create new repository to track these
This commit is contained in:
2025-03-07 14:46:38 +09:00
commit 55972b4ab7
26 changed files with 5052 additions and 0 deletions

View File

@@ -0,0 +1,34 @@
/*
Description: Translation call
Date: 2025//3/6
Creator: Clemens Schwaighofer
*/
export { l10nTranslation };
import { isObject } from './JavaScriptHelpers.mjs';
class l10nTranslation {
#i18n = {};
constructor(i18n) {
this.#i18n = i18n;
}
/**
* uses the i18n object created in the translation template
* that is filled from gettext in PHP
* @param {String} string text to translate
* @return {String} translated text (based on PHP selected language)
*/
__(string)
{
if (typeof this.#i18n !== 'undefined' && isObject(this.#i18n) && this.#i18n[string]) {
return this.#i18n[string];
} else {
return string;
}
}
}
// __END__