@hyperscript-tools/multilingual 2.9.2 → 2.9.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/hyperscript-i18n-ar.global.js +6 -5
- package/dist/hyperscript-i18n-bn.global.js +6 -5
- package/dist/hyperscript-i18n-de.global.js +6 -5
- package/dist/hyperscript-i18n-east-asian.global.js +6 -5
- package/dist/hyperscript-i18n-en.global.js +8 -7
- package/dist/hyperscript-i18n-es.global.js +6 -5
- package/dist/hyperscript-i18n-fr.global.js +6 -5
- package/dist/hyperscript-i18n-he.global.js +6 -5
- package/dist/hyperscript-i18n-hi.global.js +6 -5
- package/dist/hyperscript-i18n-id.global.js +6 -5
- package/dist/hyperscript-i18n-it.global.js +6 -5
- package/dist/hyperscript-i18n-ja.global.js +6 -5
- package/dist/hyperscript-i18n-ko.global.js +6 -5
- package/dist/hyperscript-i18n-lite.global.js +2 -1
- package/dist/hyperscript-i18n-ms.global.js +6 -5
- package/dist/hyperscript-i18n-pl.global.js +6 -5
- package/dist/hyperscript-i18n-pt.global.js +6 -5
- package/dist/hyperscript-i18n-qu.global.js +6 -5
- package/dist/hyperscript-i18n-ru.global.js +6 -5
- package/dist/hyperscript-i18n-slavic.global.js +6 -5
- package/dist/hyperscript-i18n-south-asian.global.js +6 -5
- package/dist/hyperscript-i18n-southeast-asian.global.js +6 -5
- package/dist/hyperscript-i18n-sw.global.js +6 -5
- package/dist/hyperscript-i18n-th.global.js +6 -5
- package/dist/hyperscript-i18n-tl.global.js +6 -5
- package/dist/hyperscript-i18n-tr.global.js +6 -5
- package/dist/hyperscript-i18n-uk.global.js +6 -5
- package/dist/hyperscript-i18n-vi.global.js +6 -5
- package/dist/hyperscript-i18n-western.global.js +6 -5
- package/dist/hyperscript-i18n-zh.global.js +6 -5
- package/dist/hyperscript-i18n.global.js +28 -28
- package/package.json +2 -2
|
@@ -1 +1,2 @@
|
|
|
1
|
-
var HyperscriptI18n=(function(exports){'use strict';function
|
|
1
|
+
var HyperscriptI18n=(function(exports){'use strict';function f(t){let r=t.getAttribute("data-lang");if(r)return l(r);let n=t.getAttribute("data-hyperscript-lang")??t.closest?.("[data-hyperscript-lang]")?.getAttribute("data-hyperscript-lang");if(n)return l(n);let i=typeof document<"u"?document.documentElement?.lang:null;return i&&i!=="en"?l(i):null}function l(t){return t.split("-")[0].toLowerCase()}var g="data-hyperscript-i18n-translated";function b(t){return (t.config?.attributes??"_, script, data-script").split(",").map(n=>n.trim()).filter(Boolean)}function h(t,r){for(let n of r)if(t.hasAttribute(n))return n;return null}function d(t,r){if(typeof t.addBeforeProcessHook!="function"){console.warn("[hyperscript-i18n] _hyperscript.addBeforeProcessHook is unavailable \u2014 this build of _hyperscript.org is not supported. Load a current version from https://unpkg.com/hyperscript.org.");return}let n=b(t),i=[...n.map(e=>`[${e}]`),'script[type="text/hyperscript"]'].join(", "),o=e=>{if(e.hasAttribute(g))return;if(e instanceof HTMLScriptElement&&e.type==="text/hyperscript"){let u=e.textContent??"";if(!u)return;let p=r(u,e);e.setAttribute(g,""),p!=null&&p!==u&&(e.textContent=p);return}let s=h(e,n);if(!s)return;let a=e.getAttribute(s);if(!a)return;let c=r(a,e);e.setAttribute(g,""),c!=null&&c!==a&&e.setAttribute(s,c);};t.addBeforeProcessHook(e=>{!e||typeof e.querySelectorAll!="function"||(typeof e.matches=="function"&&e.matches(i)&&o(e),e.querySelectorAll(i).forEach(o));});}function m(){if(typeof globalThis>"u")return null;let t=globalThis,r=["LokaScriptSemantic","LokaScriptSemanticPriority","LokaScriptSemanticWestern","LokaScriptSemanticEastAsian","LokaScriptSemanticEsEn","LokaScriptSemanticEn","LokaScriptSemanticEs"];for(let n of r){let i=t[n];if(i&&typeof i=="object"&&"parse"in i&&"render"in i)return i}return null}function y(t,r,n,i){try{if(n.translate)return n.translate(t,r,"en");let o=n.parse(t,r);if(o)return n.render(o,"en")}catch{}return t}function S(t={}){return function(n){let i=m();if(!i){console.warn('[hyperscript-i18n] No LokaScriptSemantic global found. Load a semantic bundle before the adapter: <script src="lokascript-semantic.browser.global.js"></script>');return}if(d(n,(o,e)=>{let s=L(e,t);if(!s||s==="en")return o;let a=y(o,s,i);return t.debug&&a!==o&&console.log(`[hyperscript-i18n] ${s}: "${o}" \u2192 "${a}"`),a}),t.debug){let o=i.getSupportedLanguages?.()??["(unknown)"];console.log(`[hyperscript-i18n] Lite adapter loaded. Languages: ${o.join(", ")}`);}}}function L(t,r){if(r.languageAttribute){let i=t.getAttribute(r.languageAttribute);if(i)return i.split("-")[0].toLowerCase()}let n=f(t);return n||(r.defaultLanguage??null)}function H(t,r){if(r==="en")return t;let n=m();if(!n)throw new Error("No LokaScriptSemantic global found");return y(t,r,n)}typeof _hyperscript<"u"&&_hyperscript.use&&_hyperscript.use(S());
|
|
2
|
+
exports.hyperscriptI18n=S;exports.preprocess=H;exports.resolveLanguage=f;return exports;})({});
|