GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - dart-archive/intl_translation: Message extraction and code generation from translated messages for the intl package

This repository was archived by the owner on Jul 13, 2023. It is now read-only.
BranchesTags
Open more actions menu

Latest commit

 

History

197 Commits
197 Commits

Folders and files

NameName
Last commit message
Last commit date
.github
.github
 
 
bin
bin
 
 
example
example
 
 
lib
lib
 
 
test
test
 
 
.gitignore
.gitignore
 
 
.status
.status
 
 
AUTHORS
AUTHORS
 
 
CHANGELOG.md
CHANGELOG.md
 
 
LICENSE
LICENSE
 
 
PATENTS
PATENTS
 
 
README.md
README.md
 
 
analysis_options.yaml
analysis_options.yaml
 
 
pubspec.yaml
pubspec.yaml
 
 

Repository files navigation

This repository has been moved to https://github.com/dart-lang/i18n/tree/main/pkgs/intl_translation. Please file any PRs and issues there.


Dart Pub

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.

dart run intl_translation:extract_to_arb --output-dir=target/directory \
    my_program.dart more_of_my_program.dart

This supports wildcards. For example, to extract messages from a series of files in path lib/**/*.dart, you can run

dart run intl_translation:extract_to_arb --output-dir=target/directory
      lib/**/*.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 Lyrebird. 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.

dart run intl_translation: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.

About

Message extraction and code generation from translated messages for the intl package

pub.dev/packages/intl_translation

Resources

Readme
BSD-3-Clause license
Activity
Custom properties

Stars

127 stars

Watchers

1 watching

Forks

192 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.