{"version":3,"file":"index.cjs","names":["events"],"sources":["../../../../../../localization/src/placeholder-pattern-config.ts","../../../../../../localization/src/converters.ts","../../../../../../localization/src/count-rules.ts","../../../../../../localization/src/events.ts","../../../../../../localization/src/translator.ts","../../../../../../localization/src/config.ts"],"sourcesContent":["// :placeholder pattern\r\nconst colonPlaceholderPattern: RegExp = /:([a-zA-Z0-9_-]+)/g;\r\n\r\n// {{placeholder}} pattern\r\nconst doubleCurlyPlaceholderPattern: RegExp = /{{([a-zA-Z0-9_-]+)}}/g;\r\n\r\nexport const placeholderPatterns = {\r\n  colon: colonPlaceholderPattern,\r\n  doubleCurly: doubleCurlyPlaceholderPattern,\r\n};\r\n\r\nlet placeholderPattern = /:([a-zA-Z0-9_-]+)/g;\r\n\r\nexport function setPlaceholderPattern(pattern: RegExp) {\r\n  placeholderPattern = pattern;\r\n}\r\n\r\nexport function getPlaceholderPattern() {\r\n  return placeholderPattern;\r\n}\r\n","interface Placeholders {\r\n  [key: string]: string | number | undefined;\r\n}\r\n\r\n/**\r\n * Convert the placeholders for the given translation\r\n */\r\nexport function plainConverter(\r\n  translation: string,\r\n  placeholders: Placeholders = {},\r\n  placeholderPattern: RegExp = /:([a-zA-Z0-9_-]+)/g,\r\n): string {\r\n  return translation.replace(\r\n    placeholderPattern,\r\n    (match: string, key: string) => {\r\n      const value = placeholders[key];\r\n      if (value === undefined) {\r\n        return match; // Return the original placeholder if no match is found\r\n      }\r\n\r\n      return value.toString();\r\n    },\r\n  );\r\n}\r\n","import { getLocalizationConfigurations } from \"./config\";\nimport { LanguageCountRules } from \"./types\";\n\n/**\n * Default count rules for English\n */\nconst defaultCountRules: LanguageCountRules = {\n  negative: (n: number) => n < 0,\n  zero: (n: number) => n === 0,\n  one: (n: number) => n === 1,\n  two: (n: number) => n === 2,\n  three: (n: number) => n === 3,\n  many: (n: number) => n > 3,\n  other: () => true,\n};\n\n/**\n * Arabic count rules\n * Following Arabic plural rules: zero, one, two, few (3-10), many (11+), other\n */\nconst arabicCountRules: LanguageCountRules = {\n  negative: (n: number) => n < 0,\n  zero: (n: number) => n === 0,\n  one: (n: number) => n === 1,\n  two: (n: number) => n === 2,\n  few: (n: number) => {\n    const mod100 = Math.abs(n) % 100;\n    return mod100 >= 3 && mod100 <= 10;\n  },\n  many: (n: number) => {\n    const mod100 = Math.abs(n) % 100;\n    return mod100 >= 11 && mod100 <= 99;\n  },\n  other: () => true,\n};\n\n/**\n * Built-in count rules for common languages\n */\nconst builtInRules = {\n  en: defaultCountRules,\n  ar: arabicCountRules,\n};\n\n/**\n * Get count rules for the given locale code\n */\nexport function getCountRules(localeCode: string): LanguageCountRules {\n  const config = getLocalizationConfigurations();\n\n  // Check for custom rules in config\n  if (config.countRules?.[localeCode]) {\n    return config.countRules[localeCode];\n  }\n\n  // Check for built-in rules\n  if (builtInRules[localeCode]) {\n    return builtInRules[localeCode];\n  }\n\n  // Fallback to default rules\n  return defaultCountRules;\n}\n\n/**\n * Get the appropriate count key suffix based on the count value and locale rules\n */\nexport function getCountKey(count: number, localeCode: string): string {\n  const rules = getCountRules(localeCode);\n  const config = getLocalizationConfigurations();\n  const absCount = Math.abs(count);\n\n  // Handle negative numbers first\n  if (count < 0 && typeof rules.negative === 'function') {\n    return \"_negative\";\n  }\n\n  // Handle range-based counts if enabled\n  if (config.countRanges?.enabled) {\n    const separator = config.countRanges.separator || \"_\";\n    // Custom thresholds via config; fall back to the documented defaults so\n    // existing consumers see no behavior change when `ranges` is unset.\n    const ranges: Array<[number, number]> = config.countRanges.ranges || [\n      [0, 5],\n      [6, 20],\n      [21, Infinity],\n    ];\n\n    for (const [min, max] of ranges) {\n      if (absCount >= min && absCount <= max) {\n        const maxKey = max === Infinity ? \"plus\" : String(max);\n        return `_range${separator}${min}${separator}${maxKey}`;\n      }\n    }\n  }\n\n  // Apply regular count rules\n  for (const [key, rule] of Object.entries(rules)) {\n    if (key !== 'negative' && rule(absCount)) {\n      return `_${key}`;\n    }\n  }\n\n  return \"_other\";\n}\n\n/**\n * Format count value based on configuration\n */\nexport function formatCount(count: number): string | number {\n  return Math.abs(count);\n}\n","import events, { EventSubscription } from \"@mongez/events\";\r\nimport { LocaleCodeChangeCallback, LocalizationEventName } from \"./types\";\r\n\r\nconst BASE_LOCALIZATION_CHANGE_EVENT = \"localization.change\";\r\n\r\nexport const localizationEvents = {\r\n  triggerChange(\r\n    eventName: LocalizationEventName,\r\n    newLocaleCode: string,\r\n    oldLocaleCode: string,\r\n  ): void {\r\n    events.trigger(\r\n      BASE_LOCALIZATION_CHANGE_EVENT + \".\" + eventName,\r\n      newLocaleCode,\r\n      oldLocaleCode,\r\n    );\r\n  },\r\n  onChange(\r\n    eventName: LocalizationEventName,\r\n    callback: LocaleCodeChangeCallback,\r\n  ): EventSubscription {\r\n    return events.subscribe(\r\n      BASE_LOCALIZATION_CHANGE_EVENT + \".\" + eventName,\r\n      callback,\r\n    );\r\n  },\r\n};\r\n","import { flatten, get, merge, set } from \"@mongez/reinforcements\";\r\nimport { getLocalizationConfigurations } from \"./config\";\r\nimport { plainConverter } from \"./converters\";\r\nimport { formatCount, getCountKey } from \"./count-rules\";\r\nimport { localizationEvents } from \"./events\";\r\nimport { getPlaceholderPattern } from \"./placeholder-pattern-config\";\r\nimport {\r\n  Converter,\r\n  GroupedTranslations,\r\n  Keywords,\r\n  Translatable,\r\n  TranslationsList,\r\n} from \"./types\";\r\n\r\n/**\r\n * Current locale code\r\n */\r\nlet currentLocaleCode: string = \"en\";\r\n\r\n/**\r\n * Current converter\r\n */\r\nlet currentConverter: Converter = plainConverter;\r\n\r\n/**\r\n * all keywords for all locale codes\r\n */\r\nlet translationsList: TranslationsList = {};\r\n\r\n/**\r\n * Current fall back locale code\r\n */\r\nlet fallbackLocaleCode: string = \"en\";\r\n\r\n/**\r\n * Get current locale code\r\n */\r\nexport function getCurrentLocaleCode() {\r\n  return currentLocaleCode;\r\n}\r\n\r\n/**\r\n * Get fallback locale code\r\n */\r\nexport function getFallbackLocaleCode() {\r\n  return fallbackLocaleCode;\r\n}\r\n\r\n/**\r\n * Set current converter\r\n */\r\nexport function setConverter(converter: Converter) {\r\n  currentConverter = converter;\r\n}\r\n\r\n/**\r\n * Get the locale code used in translation, this allows to get the locale code on the fly\r\n */\r\nexport function getTranslationLocaleCode(): string {\r\n  const config = getLocalizationConfigurations();\r\n  // Prefer the correctly-spelled key; fall back to the legacy misspelling for backward compat.\r\n  return (\r\n    config.translationLocaleCode ||\r\n    config.translationLocalCode ||\r\n    currentLocaleCode\r\n  );\r\n}\r\n\r\n/**\r\n * Set current locale code\r\n */\r\nexport function setCurrentLocaleCode(localeCode: string): void {\r\n  const oldLocaleCode = currentLocaleCode;\r\n  currentLocaleCode = localeCode;\r\n  localizationEvents.triggerChange(\"localeCode\", localeCode, oldLocaleCode);\r\n}\r\n\r\n/**\r\n * Add keywords\r\n */\r\nexport function extend(localeCode: string, keywords: Keywords) {\r\n  translationsList[localeCode] = merge(\r\n    translationsList[localeCode] || {},\r\n    keywords,\r\n  ) as Keywords;\r\n}\r\n\r\n/**\r\n * Create a grouped translations based on keyword, each keyword contains list of locale codes and beside it its corresponding translation\r\n *\r\n * @example\r\n * {\r\n *  home: {\r\n *    en: \"Home\",\r\n *    ar: \"الرئيسية\"\r\n *  }\r\n * }\r\n *\r\n * Also it could have nested grouped translations\r\n *\r\n * @example\r\n * {\r\n *  general: {\r\n *    home: {\r\n *      en: \"Home\",\r\n *      ar: \"الرئيسية\"\r\n *    }\r\n *  }\r\n */\r\nexport function groupedTranslations(\r\n  groupKey?: string | GroupedTranslations,\r\n  groupedTranslations?: GroupedTranslations,\r\n): void {\r\n  if (typeof groupKey !== \"string\" && !groupedTranslations) {\r\n    groupedTranslations = groupKey;\r\n    groupKey = undefined;\r\n  }\r\n\r\n  // now we need to loop over the grouped translations\r\n  // we have two cases here\r\n  // first one we have a group key\r\n  // second one we don't have a group key\r\n  // as values are always objects until the last level\r\n  // we need to create a recursive function to loop over the object\r\n\r\n  // output of the flatten object will be something like:\r\n  // general.home.en: \"Home\"\r\n  // general.home.ar: \"الرئيسية\"\r\n  const object = flatten(\r\n    groupKey && typeof groupKey === \"string\"\r\n      ? { [groupKey]: groupedTranslations }\r\n      : groupedTranslations,\r\n  );\r\n\r\n  // now the locale codes are the last dot in each key\r\n  // now we will loop over the object and add each key to the translations list\r\n  for (const key in object) {\r\n    const keyword = key.split(\".\");\r\n    const localeCode = keyword.pop();\r\n\r\n    set(translationsList, localeCode + \".\" + keyword.join(\".\"), object[key]);\r\n  }\r\n}\r\n\r\n/**\r\n * Override the entire translations list\r\n */\r\nexport function setTranslationsList(translations: TranslationsList): void {\r\n  translationsList = translations;\r\n}\r\n\r\n/**\r\n * Get the entire translations list\r\n */\r\nexport function getTranslationsList(): TranslationsList {\r\n  return translationsList;\r\n}\r\n\r\n/**\r\n * Get the keywords list of the given locale code\r\n */\r\nexport function getKeywordsListOf(localeCode: string): Keywords | null {\r\n  return translationsList[localeCode] || null;\r\n}\r\n\r\n/**\r\n * Set fallback locale code, if the keyword does not exist on current locale code,\r\n * then check it in the faLLBACK locale code instead\r\n */\r\nexport function setFallbackLocaleCode(fallbackLocale: string) {\r\n  const oldFallback = fallbackLocaleCode;\r\n\r\n  fallbackLocaleCode = fallbackLocale;\r\n  localizationEvents.triggerChange(\"fallback\", fallbackLocale, oldFallback);\r\n}\r\n\r\n/**\r\n * Translate the given keyword in current locale code\r\n */\r\nexport function trans(\r\n  keyword: Translatable,\r\n  placeholders?: any,\r\n  converter: Converter = currentConverter,\r\n) {\r\n  return transFrom(\r\n    getTranslationLocaleCode(),\r\n    keyword,\r\n    placeholders,\r\n    converter,\r\n  );\r\n}\r\n\r\n/**\r\n * Translate using the default converter\r\n */\r\nexport function plainTrans(keyword: string, placeholders?: any) {\r\n  return transFrom(\r\n    getTranslationLocaleCode(),\r\n    keyword,\r\n    placeholders,\r\n    plainConverter,\r\n  );\r\n}\r\n\r\n/**\r\n * Translate the given keyword for the given locale code\r\n * Please note this method accepts dot notation syntax\r\n */\r\nexport function transFrom(\r\n  localeCode: string,\r\n  keyword: Translatable,\r\n  placeholders?: any,\r\n  converter = currentConverter,\r\n) {\r\n  let translation;\r\n  if (typeof keyword === \"object\") {\r\n    translation = keyword[localeCode] || keyword[fallbackLocaleCode];\r\n  } else {\r\n    // Check if we have a count in placeholders\r\n    if (placeholders?.count !== undefined) {\r\n      const count = Number(placeholders.count);\r\n      \r\n      // Try current locale with its count rules\r\n      const currentCountKey = getCountKey(count, localeCode);\r\n      translation = get(translationsList, `${localeCode}.${keyword}${currentCountKey}`);\r\n      \r\n      // If not found and we have a fallback, try the fallback locale with its own count rules\r\n      if (!translation && fallbackLocaleCode) {\r\n        const fallbackCountKey = getCountKey(count, fallbackLocaleCode);\r\n        translation = get(translationsList, `${fallbackLocaleCode}.${keyword}${fallbackCountKey}`);\r\n      }\r\n      \r\n      // If still not found, try other variants in order:\r\n      // 1. Current locale _other\r\n      // 2. Fallback locale _other\r\n      // 3. Current locale base\r\n      // 4. Fallback locale base\r\n      if (!translation) {\r\n        translation = get(translationsList, `${localeCode}.${keyword}_other`) ||\r\n          (fallbackLocaleCode && get(translationsList, `${fallbackLocaleCode}.${keyword}_other`)) ||\r\n          get(translationsList, `${localeCode}.${keyword}`) ||\r\n          (fallbackLocaleCode && get(translationsList, `${fallbackLocaleCode}.${keyword}`));\r\n      }\r\n\r\n      // Format the count value according to configuration\r\n      if (translation && placeholders.count !== undefined) {\r\n        placeholders = { ...placeholders, count: formatCount(count) };\r\n      }\r\n    } else {\r\n      // No count, just get regular translation\r\n      translation =\r\n        get(translationsList, `${localeCode}.${keyword}`) ||\r\n        (fallbackLocaleCode\r\n          ? get(translationsList, `${fallbackLocaleCode}.${keyword}`)\r\n          : null);\r\n    }\r\n  }\r\n\r\n  if (!translation) return keyword;\r\n\r\n  return placeholders\r\n    ? converter(translation, placeholders, getPlaceholderPattern())\r\n    : translation;\r\n}\r\n\r\nexport type WithPlaceholder<T> = {\r\n  p: (keyword: keyof T, placeholders?: any) => string;\r\n  plain: (keyword: keyof T, placeholders?: any) => string;\r\n};\r\n\r\n/**\r\n * Get a translation object with automatic translation using object syntax\r\n * Please note this does not support nested objects, only keywords and their translations\r\n * i.e\r\n * const translations = transObject({\r\n *  name: {\r\n *     en: 'name',\r\n *    ar: 'الاسم'\r\n * }\r\n * });\r\n *\r\n * Usage: translations.name // returns the name in current locale code\r\n * If the keyword does not exist on current locale code, then it will check it in the fallback locale code\r\n *\r\n * If keyword is \"p\", then it will return a function that accepts keyword and its placeholders\r\n * If keyword is \"plain\", then the converter used in translation will be the plain converter\r\n */\r\nexport function transObject<T extends Keywords>(translations: T) {\r\n  // use proxy\r\n  return new Proxy(translations as any, {\r\n    get(target, key: string) {\r\n      if (key === \"p\") {\r\n        return function (keyword: keyof T, placeholders?: any) {\r\n          return transFrom(\r\n            currentLocaleCode,\r\n            target[keyword] as Translatable,\r\n            placeholders,\r\n            currentConverter,\r\n          );\r\n        };\r\n      }\r\n\r\n      if (key === \"plain\") {\r\n        return function (keyword: keyof T, placeholders?: any) {\r\n          return transFrom(\r\n            currentLocaleCode,\r\n            target[keyword] as Translatable,\r\n            placeholders,\r\n            plainConverter,\r\n          );\r\n        };\r\n      }\r\n\r\n      if (!target[key]) return transFrom(fallbackLocaleCode, key as string);\r\n\r\n      return transFrom(currentLocaleCode, target[key] as Translatable);\r\n    },\r\n  }) as WithPlaceholder<T> & {\r\n    [key in keyof T]: string;\r\n  };\r\n}\r\n","import { get, merge } from \"@mongez/reinforcements\";\r\nimport {\r\n  placeholderPatterns,\r\n  setPlaceholderPattern,\r\n} from \"./placeholder-pattern-config\";\r\nimport {\r\n  setConverter,\r\n  setCurrentLocaleCode,\r\n  setFallbackLocaleCode,\r\n  setTranslationsList,\r\n} from \"./translator\";\r\nimport { LocalizationConfigurations } from \"./types\";\r\n\r\nlet localesConfig: LocalizationConfigurations = {};\r\n\r\n/**\r\n * Initiate localization configurations\r\n */\r\nexport function setLocalizationConfigurations(\r\n  configurationsList: LocalizationConfigurations,\r\n) {\r\n  localesConfig = merge(localesConfig, configurationsList);\r\n\r\n  if (configurationsList.translations) {\r\n    setTranslationsList(configurationsList.translations);\r\n  }\r\n\r\n  if (configurationsList.converter) {\r\n    setConverter(configurationsList.converter);\r\n  }\r\n\r\n  if (configurationsList.fallback) {\r\n    setFallbackLocaleCode(configurationsList.fallback);\r\n  }\r\n\r\n  if (configurationsList.defaultLocaleCode) {\r\n    setCurrentLocaleCode(configurationsList.defaultLocaleCode);\r\n  }\r\n\r\n  if (configurationsList.placeholderPattern) {\r\n    setPlaceholderPattern(\r\n      typeof configurationsList.placeholderPattern === \"string\"\r\n        ? placeholderPatterns[configurationsList.placeholderPattern]\r\n        : configurationsList.placeholderPattern,\r\n    );\r\n  }\r\n}\r\n\r\n/**\r\n * Get current localization configurations list\r\n */\r\nexport function getLocalizationConfigurations(): LocalizationConfigurations {\r\n  return localesConfig;\r\n}\r\n\r\n/**\r\n * Get single value of the localization configurations list\r\n */\r\nexport function getLocaleConfig(\r\n  key: keyof LocalizationConfigurations,\r\n  defaultValue: any = null,\r\n): any {\r\n  return get(localesConfig, key, defaultValue);\r\n}\r\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,MAAM,0BAAkC;AAGxC,MAAM,gCAAwC;AAE9C,MAAa,sBAAsB;CACjC,OAAO;CACP,aAAa;AACf;AAEA,IAAI,qBAAqB;AAEzB,SAAgB,sBAAsB,SAAiB;CACrD,qBAAqB;AACvB;AAEA,SAAgB,wBAAwB;CACtC,OAAO;AACT;;;;;;;ACZA,SAAgB,eACd,aACA,eAA6B,CAAC,GAC9B,qBAA6B,sBACrB;CACR,OAAO,YAAY,QACjB,qBACC,OAAe,QAAgB;EAC9B,MAAM,QAAQ,aAAa;EAC3B,IAAI,UAAU,QACZ,OAAO;EAGT,OAAO,MAAM,SAAS;CACxB,CACF;AACF;;;;;;;ACjBA,MAAM,oBAAwC;CAC5C,WAAW,MAAc,IAAI;CAC7B,OAAO,MAAc,MAAM;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