Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error parsing empty component #9

Open
aschempp opened this issue Oct 26, 2018 · 9 comments
Open

Error parsing empty component #9

aschempp opened this issue Oct 26, 2018 · 9 comments

Comments

@aschempp
Copy link

aschempp commented Oct 26, 2018

If a file does not have any translations, the CLI tool will terminate with an error:

(node:31777) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 2): TypeError: Cannot read property 'toUpperCase' of undefined
(node:31777) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

@MaxGfeller
Copy link
Contributor

@aschempp How can this be recreated? The CLI tool should not even show components that don't have any strings in them to be translated.

@MaxGfeller
Copy link
Contributor

I fixed a bug in 1.1.0 that lead to the same error message. Could you try again and check if it works now?

@aschempp
Copy link
Author

Thanks for the update! Now I get a slightly different message:

(node:36976) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): SyntaxError: Unexpected token } in JSON at position 5186
(node:36976) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

The component is rather simple, here's what it looks like:

<template>
    <div id="app">
        <error v-if="$store.state.error"/>
        <router-view v-else/>
    </div>
</template>

<script>
    // import "../../template/lib/jquery/jquery.js";
    // import "../../template/lib/popper.js/popper.js";
    // import "../../template/lib/bootstrap/js/bootstrap.js";

    import Error from './layouts/Error';

    export default {
        components: { Error },

        created() {
            this.$store.dispatch('auth/refresh');
        },
    };
</script>

<style rel="stylesheet/scss" lang="scss">
    @import "../assets/template/lib/perfect-scrollbar/css/perfect-scrollbar.css";
    @import "../assets/template/lib/jquery.steps/jquery.steps.css";
    @import "../assets/template/lib/SpinKit/spinkit.css";
    @import "../assets/template/css/bracket";

    @import "../assets/styles/app";
</style>

@aschempp
Copy link
Author

I tried removing everything except the div and export statement, and the error still comes up.

@MaxGfeller
Copy link
Contributor

I'm failing to recreate this. Could the error actually be from your messages file(s)? Sorry the error handling is still very basic.

When does the error occur? Right after running translate or only after selecting a file?

@aschempp
Copy link
Author

After selecting that file. Other files work just fine. All languages are stored in the same file. Here's what my config looks like:

const path = require('path');
const { JSONAdapter } = require('vue-translation-manager');

module.exports = {
    srcPath: path.join(__dirname, 'src/components/'),
    adapter: new JSONAdapter({ path: path.join(__dirname, 'src/i18n/messages.json')}),
    languages: ['en', 'de'],
};

@MaxGfeller
Copy link
Contributor

I can not recreate this, still. Is the messages file valid JSON? Did you try to validate this?

Could you provide a small reproducable example so i could look into this?

@qzminski
Copy link

qzminski commented Jun 6, 2019

I can confirm the issue but I am not sure what's the source of the problem…

@the94air
Copy link

the94air commented Apr 19, 2021

@qzminski @MaxGfeller Turns out it shows this error if any of your templates contains an & or / or anything that can't be uppercased 😂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants