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

패키지 상세v6.0.0

i18n_extension_core

Dart 전용 번역 및 국제화(i18n) 패키지, Dart 확장 기능 포함. 대규모 및 소규모 프로젝트 모두 사용하기 쉬움.

AndroidiOSLinuxmacOSWebWindows
30일 다운로드
6.9만
좋아요
5
Pub 점수
140

패키지 설치

flutter pub add i18n_extension_core

패키지 개요

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

Flutter 앱에서 번역 및 국제화를 단순화하기 위한 Dart 전용 패키지입니다. 최소한의 뼈대 코드로 로컬라이제이션을 쉽게 만들 수 있도록 직관적인 Dart 확장 기능을 제공합니다. 소규모 및 대규모 프로젝트 모두에 적합하며, Android, iOS, 웹, 데스크톱 등 다양한 플랫폼을 지원합니다. 간단한 문법과 구조화된 키-값 쌍을 사용하여 개발자가 번역을 효율적으로 관리할 수 있게 해주며, 현지화된 문자열의 가독성과 유지보수성을 향상시킵니다.

사용 사례

  • 간단한 앱 로컬라이제이션
  • 대규모 다국어 애플리케이션
  • 크로스 플랫폼 플러터 앱
  • 동적 문자열 형식 지정
  • 기존 코드베이스와의 간편한 통합
  • 번역과 함께하는 빠른 프로토타이핑

주요 기능

  • 간결한 구문을 위한 Dart 확장
  • 최소 설정 및 뼈대 코드
  • 플랫폼에 관계없는 번역을 지원합니다
  • 내장 문자열 보간
  • 확장 가능한 키-값 번역 시스템
  • 경량이고 빠름

적합한 대상

  • i18n 초보자인 Flutter 개발자
  • 여러 언어를 관리하는 팀
  • 빠른 현지화가 필요한 프로젝트
  • 순수한 Dart 솔루션을 선호하는 개발자
  • 글로벌 대상 사용자를 위한 앱
  • 소규모에서 기업 수준의 앱

고려 사항

  • 번역 관리용 내장 UI 없음
  • 수동 번역 파일 유지 관리 필요
  • 완전한 프레임워크에 비해 IDE 지원이 제한적
  • 추가 로직 없이 런타임 언어 전환에 적합하지 않음
  • 번역 파일 생성 도구를 포함하지 않습니다
  • 키에 일관된 이름 규칙을 사용할 때 가장 효과적입니다

원본 README

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

pub package

i18n_extension_core

This is the core Dart-only package for the i18n_extension package.

In your Flutter app:

  • Do NOT include this core package directly.

    Instead, go to the i18n_extension package which already exports this core code, plus provides Flutter related code like the I18n widget that you must use to wrap your widget tree.

In your Dart server or Dart-only code:

  • If you are working on a Dart server-side application (backend) using frameworks such as Serverpod, Dart Frog, or Shelf, or developing a Dart-only package that does not rely on Flutter, you can use this package directly.:

    import 'package:i18n_extension_core/i18n_extension_core.dart';
    
    extension Localization on String {
      static var t = Translations.byText("en_us") + {"en_us":"Hello", "pt_br":"Hola"};
      String get i18n => localize(this, t);
    }
    
    DefaultLocale.set("es_ES");
    expect("Hello".i18n, "Hola");
    

    Note: One key use case is translating exception messages from the backend to the frontend. For example, if the backend throws an exception like: MyException('The password you typed is invalid'.i18n) it will automatically appear on the frontend as: MyException('La contraseña que ingresaste no es válida') if the user's device language is set to Spanish.

Documentation

Go to i18n_extension to read the docs.

There are only 2 differences when using this package directly:

  • Here you don't have access to the I18n widget, which is a Flutter widget.

  • The way to set the default locale is different. Instead of using the I18n widget, you must use the DefaultLocale.set() static method, like in the example above.


By Marcelo Glasberg

glasberg.dev
github.com/marcglasberg
linkedin.com/in/marcglasberg/
twitter.com/glasbergmarcelo
stackoverflow.com/users/3411681/marcg
medium.com/@marcglasberg

My article in the official Flutter documentation:

The Flutter packages I've authored:

My Medium Articles:

카테고리

의존성

의존성 목록 1 개

소스 저장소

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

순위