React i18next (Complete Tutorial)

🚀 Project React → cosden.solutions/project-react
Source Code → github.com/cosdensolutions/co...
Join The Discord! → discord.cosden.solutions
VSCode Theme | Font → Material Theme Darker | Menlo, Monaco "monospace"
In this video we will learn about translating your React app into multiple languages using React-i18next. This will allow you to specify a simple configuration object with all of your languages, and then use the useTranslation hook or the Trans component to translate any string in your application into any other language.

Пікірлер: 47

  • @i.hate.artists
    @i.hate.artists27 күн бұрын

    Brother, do you understand that you are the GOAT of React tutorials?

  • @dominikrodler8010
    @dominikrodler801027 күн бұрын

    Very nice introduction! A few additional things that might be interesting to new users: 1) You can keep basic HTML nodes (e.g. ) instead of those numbers () in your translation strings. 2) ESLint plugin eslint-plugin-i18next helps you find untranslated texts in your code. 3) i18next-scanner can automatically extract all translated texts and collect them in translation files (e.g. /en/frontend.json, /de/frontend.json). The same thing could be done with the "saveMissing" config option it seems, but I haven't tried that myself yet.

  • @haribo_player-too5141
    @haribo_player-too514115 күн бұрын

    Ok this is one more sub in the bank. I’ve been watching few of your tutorials here and there and you never miss, always go smoothly. Trans component was starting to give me headache, thank you for this

  • @leroviten
    @leroviten27 күн бұрын

    Trans component is much easier to deal with using built-in 'components' property. No headache at all. As an idea of improvement as in a real project - load translations async from db. So neat. Thanks for your time and gr8 tut, man

  • @ElNicopewpew
    @ElNicopewpew27 күн бұрын

    Great stuff as usual. Since hardly any websites are hardcoded these days, it would be killer to see this implemented with a cms such as sanity!

  • @rushikeshgandhmal
    @rushikeshgandhmal16 күн бұрын

    Hey man, thanks a lot. Helped me a lot. You are always best at explaining concepts.

  • @BrantK147
    @BrantK14725 күн бұрын

    Oh wow, this is awesome! I used to be a translator and now I'm a software developer. I'm REALLY interested in internationalizing and translating web apps.

  • @subhamchakraborty152
    @subhamchakraborty15227 күн бұрын

    Excited to learn something new 😁

  • @turgunov28
    @turgunov2827 күн бұрын

    thanks bro for amazing contents ✊🏻

  • @ivan4486
    @ivan448620 күн бұрын

    I used it once, and it worked well with normal tags in locales, and without passing the whole string in addition to the key. It only supported simple tags like strong etc. But it worked.

  • @dmnd2806
    @dmnd28065 күн бұрын

    Your vids are really great keep it up

  • @mnhtada12
    @mnhtada1227 күн бұрын

    Thank you so much for this video

  • @asandratrynyavojohanesa462
    @asandratrynyavojohanesa46227 күн бұрын

    Excellente vidéo mon ami

  • @giandenorte
    @giandenorte26 күн бұрын

    nice info! I also like the quality of the video. I am wondering what camera do you use? Is it green screen or just black curtain?

  • @ravisankarp61
    @ravisankarp6126 күн бұрын

    Thank You.

  • @izaias469
    @izaias46927 күн бұрын

    you can use the trans component like this with html tags or components with variables and html tags or components

  • @bastiendufour3841
    @bastiendufour384127 күн бұрын

    I am fluent in French too ! Awesome

  • @sylum3
    @sylum325 күн бұрын

    Regarding a change in keys that can break the UI - if your component and its helpers are padded with tests, then the commit that has these breaking changes should fail at some level, depending on the setup you have. For example a pre-commit script that runs all *.test files, a github action that blocks the PR if any test fails, etc.

  • @CLeovison
    @CLeovison26 күн бұрын

    Hi cosden i hope you make a tutorial on how to use react helmet async. Been watching your tutorial about react. Thank you so much for bringing a good quality video

  • @Edgars82
    @Edgars8227 күн бұрын

    No need to create workarounds creating constants or whatever... It's possible to set up i18next so it gets translations types from translation files with a little configurations.

  • @hamzamalik9735
    @hamzamalik973527 күн бұрын

  • @mmohamedfariz7814
    @mmohamedfariz781427 күн бұрын

    Your Video are Good. need a video for testing in react

  • @orangvaik
    @orangvaik26 күн бұрын

    in this tutorial string data is static, what about string data which is dynamic like data from a database?

  • @kaluczadzsi
    @kaluczadzsi26 күн бұрын

    I would like to get More TS + React projects from scratch with tailwind or MUI

  • @hadeklte5312
    @hadeklte531227 күн бұрын

    I wonder How will it be for the data fetched from database like blog posts? It is a lots of work manually.

  • @beninip
    @beninip27 күн бұрын

    Great video! My question is, should I use the useTranslation hook the same way using typescript?

  • @dominikrodler8010

    @dominikrodler8010

    27 күн бұрын

    yes

  • @qitpess2660
    @qitpess266027 күн бұрын

    Good video. Regarding the library. This i18n is SO WRONG in the first place. The thing is that I should do so much manual work and the mistake possibility is so high. This is so frustrating. As a developer, I want to have a running service within the project that will generate those JSONs without me. For me, it would be convenient to write full text in English inside t("Hello world!") and for all supported languages it will be like { fr: { "Hello world!": null } } With the highlighting when the text in the component is changing. But no one seems to move in that direction.

  • @dominikrodler8010

    @dominikrodler8010

    27 күн бұрын

    You can. Set the createMissing config option or use i18next-scanner to extract and collect translations.

  • @qitpess2660

    @qitpess2660

    25 күн бұрын

    @@dominikrodler8010 Oh. Ok. Thank you very much :)

  • @JuanPabloGomez-cc6vm
    @JuanPabloGomez-cc6vm27 күн бұрын

    is this the same for a next js project?

  • @kale_bhai
    @kale_bhai27 күн бұрын

    So I need to create translation for every key on bunch of different languages.?

  • @NabilAlSayed01

    @NabilAlSayed01

    27 күн бұрын

    Yup

  • @MehdiDeveloper
    @MehdiDeveloper23 күн бұрын

    I noticed your tattoo - is it Farsi? It made me curious if you're Iranian. :))

  • @drrandom1259
    @drrandom125927 күн бұрын

    What if we want to separate different page translations too? Like I need an en.json for my home page and my settings page separatelly because there are tons of words in each page. Can I do nested objects inside my json file like en.json { "homePage":{ "welcomeText": "Hello!", }, "settingsPage":{ "title":"Settings page" } } And use it like this: { t("homePage.welcomeText") }??

  • @cosdensolutions

    @cosdensolutions

    26 күн бұрын

    Yeah! Check the docs there are also other ways to organize

  • @drrandom1259

    @drrandom1259

    26 күн бұрын

    @@cosdensolutions thanks! Will do

  • @tszhong0411
    @tszhong041127 күн бұрын

    What about SEO?

  • @okanbayulgen
    @okanbayulgen27 күн бұрын

    What if we want to change URL name. Thats not everything…

  • @davronmaxmudov3972
    @davronmaxmudov397227 күн бұрын

    CFBR

  • @DemanaJaire
    @DemanaJaire27 күн бұрын

    Out of curiosity, what's your native language?

  • @cosdensolutions

    @cosdensolutions

    26 күн бұрын

    Romanian

  • @DemanaJaire

    @DemanaJaire

    26 күн бұрын

    @@cosdensolutions I would have never guessed! Your English sounds so good. I once had a project manager from Romania (Andrei), and you sound nothing like him. 😅

  • @samiluludag5451
    @samiluludag545127 күн бұрын

    Dude, you should read the documentation better. Use Trans with components prop.

  • @MrSeredan
    @MrSeredan18 күн бұрын