Skip to content

Composition API n() lacks support for args as in $n(value, key, args) #2195

Open
@opack

Description

@opack

Reporting a bug?

Hi!

I discovered that the injected overload [$n(value, key, args)]($n(value, key, args)) does not exist when using the composition API n().

Thus, there is no way to use a key and override some parameters. I.e., I want to use a currency key and in some contexts force the display of the sign, but while I can write $n(amount, 'currency', { signDisplay: 'always' }), I cannot write the same with n. The only workaround that I found is to create another key just for that, which will copy ALL the options except one; and I will have to do that also for signDisplay: 'never', as I need it too in only 2 places... 😢

Expected behavior

Being able to write n(value, key, args).

Reproduction

Try to write n(10, 'currency', { signDisplay: 'always' }) for example.

System Info

System:
    OS: Windows 11 10.0.26100
    CPU: (12) x64 12th Gen Intel(R) Core(TM) i5-12400F
    Memory: 14.79 GB / 31.82 GB
  Binaries:
    Node: 20.11.0 - C:\progz\dev\nodejs\node.EXE
    npm: 10.8.2 - C:\progz\dev\nodejs\npm.CMD
  Browsers:
    Edge: Chromium (131.0.2903.63)
    Internet Explorer: 11.0.26100.1882
  npmPackages:
    @intlify/eslint-plugin-vue-i18n: ^4.0.1 => 4.0.1
    @intlify/unplugin-vue-i18n: ^2.0.0 => 2.0.0
    @vue/eslint-config-prettier: ^10.1.0 => 10.1.0
    @vue/eslint-config-typescript: ^14.1.3 => 14.2.0
    vite-plugin-checker: ^0.8.0 => 0.8.0
    vue: ^3.4.18 => 3.5.13
    vue-eslint-parser: ^10.1.3 => 10.1.3
    vue-i18n: ^9.2.2 => 9.14.2
    vue-router: ^4.0.12 => 4.5.0
    vue-tsc: ^2.0.29 => 2.1.10

Screenshot

No response

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