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

GitHub 저장소marcglasberg/i18n_extension_core

i18n_extension_core

i18n_extension 패키지용 핵심 Dart 전용 패키지입니다.

i18n_extension_core 프로젝트 이미지
스타
3
포크
0
최근 푸시(UTC)
2026. 9. 3.
프로젝트 상태
활성

원본 README

아래는 영문 원문 스냅샷입니다. 최신 내용은 GitHub에서 확인하세요.

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:

Marcelo Glasberg GitHub avatar
GitHub 작성자

Marcelo Glasberg ↗

Senior Software Engineer • AI • Full stack • Mobile • Web • https://glasberg.dev

San Francisco / New York / Rio de Janeiro공식 웹사이트 ↗
언어Dart

이 저장소가 배포한 패키지

사용 중인 의존성

의존성 목록 2 개

프로젝트에 맞는 저장소를 선택하려면?

사용 목적에 따라 검색하고 개발 활동을 비교한 뒤 원본 저장소에서 요구 사항을 확인하세요.

  1. 이름, 작성자 또는 설명으로 검색하고 기술 주제로 범위를 좁힙니다.
  2. 스타, 포크, 최근 푸시를 함께 비교하세요. 스타는 관심의 지표이며 품질을 보장하지 않습니다.
  3. 사용하기 전에 GitHub에서 README, 라이선스, Issues를 확인하세요.

출처 및 관리

“A repository is the most basic element of GitHub.”

GitHub Docs — About repositories ↗