패키지, 저장소 및 앱 카테고리 검색

패키지 상세v0.4.1

intl_generator

국제화/현지화된 메시지, 날짜 및 숫자 형식 지정 및 분석, 양방향 텍스트 및 기타 국제화 문제를 처리하기 위한 코드를 포함합니다.

AndroidiOSmacOSWindowsLinux
30일 다운로드
1.6천
좋아요
25
Pub 점수
110

패키지 설치

flutter pub add intl_generator

패키지 개요

공개 정보를 바탕으로 생성한 선택 가이드입니다.

intl_generator 패키지는 Flutter 앱에서 국제화를 처리하기 위한 코드 생성 도구를 제공합니다. 로컬라이즈된 메시지, 날짜 및 숫자 형식 지정, 파싱, 양방향 텍스트 렌더링을 지원합니다. 메시지 파일에서 Dart 코드를 생성함으로써 런타임 오버헤드 없이 효율적이고 타입 안전한 로컬라이제이션을 가능하게 합니다. 이 패키지는 intl 라이브러리와 원활하게 통합되어 여러 언어 및 플랫폼 간 번역 관리를 쉽게 만듭니다.

사용 사례

  • .arb 파일에서 로컬라이즈된 문자열 생성
  • 로케일별 날짜 및 숫자 형식 지정
  • 오른쪽에서 왼쪽으로 쓰는 언어 지원
  • 다국어 앱 콘텐츠 관리
  • 번역 워크플로우 자동화

주요 기능

  • ARB 파일에서 코드 생성
  • 유형 안전한 로컬라이제이션
  • 복수형 지원 내장
  • intl 라이브러리와의 통합
  • 플랫폼에 관계없는 로컬라이제이션

적합한 대상

  • 글로벌 대상 사용자를 위한 플러터 앱
  • 다국어 번역을 관리하는 팀
  • 고성능 로컬라이제이션을 요구하는 프로젝트
  • 메시지 관리에 ARB를 사용하는 개발자
  • 일관된 날짜/숫자 형식이 필요한 앱

고려 사항

  • ARB 파일 설정이 필요합니다
  • 코드 생성을 위한 빌드 단계 필요
  • 제한된 런타임 사용자 지정
  • intl 라이브러리에 의존합니다
  • 동적 언어 전환에 적합하지 않습니다

원본 README

연결된 소스 저장소의 README 원문 스냅샷입니다. 최신 내용은 저장소에서 확인하세요.

Intl_generator

This is a fork of intl_translation to have an up to date version.

If you prefer having translations as part of your build_runner process or need to support flavors, please check intl_flavors

This package provides message extraction and code generation from translated messages for the Intl package. It's a separate package so as to not require a dependency on analyzer for all users.

Extracting And Using Translated Messages

When your program contains messages that need translation, these must be extracted from the program source, sent to human translators, and the results need to be incorporated.

To extract messages, run the extract_to_arb.dart program.

  pub run intl_generator:extract_to_arb --output-dir=target/directory
      my_program.dart more_of_my_program.dart

This will produce a file intl_messages.arb with the messages from all of these programs. This is an ARB format file which can be used for input to translation tools like Localizely or (the deprecated) Google Translator Toolkit. The resulting translations can be used to generate a set of libraries using the generate_from_arb.dart program.

This expects to receive a series of files, one per locale.

pub run intl_generator:generate_from_arb --generated-file-prefix=<prefix>
    <my_dart_files> <translated_ARB_files>

This will generate Dart libraries, one per locale, which contain the translated versions. Your Dart libraries can import the primary file, named <prefix>messages_all.dart, and then call the initialization for a specific locale. Once that's done, any Intl.message calls made in the context of that locale will automatically print the translated version instead of the original.

import "my_prefix_messages_all.dart";
...
initializeMessages("dk").then(printSomeMessages);

Once the Future returned from the initialization call completes, the message data is available.

카테고리

의존성

의존성 목록 7 개

소스 저장소

이 패키지를 사용하는 프로젝트