How can I translate app without reloading page in vue.js?Can you force Vue.js to reload/re-render?Vue.js redirection to another pageVue.js - How to properly watch for nested dataVueJS 2 - How to Pass Parameters Using $emitVue.JS on top of existing python/django/jinja app for filter and list renderHow to initiate refresh of Vuejs page elements w/ new data?How to properly render child routes in Vue.js using $router.pushVue - Force Rerendering Of All Componentsupdate component on Vuex state change through computed propertieswhat is the right way or the vuejs way to data bind the entire page?Forcing a refresh on vuejs router from an outer app

What should I say when a company asks you why someone (a friend) who was fired left?

What would be the side effects on the life of a person becoming indestructible?

Area of parallelogram = Area of square. Shear transform

Who has jurisdiction for a crime committed in an embassy?

Why keep the bed heated after initial layer(s) with PLA (or PETG)?

Why did computer video outputs go from digital to analog, then back to digital?

Unpublished Sitecore item in Google search

How can I make sure my players' decisions have consequences?

How important is a good quality camera for good photography?

Are glider winch launches rarer in the USA than in the rest of the world? Why?

Keeping an "hot eyeball planet" wet

What exactly makes a General Products hull nearly indestructible?

How did C64 games handle music during gameplay?

Do Rabbis get punished in Heaven for wrong interpretations or claims?

Book with a female main character living in a convent who has to fight gods

Is it normal practice to screen share with a client?

Determine if a triangle is equilateral, isosceles, or scalene

Would it be a good idea to memorize relative interval positions on guitar?

Is an easily guessed plot twist a good plot twist?

Character Frequency in a String

For a MOSFET, does capacitive gate current only flow through to the source?

How do professional electronic musicians/sound engineers combat listening fatigue?

Does static fire reduce reliability?

Is Grandpa Irrational? Another Grandpa Mystery



How can I translate app without reloading page in vue.js?


Can you force Vue.js to reload/re-render?Vue.js redirection to another pageVue.js - How to properly watch for nested dataVueJS 2 - How to Pass Parameters Using $emitVue.JS on top of existing python/django/jinja app for filter and list renderHow to initiate refresh of Vuejs page elements w/ new data?How to properly render child routes in Vue.js using $router.pushVue - Force Rerendering Of All Componentsupdate component on Vuex state change through computed propertieswhat is the right way or the vuejs way to data bind the entire page?Forcing a refresh on vuejs router from an outer app






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








1















I want to translate my app English to German.
on the language change event, I wrote this code



changeLocale (locale) 
i18n.locale = locale.language
VueCookies.set('UserLanguage', locale.language)
// window.location.reload() this one is reloading page
this.$root.reload() // this one is not working
,


and I want to translate this data in vuejs file :



 DashboardData: ['name': this.$t('IVR'), 'name': this.$t('DTML'), 'name': this.$t('SSH')]


if I do window.location.reload(), it's working perfectly
but I don't want to reload the page so, I am thinking to reload root in vue, I am not sure about this.



Is there any way to reload the root element or all property of the whole app?










share|improve this question






















  • I think that this.$t is undefined if you try to use it in the data block. You could try using this.$i18n.t instead, or moving your DashboardData to a computed property and keep using this.$t.

    – Ricky
    Mar 26 at 17:42

















1















I want to translate my app English to German.
on the language change event, I wrote this code



changeLocale (locale) 
i18n.locale = locale.language
VueCookies.set('UserLanguage', locale.language)
// window.location.reload() this one is reloading page
this.$root.reload() // this one is not working
,


and I want to translate this data in vuejs file :



 DashboardData: ['name': this.$t('IVR'), 'name': this.$t('DTML'), 'name': this.$t('SSH')]


if I do window.location.reload(), it's working perfectly
but I don't want to reload the page so, I am thinking to reload root in vue, I am not sure about this.



Is there any way to reload the root element or all property of the whole app?










share|improve this question






















  • I think that this.$t is undefined if you try to use it in the data block. You could try using this.$i18n.t instead, or moving your DashboardData to a computed property and keep using this.$t.

    – Ricky
    Mar 26 at 17:42













1












1








1


1






I want to translate my app English to German.
on the language change event, I wrote this code



changeLocale (locale) 
i18n.locale = locale.language
VueCookies.set('UserLanguage', locale.language)
// window.location.reload() this one is reloading page
this.$root.reload() // this one is not working
,


and I want to translate this data in vuejs file :



 DashboardData: ['name': this.$t('IVR'), 'name': this.$t('DTML'), 'name': this.$t('SSH')]


if I do window.location.reload(), it's working perfectly
but I don't want to reload the page so, I am thinking to reload root in vue, I am not sure about this.



Is there any way to reload the root element or all property of the whole app?










share|improve this question














I want to translate my app English to German.
on the language change event, I wrote this code



changeLocale (locale) 
i18n.locale = locale.language
VueCookies.set('UserLanguage', locale.language)
// window.location.reload() this one is reloading page
this.$root.reload() // this one is not working
,


and I want to translate this data in vuejs file :



 DashboardData: ['name': this.$t('IVR'), 'name': this.$t('DTML'), 'name': this.$t('SSH')]


if I do window.location.reload(), it's working perfectly
but I don't want to reload the page so, I am thinking to reload root in vue, I am not sure about this.



Is there any way to reload the root element or all property of the whole app?







vue.js vuejs2 vue-component vuex vue-router






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Mar 26 at 15:46









JYOTI SAPARIYAJYOTI SAPARIYA

3112 silver badges11 bronze badges




3112 silver badges11 bronze badges












  • I think that this.$t is undefined if you try to use it in the data block. You could try using this.$i18n.t instead, or moving your DashboardData to a computed property and keep using this.$t.

    – Ricky
    Mar 26 at 17:42

















  • I think that this.$t is undefined if you try to use it in the data block. You could try using this.$i18n.t instead, or moving your DashboardData to a computed property and keep using this.$t.

    – Ricky
    Mar 26 at 17:42
















I think that this.$t is undefined if you try to use it in the data block. You could try using this.$i18n.t instead, or moving your DashboardData to a computed property and keep using this.$t.

– Ricky
Mar 26 at 17:42





I think that this.$t is undefined if you try to use it in the data block. You could try using this.$i18n.t instead, or moving your DashboardData to a computed property and keep using this.$t.

– Ricky
Mar 26 at 17:42












2 Answers
2






active

oldest

votes


















0














If you are just trying to perform a safe reload via vue.js , there is a simple method you can use ...



vm.$forceUpdate();


for further info you can go here






share|improve this answer























  • I tried this one but it is not working in this case.

    – JYOTI SAPARIYA
    Mar 26 at 15:58












  • actually i want to reload all proerty of root in vue.

    – JYOTI SAPARIYA
    Mar 26 at 15:59











  • if you are just trying to translate a page ... you can try this

    – adib
    Mar 26 at 16:07












  • ya, I am using that one only and translation works(if page reloaded) but when I am passing data vue to HTML I need to reload the page for translation but I do not want to reload the page

    – JYOTI SAPARIYA
    Mar 26 at 16:10



















0














Why reload ? I am using vue-i18n and i don't reload my page. Here's the code:



home.vue



<v-list-tile @click="locale='fr'">
...
watch:
locale(val)
this.$i18n.locale=val;

,
mounted: function()
this.locale = this.$i18n.locale;
,


my app.js



...
import VueI18n from 'vue-i18n';
import messages from './lang/messages'
import dateTimeFormats from './lang/dateTimeFormats'
import numberFormats from './lang/numberFormats'
...
Vue.use(VueI18n);
let locale = navigator.language;
const i18n = new VueI18n(
fallbackLocale: 'gb',
locale: locale,
messages,
dateTimeFormats,
numberFormats
)
...
const app = new Vue(
el: '#app',
router,
store,
i18n,
components:
App

);





share|improve this answer

























    Your Answer






    StackExchange.ifUsing("editor", function ()
    StackExchange.using("externalEditor", function ()
    StackExchange.using("snippets", function ()
    StackExchange.snippets.init();
    );
    );
    , "code-snippets");

    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "1"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55361211%2fhow-can-i-translate-app-without-reloading-page-in-vue-js%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    If you are just trying to perform a safe reload via vue.js , there is a simple method you can use ...



    vm.$forceUpdate();


    for further info you can go here






    share|improve this answer























    • I tried this one but it is not working in this case.

      – JYOTI SAPARIYA
      Mar 26 at 15:58












    • actually i want to reload all proerty of root in vue.

      – JYOTI SAPARIYA
      Mar 26 at 15:59











    • if you are just trying to translate a page ... you can try this

      – adib
      Mar 26 at 16:07












    • ya, I am using that one only and translation works(if page reloaded) but when I am passing data vue to HTML I need to reload the page for translation but I do not want to reload the page

      – JYOTI SAPARIYA
      Mar 26 at 16:10
















    0














    If you are just trying to perform a safe reload via vue.js , there is a simple method you can use ...



    vm.$forceUpdate();


    for further info you can go here






    share|improve this answer























    • I tried this one but it is not working in this case.

      – JYOTI SAPARIYA
      Mar 26 at 15:58












    • actually i want to reload all proerty of root in vue.

      – JYOTI SAPARIYA
      Mar 26 at 15:59











    • if you are just trying to translate a page ... you can try this

      – adib
      Mar 26 at 16:07












    • ya, I am using that one only and translation works(if page reloaded) but when I am passing data vue to HTML I need to reload the page for translation but I do not want to reload the page

      – JYOTI SAPARIYA
      Mar 26 at 16:10














    0












    0








    0







    If you are just trying to perform a safe reload via vue.js , there is a simple method you can use ...



    vm.$forceUpdate();


    for further info you can go here






    share|improve this answer













    If you are just trying to perform a safe reload via vue.js , there is a simple method you can use ...



    vm.$forceUpdate();


    for further info you can go here







    share|improve this answer












    share|improve this answer



    share|improve this answer










    answered Mar 26 at 15:51









    adibadib

    414 bronze badges




    414 bronze badges












    • I tried this one but it is not working in this case.

      – JYOTI SAPARIYA
      Mar 26 at 15:58












    • actually i want to reload all proerty of root in vue.

      – JYOTI SAPARIYA
      Mar 26 at 15:59











    • if you are just trying to translate a page ... you can try this

      – adib
      Mar 26 at 16:07












    • ya, I am using that one only and translation works(if page reloaded) but when I am passing data vue to HTML I need to reload the page for translation but I do not want to reload the page

      – JYOTI SAPARIYA
      Mar 26 at 16:10


















    • I tried this one but it is not working in this case.

      – JYOTI SAPARIYA
      Mar 26 at 15:58












    • actually i want to reload all proerty of root in vue.

      – JYOTI SAPARIYA
      Mar 26 at 15:59











    • if you are just trying to translate a page ... you can try this

      – adib
      Mar 26 at 16:07












    • ya, I am using that one only and translation works(if page reloaded) but when I am passing data vue to HTML I need to reload the page for translation but I do not want to reload the page

      – JYOTI SAPARIYA
      Mar 26 at 16:10

















    I tried this one but it is not working in this case.

    – JYOTI SAPARIYA
    Mar 26 at 15:58






    I tried this one but it is not working in this case.

    – JYOTI SAPARIYA
    Mar 26 at 15:58














    actually i want to reload all proerty of root in vue.

    – JYOTI SAPARIYA
    Mar 26 at 15:59





    actually i want to reload all proerty of root in vue.

    – JYOTI SAPARIYA
    Mar 26 at 15:59













    if you are just trying to translate a page ... you can try this

    – adib
    Mar 26 at 16:07






    if you are just trying to translate a page ... you can try this

    – adib
    Mar 26 at 16:07














    ya, I am using that one only and translation works(if page reloaded) but when I am passing data vue to HTML I need to reload the page for translation but I do not want to reload the page

    – JYOTI SAPARIYA
    Mar 26 at 16:10






    ya, I am using that one only and translation works(if page reloaded) but when I am passing data vue to HTML I need to reload the page for translation but I do not want to reload the page

    – JYOTI SAPARIYA
    Mar 26 at 16:10














    0














    Why reload ? I am using vue-i18n and i don't reload my page. Here's the code:



    home.vue



    <v-list-tile @click="locale='fr'">
    ...
    watch:
    locale(val)
    this.$i18n.locale=val;

    ,
    mounted: function()
    this.locale = this.$i18n.locale;
    ,


    my app.js



    ...
    import VueI18n from 'vue-i18n';
    import messages from './lang/messages'
    import dateTimeFormats from './lang/dateTimeFormats'
    import numberFormats from './lang/numberFormats'
    ...
    Vue.use(VueI18n);
    let locale = navigator.language;
    const i18n = new VueI18n(
    fallbackLocale: 'gb',
    locale: locale,
    messages,
    dateTimeFormats,
    numberFormats
    )
    ...
    const app = new Vue(
    el: '#app',
    router,
    store,
    i18n,
    components:
    App

    );





    share|improve this answer



























      0














      Why reload ? I am using vue-i18n and i don't reload my page. Here's the code:



      home.vue



      <v-list-tile @click="locale='fr'">
      ...
      watch:
      locale(val)
      this.$i18n.locale=val;

      ,
      mounted: function()
      this.locale = this.$i18n.locale;
      ,


      my app.js



      ...
      import VueI18n from 'vue-i18n';
      import messages from './lang/messages'
      import dateTimeFormats from './lang/dateTimeFormats'
      import numberFormats from './lang/numberFormats'
      ...
      Vue.use(VueI18n);
      let locale = navigator.language;
      const i18n = new VueI18n(
      fallbackLocale: 'gb',
      locale: locale,
      messages,
      dateTimeFormats,
      numberFormats
      )
      ...
      const app = new Vue(
      el: '#app',
      router,
      store,
      i18n,
      components:
      App

      );





      share|improve this answer

























        0












        0








        0







        Why reload ? I am using vue-i18n and i don't reload my page. Here's the code:



        home.vue



        <v-list-tile @click="locale='fr'">
        ...
        watch:
        locale(val)
        this.$i18n.locale=val;

        ,
        mounted: function()
        this.locale = this.$i18n.locale;
        ,


        my app.js



        ...
        import VueI18n from 'vue-i18n';
        import messages from './lang/messages'
        import dateTimeFormats from './lang/dateTimeFormats'
        import numberFormats from './lang/numberFormats'
        ...
        Vue.use(VueI18n);
        let locale = navigator.language;
        const i18n = new VueI18n(
        fallbackLocale: 'gb',
        locale: locale,
        messages,
        dateTimeFormats,
        numberFormats
        )
        ...
        const app = new Vue(
        el: '#app',
        router,
        store,
        i18n,
        components:
        App

        );





        share|improve this answer













        Why reload ? I am using vue-i18n and i don't reload my page. Here's the code:



        home.vue



        <v-list-tile @click="locale='fr'">
        ...
        watch:
        locale(val)
        this.$i18n.locale=val;

        ,
        mounted: function()
        this.locale = this.$i18n.locale;
        ,


        my app.js



        ...
        import VueI18n from 'vue-i18n';
        import messages from './lang/messages'
        import dateTimeFormats from './lang/dateTimeFormats'
        import numberFormats from './lang/numberFormats'
        ...
        Vue.use(VueI18n);
        let locale = navigator.language;
        const i18n = new VueI18n(
        fallbackLocale: 'gb',
        locale: locale,
        messages,
        dateTimeFormats,
        numberFormats
        )
        ...
        const app = new Vue(
        el: '#app',
        router,
        store,
        i18n,
        components:
        App

        );






        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Mar 28 at 12:44









        Charles GCharles G

        1212 bronze badges




        1212 bronze badges



























            draft saved

            draft discarded
















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55361211%2fhow-can-i-translate-app-without-reloading-page-in-vue-js%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            밀양 대씨 역사 각주 함께 보기 둘러보기 메뉴밀양 대씨

            1973년 목차 사건 문화 탄생 사망 노벨상 달력 둘러보기 메뉴

            SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table