Vuetify: [Bug Report] $vuetify.t(key,params)

Created on 9 Jul 2018  路  5Comments  路  Source: vuetifyjs/vuetify

Versions and Environment

Vuetify: 1.1.1
Vue: 2.5.16
Browsers: Chrome 67.0.3396.99
OS: Windows 10

Steps to reproduce

  • use vue-i18n module with vuetify like documention (https://vuetifyjs.com/en/framework/internationalization)
  • add new object key to messages
{
    en: {
      $vuetify: {
        dataIterator: {
          rowsPerPageText: "Items per page:"
        }
      },
      other: {
        test: "the test"
      }
    }
  }
  • use $vuetify.t('other.test') in vue template

Expected Behavior

{{ $vuetify.t('other.test') }} must return the translation

Actual Behavior

{{ $vuetify.t('other.test') }} return the key

Reproduction Link

https://codesandbox.io/s/py90q0l9q0

documentation

Most helpful comment

The documentation is wrong, keys must be prefixed with $vuetify

{{ $vuetify.t('$vuetify.other.test') }}

This is so we can dynamically change the locale with prop defaults. $vuetify.t isn't really intended to be used externally, if you already have vue-i18n installed you should use its $t() instead.

https://github.com/vuetifyjs/vuetify/pull/4051/commits/c6e17bb1f5ad73e5a62b0a3df1d07796bb69d862

All 5 comments

The documentation is wrong, keys must be prefixed with $vuetify

{{ $vuetify.t('$vuetify.other.test') }}

This is so we can dynamically change the locale with prop defaults. $vuetify.t isn't really intended to be used externally, if you already have vue-i18n installed you should use its $t() instead.

https://github.com/vuetifyjs/vuetify/pull/4051/commits/c6e17bb1f5ad73e5a62b0a3df1d07796bb69d862

I just ran into this documentation issue too...what's the reason for wontfix @KaelWD ?

the documentation still have the issue and killing developers time!

Was this page helpful?
0 / 5 - 0 ratings