nuxt / ui

A UI Library for Modern Web Apps, powered by Vue & Tailwind CSS.
https://ui.nuxt.com
MIT License
4.03k stars 509 forks source link

i18n for string literals #2512

Open hywax opened 3 days ago

hywax commented 3 days ago

For what version of Nuxt UI are you suggesting this?

v3-alpha

Description

Add a lang prop for the UApp component that will accept a string with the locale code.

Adding the i18n integration I think will be overkill (@benjamincanac, what do you think?).

Additional context

Example:

benjamincanac commented 3 days ago

What would this lang prop do? 🤔

hywax commented 3 days ago

The simplest example, literals are hardcode into InputMenu.vue#L340 and there are lines like this all over the ui.

Prop lang would accept a locale for example: en (default), ru, es, de. Somewhere a directory with all the locales would be stored and based on the prop UApp we would change the literals

upd: Passing an object with all values inside lang is one option. Example https://github.com/element-plus/element-plus/blob/dev/packages/locale/lang/en.ts