We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 7cdeff9 commit 7ce9f43Copy full SHA for 7ce9f43
src/index.ts
@@ -338,7 +338,14 @@ export class I18n {
338
*/
339
wTrans(key: string, replacements: ReplacementsInterface = {}): ComputedRef<string> {
340
if (!this.activeMessages[key]) {
341
- this.activeMessages[key] = key
+ const hasChildItems = this.activeMessages[`${key}.0`] !== undefined;
342
+
343
+ if (hasChildItems) {
344
+ const childItems = Object.entries(this.activeMessages).filter((item) => item[0].startsWith(`${key}.`)).map(item => item[1]);
345
+ this.activeMessages[key] = reactive(childItems);
346
+ } else {
347
+ this.activeMessages[key] = key;
348
+ }
349
}
350
351
return computed(() => this.makeReplacements(this.activeMessages[key], replacements))
0 commit comments