This repository demonstrates the implementation of internationalization (i18n) in a web application, where language data is fetched asynchronously from an API and stored in a database instead of using traditional language files. The goal is to showcase a more dynamic and scalable approach to managing language translations.
-
Async Fetch Languages: The web application fetches language data asynchronously from a language API, enabling real-time updates and new language additions without modifying the application's source code.
-
Database Storage: Instead of using static language files, language data is stored in a database (e.g., MongoDB, MySQL, PostgreSQL), allowing easy management and manipulation of translations.
-
Localization Support: The application supports multiple languages and locales, making it more accessible and user-friendly for a global audience.
-
Dynamic Content Update: Users can switch between languages without the need to refresh the page, as the translations are dynamically updated through async API calls.
-
Clone this repository to your local machine:
git clone https://github.com/your_username/i18n-database-async-fetch.git cd i18n-database-async-fetch
-
Install the required dependencies:
npm install
-
Set up the database connection in the configuration file (e.g.,
config.js
), providing necessary details like host, port, username, and password. -
Set up the language API endpoint in the configuration file, specifying the URL to fetch language data.
-
Create the necessary database tables or collections to store language data.
-
Start the web application:
npm start
-
Access the application in your web browser at
http://localhost:3000
. -
Explore the application and switch between different languages using the language selector.
-
Observe how the language data is fetched asynchronously from the language API and stored in the database.
Contributions to this project are welcome. If you find any issues or have suggestions for improvements, feel free to create a pull request.