mirror of
https://github.com/arsvendg/Stirling-PDF.git
synced 2026-07-14 10:34:06 +02:00
Change default language to en-US and add US language (#6621)
This commit is contained in:
@@ -16,7 +16,7 @@ Java forms the core of Stirling-PDF. When adding new features or handling errors
|
||||
2. **Use `try-with-resources`** when working with streams or other closable resources to ensure clean-up even on failure.
|
||||
3. **Return meaningful HTTP status codes** in controllers by throwing `ResponseStatusException` or using `@ExceptionHandler` methods.
|
||||
4. **Log with context** using the project’s logging framework. Include identifiers or IDs that help trace the issue.
|
||||
5. **Internationalise messages** by placing user-facing text in `messages_en_GB.properties` and referencing them with message keys.
|
||||
5. **Internationalise messages** by placing user-facing text in `messages_en_US.properties` and referencing them with message keys.
|
||||
|
||||
## JavaScript
|
||||
|
||||
@@ -55,11 +55,11 @@ except Exception as err:
|
||||
|
||||
## Internationalisation (i18n)
|
||||
|
||||
All user-visible error strings should be defined in the main translation file (`messages_en_GB.properties`). Other language files will use the same keys. Refer to messages in code rather than hard-coding text.
|
||||
All user-visible error strings should be defined in the main translation file (`messages_en_US.properties`). Other language files will use the same keys. Refer to messages in code rather than hard-coding text.
|
||||
|
||||
When creating new messages:
|
||||
|
||||
1. Add the English phrase to `messages_en_GB.properties`.
|
||||
1. Add the English phrase to `messages_en_US.properties`.
|
||||
2. Reference the message key in your Java, JavaScript, or Python code.
|
||||
3. Update other localisation files as needed.
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ Fork Stirling-PDF and create a new branch out of `main`.
|
||||
- Use hyphenated format: `pl-PL` (not underscore)
|
||||
|
||||
2. Copy the reference translation file:
|
||||
- Source: `frontend/editor/public/locales/en-GB/translation.toml`
|
||||
- Source: `frontend/editor/public/locales/en-US/translation.toml`
|
||||
- Destination: `frontend/editor/public/locales/pl-PL/translation.toml`
|
||||
|
||||
3. Translate all entries in the TOML file
|
||||
@@ -47,10 +47,10 @@ ignore = [
|
||||
## Add New Translation Tags
|
||||
|
||||
> [!IMPORTANT]
|
||||
> If you add any new translation tags, they must first be added to the `en-GB/translation.toml` file. This ensures consistency across all language files.
|
||||
> If you add any new translation tags, they must first be added to the `en-US/translation.toml` file. This ensures consistency across all language files.
|
||||
|
||||
- New translation tags **must be added** to `frontend/editor/public/locales/en-GB/translation.toml` to maintain a reference for other languages.
|
||||
- After adding the new tags to `en-GB/translation.toml`, add and translate them in the respective language file (e.g., `pl-PL/translation.toml`).
|
||||
- New translation tags **must be added** to `frontend/editor/public/locales/en-US/translation.toml` to maintain a reference for other languages.
|
||||
- After adding the new tags to `en-US/translation.toml`, add and translate them in the respective language file (e.g., `pl-PL/translation.toml`).
|
||||
- Use the scripts in `scripts/translations/` to validate and manage translations (see `scripts/translations/README.md`)
|
||||
|
||||
Make sure to place the entry under the correct language section. This helps maintain the accuracy of translation progress statistics and ensures that the translation tool or scripts do not misinterpret the completion rate.
|
||||
|
||||
Reference in New Issue
Block a user