@stacksjs/i18n 0.75.514 → 0.75.518
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/bootstrap.js +1 -1
- package/dist/formatter.js +1 -1
- package/dist/loader.js +1 -1
- package/dist/locale-switch.js +1 -1
- package/dist/pluralization.js +1 -1
- package/dist/translator.js +1 -1
- package/dist/types.js +1 -1
- package/package.json +5 -5
package/dist/bootstrap.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{existsSync}from"node:fs";import{config}from"@stacksjs/config";import{projectPath}from"@stacksjs/path";import{loadFromDirectory}from"./loader";import{configure,getAvailableLocales,setLocale}from"./translator";let localesLoaded
|
|
1
|
+
import{existsSync}from"node:fs";import{config}from"@stacksjs/config";import{projectPath}from"@stacksjs/path";import{loadFromDirectory}from"./loader";import{configure,getAvailableLocales,setLocale}from"./translator";let localesLoaded=false;export async function ensureLocalesLoaded(){if(localesLoaded)return;const directory=projectPath("locales");if(existsSync(directory)){await loadFromDirectory({directory,extensions:[".yaml",".yml",".json"]})}const app=config.app;const defaultLocale=app?.locale??"en";const fallback=app?.fallbackLocale??defaultLocale;const available=getAvailableLocales();configure({locale:defaultLocale,fallbackLocale:fallback,availableLocales:available.length>0?available:[defaultLocale],warnMissing:(app?.env??process.env.APP_ENV)!=="production"});localesLoaded=true}export function resolveRequestLocale(request){const app=config.app;const defaultLocale=app?.locale??"en";const available=new Set(getAvailableLocales());if(!available.size)available.add(defaultLocale);const pick=(code)=>{const normalized=code.trim().toLowerCase();if(available.has(normalized))return normalized;const short=normalized.split("-")[0];if(short&&available.has(short))return short;return defaultLocale};if(!request)return defaultLocale;const url=new URL(request.url);const pathname=url.pathname;const fromStx=request.headers.get("x-stx-locale");if(fromStx)return pick(fromStx);for(const code of available){if(code===defaultLocale)continue;if(pathname===`/${code}`||pathname===`/${code}/`)return pick(code);if(pathname.startsWith(`/${code}/`))return pick(code)}const fromQuery=url.searchParams.get("locale");if(fromQuery)return pick(fromQuery);const cookie=request.headers.get("cookie")??"";const match=cookie.match(/(?:^|;\s*)locale=([a-z]{2}(?:-[a-z]{2})?)(?:;|$)/i);if(match?.[1])return pick(match[1]);const accept=request.headers.get("accept-language")??"";for(const part of accept.split(",")){const tag=part.split(";")[0]?.trim();if(tag)return pick(tag)}return defaultLocale}export async function applyRequestLocale(request){await ensureLocalesLoaded();const locale=resolveRequestLocale(request);setLocale(locale);return locale}
|
package/dist/formatter.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{getLocale}from"./translator";export function formatDate(date,style="medium",locale){const targetLocale=locale||getLocale()
|
|
1
|
+
import{getLocale}from"./translator";export function formatDate(date,style="medium",locale){const targetLocale=locale||getLocale();const dateObj=toDate(date);const options=typeof style==="string"?{dateStyle:style}:style;return new Intl.DateTimeFormat(targetLocale,options).format(dateObj)}export function formatTime(date,style="short",locale){const targetLocale=locale||getLocale();const dateObj=toDate(date);const options=typeof style==="string"?{timeStyle:style}:style;return new Intl.DateTimeFormat(targetLocale,options).format(dateObj)}export function formatDateTime(date,dateStyle="medium",timeStyle="short",locale){const targetLocale=locale||getLocale();const dateObj=toDate(date);return new Intl.DateTimeFormat(targetLocale,{dateStyle,timeStyle}).format(dateObj)}export function formatRelativeTime(date,baseDate=new Date,style="long",locale){const targetLocale=locale||getLocale();const dateObj=toDate(date);const baseDateObj=toDate(baseDate);const diffMs=dateObj.getTime()-baseDateObj.getTime();const diffSeconds=Math.round(diffMs/1000);const diffMinutes=Math.round(diffSeconds/60);const diffHours=Math.round(diffMinutes/60);const diffDays=Math.round(diffHours/24);const diffWeeks=Math.round(diffDays/7);const diffMonths=Math.round(diffDays/30);const diffYears=Math.round(diffDays/365);const rtf=new Intl.RelativeTimeFormat(targetLocale,{style});if(Math.abs(diffSeconds)<60){return rtf.format(diffSeconds,"second")}if(Math.abs(diffMinutes)<60){return rtf.format(diffMinutes,"minute")}if(Math.abs(diffHours)<24){return rtf.format(diffHours,"hour")}if(Math.abs(diffDays)<7){return rtf.format(diffDays,"day")}if(Math.abs(diffWeeks)<4){return rtf.format(diffWeeks,"week")}if(Math.abs(diffMonths)<12){return rtf.format(diffMonths,"month")}return rtf.format(diffYears,"year")}export function formatNumber(value,options={},locale){const targetLocale=locale||getLocale();const formatOptions={...options};if(options.compact){formatOptions.notation="compact";formatOptions.compactDisplay="short"}if(options.precision!==undefined){formatOptions.minimumFractionDigits=options.precision;formatOptions.maximumFractionDigits=options.precision}return new Intl.NumberFormat(targetLocale,formatOptions).format(value)}export function formatCurrency(value,currency="USD",options={},locale){const targetLocale=locale||getLocale();return new Intl.NumberFormat(targetLocale,{style:"currency",currency,...options}).format(value)}export function formatPercent(value,options={},locale){const targetLocale=locale||getLocale();return new Intl.NumberFormat(targetLocale,{style:"percent",...options}).format(value)}export function formatUnit(value,unit,unitDisplay="short",locale){const targetLocale=locale||getLocale();return new Intl.NumberFormat(targetLocale,{style:"unit",unit,unitDisplay}).format(value)}export function formatBytes(bytes,decimals=2,locale){const targetLocale=locale||getLocale();if(bytes===0)return"0 B";const k=1024;const sizes=["B","KB","MB","GB","TB","PB","EB","ZB","YB"];const i=Math.floor(Math.log(bytes)/Math.log(k));const value=bytes/Math.pow(k,i);const formatted=new Intl.NumberFormat(targetLocale,{minimumFractionDigits:0,maximumFractionDigits:decimals}).format(value);return`${formatted} ${sizes[i]}`}export function formatList(items,type="conjunction",style="long",locale){const targetLocale=locale||getLocale();return new Intl.ListFormat(targetLocale,{type,style}).format(items)}export function formatPlural(value,locale){const targetLocale=locale||getLocale();const pr=new Intl.PluralRules(targetLocale);return pr.select(value)}export function selectPlural(value,options,locale){const category=formatPlural(value,locale);return options[category]??options.other}export function getDisplayName(code,type="language",style="long",locale){const targetLocale=locale||getLocale();try{const dn=new Intl.DisplayNames(targetLocale,{type,style});return dn.of(code)}catch{return}}export function getLanguageName(languageCode,locale){return getDisplayName(languageCode,"language","long",locale)}export function getRegionName(regionCode,locale){return getDisplayName(regionCode,"region","long",locale)}export function getCurrencyName(currencyCode,locale){return getDisplayName(currencyCode,"currency","long",locale)}export function compareStrings(a,b,options={},locale){const targetLocale=locale||getLocale();const collator=new Intl.Collator(targetLocale,options);return collator.compare(a,b)}export function sortStrings(strings,options={},locale){const targetLocale=locale||getLocale();const collator=new Intl.Collator(targetLocale,options);return[...strings].sort((a,b)=>collator.compare(a,b))}function toDate(date){if(date instanceof Date)return date;if(typeof date==="number")return new Date(date);return new Date(date)}export function getTextDirection(locale){const targetLocale=locale||getLocale();const lang=(targetLocale.split("-")[0]??targetLocale).toLowerCase();const rtlLanguages=["ar","he","fa","ur","yi","ps","sd","ug","ku","ckb"];return rtlLanguages.includes(lang)?"rtl":"ltr"}export function isRTL(locale){return getTextDirection(locale)==="rtl"}
|
package/dist/loader.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{existsSync,readdirSync}from"node:fs";import{readFile}from"node:fs/promises";import{basename,extname,join}from"node:path";import{log}from"@stacksjs/logging";import{addTranslations,loadTranslations}from"./translator";export async function loadFromDirectory(options){const{directory,extensions=[".json",".yaml",".yml",".ts",".js"],recursive
|
|
1
|
+
import{existsSync,readdirSync}from"node:fs";import{readFile}from"node:fs/promises";import{basename,extname,join}from"node:path";import{log}from"@stacksjs/logging";import{addTranslations,loadTranslations}from"./translator";export async function loadFromDirectory(options){const{directory,extensions=[".json",".yaml",".yml",".ts",".js"],recursive=false,namespaceSeparator="."}=options;const translations={};if(!existsSync(directory)){log.warn(`[i18n] Translation directory not found: ${directory}`);return translations}await loadDirectory(directory,translations,extensions,recursive,namespaceSeparator,"");loadTranslations(translations);return translations}async function loadDirectory(dir,translations,extensions,recursive,namespaceSeparator,namespace){const entries=readdirSync(dir,{withFileTypes:true});for(const entry of entries){const fullPath=join(dir,entry.name);if(entry.isDirectory()){const locale=entry.name;if(isLocaleCode(locale)){await loadLocaleDirectory(fullPath,locale,translations,extensions)}else if(recursive){const newNamespace=namespace?`${namespace}${namespaceSeparator}${entry.name}`:entry.name;await loadDirectory(fullPath,translations,extensions,recursive,namespaceSeparator,newNamespace)}}else if(entry.isFile()){const ext=extname(entry.name);if(extensions.includes(ext)){const locale=basename(entry.name,ext);if(!translations[locale]){translations[locale]={}}const messages=await loadFile(fullPath);if(namespace){setNested(translations[locale],namespace,messages,namespaceSeparator)}else{translations[locale]=deepMerge(translations[locale],messages)}}}}}async function loadLocaleDirectory(dir,locale,translations,extensions){if(!translations[locale]){translations[locale]={}}const entries=readdirSync(dir,{withFileTypes:true});for(const entry of entries){if(!entry.isFile())continue;const ext=extname(entry.name);if(!extensions.includes(ext))continue;const fullPath=join(dir,entry.name);const namespace=basename(entry.name,ext);const messages=await loadFile(fullPath);if(namespace===locale){translations[locale]=deepMerge(translations[locale],messages)}else{translations[locale][namespace]=messages}}}export async function loadFile(filePath){const ext=extname(filePath).toLowerCase();const content=await readFile(filePath,"utf8");switch(ext){case".json":try{return JSON.parse(content)}catch{throw new Error(`Invalid JSON in translation file: ${filePath}`)}case".yaml":case".yml":return parseYaml(content);case".ts":case".js":{const module=await import(filePath);return module.default||module}default:throw new Error(`Unsupported file type: ${ext}`)}}export async function loadLocale(locale,path){const messages=await loadFile(path);addTranslations(locale,messages);return messages}function parseYaml(content){try{const parsed=Bun.YAML.parse(content);if(!parsed||typeof parsed!=="object"||Array.isArray(parsed)){throw new Error("YAML content must be an object at the root level")}return parsed}catch(error){const message=error instanceof Error?error.message:"Unknown YAML parse error";throw new Error(`Invalid YAML translation file: ${message}`)}}function isLocaleCode(str){return/^[a-z]{2}(?:-[A-Z]{2})?(?:-[A-Za-z]+)?$/i.test(str)}function setNested(obj,path,value,separator){const parts=path.split(separator);let current=obj;for(let i=0;i<parts.length-1;i++){const part=parts[i];if(!part)continue;if(!current[part]||typeof current[part]==="string"){current[part]={}}current=current[part]}const lastPart=parts[parts.length-1];if(lastPart)current[lastPart]=value}function deepMerge(target,source){const result={...target};for(const key of Object.keys(source)){const sourceValue=source[key];if(sourceValue===undefined)continue;const targetValue=result[key];if(typeof sourceValue==="object"&&sourceValue!==null&&typeof targetValue==="object"&&targetValue!==null){result[key]=deepMerge(targetValue,sourceValue)}else{result[key]=sourceValue}}return result}export function createLoader(directory,options={}){return{load:()=>loadFromDirectory({directory,...options}),loadLocale:(locale,filename)=>loadLocale(locale,join(directory,filename))}}export async function loadFromTsI18n(config){const{loadTranslations:tsLoad}=await import("@stacksjs/ts-i18n");const localeMap=await tsLoad(config);loadTranslations(localeMap);return localeMap}
|
package/dist/locale-switch.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function normalizeLocale(code,config){const normalized=code.trim().toLowerCase();if(config.locales.includes(normalized))return normalized;const short=normalized.split("-")[0];if(short&&config.locales.includes(short))return short;return null}export function stripLocalePrefix(path,locales){for(const loc of locales){if(path===`/${loc}`||path===`/${loc}/`)return{locale:loc,path:"/"};if(path.startsWith(`/${loc}/`))return{locale:loc,path:path.slice(loc.length+1)}}return{locale:null,path}}export function localizePath(path,locale,defaultLocale){if(locale===defaultLocale)return path;if(path==="/")return`/${locale}/`;if(path==="/404.html")return`/${locale}/404.html`;return`/${locale}${path}`}export function createLocaleSwitchResponse(request,localeCode,config){const locale=normalizeLocale(localeCode,config);if(!locale)return Response.redirect(new URL("/",request.url).href,302)
|
|
1
|
+
function normalizeLocale(code,config){const normalized=code.trim().toLowerCase();if(config.locales.includes(normalized))return normalized;const short=normalized.split("-")[0];if(short&&config.locales.includes(short))return short;return null}export function stripLocalePrefix(path,locales){for(const loc of locales){if(path===`/${loc}`||path===`/${loc}/`)return{locale:loc,path:"/"};if(path.startsWith(`/${loc}/`))return{locale:loc,path:path.slice(loc.length+1)}}return{locale:null,path}}export function localizePath(path,locale,defaultLocale){if(locale===defaultLocale)return path;if(path==="/")return`/${locale}/`;if(path==="/404.html")return`/${locale}/404.html`;return`/${locale}${path}`}export function createLocaleSwitchResponse(request,localeCode,config){const locale=normalizeLocale(localeCode,config);if(!locale){return Response.redirect(new URL("/",request.url).href,302)}const referer=request.headers.get("referer");let basePath="/";if(referer){try{const ref=new URL(referer);if(!ref.pathname.startsWith("/locale/")){const stripped=stripLocalePrefix(ref.pathname,config.locales);basePath=stripped.path||"/"}}catch{basePath="/"}}const targetPath=localizePath(basePath,locale,config.defaultLocale);const target=new URL(targetPath,request.url);const res=Response.redirect(target.href,302);res.headers.append("Set-Cookie",`locale=${locale}; Path=/; Max-Age=31536000; SameSite=Lax`);return res}
|
package/dist/pluralization.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export function getPluralCategory(n,locale){
|
|
1
|
+
export function getPluralCategory(n,locale){const rule=getPluralRule(locale);return rule(n)}const customRules={};const runtimeRules=new Map;function baseLanguage(locale){return locale.split("-")[0]?.toLowerCase()??locale.toLowerCase()}function runtimeRule(locale){if(!runtimeRules.has(locale)){let rules=null;try{if(Intl.PluralRules.supportedLocalesOf([locale]).length)rules=new Intl.PluralRules(locale)}catch{}runtimeRules.set(locale,rules)}return runtimeRules.get(locale)??null}export function getPluralRule(locale){const custom=customRules[baseLanguage(locale)];if(custom)return custom;const rules=runtimeRule(locale)??runtimeRule(baseLanguage(locale));if(rules)return(n)=>rules.select(n);return()=>"other"}export function parsePluralForms(str,separator="|"){const parts=str.split(separator).map((s)=>s.trim());const forms=new Map;if(parts.length===1){forms.set("other",parts[0]??"")}else if(parts.length===2){forms.set("one",parts[0]??"");forms.set("other",parts[1]??"")}else if(parts.length===3){forms.set("zero",parts[0]??"");forms.set("one",parts[1]??"");forms.set("other",parts[2]??"")}else if(parts.length>=4){const categories=["zero","one","two","few","many","other"];for(let i=0;i<parts.length&&i<categories.length;i++){const category=categories[i];const part=parts[i];if(category!==undefined&&part!==undefined)forms.set(category,part)}}return forms}export function selectPluralForm(forms,count,locale){if(count===0&&forms.has("zero"))return forms.get("zero");const category=getPluralCategory(count,locale);if(forms.has(category)){return forms.get(category)}if(forms.has("other")){return forms.get("other")}const first=forms.values().next();return first.done?"":first.value}export function getSupportedPluralLocales(){return Object.keys(customRules)}export function hasPluralRule(locale){const lang=baseLanguage(locale);return lang in customRules||runtimeRule(lang)!==null}export function addPluralRule(locale,rule){customRules[baseLanguage(locale)]=rule}
|
package/dist/translator.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{parsePluralForms,selectPluralForm}from"./pluralization";const defaultConfig={locale:"en",fallbackLocale:"en",availableLocales:["en"],messages:{},warnMissing
|
|
1
|
+
import{parsePluralForms,selectPluralForm}from"./pluralization";const defaultConfig={locale:"en",fallbackLocale:"en",availableLocales:["en"],messages:{},warnMissing:true,escapeValues:false,keySeparator:".",pluralSeparator:"|"};let currentLocale="en";let fallbackLocale="en";const translations={};let config={...defaultConfig};export class I18n{_locale;_fallbackLocale;_messages;_config;constructor(options={}){this._config={...defaultConfig,...options};this._locale=this._config.locale;this._fallbackLocale=this._config.fallbackLocale;this._messages=this._config.messages||{}}get locale(){return this._locale}set locale(value){this._locale=value}get fallbackLocale(){return this._fallbackLocale}get availableLocales(){return Object.keys(this._messages)}t=(key,values,locale)=>{return this.translate(key,values,locale)};tc=(key,count,values,locale)=>{return this.translatePlural(key,count,values,locale)};te=(key,locale)=>{return this.hasTranslation(key,locale)};tm=(key,locale)=>{return this.getMessage(key,locale??this.locale)};setLocale=(locale)=>{this._locale=locale};addTranslations=(locale,messages)=>{if(!this._messages[locale]){this._messages[locale]={}}this._messages[locale]=deepMerge(this._messages[locale],messages)};d=(value,format)=>{const date=typeof value==="number"?new Date(value):value;const options=this._config.dateTimeFormats?.[this._locale]?.[format||"short"]||{};return new Intl.DateTimeFormat(this._locale,options).format(date)};n=(value,format)=>{const options=this._config.numberFormats?.[this._locale]?.[format||"decimal"]||{};return new Intl.NumberFormat(this._locale,options).format(value)};translate(key,values,locale){const targetLocale=locale||this._locale;let message=this.getMessage(key,targetLocale);if(message===undefined){const dash=targetLocale.indexOf("-");if(dash>0){const langOnly=targetLocale.slice(0,dash);if(langOnly!==this._fallbackLocale){message=this.getMessage(key,langOnly)}}}if(message===undefined&&targetLocale!==this._fallbackLocale){message=this.getMessage(key,this._fallbackLocale)}if(message===undefined){if(this._config.warnMissing){console.warn(`[i18n] Missing translation: "${key}" for locale "${targetLocale}"`)}if(this._config.missingHandler){const result=this._config.missingHandler(targetLocale,key);if(result!==undefined)return result}return key}if(typeof message!=="string"){return key}return this.interpolate(message,values)}translatePlural(key,count,values,locale){const targetLocale=locale||this._locale;let message=this.getMessage(key,targetLocale);if(message===undefined&&targetLocale!==this._fallbackLocale){message=this.getMessage(key,this._fallbackLocale)}if(message===undefined||typeof message!=="string"){if(this._config.warnMissing){console.warn(`[i18n] Missing plural translation: "${key}" for locale "${targetLocale}"`)}return key}const forms=parsePluralForms(message,this._config.pluralSeparator);const selectedForm=selectPluralForm(forms,count,targetLocale);const allValues={count,n:count,...values};return this.interpolate(selectedForm,allValues)}hasTranslation(key,locale){const targetLocale=locale||this._locale;return this.getMessage(key,targetLocale)!==undefined}getMessage(key,locale){const messages=this._messages[locale];if(!messages)return;const parts=key.split(this._config.keySeparator||".");let current=messages;for(const part of parts){if(current===undefined||typeof current==="string"){return}current=current[part]}return current}interpolate(message,values){if(!values)return message;return message.replace(/\{(\w+)\}/g,(match,key)=>{const value=values[key];if(value===undefined||value===null)return match;const str=String(value);return this._config.escapeValues?escapeHtml(str):str})}}export function setLocale(locale){currentLocale=locale}export function getLocale(){return currentLocale}export function setFallbackLocale(locale){fallbackLocale=locale}export function getAvailableLocales(){return Object.keys(translations)}export function addTranslations(locale,messages){if(!translations[locale]){translations[locale]={}}translations[locale]=deepMerge(translations[locale],messages)}export function loadTranslations(messages){for(const[locale,localeMessages]of Object.entries(messages)){addTranslations(locale,localeMessages)}}export function hasTranslation(key,locale){const targetLocale=locale||currentLocale;return getMessage(key,targetLocale)!==undefined}function getMessage(key,locale){const messages=translations[locale];if(!messages)return;const parts=key.split(config.keySeparator||".");let current=messages;for(const part of parts){if(current===undefined||typeof current==="string"){return}current=current[part]}return current}function interpolate(message,values){if(!values)return message;return message.replace(/\{(\w+)\}/g,(match,key)=>{const value=values[key];if(value===undefined||value===null)return match;return String(value)})}export function t(key,values,locale){const targetLocale=locale||currentLocale;let message=getMessage(key,targetLocale);if(message===undefined&&targetLocale!==fallbackLocale){message=getMessage(key,fallbackLocale)}if(message===undefined){if(config.warnMissing){console.warn(`[i18n] Missing translation: "${key}" for locale "${targetLocale}"`)}return key}if(typeof message!=="string"){return key}return interpolate(message,values)}export const trans=t;export function tc(key,count,values,locale){const targetLocale=locale||currentLocale;let message=getMessage(key,targetLocale);if(message===undefined&&targetLocale!==fallbackLocale){message=getMessage(key,fallbackLocale)}if(message===undefined||typeof message!=="string"){return key}const forms=parsePluralForms(message,config.pluralSeparator);const selectedForm=selectPluralForm(forms,count,targetLocale);const allValues={count,n:count,...values};return interpolate(selectedForm,allValues)}export function te(key,locale){return hasTranslation(key,locale)}export function tm(key,locale){return getMessage(key,locale||currentLocale)}export function createI18n(options={}){return new I18n(options)}export function useI18n(options={}){return createI18n(options)}export function configure(options){config={...config,...options};if(options.locale)currentLocale=options.locale;if(options.fallbackLocale)fallbackLocale=options.fallbackLocale;if(options.messages)loadTranslations(options.messages)}function deepMerge(target,source){const result={...target};for(const key of Object.keys(source)){const sourceValue=source[key];const targetValue=result[key];if(typeof sourceValue==="object"&&sourceValue!==null&&typeof targetValue==="object"&&targetValue!==null){result[key]=deepMerge(targetValue,sourceValue)}else{if(sourceValue!==undefined)result[key]=sourceValue}}return result}function escapeHtml(str){const htmlEscapes={"&":"&","<":"<",">":">",'"':""","'":"'"};return str.replace(/[&<>"']/g,(char)=>htmlEscapes[char]||char)}
|
package/dist/types.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const LOCALE_INFO={en:{code:"en",name:"English",nativeName:"English",direction:"ltr"},"en-US":{code:"en-US",name:"English (US)",nativeName:"English (US)",direction:"ltr",region:"US"},"en-GB":{code:"en-GB",name:"English (UK)",nativeName:"English (UK)",direction:"ltr",region:"GB"},es:{code:"es",name:"Spanish",nativeName:"
|
|
1
|
+
export const LOCALE_INFO={en:{code:"en",name:"English",nativeName:"English",direction:"ltr"},"en-US":{code:"en-US",name:"English (US)",nativeName:"English (US)",direction:"ltr",region:"US"},"en-GB":{code:"en-GB",name:"English (UK)",nativeName:"English (UK)",direction:"ltr",region:"GB"},es:{code:"es",name:"Spanish",nativeName:"Español",direction:"ltr"},fr:{code:"fr",name:"French",nativeName:"Français",direction:"ltr"},de:{code:"de",name:"German",nativeName:"Deutsch",direction:"ltr"},it:{code:"it",name:"Italian",nativeName:"Italiano",direction:"ltr"},pt:{code:"pt",name:"Portuguese",nativeName:"Português",direction:"ltr"},"pt-BR":{code:"pt-BR",name:"Portuguese (Brazil)",nativeName:"Português (Brasil)",direction:"ltr",region:"BR"},zh:{code:"zh",name:"Chinese",nativeName:"中文",direction:"ltr"},"zh-CN":{code:"zh-CN",name:"Chinese (Simplified)",nativeName:"简体中文",direction:"ltr",region:"CN"},"zh-TW":{code:"zh-TW",name:"Chinese (Traditional)",nativeName:"繁體中文",direction:"ltr",region:"TW"},ja:{code:"ja",name:"Japanese",nativeName:"日本語",direction:"ltr"},ko:{code:"ko",name:"Korean",nativeName:"한국어",direction:"ltr"},ar:{code:"ar",name:"Arabic",nativeName:"العربية",direction:"rtl"},he:{code:"he",name:"Hebrew",nativeName:"עברית",direction:"rtl"},ru:{code:"ru",name:"Russian",nativeName:"Русский",direction:"ltr"},nl:{code:"nl",name:"Dutch",nativeName:"Nederlands",direction:"ltr"},pl:{code:"pl",name:"Polish",nativeName:"Polski",direction:"ltr"},tr:{code:"tr",name:"Turkish",nativeName:"Türkçe",direction:"ltr"},vi:{code:"vi",name:"Vietnamese",nativeName:"Tiếng Việt",direction:"ltr"},th:{code:"th",name:"Thai",nativeName:"ไทย",direction:"ltr"},hi:{code:"hi",name:"Hindi",nativeName:"हिन्दी",direction:"ltr"}};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stacksjs/i18n",
|
|
3
|
-
"version": "0.75.
|
|
3
|
+
"version": "0.75.518",
|
|
4
4
|
"description": "Internationalization system for Stacks.js applications",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -36,13 +36,13 @@
|
|
|
36
36
|
"prepublishOnly": "bun run build"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@stacksjs/config": "0.75.
|
|
40
|
-
"@stacksjs/logging": "0.75.
|
|
41
|
-
"@stacksjs/path": "0.75.
|
|
39
|
+
"@stacksjs/config": "0.75.518",
|
|
40
|
+
"@stacksjs/logging": "0.75.518",
|
|
41
|
+
"@stacksjs/path": "0.75.518",
|
|
42
42
|
"@stacksjs/ts-i18n": "^0.1.11"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
|
-
"@stacksjs/development": "0.75.
|
|
45
|
+
"@stacksjs/development": "0.75.518"
|
|
46
46
|
},
|
|
47
47
|
"publishConfig": {
|
|
48
48
|
"exports": {
|