Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat, perf, ci, style: Enhancements to Localization, Server Configuration, and Code Clarity #572

Open
wants to merge 14 commits into
base: main
Choose a base branch
from

Conversation

MaverickTR
Copy link

This pull request introduces several enhancements across the project. It adds multi-language support for dynamic message display based on system language settings, improves server host configuration flexibility, and refactors code in several modules to enhance readability and maintainability. These changes aim to improve user experience, adaptability across different locales, and ensure cleaner code management.

Added Multi-Language Support:

Implemented a mechanism to detect the system language using environment variables (LANG, LC_ALL) on Linux and Unix-based systems. On Windows, the chcp command is used.
Supported languages include English, Turkish, Spanish, French, German, Chinese, and Japanese.
Translation JSON File:

Created a translations.json file containing translations for all supported languages.
The JSON file includes keys for various messages used in the script.

Translation Function:

Added a translate function to fetch the appropriate translation from the JSON file based on the detected system language.
The function uses jq to parse the JSON and retrieve the correct message.

Integrated Translations in Script:

Replaced hardcoded messages with calls to the translate function.
Ensured that all user-facing messages are translated according to the system language.
Example of Translated Messages:

Messages such as "Connected to L1 chain", "Waiting for L1 chain deployment data", and "Starting Fuel node" are now dynamically translated.

Improved User Experience:

Users will now see messages in their system's language, enhancing usability and accessibility.
- Integrated system language detection to determine the appropriate language for messages.
- Loaded translations from a JSON file based on the detected system language.
- Replaced echo statements with a translate function to fetch and display messages in the appropriate language.
- Added translations for English, Turkish, Chinese, Japanese, Spanish, German, and French.
…e server configuration

- Introduced dynamic HOST variable in app.ts to allow flexible server host configuration.
- Updated the server startup message to use the HOST environment variable.
- Ensured the server starts on the specified host from the environment variable, defaulting to 'localhost' if not set.
- Added HOST entries in the environment (.env) files.
…ation)

Updated the BlockEntity class to use const for transaction mapping, ensuring values are not reassigned elsewhere in the code. This improves code reliability and maintainability by preventing unintended mutations.
Refactored the ChainEntity creation method to streamline the assignment of chainID and chainData. This improves readability by using clear variable names and structured data flow, enhancing code maintainability.
@CLAassistant
Copy link

CLAassistant commented Sep 21, 2024

CLA assistant check
All committers have signed the CLA.

@MaverickTR MaverickTR force-pushed the main branch 2 times, most recently from 28af502 to 5f3b961 Compare September 21, 2024 03:58
@MaverickTR MaverickTR changed the title Enhancements to Localization, Server Configuration, and Code Clarity feat, perf, ci, style: Enhancements to Localization, Server Configuration, and Code Clarity Sep 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants