question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Number localization with Custom formatting not working

See original GitHub issue

vue & vue-i18n version

ex: 2.6.12, 8.22.4

I copied this example from the docs and can’t compile it. MyComponent.vue content:

<template>
  <i18n-n :value="100" format="currency">
    <span v-slot:integer="slotProps">{{ slotProps.integer }}</span>
  </i18n-n>
</template>

https://kazupon.github.io/vue-i18n/guide/number.html

Is this a bug or do I miss something?

  Errors compiling template:

  v-slot can only be used on components or <template>.

  1  |  
  2  |  <i18n-n :value="100" format="currency">
  3  |    <span v-slot:integer="slotProps">{{ slotProps.integer }}</span>
     |          ^^^^^^^^^^^^^^^^^^^^^^^^^^
  4  |  </i18n-n>
  5  |  

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:12 (7 by maintainers)

github_iconTop GitHub Comments

2reactions
rchlcommented, Jul 22, 2021

You have to put it inside the vuei18n object within the nuxt-i18n configuration.

1reaction
rchlcommented, Jul 21, 2021

Something like this should be a proper example:

<i18n-n :value="100" format="currency">
    <template #integer="slotProps"><span style="font-weight: bold;">{{ slotProps.integer }}</span></template>
</i18n-n>
Read more comments on GitHub >

github_iconTop Results From Across the Web

Internationalization(Number formatting "num.toLocaleString ...
The toLocaleString() method is by definition implementation-dependent: it uses the implementation locale, such as browser locale.
Read more >
German Localization issue on number format with excel chart
This is working fine when the sheet2 is active. If sheet1 is active where chart is present then this localization is not applying...
Read more >
A Concise Guide to Number Localization | Phrase
NumberFormat object for formatting localized numbers, optionally as currencies or percentages. C'est Fini. We hope you enjoyed this brief guide ...
Read more >
Number.prototype.toLocaleString() - JavaScript | MDN
Using toLocaleString()​​ In basic use without specifying a locale, a formatted string in the default locale and with default options is returned.
Read more >
Localizing number formatting | Looker - Google Cloud
Manage localized number formatting in Looker.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found