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

Add sz l10n command to our repo CLI #1799

Open
nilsreichardt opened this issue Dec 22, 2024 · 0 comments
Open

Add sz l10n command to our repo CLI #1799

nilsreichardt opened this issue Dec 22, 2024 · 0 comments

Comments

@nilsreichardt
Copy link
Member

The sz l10n should the same as the following VS Code:

{
    // See https://go.microsoft.com/fwlink/?LinkId=733558
    // for the documentation about the tasks.json format
    "version": "2.0.0",
    "tasks": [
        {
            // This task generates the l10n files for the
            // sharezone_localizations.
            //
            // FVM is required to run this task.
            "label": "Generate l10n for sharezone_localizations",
            "type": "shell",
            // We also format the files after generating the l10n files because
            // the generated files use a different formatting style than the
            // rest of the project.
            "command": "fvm flutter gen-l10n && fvm dart format .",
            "options": {
                "cwd": "${workspaceFolder}/lib/sharezone_localizations"
            },
            "problemMatcher": []
        }
    ]
}
@github-project-automation github-project-automation bot moved this to Needs triage in Triage Dec 22, 2024
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
Projects
Status: Needs triage
Development

No branches or pull requests

1 participant