Vue.js i18n Language Switcher

แชร์
ฝัง
  • เผยแพร่เมื่อ 14 พ.ย. 2024

ความคิดเห็น • 100

  • @inquiz9747
    @inquiz9747 5 ปีที่แล้ว +8

    I am currently working on my first project. Since I was hard pressed into doing it, I had to learn everything from scratch in under a month, starting with html and ending right here. Long story short, localization was my nemesis. I couldn't get it to work no matter how hard I tried. And you, you absolute beautiful beast of a human, just made my life for at least a few years. You are amazing.

  • @thelonewolf9866
    @thelonewolf9866 2 ปีที่แล้ว

    Am making a trilingual GUI in 2022. Still really relevant & usefull! Thank you my good sir!

  • @BrunoDeAngelis
    @BrunoDeAngelis 5 ปีที่แล้ว +2

    We need this for Gridsome so badly!! Thanks for the tutorial Andre.

    • @drehimself
      @drehimself  5 ปีที่แล้ว +2

      Agree 100%! Thanks for watching.

  • @noureibo1628
    @noureibo1628 3 ปีที่แล้ว

    very few people teaching like you
    thank you so much I get what I want

  • @RenanBecker
    @RenanBecker 2 ปีที่แล้ว +1

    Language Switcher starts at 20:01

  • @agun21st
    @agun21st 4 ปีที่แล้ว

    Mana many thanks to you Andre. I was looking for Localization for my Laravel Vuejs Site but I could not find any easy tutorial like yours. it wonderful Andre. God bless you.

  • @MrMarcoAlvarado
    @MrMarcoAlvarado 3 ปีที่แล้ว +3

    Hi, that doesn't work with component: {
    render(c) {
    return c("router-view");
    },... c takes "router-view" as an argument, but where does it come from?

    • @bouachalazhar
      @bouachalazhar 2 ปีที่แล้ว

      I have the same problem in vue3 :
      path: "/:lang", component: { render(c) { return c("router-view"); }, },
      with warnings :
      www.developpez.net/forums/attachments/p595040d1617739325/javascript/bibliotheques-frameworks/vuejs/i18n-integration-vue-router-vue3-vue-cli/c_erreur.jpg/

  • @AmarjargalB
    @AmarjargalB ปีที่แล้ว

    Thank you so much super helpful to understand and implementing i18n with router

  • @CodeMonkeyG2011
    @CodeMonkeyG2011 5 ปีที่แล้ว

    Helped me meet a deadline. Excellent execution.

  • @ForgotMyStupidName
    @ForgotMyStupidName 4 ปีที่แล้ว

    Just a heads up, if it's not a requirement to have the language parameter set from the URL, it can be done much easier: just switch i18n.locale to your desired language upon a button click, no need to hassle about with routes and route params and route guards. For a one page application that'll suffice since the page never gets reloaded and the locale param persists until the user changes it again.
    Still a nice tutorial though!

    • @SuperSarhanWebdev
      @SuperSarhanWebdev 4 ปีที่แล้ว

      please share some code snippets that would help me a lot with my project I just need one button to do it yes

    • @ForgotMyStupidName
      @ForgotMyStupidName 4 ปีที่แล้ว +2

      @@SuperSarhanWebdev In the component where you want to have the buttons, add a method:
      switchLang(lang) {
      i18n.locale = lang;
      },
      Add buttons to your html that call this method:
      Use a i18n lookup wherever you want your translated texts like instructed in the video:
      {{ $t('nav.nearbyAlerts') }}

    • @SuperSarhanWebdev
      @SuperSarhanWebdev 4 ปีที่แล้ว

      Thank u that was helpful, i did sth like it, inside i18n.js I did
      Const locale = navigation.language
      And in main js
      document.documentElement = navigation.language

    • @sheriffcrandy
      @sheriffcrandy ปีที่แล้ว

      @@SuperSarhanWebdev where in i18n.js did you put Const locale = navigation.language and what does Const locale = navigation.language mean?

    • @sheriffcrandy
      @sheriffcrandy ปีที่แล้ว

      @@ForgotMyStupidName doesn't work

  • @leonvanrijswijk8409
    @leonvanrijswijk8409 5 ปีที่แล้ว

    It would be great if you make a series on Quasar. There are not many tutorials to be found, yet it seems to be a beautiful framework

  • @iomelyuhin
    @iomelyuhin 5 ปีที่แล้ว +6

    Thanks for your tutorial!! it works!!!
    I want to ask how to change the path in the url to the standard locale? The task is to make sure that on the English version of the site in the url is displayed not site.com/en but site.com/
    is it possible??

  • @SusanthCom
    @SusanthCom 3 ปีที่แล้ว

    Thank You Dear ❣️ really amazing explanation 👍👍

  • @mtzrmzia
    @mtzrmzia 5 ปีที่แล้ว +2

    You're the best man, thanks a lot... i've learned so much about Vue.. thanks to you, greetings from mexico

    • @drehimself
      @drehimself  5 ปีที่แล้ว

      Thanks for watching!

  •  3 ปีที่แล้ว

    Ha! my instructor from laracast! grrreat!

  • @RHmoon07
    @RHmoon07 ปีที่แล้ว

    Thanks for the tutorial. Is seems too useful. 😊

  • @mypegionworld7612
    @mypegionworld7612 2 ปีที่แล้ว

    You are amaizing my guy..

  • @jniyaz
    @jniyaz 5 ปีที่แล้ว

    Thanks Andrew for your great stuffs. Very helpful.

    • @drehimself
      @drehimself  5 ปีที่แล้ว

      Thanks for watching!

  • @MehmetDemir-jl4ny
    @MehmetDemir-jl4ny 4 ปีที่แล้ว

    Andre, thanks for this plugin, video, documentation. Best regards. 👏😊🇹🇷

  • @2n1u0
    @2n1u0 4 ปีที่แล้ว

    very helpful, thanks, you make it easy to understand

  • @franklinantony
    @franklinantony 3 ปีที่แล้ว

    Great tutorial ! 👍🏽 Curious to see your VSCode extensions 🤔

  • @won1626
    @won1626 5 ปีที่แล้ว

    Andre, that what i waiting for. Thanks 👏

    • @drehimself
      @drehimself  5 ปีที่แล้ว +1

      Thanks for watching!

  • @nanchitacr
    @nanchitacr 4 ปีที่แล้ว +3

    Without installing it with the vue-cli I don't have any of the files you show in your project? What am I supposed to do then?

    • @aymenbenchiheub3521
      @aymenbenchiheub3521 3 ปีที่แล้ว

      if you are using vue.js with out the vue-cli you can add the vue-i18n cdn and create new component , by the way if you are creating a big App it will be better if you use the Vue-CLI

  • @stsbmu7169
    @stsbmu7169 4 ปีที่แล้ว

    Btw, I think we could work without manipulating with router. I would prefer just to change language parameter and that's it. What do you think?

  • @usertester8982
    @usertester8982 3 ปีที่แล้ว +1

    Hello,
    path:'/:lang',
    component: { render(h) {return h('router-view')},},
    I have used this code in vue3.js. but not proper work.
    I have this facing this issue
    Uncaught (in promise) TypeError: h is not a function

    • @bouachalazhar
      @bouachalazhar 2 ปีที่แล้ว

      I have the same problem in vue3 :
      path: "/:lang", component: { render(c) { return c("router-view"); }, },
      with warnings :
      www.developpez.net/forums/attachments/p595040d1617739325/javascript/bibliotheques-frameworks/vuejs/i18n-integration-vue-router-vue3-vue-cli/c_erreur.jpg/

  • @ahmadaliazhary369
    @ahmadaliazhary369 3 ปีที่แล้ว

    Thanks for the tutorial!

  • @chengjoseph9459
    @chengjoseph9459 3 ปีที่แล้ว +2

    following the steps now with the installation makes it a bit different, a globalInjection parameter needs to be set to true for the reference $t to work! otherwise this video is super useful. thank you

    • @abat_dauletbaev
      @abat_dauletbaev 3 ปีที่แล้ว +1

      Thank you so much. You saved my day.

    • @coredeadman5980
      @coredeadman5980 2 ปีที่แล้ว +1

      Oh my god thanks, i wasted hours on this... ;(

    • @jadigger8695
      @jadigger8695 ปีที่แล้ว +1

      my fucking god , i love you

  • @timtitus7861
    @timtitus7861 5 ปีที่แล้ว

    Awesome tutorial. Cheer!

  • @davidadu-tenkorang3186
    @davidadu-tenkorang3186 3 ปีที่แล้ว

    Such a blessing.

  • @johndp1851
    @johndp1851 4 ปีที่แล้ว

    Neat and very simple :) thanks man

  • @bartoszsowa5140
    @bartoszsowa5140 3 ปีที่แล้ว

    This doesn't work, or am I missing something? If I output the strings from json file, the app breaks. Instead, I need to put then in tag inside the component, although the json file was created by default. WTH? :D

  • @bf-xi3om
    @bf-xi3om 5 ปีที่แล้ว

    Awesome stuff as usual :)

    • @drehimself
      @drehimself  5 ปีที่แล้ว

      Thanks for watching!

  • @shahmirjadoon3587
    @shahmirjadoon3587 3 ปีที่แล้ว

    Kindly guide,
    How to use this.router.push() inside any component? How to pass lang ?

  • @이건개발-p8n
    @이건개발-p8n 2 ปีที่แล้ว

    1:50 use legacy option: yes

  • @cjoyales7019
    @cjoyales7019 4 ปีที่แล้ว

    thanks for the tutorial. How do you solve the error when the user double clicks on the language?

  • @wingsaber629
    @wingsaber629 4 ปีที่แล้ว

    Hmm how would I do this WITHOUT router? I see websites with no /en path or /:language pathing in the URL.

  • @sheriffcrandy
    @sheriffcrandy ปีที่แล้ว

    In router.js I am getting a 'TypeError: c is not a function' for
    path: '/:lang',
    component: {
    render (c) { return c('router-view') }
    },

  • @quickpodcast5minutecasts
    @quickpodcast5minutecasts 3 ปีที่แล้ว

    Hello thanks for the beautiful tut but i have a q, how to i guard the /wrong-url and the wrong input of a language?

  • @m4mex972
    @m4mex972 2 ปีที่แล้ว

    nice work bro

  • @TheSILVERVEVO
    @TheSILVERVEVO 4 ปีที่แล้ว

    thanks man, very detailed

  • @RajaSekhar-te5nz
    @RajaSekhar-te5nz ปีที่แล้ว

    How to use multiple files per language in vue3 vue-i18n?

  • @neyasbltb
    @neyasbltb 5 ปีที่แล้ว

    It`s cool stuff and cool lesson!

    • @drehimself
      @drehimself  5 ปีที่แล้ว

      Thanks for watching!

  • @underthewing
    @underthewing 4 ปีที่แล้ว +1

    If you choose the same flag ..
    (in promise) NavigationDuplicated: Avoided redundant navigation to current location: "/en/".

  • @arslanahmed2117
    @arslanahmed2117 5 ปีที่แล้ว

    How we can use this in a dynamic website where data comes from database and user can switch language and the whole site content changes with the selected language by user. Instead of creating keys and setting a static content there ???

  • @mullla1ya
    @mullla1ya 3 ปีที่แล้ว

    In case of having dynamic URL:
    router :to="`/${$i18n.locale}${link.route}`"

  • @freestyleez1
    @freestyleez1 5 ปีที่แล้ว

    Thanks for your tutorial!
    PS. Can you include your starting code? ;)

  • @alimosbah
    @alimosbah 4 ปีที่แล้ว

    There are some languages, such as Arabic RTL, is possible by injecting dir RTL into the HTML tag ?? !!

  • @wingsaber629
    @wingsaber629 4 ปีที่แล้ว

    Thanks. Hope this still works

  • @SenthuranElangovan
    @SenthuranElangovan 5 ปีที่แล้ว

    much needed, thanks

    • @drehimself
      @drehimself  5 ปีที่แล้ว

      Thanks for watching!

  • @abdo.magdy.
    @abdo.magdy. 4 ปีที่แล้ว

    just use the routes names in :to directive

  • @AzizKhan-ju5vd
    @AzizKhan-ju5vd ปีที่แล้ว

    Thank you very much

  • @rakeshs1453
    @rakeshs1453 4 ปีที่แล้ว

    i understand the working process using keys, what if i want to translate in chinese or any other language which i dont know.. please help me

    • @wingsaber629
      @wingsaber629 4 ปีที่แล้ว

      I'm needing to do a website with English and Chinese as well and came looking here... were you able to do Chinese? Is it just as easy as replacing the keys with chinese words?

  • @MrTarang1
    @MrTarang1 4 ปีที่แล้ว

    vue js submit form in regional language ?

  • @geliangzhu9136
    @geliangzhu9136 5 ปีที่แล้ว +1

    Very helpful. Tq

    • @drehimself
      @drehimself  5 ปีที่แล้ว

      Thanks for watching!

  • @mullla1ya
    @mullla1ya 3 ปีที่แล้ว

    wth man I do need exactly this thing with v-for and you said you not gonna use.

  • @rozhansheikholmoluki3166
    @rozhansheikholmoluki3166 3 ปีที่แล้ว

    Awesome😍👌👌

  • @kinax2
    @kinax2 3 ปีที่แล้ว

    Can you do the same with vue 3 ?

  • @abrhagebreamlak-jk2th
    @abrhagebreamlak-jk2th 5 ปีที่แล้ว

    thanks bro but i am not using the routing stuff but the local changing @kazupon.github.io am havieng difficulties in table headers pls help it is not translating it and if i reload the page it loads to fallback locale even if i have selected my choice in the drop down

    • @RajaSekhar-te5nz
      @RajaSekhar-te5nz ปีที่แล้ว

      How to use multiple files per language in vue3 i18n

  • @yanapurnaya3564
    @yanapurnaya3564 5 ปีที่แล้ว

    I want to ask if vue-i18n is used in nuxt, how do I make the settings?

    • @gonzoartemis2503
      @gonzoartemis2503 4 ปีที่แล้ว

      There's a nuxt module wrapper for vue-i18n. It's called nuxt-i18n.

  • @seppeclijsters6433
    @seppeclijsters6433 5 ปีที่แล้ว

    Hi thanks for the tutorial! Is it also possible to translate the URL itself?

  • @najmeddinhaidar9641
    @najmeddinhaidar9641 5 ปีที่แล้ว

    does it work with laravel app ???

    • @drehimself
      @drehimself  5 ปีที่แล้ว

      You can build a vue component for the language switcher, but the i18n stuff has to be done using Laravel's available translation tools. Maybe I'll do a video on that too :)

    • @najmeddinhaidar9641
      @najmeddinhaidar9641 5 ปีที่แล้ว

      @@drehimself yes, a separate video to user laravel and i18n will be great idea ? :-)

  • @frozenhead7395
    @frozenhead7395 5 ปีที่แล้ว

    Cool vid! Thank you a lot!
    Like and sub, keep teach us

  • @azamjon_aliyev
    @azamjon_aliyev 3 ปีที่แล้ว +1

    Salom 👍👍👍👍👍

  • @Jesus-mu4ix
    @Jesus-mu4ix 5 ปีที่แล้ว

    💚

  • @adriatic123
    @adriatic123 2 ปีที่แล้ว

    Very unintuitive