https://github.com/masreplay/l10n_lint
Add flutter_localizations with on command (l10n --init)
https://github.com/masreplay/l10n_lint
cli dart easy flutter intl l10n lint localizations
Last synced: 6 months ago
JSON representation
Add flutter_localizations with on command (l10n --init)
- Host: GitHub
- URL: https://github.com/masreplay/l10n_lint
- Owner: masreplay
- License: other
- Created: 2024-04-16T10:54:08.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-04-09T12:11:33.000Z (6 months ago)
- Last Synced: 2025-04-09T12:21:59.694Z (6 months ago)
- Topics: cli, dart, easy, flutter, intl, l10n, lint, localizations
- Language: Dart
- Homepage: https://pub.dev/packages/l10n_lint
- Size: 295 KB
- Stars: 4
- Watchers: 1
- Forks: 3
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# l10n_lint
The `l10n_lint` package provides linting rules for Flutter localization. It helps you check if localization is initialized correctly and find string literals that should be localized.
## Features
- Cli init, sort and get unused value
- Linting rules to ensure correct initialization of localization.
- Detection of string literals that should be localized.## Getting started
To start using the `l10n_lint` package, make sure you have the following prerequisites:
Flutter SDK is installed on your machine.To install the `l10n_lint` cli and , run the following command:
```sh
dart pub global activate l10n_lint
```# Use Init Flutter localization
```bash
l10n --init
```
- create l10n.yaml file
- create lib/l10n folder
- create lib/l10n/app_en.arb file
- write file content
- add intl and flutter_localizations to pubspec.yaml## Usage other command
use:```sh
l10n [arguments]
-h, --help Print this usage information.
-v, --verbose Show additional command output.
-s, --sort Sort the ARB files alphabetically.
-u, --[no-]remove-unused Remove unused translations from the ARB file
-i, --init Initialize the l10n tool.
--version Print the tool version.
```## Use lint
To add `l10n_lint` to your Flutter project, follow these steps:
1. Open your project's `pubspec.yaml` file.
2. Add `l10n_lint` as a dev dependency:```yaml
dev_dependencies:
flutter_lints: ^3.0.0
custom_lint:
l10n_lint:
```3. In `analysis_options.yaml` add
```yaml
include: package:flutter_lints/flutter.yamlanalyzer:
plugins:
- custom_lint
```## TODO
- [x] show number of deleted keys when run `l10n unused`
- [ ] add test