Skip to content

Linked messages keys with hyphen ( - ) not working #1538

@s-castagnaro-abaco

Description

@s-castagnaro-abaco

Reporting a bug?

In version v9.3.0, linked messages with keys contains an hyphen the translations not working.

// main.ts
const messages = {
  en: {
    'my-message': {
      the_world: 'the world',
      dio: 'DIO:',
      linked: '@:my-message.dio @:my-message.the_world !!!!'
    }
  }
}
...
app.use(
  createI18n({
    legacy: false,
    locale: 'en',
    messages
  })
)
<script setup lang="ts">
import { useI18n } from 'vue-i18n'

const { t } = useI18n()
</script>

<template>
  <main>
    <div>{{ t(`my-message.linked`) }}</div>
  </main>
</template>

Output:

<div>-message.dio -message.the_world !!!!</div>

Expected behavior

I expected like version v9.2.2 the right translation.

<div>DIO: the world !!!!</div>

Reproduction

https://github.com/s-castagnaro-abaco/test-vue-i18n

System Info

System:
    OS: Windows 10 10.0.22621
    CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
    Memory: 565.09 MB / 15.79 GB
Binaries:
    Node: 16.15.0 - C:\Program Files\nodejs\node.EXE
    npm: 8.5.5 - C:\Program Files\nodejs\npm.CMD
Browsers:
    Edge: Spartan (44.22621.2215.0), Chromium (116.0.1938.54)
    Internet Explorer: 11.0.22621.1
npmPackages:
    @vitejs/plugin-vue: ^4.3.1 => 4.3.4
    @vue/eslint-config-prettier: ^8.0.0 => 8.0.0
    @vue/eslint-config-typescript: ^11.0.3 => 11.0.3
    @vue/test-utils: ^2.4.1 => 2.4.1
    @vue/tsconfig: ^0.4.0 => 0.4.0
    vite: ^4.4.9 => 4.4.9
    vitest: ^0.34.2 => 0.34.4
    vue: ^3.3.4 => 3.3.4
    vue-i18n: ^9.3.0 => 9.3.0
    vue-router: ^4.2.4 => 4.2.4
    vue-tsc: ^1.8.8 => 1.8.10

Screenshot

No response

Additional context

No response

Validations

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type: BugBug or Bug fixes🔨 p3-minor-bugPriority 3: a bug in an edge case that only affects very specific usage

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions