클라우드 번역 서비스를 사용하여 ARB(App Resource Bundle) 파일의 번역을 자동화하도록 설계된 명령줄 도구입니다. 영문 ARB 파일을 여러 대상 언어로 변환함으로써 국제화 과정에서 수작업을 줄이고 로컬라이제이션 워크플로우를 간소화합니다. 다국어 Flutter 앱을 관리하는 개발자에게 이상적이며 기존 빌드 프로세스와 원활하게 통합되며 macOS, Windows, Linux에서 크로스 플랫폼 작동을 지원합니다. 이 도구는 외부 번역 API를 활용하여 높은 품질의 번역을 보장하면서 언어 파일 간 일관성을 유지합니다.
사용 사례
ARB 파일 번역 자동화
CI/CD 파이프라인과의 통합
다국어 Flutter 애플리케이션 지원
수동 번역 작업 부담 감소
대량 번역 업데이트
팀 간 언어 파일 동기화
주요 기능
API를 통한 클라우드 기반 번역
명령줄 인터페이스
크로스 플랫폼 호환성
ARB 파일 형식 지원
번역의 배치 처리
Flutter 로컬라이제이션 워크플로우와의 통합
적합한 대상
다중 언어를 관리하는 플러터 개발자
로컬라이제이션에 ARB를 사용하는 팀
번역을 위한 CI/CD 자동화
자주 번역 업데이트가 필요한 프로젝트
시간 절약을 위한 로컬라이제이션 도구를 찾는 개발자
고려 사항
번역 API 호출을 위해 인터넷 연결이 필요합니다
제3자 번역 서비스 품질에 따라 다름
고용량 사용 시 잠재적 비용
올바른 API 키 구성이 필요합니다
ARB 파일 형식으로 제한됨
사용자 지정 번역 공급자를 위해 추가 설정이 필요할 수 있습니다
원본 README
연결된 소스 저장소의 README 원문 스냅샷입니다. 최신 내용은 저장소에서 확인하세요.
Auto Translator
A command-line tool that simplifies translation of an ARB template file to selected languages. This package is designed to work seamlessly with the flutter_localizations and intl packages, Flutter's preferred internationalization approach.
Features
Seamless integration with flutter_localizations and intl packages.
Works with Google Cloud Translate & DeepL Translate.
Minimal quota usage.
Works with simple & complex ARB strings, conditions, and variables.
Uses placeholder examples for more accurate translations involving proper nouns and other unique cases.
Specify translator service and/or source language for individual target languages.
Support the developer
If you found this package useful, please consider contribuitng to it's continued development. Or just show the developer a little love & support. Every little bit helps!
Getting Started
1. Setup Translation Service(s)
Auto Translator supports Google Cloud Translate and DeepL out of the box. You may specify either one as your primary service in the l10n.yaml config file. If neither is provided, the default (Google) is used. You may also specify different translators on a per-language basis, as seen in Preferred Services.
If you are configuring only one service, you can save the API key in a file in the project root directory called translator_key or as a json map in translator_keys. If configuring both services, you must use the json map approach.
:warning: DO NOT publish your key file to Github or similar VCS.
If you do not have a Google Cloud Project with the Cloud Translation API enabled, follow the guide here.
DeepL Translate
If you do not have DeepL API access, follow DeepL's guide to creating an account and obtaining API access here
2. Add auto_translator to your project
Add auto_translator under dev_dependencies in pubspec.yaml
dev_dependencies:auto_translator:^2.3.6
3. Setup the config files
auto_translator uses the same config file as the intl package, Flutter's recommended package for internationalizing your app, as explained here.
If you have not already created the l10n.yaml file, do so now.
arb-dir:lib/l10ntemplate-arb-file:app_en.arboutput-localization-file:app_localizations.darttranslator:#Defaults to Google Translate.service:Googletargets:-es-ES-fr-ja
The first three parameters are used by intl as well as auto_translator. The translator section is specific to auto_translator.
The targets parameter is required and tells auto_translator which languages to translate the template file to. Available languages can be found here.
You can use 2-letter language codes and regional designations (en-US, en-GB, es-Es, etc.).
4. Run the package
Once configured, run the package from the command line.
flutter pub get
dart run auto_translator
All translations will be placed in the defined location and be compatible with flutter_localizations and intl.
Additional Usage
Placeholder Examples
Some translations are more accurate when using an example in place of a generic placeholder variable name. auto_translator now passes a placeholder's example if provided to ensure better quality translations.
To prevent unecessary Google Cloud Translate quota usage, messages that already exist in a target ARB file are not retranslated. You can force a translation by adding the force parameter to translator options in a message's metadata in the template file.
You can also tell the translator to ignore a particular message with the ignore tag.
"doNotTranslate":"DO NOT TRANSLATE THIS STRING!!!","@doNotTranslate":{"description":"...","translator":{"ignore":true}}
Preferred Templates
Sometimes, you may wish to specify a language that translates more accurately to a target than the language used in the template-arb-file. For that, you can provide a prefer-lang-templates map to specify a preferred source language to use as a template for any target language.
translator:# use es-ES template for fr translation ja for ko# all other translations will use [template-arb-file]prefer-lang-templates:fr:esko:ja
Preferred Services
As one service may outperform the other in a given language you may wish to specify a service an a per-language basis. This can be done by providing a prefer-service map in the config file.
translator:# use DeepL for tr and uk# all other translations will use the primary service# (presumably Google in this case)prefer-service:# capitilization does not matter for service nameDeepL:-tr-uk
Each API key must be provided in the key file (service name capitalization does not matter).
You can enable verbose output with the --verbose (-v) flag. This is especially helpful in pinpointing the cause of errors.
Alternate config file
By default, the config file is named l10n.yaml and is located in the project's root directory. You can pass in an alternate file path when running on the command line using the --config-file option.
Alternate key file
By default, auto_translator looks for keys in the project root at translator_keys or translator_key. You may specify a different location in the config file.