Skip to content

feat(i18n): add browser locale support for formatting#1727

Draft
userquin wants to merge 5 commits intomainfrom
userquin/feat-add-browser-locale-support
Draft

feat(i18n): add browser locale support for formatting#1727
userquin wants to merge 5 commits intomainfrom
userquin/feat-add-browser-locale-support

Conversation

@userquin
Copy link
Member

@userquin userquin commented Feb 27, 2026

🔗 Linked issue

🧭 Context

Add support for browser locale formatting via new setting for:

  • dates
  • datetimes
  • sizes
  • numbers

📚 Description

This PR adds a new composable (useUserLocale) to use the new setting useSystemLocaleForFormatting (false by default, current behavior) or the app locale.

This will allow use correct formatting for country variants locales where we use the generic one (ar-EG or es-419): date, datetime, size or numbers can vary (decimal separator, thousand separator, date formats can change some style => es-CO and es-ES dates with short style for example)

TODO:

  • delete unused package.size.b , package.size.k and package.size.m
  • review a lot of vue and ts files
  • remove svg ltr hack at app/components/Package/WeeklyDownloadStats.vue: we need to check VueUi RTL support (flex-start)
  • fix tests

@vercel
Copy link

vercel bot commented Feb 27, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
npmx.dev Ready Ready Preview, Comment Feb 28, 2026 9:08pm
2 Skipped Deployments
Project Deployment Actions Updated (UTC)
docs.npmx.dev Ignored Ignored Preview Feb 28, 2026 9:08pm
npmx-lunaria Ignored Ignored Feb 28, 2026 9:08pm

Request Review

@github-actions
Copy link

github-actions bot commented Feb 27, 2026

Lunaria Status Overview

🌕 This pull request will trigger status changes.

Learn more

By default, every PR changing files present in the Lunaria configuration's files property will be considered and trigger status changes accordingly.

You can change this by adding one of the keywords present in the ignoreKeywords property in your Lunaria configuration file in the PR's title (ignoring all files) or by including a tracker directive in the merged commit's description.

Tracked Files

File Note
lunaria/files/en-GB.json Localization changed, will be marked as complete. 🔄️
lunaria/files/en-US.json Source changed, localizations will be marked as outdated.
Warnings reference
Icon Description
🔄️ The source for this localization has been updated since the creation of this pull request, make sure all changes in the source have been applied.

@codecov
Copy link

codecov bot commented Feb 27, 2026

❌ 3 Tests Failed:

Tests completed Failed Passed Skipped
2003 3 2000 6
View the top 3 failed test(s) by shortest run time
test/unit/app/composables/use-number-formatter.spec.ts > useBytesFormatter > formats MB values using decimal base (1000 * 1000)
Stack Traces | 0.000351s run time
ReferenceError: useUserLocale is not defined
 ❯ useBytesFormatter app/composables/useNumberFormatter.ts:23:26
 ❯ .../app/composables/use-number-formatter.spec.ts:41:24
 ❯ node_modules/.pnpm/@[email protected]_@[email protected]_@ty_834e93e50ef9b757035e9a2ea4a7a65a/node_modules/@voidzero-dev/vite-plus-test/dist/@vitest/runner/index.js:145:14
 ❯ node_modules/.pnpm/@[email protected]_@[email protected]_@ty_834e93e50ef9b757035e9a2ea4a7a65a/node_modules/@voidzero-dev/vite-plus-test/dist/@vitest/runner/index.js:915:28
 ❯ node_modules/.pnpm/@[email protected]_@[email protected]_@ty_834e93e50ef9b757035e9a2ea4a7a65a/node_modules/@voidzero-dev/vite-plus-test/dist/@vitest/runner/index.js:1243:24
 ❯ runWithTimeout node_modules/.pnpm/@[email protected]_@[email protected]_@ty_834e93e50ef9b757035e9a2ea4a7a65a/node_modules/@voidzero-dev/vite-plus-test/dist/@vitest/runner/index.js:1209:12
 ❯ node_modules/.pnpm/@[email protected]_@[email protected]_@ty_834e93e50ef9b757035e9a2ea4a7a65a/node_modules/@voidzero-dev/vite-plus-test/dist/@vitest/runner/index.js:1653:42
 ❯ Traces.$ node_modules/.pnpm/@[email protected]_@[email protected]_@ty_834e93e50ef9b757035e9a2ea4a7a65a/node_modules/@.../dist/chunks/traces.CCmnQaNT.js:142:29
 ❯ trace node_modules/.pnpm/@[email protected]_@[email protected]_@ty_834e93e50ef9b757035e9a2ea4a7a65a/node_modules/@.../dist/chunks/test.B8ej_ZHS.js:239:23
test/unit/app/composables/use-number-formatter.spec.ts > useBytesFormatter > formats kB values using decimal base (1000)
Stack Traces | 0.000557s run time
ReferenceError: useUserLocale is not defined
 ❯ useBytesFormatter app/composables/useNumberFormatter.ts:23:26
 ❯ .../app/composables/use-number-formatter.spec.ts:34:24
 ❯ node_modules/.pnpm/@[email protected]_@[email protected]_@ty_834e93e50ef9b757035e9a2ea4a7a65a/node_modules/@voidzero-dev/vite-plus-test/dist/@vitest/runner/index.js:145:14
 ❯ node_modules/.pnpm/@[email protected]_@[email protected]_@ty_834e93e50ef9b757035e9a2ea4a7a65a/node_modules/@voidzero-dev/vite-plus-test/dist/@vitest/runner/index.js:915:28
 ❯ node_modules/.pnpm/@[email protected]_@[email protected]_@ty_834e93e50ef9b757035e9a2ea4a7a65a/node_modules/@voidzero-dev/vite-plus-test/dist/@vitest/runner/index.js:1243:24
 ❯ runWithTimeout node_modules/.pnpm/@[email protected]_@[email protected]_@ty_834e93e50ef9b757035e9a2ea4a7a65a/node_modules/@voidzero-dev/vite-plus-test/dist/@vitest/runner/index.js:1209:12
 ❯ node_modules/.pnpm/@[email protected]_@[email protected]_@ty_834e93e50ef9b757035e9a2ea4a7a65a/node_modules/@voidzero-dev/vite-plus-test/dist/@vitest/runner/index.js:1653:42
 ❯ Traces.$ node_modules/.pnpm/@[email protected]_@[email protected]_@ty_834e93e50ef9b757035e9a2ea4a7a65a/node_modules/@.../dist/chunks/traces.CCmnQaNT.js:142:29
 ❯ trace node_modules/.pnpm/@[email protected]_@[email protected]_@ty_834e93e50ef9b757035e9a2ea4a7a65a/node_modules/@.../dist/chunks/test.B8ej_ZHS.js:239:23
test/unit/app/composables/use-number-formatter.spec.ts > useBytesFormatter > formats values below 1 kB in bytes
Stack Traces | 0.00432s run time
ReferenceError: useUserLocale is not defined
 ❯ useBytesFormatter app/composables/useNumberFormatter.ts:23:26
 ❯ .../app/composables/use-number-formatter.spec.ts:27:24
 ❯ node_modules/.pnpm/@[email protected]_@[email protected]_@ty_834e93e50ef9b757035e9a2ea4a7a65a/node_modules/@voidzero-dev/vite-plus-test/dist/@vitest/runner/index.js:145:14
 ❯ node_modules/.pnpm/@[email protected]_@[email protected]_@ty_834e93e50ef9b757035e9a2ea4a7a65a/node_modules/@voidzero-dev/vite-plus-test/dist/@vitest/runner/index.js:915:28
 ❯ node_modules/.pnpm/@[email protected]_@[email protected]_@ty_834e93e50ef9b757035e9a2ea4a7a65a/node_modules/@voidzero-dev/vite-plus-test/dist/@vitest/runner/index.js:1243:24
 ❯ runWithTimeout node_modules/.pnpm/@[email protected]_@[email protected]_@ty_834e93e50ef9b757035e9a2ea4a7a65a/node_modules/@voidzero-dev/vite-plus-test/dist/@vitest/runner/index.js:1209:12
 ❯ node_modules/.pnpm/@[email protected]_@[email protected]_@ty_834e93e50ef9b757035e9a2ea4a7a65a/node_modules/@voidzero-dev/vite-plus-test/dist/@vitest/runner/index.js:1653:42
 ❯ Traces.$ node_modules/.pnpm/@[email protected]_@[email protected]_@ty_834e93e50ef9b757035e9a2ea4a7a65a/node_modules/@.../dist/chunks/traces.CCmnQaNT.js:142:29
 ❯ trace node_modules/.pnpm/@[email protected]_@[email protected]_@ty_834e93e50ef9b757035e9a2ea4a7a65a/node_modules/@.../dist/chunks/test.B8ej_ZHS.js:239:23

To view more test analytics, go to the Test Analytics Dashboard
📋 Got 3 mins? Take this short survey to help us improve Test Analytics.

const { currentLocaleStatus, isSourceLocale } = useI18nStatus()
const keyboardShortcutsEnabled = useKeyboardShortcuts()

const rtl = new Map<string, boolean>(locales.value.map(l => [l.code, l.dir === 'rtl']))
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't remove this, maybe we'll need it

Override not necessary after vue-data-ui's bump to 3.15.9 (#1740)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants