question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

pre-compilation of messages

See original GitHub issue

Module versions

@intlify/vue-i18n-loader: ^4.0.0 @vue/cli-plugin-babel: ^5.0.0-rc.0 @vue/cli-service: ^5.0.0-rc.0 vue-cli-plugin-i18n: ~2.3.1 vue-i18n: ^9.1.9

Config

vue.config.js:

module.exports = {
    pluginOptions: {
        i18n: {
            locale: "de",
            fallbackLocale: "en",
            localeDir: "locales",
            enableLegacy: false,
            runtimeOnly: true,
            compositionOnly: false,
            fullInstall: true,
        },
    },

    chainWebpack: (config) => {
        config.module
            .rule("i18n")
            .resourceQuery(/blockType=i18n/)
            .type("javascript/auto")
            .use("i18n")
            .loader("@intlify/vue-i18n-loader")
            .end();
    },
};

i18n.ts:

import { createI18n } from 'vue-i18n';
import locales from './locales';

export default createI18n({
    legacy: true,
    locale: 'en',
    fallbackLocale: 'en',
    sharedMessages: locales,
});

Description

So I’ve ran into Content-Security setting problems and noticed, that I have to set runtimeOnly to true. But now I’m getting many errors like this:

[intlify] The message format compilation is not supported in this build. Because message compiler isn't included. You need to pre-compilation all message format. So translate function return 'my-string'.

I’ve searched for this issue and found out, that I have to set an alias for webpack. But I thought I dont need to do that, because I am using the vue cli plugin. Additionally according to https://vue-i18n-next.intlify.dev/installation.html#with-a-bundler @intlify/vue-i18n-loader already precompiles the messages. So how to solve this?

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
kazuponcommented, Nov 17, 2021

Thank you for your feedback! I’ll add the sharedMessages to docs later! Happy coding! 😃

0reactions
Zauberbuttercommented, Nov 17, 2021

So I’m using <i18n> blocks too, so i thought I need to use sharedMessages. I think the use case for sharedMessages should be better explained in the docs.

Now that I’m using the loadLocaleMessages function together with JSON files in /locales it’s working. But I’m getting an warning for each key that isn’t in local scope. Just like in https://github.com/intlify/vue-cli-plugin-i18n/issues/191 But it is working nevertheless.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Precompiler Messages - Oracle Help Center
This section lists precompile and runtime error messages that were added since Pro*C/C++, Release 2.1, and Pro*COBOL, Pro*FORTRAN, and Pro*Ada, Releases 1.7.
Read more >
message pragma | Microsoft Learn
Sends a string literal to the standard output without terminating the compilation. Syntax. #pragma message( message-string ). Remarks. A typical ...
Read more >
DSNH messages - Db2 - IBM
Message numbers that begin with DSNH communicate information about the Db2 precompiler or the Db2 coprocessor.
Read more >
Tutorial on precompilation - The Julia Programming Language
In this tutorial, we've learned about MethodInstance s, backedges, inference, and precompilation. Some important take-home messages are: you can ...
Read more >
Appendix A: Precompiler Warning and Error Messages
Information – no error or warning was detected, and the precompiler ... The message is purely informational. ... Table A-1: Command line option...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found