intlify / vue-i18n

Vue I18n for Vue 3
https://vue-i18n.intlify.dev/
MIT License
2.17k stars 334 forks source link

Placeholder for testing environment, is not replaced #1428

Open chenguzhen87 opened 1 year ago

chenguzhen87 commented 1 year ago

Reporting a bug?

Placeholder for testing environment, is not replaced, development environment is replaced normally

Expected behavior

Placeholder for testing environment is replaced,

Reproduction

None

System Info

System:
    OS: Windows 10 10.0.19045
    CPU: (8) x64 Intel(R) Core(TM) i5-8265U CPU @ 1.60GHz
    Memory: 1.37 GB / 7.85 GB
  Binaries:
    Node: 16.15.0 - D:\software\nodejs\node.EXE
    Yarn: 1.22.19 - D:\software\nodejs\npm-global\yarn.CMD
    npm: 8.5.5 - D:\software\nodejs\npm.CMD
  Managers:
    Cargo: 1.63.0 - ~\.cargo\bin\cargo.EXE
    Composer: 2.1.14 - C:\ProgramData\ComposerSetup\bin\composer.BAT
    Gradle: 6.5.1 - D:\software\gradle-6.5.1\bin\gradle.BAT
    pip3: 23.0.1
  Utilities:
    Git: 2.36.1.
    FFmpeg: 9.2.1 - D:\software\ffmpeg-20191223-5b42d33-win64-static\bin\ffmpeg.EXE
  Virtualization:
    Docker: 20.10.8 - C:\Program Files\Docker\Docker\resources\bin\docker.EXE
  SDKs:
    Android SDK:
      API Levels: 28, 29
      Build Tools: 28.0.3, 29.0.2
      System Images: android-28 | Google Play Intel x86 Atom
  IDEs:
    VSCode: 1.79.0 - D:\software\Microsoft VS Code\bin\code.CMD
  Languages:
    Go: 1.16.7 - D:\software\go1.16.7\bin\go.EXE
    Java: 1.8.0_202
    Perl: 5.32.1 - D:\software\Strawberry\perl\bin\perl.EXE
    PHP: 7.3.4 - D:\software\phpstudy_pro\Extensions\php\php7.3.4nts\php.EXE
    Python: 3.10.11
    Python3: 3.10.11
    Rust: 1.63.0
  Databases:
    MongoDB: 4.2.0 - D:\software\MongoDB\bin\mongo.EXE
    MySQL: undefined - D:\software\MySQL Server 8.0\bin\mysql.EXE
    SQLite: 3.28.0 - D:\software\AndroidSDK\platform-tools\sqlite3.EXE
  Browsers:
    Chrome: 113.0.5672.127
    Edge: Spartan (44.19041.1266.0), Chromium (114.0.1823.43)

Screenshot

Test environment placeholder not replaced 5c7906cc9c5e52efaf20f8e3bbd164c

Develoment environment placeholder replaced image

Additional context

none

Validations

Rafelder commented 1 year ago

Same problem here. I am using version 9.2.2. Placeholders are replaced in dev environment (vite), but not in testing/production environment (vite build).

AnthonyRuelle commented 1 year ago

Same problem here it's really very blocking, it's supposed to go into production soon but this bug will stop me

kazupon commented 1 year ago

Thank you for your reporting! Could you give us your minimal reproduction with github or stackblize, please?

AnthonyRuelle commented 1 year ago

Thank you @kazupon for your answer

Here is a simple scenario with the bug occurring: Pull the sources of this project: https://github.com/AnthonyRuelle/i18n_prod_HS Run: npm i npm run dev : all good npm run prod : pluralization not working

kazupon commented 1 year ago

Thank you for your reproduction!

Unfortunately, I could not reproduce this issue. I saw the Enfant with $t('children', 1) 😞

We would need more information that is included reproduction.

chenguzhen87 commented 1 year ago

Same problem here it's really very blocking, it's supposed to go into production soon but this bug will stop me you maybe solve this like this image

AnthonyRuelle commented 1 year ago

Hi @kazupon !

I updated the project to reproduce the problem

Pull the sources of this project: https://github.com/AnthonyRuelle/i18n_prod_HS Run: npm i npm run dev : all good npm run prod : pluralization not working

When we put the translation keys directly in the i18n.config.ts file it works in dev and prod image

However, when the messages are put in a separate file (en.json and fr.json files in the locales folder on my project) + configuration in the following nuxt.config.ts, it works fine in dev but not in production.

I remain available if you need more information but you should reproduce the problem now

image

andersonAlmeida commented 1 year ago

I have fixed my issue setting the option runtimeOnly to false. I am using vite.