Skip to content

Implicit {n} only support Number, and not String #2147

Open
@mrleblanc101

Description

@mrleblanc101

Reporting a bug?

Not sure if this is a bug, or a feature request.

Since $tc has been deprecated, there is very little difference between Message Format Syntax and Plurialization.

In Message Format Syntax, you can use Named interpolation ({count}) and List Interpolation ({0}), but not Implicit Interpolation. Implicit Interpolation ({n}) can only be used with Plurizalization.

Techncally, you can use Implicit Interpolation ({n}) without Plurizalization, but only if n is a Number, not if it's a String.

Input: 
<div>{{ t('Test {n}', 1) }}</div>
Output: "Test 1"
Input: 
<div>{{ t('Test {n}', "1") }}</div> 
Output: "1"

Maybe there is a good reason for it, and I don't see it, or maybe Message Format could be made to support Implicit Interpolation ({n}) with a String.

Expected behavior

Input: 
<div>{{ t('Test {n}', "1") }}</div> 
Output: "Test 1"

Reproduction

https://stackblitz.com/edit/vitejs-vite-saeaemxg?file=src%2FApp.vue

System Info

System:
    OS: macOS 15.3.1
    CPU: (8) arm64 Apple M1 Pro
    Memory: 72.06 MB / 32.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 20.18.0 - ~/.nvm/versions/node/v20.18.0/bin/node
    npm: 10.8.2 - ~/.nvm/versions/node/v20.18.0/bin/npm
  Browsers:
    Chrome: 134.0.6998.166
    Chrome Canary: 136.0.7093.0
    Edge: 134.0.3124.85
    Safari: 18.3
    Safari Technology Preview: 18.4
  npmPackages:
    vue: latest => 3.5.13

Screenshot

Image

Additional context

No response

Validations

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions