vue3

vue-i18n 특수문자 에러

킹king 2023. 4. 28. 13:15
반응형

ㄷㄷㄷㄷㄷㄷㄷㄷㄷ

Message compilation error: Invalid linked format

Message compilation error: Unexpected lexical analysis in token

Message compilation error: Unexpected empty linked key

 

이런 메세지들이 뜨면서 안되기 시작했는데 알고보니 특수문자는 별도로 처리를 해줬어야했음.

 

1. 특수문자 앞뒤로 {''} 붙여주기

// 틀림
const string = "특수문자 !,@,#,$를 넣어주세요.";

// 맞음
const string = "특수문자 {'!'},{'@'},{'#'},{'$'}를 넣어주세요.";

이렇게 해주면 되는데 꼭 따옴표(쌍따옴표 말고)로 써야함!

 

https://github.com/kazupon/vue-i18n/issues/1149

 

Can't escape { } and # in messages · Issue #1149 · kazupon/vue-i18n

Hi, I can't find a way to escape such characters in translation messages like { } #. When I use them I get runtime errors telling that message failed to parse. Module versions: vue: 3.x vue-i18n: 9...

github.com

 

모든 게시물(특히 과거 게시물)은 잘못된 방법으로 처리한것을 좋다고 써놨을 수 있습니다. 참고만 하시고 틀린게 있다면 댓글 남겨주세요~