O'Reilly logo

Dart: Scalable Application Development by Ivo Balbaert, Sergey Akopkokhyants, Davy Mitchell

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Using translated messages

Now, it's time to generate a set of Dart libraries that contain translated versions of our messages—one per locale from the ARB files prepared before. We use the generate_from_arb program from the intl package:

pub run intl:generate_from_arb --output-dir=web web/registration_form.dart web/translate_en.arb web/translate_de.arb

The program generates the message_de.dart, message_en.dart, and messages_all.dart files in the specified web directory. Each message_<locale_tag>.dart file contains the MessageLookup class that implements MessageLookupByLibrary. The MessageLookup class has a getter method localeName, a set of static functions that are returned translated on the specific locale text messages, and final constant messages ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required