mirror of
				https://github.com/mealie-recipes/mealie.git
				synced 2025-10-31 02:03:35 -04:00 
			
		
		
		
	fix: Missing Locale Dates (#6116)
This commit is contained in:
		| @@ -173,9 +173,25 @@ the code generation ID is hardcoded into the script and required in the nuxt con | |||||||
|  |  | ||||||
|  |  | ||||||
| def inject_nuxt_values(): | def inject_nuxt_values(): | ||||||
|     all_date_locales = [ |     datetime_files = list(datetime_dir.glob("*.json")) | ||||||
|         f'"{match.stem}": () => import("./lang/dateTimeFormats/{match.name}"),' for match in datetime_dir.glob("*.json") |     datetime_files.sort() | ||||||
|     ] |  | ||||||
|  |     datetime_imports = [] | ||||||
|  |     datetime_object_entries = [] | ||||||
|  |  | ||||||
|  |     for match in datetime_files: | ||||||
|  |         # Convert locale name to camelCase variable name (e.g., "en-US" -> "enUS") | ||||||
|  |         var_name = match.stem.replace("-", "") | ||||||
|  |  | ||||||
|  |         # Generate import statement | ||||||
|  |         import_line = f'import * as {var_name} from "./lang/dateTimeFormats/{match.name}";' | ||||||
|  |         datetime_imports.append(import_line) | ||||||
|  |  | ||||||
|  |         # Generate object entry | ||||||
|  |         object_entry = f'  "{match.stem}": {var_name},' | ||||||
|  |         datetime_object_entries.append(object_entry) | ||||||
|  |  | ||||||
|  |     all_date_locales = datetime_imports + ["", "const datetimeFormats = {"] + datetime_object_entries + ["};"] | ||||||
|  |  | ||||||
|     all_langs = [] |     all_langs = [] | ||||||
|     for match in locales_dir.glob("*.json"): |     for match in locales_dir.glob("*.json"): | ||||||
| @@ -186,7 +202,6 @@ def inject_nuxt_values(): | |||||||
|         all_langs.append(lang_string) |         all_langs.append(lang_string) | ||||||
|  |  | ||||||
|     all_langs.sort() |     all_langs.sort() | ||||||
|     all_date_locales.sort() |  | ||||||
|  |  | ||||||
|     log.debug(f"injecting locales into nuxt config -> {nuxt_config}") |     log.debug(f"injecting locales into nuxt config -> {nuxt_config}") | ||||||
|     inject_inline(nuxt_config, CodeKeys.nuxt_local_messages, all_langs) |     inject_inline(nuxt_config, CodeKeys.nuxt_local_messages, all_langs) | ||||||
|   | |||||||
| @@ -1,56 +1,99 @@ | |||||||
| const datetimeFormats = { |  | ||||||
| // CODE_GEN_ID: DATE_LOCALES | // CODE_GEN_ID: DATE_LOCALES | ||||||
|   "af-ZA": () => import("./lang/dateTimeFormats/af-ZA.json"), | import * as afZA from "./lang/dateTimeFormats/af-ZA.json"; | ||||||
|   "ar-SA": () => import("./lang/dateTimeFormats/ar-SA.json"), | import * as arSA from "./lang/dateTimeFormats/ar-SA.json"; | ||||||
|   "bg-BG": () => import("./lang/dateTimeFormats/bg-BG.json"), | import * as bgBG from "./lang/dateTimeFormats/bg-BG.json"; | ||||||
|   "ca-ES": () => import("./lang/dateTimeFormats/ca-ES.json"), | import * as caES from "./lang/dateTimeFormats/ca-ES.json"; | ||||||
|   "cs-CZ": () => import("./lang/dateTimeFormats/cs-CZ.json"), | import * as csCZ from "./lang/dateTimeFormats/cs-CZ.json"; | ||||||
|   "da-DK": () => import("./lang/dateTimeFormats/da-DK.json"), | import * as daDK from "./lang/dateTimeFormats/da-DK.json"; | ||||||
|   "de-DE": () => import("./lang/dateTimeFormats/de-DE.json"), | import * as deDE from "./lang/dateTimeFormats/de-DE.json"; | ||||||
|   "el-GR": () => import("./lang/dateTimeFormats/el-GR.json"), | import * as elGR from "./lang/dateTimeFormats/el-GR.json"; | ||||||
|   "en-GB": () => import("./lang/dateTimeFormats/en-GB.json"), | import * as enGB from "./lang/dateTimeFormats/en-GB.json"; | ||||||
|   "en-US": () => import("./lang/dateTimeFormats/en-US.json"), | import * as enUS from "./lang/dateTimeFormats/en-US.json"; | ||||||
|   "es-ES": () => import("./lang/dateTimeFormats/es-ES.json"), | import * as esES from "./lang/dateTimeFormats/es-ES.json"; | ||||||
|   "et-EE": () => import("./lang/dateTimeFormats/et-EE.json"), | import * as etEE from "./lang/dateTimeFormats/et-EE.json"; | ||||||
|   "fi-FI": () => import("./lang/dateTimeFormats/fi-FI.json"), | import * as fiFI from "./lang/dateTimeFormats/fi-FI.json"; | ||||||
|   "fr-BE": () => import("./lang/dateTimeFormats/fr-BE.json"), | import * as frBE from "./lang/dateTimeFormats/fr-BE.json"; | ||||||
|   "fr-CA": () => import("./lang/dateTimeFormats/fr-CA.json"), | import * as frCA from "./lang/dateTimeFormats/fr-CA.json"; | ||||||
|   "fr-FR": () => import("./lang/dateTimeFormats/fr-FR.json"), | import * as frFR from "./lang/dateTimeFormats/fr-FR.json"; | ||||||
|   "gl-ES": () => import("./lang/dateTimeFormats/gl-ES.json"), | import * as glES from "./lang/dateTimeFormats/gl-ES.json"; | ||||||
|   "he-IL": () => import("./lang/dateTimeFormats/he-IL.json"), | import * as heIL from "./lang/dateTimeFormats/he-IL.json"; | ||||||
|   "hr-HR": () => import("./lang/dateTimeFormats/hr-HR.json"), | import * as hrHR from "./lang/dateTimeFormats/hr-HR.json"; | ||||||
|   "hu-HU": () => import("./lang/dateTimeFormats/hu-HU.json"), | import * as huHU from "./lang/dateTimeFormats/hu-HU.json"; | ||||||
|   "is-IS": () => import("./lang/dateTimeFormats/is-IS.json"), | import * as isIS from "./lang/dateTimeFormats/is-IS.json"; | ||||||
|   "it-IT": () => import("./lang/dateTimeFormats/it-IT.json"), | import * as itIT from "./lang/dateTimeFormats/it-IT.json"; | ||||||
|   "ja-JP": () => import("./lang/dateTimeFormats/ja-JP.json"), | import * as jaJP from "./lang/dateTimeFormats/ja-JP.json"; | ||||||
|   "ko-KR": () => import("./lang/dateTimeFormats/ko-KR.json"), | import * as koKR from "./lang/dateTimeFormats/ko-KR.json"; | ||||||
|   "lt-LT": () => import("./lang/dateTimeFormats/lt-LT.json"), | import * as ltLT from "./lang/dateTimeFormats/lt-LT.json"; | ||||||
|   "lv-LV": () => import("./lang/dateTimeFormats/lv-LV.json"), | import * as lvLV from "./lang/dateTimeFormats/lv-LV.json"; | ||||||
|   "nl-NL": () => import("./lang/dateTimeFormats/nl-NL.json"), | import * as nlNL from "./lang/dateTimeFormats/nl-NL.json"; | ||||||
|   "no-NO": () => import("./lang/dateTimeFormats/no-NO.json"), | import * as noNO from "./lang/dateTimeFormats/no-NO.json"; | ||||||
|   "pl-PL": () => import("./lang/dateTimeFormats/pl-PL.json"), | import * as plPL from "./lang/dateTimeFormats/pl-PL.json"; | ||||||
|   "pt-BR": () => import("./lang/dateTimeFormats/pt-BR.json"), | import * as ptBR from "./lang/dateTimeFormats/pt-BR.json"; | ||||||
|   "pt-PT": () => import("./lang/dateTimeFormats/pt-PT.json"), | import * as ptPT from "./lang/dateTimeFormats/pt-PT.json"; | ||||||
|   "ro-RO": () => import("./lang/dateTimeFormats/ro-RO.json"), | import * as roRO from "./lang/dateTimeFormats/ro-RO.json"; | ||||||
|   "ru-RU": () => import("./lang/dateTimeFormats/ru-RU.json"), | import * as ruRU from "./lang/dateTimeFormats/ru-RU.json"; | ||||||
|   "sk-SK": () => import("./lang/dateTimeFormats/sk-SK.json"), | import * as skSK from "./lang/dateTimeFormats/sk-SK.json"; | ||||||
|   "sl-SI": () => import("./lang/dateTimeFormats/sl-SI.json"), | import * as slSI from "./lang/dateTimeFormats/sl-SI.json"; | ||||||
|   "sr-SP": () => import("./lang/dateTimeFormats/sr-SP.json"), | import * as srSP from "./lang/dateTimeFormats/sr-SP.json"; | ||||||
|   "sv-SE": () => import("./lang/dateTimeFormats/sv-SE.json"), | import * as svSE from "./lang/dateTimeFormats/sv-SE.json"; | ||||||
|   "tr-TR": () => import("./lang/dateTimeFormats/tr-TR.json"), | import * as trTR from "./lang/dateTimeFormats/tr-TR.json"; | ||||||
|   "uk-UA": () => import("./lang/dateTimeFormats/uk-UA.json"), | import * as ukUA from "./lang/dateTimeFormats/uk-UA.json"; | ||||||
|   "vi-VN": () => import("./lang/dateTimeFormats/vi-VN.json"), | import * as viVN from "./lang/dateTimeFormats/vi-VN.json"; | ||||||
|   "zh-CN": () => import("./lang/dateTimeFormats/zh-CN.json"), | import * as zhCN from "./lang/dateTimeFormats/zh-CN.json"; | ||||||
|   "zh-TW": () => import("./lang/dateTimeFormats/zh-TW.json"), | import * as zhTW from "./lang/dateTimeFormats/zh-TW.json"; | ||||||
|   // END: DATE_LOCALES |  | ||||||
|  | const datetimeFormats = { | ||||||
|  |   "af-ZA": afZA, | ||||||
|  |   "ar-SA": arSA, | ||||||
|  |   "bg-BG": bgBG, | ||||||
|  |   "ca-ES": caES, | ||||||
|  |   "cs-CZ": csCZ, | ||||||
|  |   "da-DK": daDK, | ||||||
|  |   "de-DE": deDE, | ||||||
|  |   "el-GR": elGR, | ||||||
|  |   "en-GB": enGB, | ||||||
|  |   "en-US": enUS, | ||||||
|  |   "es-ES": esES, | ||||||
|  |   "et-EE": etEE, | ||||||
|  |   "fi-FI": fiFI, | ||||||
|  |   "fr-BE": frBE, | ||||||
|  |   "fr-CA": frCA, | ||||||
|  |   "fr-FR": frFR, | ||||||
|  |   "gl-ES": glES, | ||||||
|  |   "he-IL": heIL, | ||||||
|  |   "hr-HR": hrHR, | ||||||
|  |   "hu-HU": huHU, | ||||||
|  |   "is-IS": isIS, | ||||||
|  |   "it-IT": itIT, | ||||||
|  |   "ja-JP": jaJP, | ||||||
|  |   "ko-KR": koKR, | ||||||
|  |   "lt-LT": ltLT, | ||||||
|  |   "lv-LV": lvLV, | ||||||
|  |   "nl-NL": nlNL, | ||||||
|  |   "no-NO": noNO, | ||||||
|  |   "pl-PL": plPL, | ||||||
|  |   "pt-BR": ptBR, | ||||||
|  |   "pt-PT": ptPT, | ||||||
|  |   "ro-RO": roRO, | ||||||
|  |   "ru-RU": ruRU, | ||||||
|  |   "sk-SK": skSK, | ||||||
|  |   "sl-SI": slSI, | ||||||
|  |   "sr-SP": srSP, | ||||||
|  |   "sv-SE": svSE, | ||||||
|  |   "tr-TR": trTR, | ||||||
|  |   "uk-UA": ukUA, | ||||||
|  |   "vi-VN": viVN, | ||||||
|  |   "zh-CN": zhCN, | ||||||
|  |   "zh-TW": zhTW, | ||||||
| }; | }; | ||||||
|  | // END: DATE_LOCALES | ||||||
|  |  | ||||||
| export default defineI18nConfig(() => { | export default defineI18nConfig(() => { | ||||||
|   return { |   return { | ||||||
|     legacy: false, |     legacy: false, | ||||||
|     locale: "en-US", |     locale: "en-US", | ||||||
|     availableLocales: Object.keys(datetimeFormats), |     availableLocales: Object.keys(datetimeFormats), | ||||||
|     datetimeFormats, |     datetimeFormats: datetimeFormats as any, | ||||||
|     fallbackLocale: "en-US", |     fallbackLocale: "en-US", | ||||||
|     fallbackWarn: true, |     fallbackWarn: true, | ||||||
|   }; |   }; | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user