rust-i18n icon indicating copy to clipboard operation
rust-i18n copied to clipboard

i18n Ally in VS Code fails to parse version 2 locales file (app.yml) syntax

Open YuniqueUnic opened this issue 10 months ago • 0 comments

It appears that the app.yml locales file with version 2 is incompatible with the i18n Ally extension in VS Code. Here are the details of the problem:

1. app.yml File Structure

The following is the content of the app.yml file:

_version: 2

language:
  en: language
  zh-CN: 语言
  ja: 言語
  ko: 언어
  es: idioma
  fr: langue
  de: sprache
  it: lingua

2. Parsing Behavior in i18n Ally

i18n Ally can only retrieve the actual string in the specified language from the app.yml file when using the format 'language.[language-shortcut]', such as 'language.en'. This can be observed from the code and the attached screenshot.

3. Runtime Parsing Behavior

However, in the actual runtime, the correct internationalized string can only be parsed using 'language' as the key in the app.yml file. The following is the relevant Rust code snippet:

rust_i18n::set_locale(&language);
println!("1. language:{}", t!("language.zh-CN"));
println!("2. language:{}", t!("language.en"));
println!("3. language:{}", t!("language"));

4. Screenshots for Reference

  • i18n Ally in VS Code: Click to view
  • Actual runtime output: Click to view

5. Request for Solution

I would like to ask if there is any solution to make i18n Ally compatible with the version 2 syntax of the app.yml file so that it can correctly parse and display the corresponding language strings in VS Code.

Thank you!

YuniqueUnic avatar Mar 11 '25 04:03 YuniqueUnic