Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

fix(web): load Arabic and Lao date locales (#45571)

0718lol9dd42b024e0e
diff --git a/web/utils/format.spec.ts b/web/utils/format.spec.ts
index b5edaa18f14..d3ddd370cc4 100644
--- a/web/utils/format.spec.ts
+++ b/web/utils/format.spec.ts
@@ -1,4 +1,11 @@
-import { formatFileSize, formatNumber, formatNumberAbbreviated, formatTime } from './format'
+import dayjs from 'dayjs'
+import {
+ formatFileSize,
+ formatNumber,
+ formatNumberAbbreviated,
+ formatTime,
+ formatToLocalTime,
+} from './format'
describe('formatNumber', () => {
it.each([
@@ -48,3 +55,13 @@ describe('formatNumberAbbreviated', () => {
expect(formatNumberAbbreviated(input)).toBe(expected)
})
})
+
+describe('formatToLocalTime', () => {
+ it.each([
+ ['ar-TN', 'يناير'],
+ ['lo-LA', 'ມັງກອນ'],
+ ['en-US', 'January'],
+ ] as const)('formats month names in %s', (locale, expectedMonth) => {
+ expect(formatToLocalTime(dayjs('2026-01-15'), locale, 'MMMM')).toBe(expectedMonth)
+ })
+})
diff --git a/web/utils/format.ts b/web/utils/format.ts
index a53c29f0b40..208aa4a2551 100644
--- a/web/utils/format.ts
+++ b/web/utils/format.ts
@@ -1,6 +1,7 @@
import type { Dayjs } from 'dayjs'
import type { Locale } from '@/i18n'
import { localeMap } from '@/i18n/language'
+import 'dayjs/locale/ar'
import 'dayjs/locale/az'
import 'dayjs/locale/de'
import 'dayjs/locale/es'
@@ -12,6 +13,7 @@ import 'dayjs/locale/it'
import 'dayjs/locale/nl'
import 'dayjs/locale/ja'
import 'dayjs/locale/ko'
+import 'dayjs/locale/lo'
import 'dayjs/locale/pl'
import 'dayjs/locale/pt-br'
import 'dayjs/locale/ro'