kazupon/vue-i18n

Missing translation if key is the same as a prototype function name

オープン

#968 opened on 2020/08/11

 (1 件のコメント) (1 件のリアクション) (0 人の担当者)JavaScript (837 件のフォーク)batch import
Type: Bughelp wanted

Repository metrics

Stars
 (7,222 個のスター)
PR merge metrics
 (30d に merged PR はありません)

説明

It is possible to get string protoype function with the translate function. If you are using a plain object for the messages and the keys are looking like this

{ 
    "somekey": "Im a translation",
    "somekey.deep": "Im a translation which is deep",
    "somekey.link": "I do not work",
}

The translate function will return null if the last key is the same as a prototype function. For example somekey.link will always be empty. This is because the internal function getPathValue returns the protoype function itself.

vue & vue-i18n version

vue: 2.6.1 vue-i18n: 8.18.2

Reproduction Link

https://jsfiddle.net/MrWook/ukfdp8q1/3/

Steps to reproduce

Open the Reproduction Link and look at the rendered page

What is Expected?

The last translation key is translated as well.

What is actually happening?

The last translation key isn't translated.

コントリビューターガイド