Translations 모듈
The translations module (@backstage/cli-module-translations)은 번역 메시지를 내보내고 가져오기 위한 명령을 제공하며, Backstage 앱의 국제화 워크플로를 지원합니다.
출처: 문서
본문
The translations module (@backstage/cli-module-translations)은 번역 메시지를 내보내고 가져오기 위한 명령을 제공하며, Backstage 앱의 국제화 워크플로를 지원합니다. 번역 워크플로에 대한 자세한 내용은 Internationalization 문서를 참조하세요.
translations export
앱과 모든 프런트엔드 플러그인의 번역 메시지를 JSON 파일로 내보냅니다. 이 명령은 저장소 루트가 아닌 패키지 디렉터리 내에서 실행해야 합니다 (예: packages/app).
명령은 의존성 트리의 모든 TranslationRef 정의를 발견하고 TypeScript 타입 시스템을 사용해 기본 메시지를 추출한 다음 매니페스트와 함께 JSON 파일로 씁니다.
Usage: backstage-cli translations export [options]Options: --output <dir> Output directory for exported messages and manifest (default: "translations") --pattern <pattern> File path pattern for message files relative to the output directory, with {id} and {lang} placeholders (default: "messages/{id}.{lang}.json") -h, --help display help for command
예시 (Examples)
기본 설정으로 번역 내보내기:
cd packages/appyarn backstage-cli translations export
언어 기반 디렉터리 그룹화로 내보내기:
yarn backstage-cli translations export --pattern '{lang}/{id}.json'
translations import
번역된 JSON 파일에서 번역 리소스 연결 코드를 생성합니다. translations export가 만든 매니페스트와 번역된 메시지 파일을 읽고, 각 번역된 ref에 대한 TranslationResource 객체를 만드는 TypeScript 모듈을 생성합니다.
내보내기 중 사용된 파일 패턴은 매니페스트에 저장되며 import 명령이 자동으로 사용합니다.
Usage: backstage-cli translations import [options]Options: --input <dir> Input directory containing the manifest and translated message files (default: "translations") --output <path> Output path for the generated wiring module (default: "src/translations/resources.ts") -h, --help display help for command
예시 (Examples)
기본 설정으로 연결 코드 생성:
cd packages/appyarn backstage-cli translations import