Flutter ARB(App Resource Bundle) 파일의 번역 프로세스를 간소화하기 위해 설계된 명령줄 도구입니다. 로컬라이즈된 문자열의 추출 및 관리를 자동화하여 개발자와 번역가가 다국어 콘텐츠를 효율적으로 처리할 수 있도록 합니다. 기존의 Flutter 워크플로우와 통합되어 여러 언어 간 번역 유지에 필요한 수작업을 줄여줍니다. 이 도구는 다양한 플랫폼을 지원하며, Android, iOS, macOS, Windows, Linux 앱에서 일관된 현지화를 보장합니다.
사용 사례
ARB 파일 번역 자동화
다국어 앱 개발 간소화
CI/CD 파이프라인과의 통합
대규모 현지화 프로젝트 관리
수동 문자열 추출 오류 감소
주요 기능
명령줄 인터페이스
ARB 파일 자동화
다중 언어 지원
크로스 플랫폼 호환성
Flutter 워크플로우와의 간편한 통합
적합한 대상
번역을 관리하는 Flutter 개발자
ARB 파일과 함께 작업하는 로컬라이제이션 팀
국제화를 위해 CI/CD를 사용하는 팀
자주 언어 업데이트가 필요한 프로젝트
고려 사항
명령줄에 익숙해야 합니다
외부 번역 서비스에 의존
사용자 지정 워크플로에 대한 구성이 필요할 수 있습니다
제한된 GUI 지원
명확한 번역 프로세스를 갖춘 팀 환경에서 가장 효과적으로 사용됩니다
원본 README
연결된 소스 저장소의 README 원문 스냅샷입니다. 최신 내용은 저장소에서 확인하세요.
Flutter ARB Translator
A command line tool which simplifies translation of Flutter ARB files. You can simply choose a service from supported list: Azure Cognitive Services, Yandex, Google Cloud, DeepL and flexibly adjust translation options. Get it on pub.dev
Installing
Add flutter_arb_translator to your dev_dependencies:
dev_dependencies:flutter_arb_translator:^1.0.28
Example
Using this package you can translate ARB files which contain annotations, plurals and placeholders. For example, translation of this file:
{"appName":"Demo app","pageHomeTitle":"Welcome {firstName}","@pageHomeTitle":{"description":"Welcome message on the Home screen","placeholders":{"firstName":{"type":"String","example":"John Doe"}}},"pageHomeInboxCount":"{count, plural, zero{You have no new messages} one{You have 1 new message} other{You have {count} new messages}}","@pageHomeInboxCount":{"description":"New messages count on the Home screen","placeholders":{"count":{}}},"pageHomeBirthday":"{sex, select, male{His birthday} female{Her birthday} other{Their birthday}}","@pageHomeBirthday":{"description":"Birthday message on the Home screen","placeholders":{"sex":{}}}}
to Spanish will look like this (exact text depends on selected translation API):
{"appName":"Aplicación de demostración","pageHomeTitle":"Bienvenidos {firstName}","@pageHomeTitle":{"description":"Welcome message on the Home screen","placeholders":{"firstName":{"type":"String","example":"John Doe"}}},"pageHomeInboxCount":"{count, plural, zero{No tienes mensajes nuevos} one{Tienes 1 mensaje nuevo} other{Has {count} nuevos mensajes}}","@pageHomeInboxCount":{"description":"New messages count on the Home screen","placeholders":{"count":{}}},"pageHomeBirthday":"{sex, select, male{Su cumpleaños} female{Su cumpleaños} other{Su cumpleaños}}","@pageHomeBirthday":{"description":"Birthday message on the Home screen","placeholders":{"sex":{}}}}
Guide
Set up the configuration file
In your project root directory create a dev_assets folder and create flutter_arb_translator_config.json there. The content of file contains optional JSON objects, see the full file example:
Optional JSON objects means that if you are going to use Azure translation service - only AzureCognitiveServices block is required in configuration file while YandexCloud, GoogleCloud, AmazonTranslate and DeepL objects can be dismissed.
Set up translation service configuration
Azure
Azure Cognitive Services translation service uses Subscription Key for authorization in Azure API. See how to create or find your Subscription key here. Once you got it, put it into dev_assets/flutter_arb_translator_config.jsonAzureCognitiveServices JSON object so it looks like:
Yandex translation service uses API key for authorization in Yandex API. See here how to create an API key. Once you got it, put it into dev_assets/flutter_arb_translator_config.jsonYandexCloud JSON object so it looks like:
{"YandexCloud":{"APIKey":"********************"}}
Google Cloud
Google Cloud translation service uses Service Account for authorization in Google Cloud API. You will need to create a new account or use existing one and export it's Private Key in JSON format. Then put project_id, private_key and client_email into dev_assets/flutter_arb_translator_config.jsonGoogleCloud object so it looks like:
DeepL translation service uses Api Key for authorization in DeepL API. You will need to create a new DeepL account here or use existing one. Once you got it, put API key into dev_assets/flutter_arb_translator_config.jsonDeepL JSON object so it looks like:
If you are going to use free DeepL API key update the Url value of DeepL configuration. You can also specify GlossaryId which will be passed to the API in order to prevent translation of specific terms (e.g., brand names).
Amazon Translate
Amazon Translate translation service uses access keys for authorization in Amazon API. See here how to create an access key. Once you got it, put it into dev_assets/flutter_arb_translator_config.jsonAmazonTranslate JSON object so it looks like:
LibreTranslate translation service uses ApiKey authorization in LibreTranslate API. Api Key is optional because you can run self-hosted version of libretranslate. See here on how to set it up. Once it's configured, you need to put API URL and optional Api Key into dev_assets/flutter_arb_translator_config.jsonLibreTranslate JSON object so it looks like:
OpenAI translation service uses API key authorization for authorization in OpenAI API. You can create a new OpenAI account here or use existing one. Once you got it, put API key into dev_assets/flutter_arb_translator_config.jsonOpenAI JSON object, so it looks like:
Note, that you can also specify model which should be used for translation.
Usage
Assuming you store ARB files in lib/l10n folder and want to translate app_en.arb into Spanish and Italian using Azure Cognitive Services translator. Run the following command:
flutter pub run flutter_arb_translator:main --from en --to es --to it --service azure
When command will complete, it will write lib/l10n/app_es.arb and lib/l10n/app_it.arb files containing translation. That's it, if you want to see all available options type flutter pub run flutter_arb_translator:main -h
Command Line Options
Option
Description
dir
(optional) Directory containing .arb files. By default it is set to lib/l10n
service
(required) Translation service which will be used. [azure, yandex, google, deepl, amazon, libtrans, openai]
from
(required) Main language, ARB will be translated from this language to targets. Example usage: --from en
to
(required) List of languages to which ARB should be translated. At least 1 language required. Example usage: --to es,pt or --to es --to pt
key
(optional) If defined, only items with given keys will be translated. Example usage: -k key1 -k key2
ignore
(optional) If defined, items with given keys will be skipped from translation. Example usage: --ignore key1,key2
override
(optional) If true and if ARB file with defined target language already exist all items will be replaced with new translation. Otherwise, they will be not modified. By default it is set to false
interactive
(optional) You will be prompted before applying translation. By default it is set to false
translate-equal
(optional) If true and if ARB file with defined target language contains entry which is equal to source ARB file entry it will be translated. By default it is set to false
prefix
(optional) The file prefix to be used to find the file. By default it is set to app