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

패키지 상세v0.0.7

localized_rich_text

RichText의 로컬라이제이션을 용이하게 하는 플러터 플러그인

AndroidiOSWeb
30일 다운로드
971
좋아요
7
Pub 점수
140

패키지 설치

flutter pub add localized_rich_text

패키지 개요

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

RichText 위젯의 로컬라이제이션을 단순화하기 위해 설계된 플러터 플러그인으로, 자리 표시자와 서식이 지정된 문자열을 지원하여 동적이고 로컬라이즈된 텍스트 콘텐츠를 가능하게 합니다. 개발자가 다국어 리치 텍스트를 효율적으로 관리하고 플랫폼 간 일관된 번역을 보장할 수 있습니다. 이 패키지는 플러터의 로컬라이제이션 시스템과 원활하게 통합되며 Android, iOS 및 웹을 지원합니다. 다양한 언어로 복잡하고 스타일이 적용된 텍스트가 필요한 앱에 특히 유용합니다.

사용 사례

  • 플레이스홀더를 사용한 리치 텍스트 로컬라이제이션
  • 다국어 앱 콘텐츠 지원
  • 다른 언어에서의 동적 텍스트 형식 지정
  • Flutter의 로컬라이제이션 시스템과의 통합
  • 다양한 로케일에서 스타일 텍스트 표시

주요 기능

  • 로컬라이즈된 리치 텍스트에서 자리 표시자 지원
  • Flutter 로컬라이제이션과의 원활한 통합
  • 다국어 간 형식화된 텍스트 처리
  • 크로스 플랫폼 호환성 (Android, iOS, Web)
  • 풍부한 텍스트 로컬라이제이션을 위한 간단한 API

적합한 대상

  • 다국어 리치 텍스트 콘텐츠를 갖춘 앱
  • Flutter의 로컬라이제이션 프레임워크를 사용하는 개발자
  • 동적 텍스트 형식 지정이 필요한 프로젝트
  • 대규모 번역을 관리하는 팀
  • 일관된 UI 로컬라이제이션을 필요로 하는 웹 및 모바일 애플리케이션

고려 사항

  • Flutter 로컬라이제이션의 올바른 설정이 필요합니다
  • 풍부한 텍스트 시나리오에 한정
  • 정확한 번역 파일 구조에 따라 달라집니다
  • 복잡한 중첩 위젯에 대해 추가 처리가 필요할 수 있습니다
  • 리치 텍스트가 아닌 콘텐츠에 적합하지 않습니다

원본 README

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

A flutter plugin to facilitate the localization of a RichText.

Getting started

Install the library in your pubspec.yaml.

dependencies:
  localized_rich_text: ^0.0.7

Usage

final textToLocalize = "Hi #name, how are you?";
final userName = "Jhon";

final textSpanProperties = TextSpanProperties(
    recognizer: TapGestureRecognizer()
      ..onTap = () {
        //Do something
      },
  );
...
LocalizedRichText(
  text: textToLocalize,
  defaultTextStyle: Theme.of(context).textTheme.bodyText1!,
  keys: [
    LocalizedRichTextKey(
      key: '#name',
      value: userName,
      textStyle: Theme.of(context).textTheme.subtitle1!,
      textSpanProperties: textSpanProperties,
    ),
  ],
)

Parameters explanation

text

This must be the String to localize.
The dynamic values inside the text have to be unique, you can mark them with a special character, or you can use a unique value.

The string could be:

final textToLocalize = "Hi #name, how are you?";

or

AppLocalizations.of(context)!.title,

For more info about internationalization you can check the flutter documentation.

defaultTextStyle

This is the TextStyle used for the static words.

keys

This is the List that has to contain the dynamic values.
Each dynamic value has to be passed like an LocalizedRichTextKey object.
This list cannot be empty.

The keys will be ordered by the order in which they are been inserted in the String to localize.
This means that the order in which you pass the keys inside the keys array isn't important.

LocalizedRichText(
  ...,
  keys: [
    LocalizedRichTextKey(
      key: '#name',
      value: userName,
      textStyle: Theme.of(context).textTheme.subtitle1!,
    ),
  ],
)

카테고리

소스 저장소

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

아직 데이터가 없습니다.