@rotki/ui-library 2.3.0 → 2.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +62 -0
- package/dist/components/index.es.js +2230 -2225
- package/dist/composables/index-DggmQIbL.js +487 -0
- package/dist/composables/index.es.js +1 -1
- package/dist/composables/use-rui-i18n.d.ts +13 -0
- package/dist/i18n/keys-CNGXWOJX.js +19 -0
- package/dist/i18n/keys.d.ts +13 -0
- package/dist/index-B4Z0iEL-.js +53 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.es.js +1707 -1704
- package/dist/style.css +1 -1
- package/dist/utils/{index-CBlHWMiJ.js → index-B__GIRn7.js} +1 -1
- package/dist/{vendor-DcELhvq6.js → vendor-DONK-IZM.js} +1 -1
- package/dist/web-types.json +1 -1
- package/package.json +1 -1
- package/dist/composables/index-BpCfYHMO.js +0 -477
- package/dist/index-ubVTzSrC.js +0 -33
package/README.md
CHANGED
|
@@ -102,6 +102,68 @@ import { RuiIcon } from '@rotki/ui-library';
|
|
|
102
102
|
</template>
|
|
103
103
|
```
|
|
104
104
|
|
|
105
|
+
### Setting up internationalization (i18n)
|
|
106
|
+
|
|
107
|
+
The UI library supports internationalization through the `createRuiI8nPlugin` function. This allows you to provide translations for UI components.
|
|
108
|
+
|
|
109
|
+
#### Setting up the i18n plugin
|
|
110
|
+
|
|
111
|
+
First, you need to set up your Vue i18n instance and then connect it to the UI library:
|
|
112
|
+
|
|
113
|
+
```typescript
|
|
114
|
+
import { createRui, createRuiI8nPlugin } from '@rotki/ui-library';
|
|
115
|
+
import { createApp } from 'vue';
|
|
116
|
+
import { createI18n } from 'vue-i18n';
|
|
117
|
+
|
|
118
|
+
// Create your i18n instance
|
|
119
|
+
const i18n = createI18n({
|
|
120
|
+
legacy: false, // You must set `false`, to use Composition API
|
|
121
|
+
locale: 'en',
|
|
122
|
+
messages: {
|
|
123
|
+
en: {
|
|
124
|
+
// Your app translations
|
|
125
|
+
// UI library translations (see below)
|
|
126
|
+
rui: {
|
|
127
|
+
date_time_picker: {
|
|
128
|
+
date_after_max: 'Date cannot be after {date}',
|
|
129
|
+
date_before_min: 'Date cannot be before {date}',
|
|
130
|
+
date_in_future: 'The selected date cannot be in the future',
|
|
131
|
+
},
|
|
132
|
+
},
|
|
133
|
+
},
|
|
134
|
+
// Other languages...
|
|
135
|
+
},
|
|
136
|
+
});
|
|
137
|
+
|
|
138
|
+
const app = createApp(App);
|
|
139
|
+
|
|
140
|
+
// Create and use the Rotki UI plugin
|
|
141
|
+
const RuiPlugin = createRui();
|
|
142
|
+
app.use(RuiPlugin);
|
|
143
|
+
|
|
144
|
+
// Create and use the Rotki UI i18n plugin
|
|
145
|
+
const RuiI18nPlugin = createRuiI8nPlugin(i18n);
|
|
146
|
+
app.use(RuiI18nPlugin);
|
|
147
|
+
|
|
148
|
+
app.use(i18n);
|
|
149
|
+
app.mount('#app');
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
#### Available translation keys
|
|
153
|
+
|
|
154
|
+
The UI library uses the following translation keys:
|
|
155
|
+
|
|
156
|
+
```typescript
|
|
157
|
+
// These are defined in src/i18n/keys.ts
|
|
158
|
+
export const RUI_I18N_KEYS = {
|
|
159
|
+
dateTimePicker: {
|
|
160
|
+
dateAfterMax: 'rui.date_time_picker.date_after_max',
|
|
161
|
+
dateBeforeMin: 'rui.date_time_picker.date_before_min',
|
|
162
|
+
dateInFuture: 'rui.date_time_picker.date_in_future',
|
|
163
|
+
},
|
|
164
|
+
} as const;
|
|
165
|
+
```
|
|
166
|
+
|
|
105
167
|
### Use @rotki/ui-library tailwindcss theme
|
|
106
168
|
|
|
107
169
|
You can extend @rotki/ui-library tailwind theme configuration by adding these to your tailwind config. It will provide you the classes for the colors, typography, and shadow.
|