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

Multi-language support | Internationalization #346

Open
Th3Ph4nt0m opened this issue Feb 5, 2023 · 2 comments
Open

Multi-language support | Internationalization #346

Th3Ph4nt0m opened this issue Feb 5, 2023 · 2 comments
Labels
feature request An idea for a new feature. It's open if we are going to implement this or not. ui / ux

Comments

@Th3Ph4nt0m
Copy link
Contributor

Sharezone is currently only available in German. This not only limits the company to the German-speaking market, but also presents communication difficulties for exchange students and people with a migration background who do not yet have a sufficient command of German.

Sharezone should therefore be available in several languages. Flutter has an article on this in the documentation: XX.

To realize the translations, English should be added as the first new language. This way, people from all over the world can translate the app into "their language" from English. Software like Weblate is best suited for this. Possibly, Sharezone even falls under a free licence with such a provider (Weblate or similar), since the project is open source.

@Jonas-Sander Jonas-Sander added ui / ux feature request An idea for a new feature. It's open if we are going to implement this or not. labels Feb 8, 2023
@YazeedAlKhalaf
Copy link

I would like to help in localization, both Arabic and English.

I see you suggested Weblate, is it still recommended or shall we do it via GitHub only and using flutter_localizations directly and editing .arb files?

@nilsreichardt
Copy link
Member

We started to work that :) See #1798

nilsreichardt added a commit that referenced this issue Dec 29, 2024
This pull request introduces a new package, sharezone_localizations,
which provides a streamlined way of managing and accessing localized
strings in the Sharezone-App using Flutter’s internationalization
features. Below is an overview of the core additions:
	1.	New Package: sharezone_localizations
• README Documentation: Explains how to add, generate, and use
translatable strings.
• Internationalization Setup: Based on Flutter’s gen-l10n tooling,
enabling multiple locales and seamless code generation.
	2.	Locale Management
	•	`AppLocaleProvider`: Facilitates dynamic switching of app locales.
	3.	Usage Guidelines
• String Access: Via the context.sl extension, which simplifies
referencing keys from the .arb files.
• Adding/Updating Strings: Detailed steps on modifying .arb files,
including placeholder usage and recommended auto-translation tools.
	4.	Generating Localizations
• Flutter gen-l10n Command: Simple CLI approach to regenerate
localizations after .arb updates.
• VS Code Task: Option to run a dedicated VS Code Task (“Generate l10n
for sharezone_localizations”) for developers who prefer an IDE-based
workflow.

Overall, this package consolidates translation logic, enhances
maintainability by centralizing locale management, and simplifies how
developers interact with localized strings.

<img width="1552" alt="image"
src="https://github.com/user-attachments/assets/39c625b4-1f5d-437f-b1fb-3b6d2f81511a"
/>

Things, we need to do in future pull requests:
* #1799
* Write tests for language page
* Store locale in user document (the backend have to know the language
to send push notifications in the user's language)
* Replace hard-coded strings with l10n strings
* Remove old l10n files in `/app/l10n/`
* Document how to add new languages (copy `.arb` file, use
[`arb_translate`](https://pub.dev/packages/arb_translate), makes native
changes - `Info.plist` needs changed)
* Make sure that when system language is French, English is selected as
default


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

## Summary by CodeRabbit

- **New Features**
	- Introduced a language selection feature in the settings.
	- Added localization support for German and English languages.
- Implemented a `LanguagePage` for users to choose their preferred
language.
	- Enhanced localization management with a new `FeatureFlagl10n` class.
	- Integrated dynamic locale adjustment based on user preferences.
- Added a new `AppLocaleProvider` for managing application locale
settings.
- Established a structured localization framework with
`SharezoneLocalizations`.
- **Bug Fixes**
	- Enhanced state management for localization features.
- **Documentation**
- Added a comprehensive README for the `sharezone_localizations`
package.
- **Chores**
	- Updated `.gitignore` to manage ignored files more effectively.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

Part of #346

---------

Co-authored-by: nilsreichardt <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request An idea for a new feature. It's open if we are going to implement this or not. ui / ux
Projects
None yet
Development

No branches or pull requests

4 participants