This pull request introduces a language toggle feature that allows users to switch between English and French within the application. The changes enable dynamic loading of corresponding language files for the text area, enhancing the user experience for bilingual users.
Code Changes
HomePage Component
Introduced a state variable language to track the current language, initialized to English.
Added a toggleLanguage function to switch between English and French when the language text is clicked.
Passed the language state as a prop to the TextArea component.
Users can now toggle between English and French by clicking on the language text displayed on the home page. The text changes accordingly to reflect the selected language.
The TextArea dynamically loads words from the appropriate language JSON file based on the user's selection.
Pull Request Description
Overview
This pull request introduces a language toggle feature that allows users to switch between English and French within the application. The changes enable dynamic loading of corresponding language files for the text area, enhancing the user experience for bilingual users.
Code Changes
HomePage Component
language
to track the current language, initialized to English.toggleLanguage
function to switch between English and French when the language text is clicked.language
state as a prop to theTextArea
component.TextArea Component
useEffect
hook to dynamically import the correct JSON language file based on thelanguage
prop received fromHomePage
.User Interface Changes
Users can now toggle between English and French by clicking on the language text displayed on the home page. The text changes accordingly to reflect the selected language.
The TextArea dynamically loads words from the appropriate language JSON file based on the user's selection.
Before Toggle:
After Toggle: