Тёмный

React i18next (Complete Tutorial) 

Cosden Solutions
Подписаться 106 тыс.
Просмотров 19 тыс.
50% 1

🚀 Project React → cosden.solutio...
📥 Import React (Newsletter) → cosden.solutio...
Source Code → github.com/cos...
Join The Discord! → discord.cosden...
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.

Опубликовано:

 

2 окт 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 64   
@i.hate.artists
@i.hate.artists 3 месяца назад
Brother, do you understand that you are the GOAT of React tutorials?
@nin9code
@nin9code 10 дней назад
We do
@dominikrodler8010
@dominikrodler8010 3 месяца назад
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.
@orangvaik
@orangvaik 3 месяца назад
in this tutorial string data is static, what about string data which is dynamic like data from a database?
@VersionSix-su2dp
@VersionSix-su2dp 29 дней назад
How it good of the you already specific the data on which language is in convert what is that , example Welcom - helo I am developer. To - you also write his translate value so what he do. I want something like if I give the value translation and give it the language it automatically converts to the languages not specified the convert language value
@АлександрПрошанов
Thank you for helping us to get into new instruments without having to waddle through infinite docs. Immense gratitude from the whole react-junior community
@tomeski1072
@tomeski1072 Месяц назад
Don't forget, that my bro is fluent in French, and he's very proud of it!
@izaias469
@izaias469 3 месяца назад
you can use the trans component like this with html tags or components with variables and html tags or components
@namesare4fools
@namesare4fools Месяц назад
best tutorial for useful libraries that most people didnt cover. you earn my sub!
@kaluczadzsi
@kaluczadzsi 3 месяца назад
I would like to get More TS + React projects from scratch with tailwind or MUI
@codeaz5673
@codeaz5673 6 дней назад
thank u sir. But you haven't show how to change lang dynamically
@clementinaodinakachukwu1756
@clementinaodinakachukwu1756 29 дней назад
Welldone bro. You're God's sent. I tried clicking that link for the project react, seems its broken. It keeps saying cosden refused to connect.
@serdotsenko
@serdotsenko 2 месяца назад
Thank you Bro! very useful, but do time-codes pls for the future video
@davronmaxmudov3972
@davronmaxmudov3972 3 месяца назад
CFBR
@toniwincent6653
@toniwincent6653 16 дней назад
Amazing tutorial. Thank you!
@MehdiDeveloper
@MehdiDeveloper 3 месяца назад
I noticed your tattoo - is it Farsi? It made me curious if you're Iranian. :))
@kale_bhai
@kale_bhai 3 месяца назад
So I need to create translation for every key on bunch of different languages.?
@NabilAlSayed01
@NabilAlSayed01 3 месяца назад
Yup
@qitpess2660
@qitpess2660 3 месяца назад
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 3 месяца назад
You can. Set the createMissing config option or use i18next-scanner to extract and collect translations.
@qitpess2660
@qitpess2660 3 месяца назад
@@dominikrodler8010 Oh. Ok. Thank you very much :)
@nogafouz2174
@nogafouz2174 6 дней назад
thanks best tutorial👍
@AndreiTornyai
@AndreiTornyai Месяц назад
thank you good summary of the capabilities of i18n
@sylum3
@sylum3 3 месяца назад
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
@CLeovison 3 месяца назад
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
@Edgars82 3 месяца назад
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.
@rushikeshgandhmal
@rushikeshgandhmal 3 месяца назад
Hey man, thanks a lot. Helped me a lot. You are always best at explaining concepts.
@ivan4486
@ivan4486 3 месяца назад
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.
@hadeklte5312
@hadeklte5312 3 месяца назад
I wonder How will it be for the data fetched from database like blog posts? It is a lots of work manually.
@okanbayulgen
@okanbayulgen 3 месяца назад
What if we want to change URL name. Thats not everything…
@BrantK147
@BrantK147 3 месяца назад
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.
@haribo_player-too5141
@haribo_player-too5141 3 месяца назад
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
@amithm4010
@amithm4010 12 дней назад
how to use this outside the component?????????????
@cosdensolutions
@cosdensolutions 12 дней назад
Import i18n directly and do i18n.t()
@Kimi-xp2th
@Kimi-xp2th Месяц назад
So is this like Google translate? How accurate are the translations?
@cosdensolutions
@cosdensolutions Месяц назад
oh no, you add your own translations. So it's as accurate as your translator/yourself!
@Kimi-xp2th
@Kimi-xp2th Месяц назад
@cosdensolutions my bad. I commented before watching the vid. Lol. I'll try using this in my next project because with my previous one I used a custom made object for multiple languages and when I switched languages in the app it worked on my local host but after deploying the website on netlify apparently the switch doesn't work for some reason.
@mmohamedfariz7814
@mmohamedfariz7814 3 месяца назад
Your Video are Good. need a video for testing in react
@leroviten
@leroviten 3 месяца назад
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
@ElNicopewpew 3 месяца назад
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!
@bastiendufour3841
@bastiendufour3841 3 месяца назад
I am fluent in French too ! Awesome
@JuanPabloGomez-cc6vm
@JuanPabloGomez-cc6vm 3 месяца назад
is this the same for a next js project?
@dmnd2806
@dmnd2806 2 месяца назад
Your vids are really great keep it up
@MrSeredan
@MrSeredan 3 месяца назад
@giandenorte
@giandenorte 3 месяца назад
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?
@mnhtada12
@mnhtada12 3 месяца назад
Thank you so much for this video
@beninip
@beninip 3 месяца назад
Great video! My question is, should I use the useTranslation hook the same way using typescript?
@dominikrodler8010
@dominikrodler8010 3 месяца назад
yes
@turgunov28
@turgunov28 3 месяца назад
thanks bro for amazing contents ✊🏻
@tszhong0411
@tszhong0411 3 месяца назад
What about SEO?
@drrandom1259
@drrandom1259 3 месяца назад
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 3 месяца назад
Yeah! Check the docs there are also other ways to organize
@drrandom1259
@drrandom1259 3 месяца назад
@@cosdensolutions thanks! Will do
@subhamchakraborty152
@subhamchakraborty152 3 месяца назад
Excited to learn something new 😁
@ravisankarp61
@ravisankarp61 3 месяца назад
Thank You.
@asandratrynyavojohanesa462
@asandratrynyavojohanesa462 3 месяца назад
Excellente vidéo mon ami
@DemanaJaire
@DemanaJaire 3 месяца назад
Out of curiosity, what's your native language?
@cosdensolutions
@cosdensolutions 3 месяца назад
Romanian
@DemanaJaire
@DemanaJaire 3 месяца назад
@@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. 😅
@jfr-001
@jfr-001 2 месяца назад
Bon tutoriel, il y a tout ce qu'il faut
@cosdensolutions
@cosdensolutions 2 месяца назад
content de l'entendre!
@hamzamalik9735
@hamzamalik9735 3 месяца назад
@samiluludag5451
@samiluludag5451 3 месяца назад
Dude, you should read the documentation better. Use Trans with components prop.
Далее
React Testing with Playwright (Complete Tutorial)
32:45
The Most Important Design Pattern in React
35:04
Просмотров 59 тыс.
Being Competent With Coding Is More Fun
11:13
Просмотров 85 тыс.
Why You Shouldn't Nest Your Code
8:30
Просмотров 2,7 млн
`const` was a mistake
31:50
Просмотров 136 тыс.
Compound Components in React (Design Patterns)
18:21
Просмотров 41 тыс.
You might not need useEffect() ...
21:45
Просмотров 162 тыс.
This might change how we build UI forever
15:14
Просмотров 131 тыс.