Internationalization and localization support

Last update: May 23, 2022

Provides internationalization and localization facilities, including message translation, plurals and genders, date/number formatting and parsing, and bidirectional text.

General

The most important library is intl. It defines the Intl class, with the default locale and methods for accessing most of the internationalization mechanisms. This library also defines the DateFormat, NumberFormat, and BidiFormatter classes.

Current locale

The package has a single current locale, called defaultLocale. Operations will use that locale unless told to do otherwise.

You can explicitly set the global locale

Intl.defaultLocale = 'pt_BR';

or get it from the browser

import 'package:intl/intl_browser.dart';
...
findSystemLocale().then(runTheRestOfMyProgram);

To override the current locale for a particular operation, pass the operation to withLocale. Note that this includes async tasks spawned from that operation, and that the argument to withLocale will supercede the defaultLocale while the operation is active. If you are using different locales within an application, the withLocale operation may be preferable to setting defaultLocale.

Intl.withLocale('fr', () => print(myLocalizedMessage());

To specify the locale for an operation you can create a format object in a specific locale, pass in the locale as a parameter to methods, or set the default locale.

var format = DateFormat.yMd('ar');
var dateString = format.format(DateTime.now());

or

print(myMessage(dateString, locale: 'ar');

or

Intl.defaultLocale = 'es';
DateFormat.jm().format(DateTime.now());

Initialization

All the different types of locale data require an async initialization step to make sure the data is available. This reduces the size of the application by only loading the data that is actually required.

Each different area of internationalization (messages, dates, numbers) requires a separate initialization process. That way, if the application only needs to format dates, it doesn't need to take the time or space to load up messages, numbers, or other things it may not need.

With messages, there is also a need to import a file that won't exist until the code generation step has been run. This can be awkward, but can be worked around by creating a stub messages_all.dart file, running an empty translation step, or commenting out the import until translations are available. See "Extracting and Using Translated Messages"

Messages

Messages to be localized are written as functions that return the result of an Intl.message call.

String continueMessage() => Intl.message(
    'Hit any key to continue',
    name: 'continueMessage',
    args: [],
    desc: 'Explains that we will not proceed further until '
        'the user presses a key');
print(continueMessage());

This provides, in addition to the basic message string, a name, a description for translators, the arguments used in the message, and examples. The name and args parameters must match the name (or ClassName_methodName) and arguments list of the function respectively. For messages without parameters, both of these can be omitted.

A function with an Intl.message call can be run in the program before any translation has been done, and will just return the message string. It can also be extracted to a file and then be made to return a translated version without modifying the original program. See "Extracting Messages" below for more details.

The purpose of wrapping the message in a function is to allow it to have parameters which can be used in the result. The message string is allowed to use a restricted form of Dart string interpolation, where only the function's parameters can be used, and only in simple expressions. Local variables cannot be used, and neither can expressions with curly braces. Only the message string can have interpolation. The name, desc, args, and examples must be literals and not contain interpolations. Only the args parameter can refer to variables, and it should list exactly the function parameters. If you are passing numbers or dates and you want them formatted, you must do the formatting outside the function and pass the formatted string into the message.

greetingMessage(name) => Intl.message(
    'Hello $name!',
    name: 'greetingMessage',
    args: [name],
    desc: 'Greet the user as they first open the application',
    examples: const {'name': 'Emily'});
print(greetingMessage('Dan'));

There is one special class of complex expressions allowed in the message string, for plurals and genders.

remainingEmailsMessage(int howMany, String userName) =>
  Intl.message(
    '''${Intl.plural(howMany,
        zero: 'There are no emails left for $userName.',
        one: 'There is $howMany email left for $userName.',
        other: 'There are $howMany emails left for $userName.')}''',
  name: 'remainingEmailsMessage',
  args: [howMany, userName],
  desc: How many emails remain after archiving.',
  examples: const {'howMany': 42, 'userName': 'Fred'});

print(remainingEmailsMessage(1, 'Fred'));

However, since the typical usage for a plural or gender is for it to be at the top-level, we can also omit the Intl.message call and provide its parameters to the Intl.plural call instead.

remainingEmailsMessage(int howMany, String userName) =>
  Intl.plural(
    howMany,
    zero: 'There are no emails left for $userName.',
    one: 'There is $howMany email left for $userName.',
    other: 'There are $howMany emails left for $userName.',
    name: 'remainingEmailsMessage',
    args: [howMany, userName],
    desc: 'How many emails remain after archiving.',
    examples: const {'howMany': 42, 'userName': 'Fred'});

Similarly, there is an Intl.gender message, and plurals and genders can be nested.

notOnlineMessage(String userName, String userGender) =>
  Intl.gender(
    userGender,
    male: '$userName is unavailable because he is not online.',
    female: '$userName is unavailable because she is not online.',
    other: '$userName is unavailable because they are not online',
    name: 'notOnlineMessage',
    args: [userName, userGender],
    desc: 'The user is not available to hangout.',
    examples: const {{'userGender': 'male', 'userName': 'Fred'},
        {'userGender': 'female', 'userName' : 'Alice'}});

It's recommended to use complete sentences in the sub-messages to keep the structure as simple as possible for the translators.

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. The code for this is in the Intl_translation package.

To extract messages, run the extract_to_arb.dart program.

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

This will produce a file intl_messages.arb with the messages from all of these programs. See ARB. 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.

> pub 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 returns, the message data is available.

Number Formatting and Parsing

To format a number, create a NumberFormat instance.

var f = NumberFormat('###.0#', 'en_US');
print(f.format(12.345));
  ==> 12.34

The locale parameter is optional. If omitted, then it will use the current locale. The format string is as described in NumberFormat

It's also possible to access the number symbol data for the current locale, which provides information as to the various separator characters, patterns, and other information used for formatting, as

f.symbols

Current known limitations are that the currency format will only print the name of the currency, and does not support currency symbols, and that the scientific format does not really agree with scientific notation. Number parsing is not yet implemented.

Date Formatting and Parsing

To format a DateTime, create a DateFormat instance. These can be created using a set of commonly used skeletons taken from ICU/CLDR or using an explicit pattern. For details on the supported skeletons and patterns see DateFormat.

DateFormat.yMMMMEEEEd().format(aDateTime);
  ==> 'Wednesday, January 10, 2012'
DateFormat('EEEEE', 'en_US').format(aDateTime);
  ==> 'Wednesday'
DateFormat('EEEEE', 'ln').format(aDateTime);
  ==> 'mokɔlɔ mwa mísáto'

You can also parse dates using the same skeletons or patterns.

DateFormat.yMd('en_US').parse('1/10/2012');
DateFormat('Hms', 'en_US').parse('14:23:01');

Skeletons can be combined, the main use being to print a full date and time, e.g.

DateFormat.yMEd().add_jms().format(DateTime.now());
  ==> 'Thu, 5/23/2013 10:21:47 AM'

Known limitations: Time zones are not yet supported. Dart DateTime objects don't have a time zone, so are either local or UTC. Formatting and parsing Durations is not yet implemented.

Note that before doing any DateTime formatting for a particular locale, you must load the appropriate data by calling.

import 'package:intl/date_symbol_data_local.dart';
...
initializeDateFormatting('de_DE', null).then(formatDates);

Once the future returned from the initialization call returns, the formatting data is available.

There are other mechanisms for loading the date formatting data implemented, but we expect to deprecate those in favor of having the data in a library as in the above, and using deferred loading to only load the portions that are needed. For the time being, this will include all of the data, which will increase code size.

Bidirectional Text

The class BidiFormatter provides utilities for working with Bidirectional text. We can wrap the string with unicode directional indicator characters or with an HTML span to indicate direction. The direction can be specified with the RTL and LTR constructors, or detected from the text.

BidiFormatter.RTL().wrapWithUnicode('xyz');
BidiFormatter.RTL().wrapWithSpan('xyz');

GitHub

https://github.com/dart-lang/intl
Comments
  • 1. Parsing two-digit year `16` with results in `0016` and not `2016`

    import 'package:intl/intl.dart';
    final dateFormat = new DateFormat("d/M/y H:m:s");
    print(dateFormat.parse("01/02/16 12:11:12").year);
    

    This code results in a year of 0016 and not 2016. Same thing happens whether I use y or yy in the format. Unfortunately it's tricky to fix this, because you can't even .add 2000 years, because the Duration class only goes up to days!

    Other languages make assumptions about two-digit years being 19/20; it probably makes sense to do the same.

    Reviewed by DanTup at 2016-08-26 20:02
  • 2. intl_translation:extract_to_arb should support const references as name

      String themeDisplayName(String themeName) {
        switch (themeName) {
          case 'origin':
            return Intl.message('Origin', name: AppTheme.origin.name);
          case 'purple':
            return Intl.message('Purple', name: AppTheme.purple.name);
        ...
    

    To make refactoring easier and prevent accidental mismatches.

    used constants

    class AppTheme {
      static const AppTheme origin = const AppTheme('origin');
      static const AppTheme purple = const AppTheme('purple');
      ...
    
      final String name;
    }
    

    Currently I get

    Skipping invalid Intl.message invocation
        <Intl.message('Origin', name: AppTheme.origin.name)>
        reason: The 'name' argument for Intl.message must be a string literal
        from File: 'lib/localization/localizations.dart'    line: 33, column: 16
    Skipping invalid Intl.message invocation
        <Intl.message('Purple', name: AppTheme.purple.name)>
        reason: The 'name' argument for Intl.message must be a string literal
        from File: 'lib/localization/localizations.dart'    line: 35, column: 16
    
    Reviewed by zoechi at 2018-07-10 13:27
  • 3. Multiple dart translations in one project

    hi, I have two translations.dart one for each project and another one for the commons translation, I would like to use 2 translations.dart in one project (project_translation.dart and common_translation.dart), is it possible?

    Reviewed by samiahakmi at 2018-08-14 08:16
  • 4. 'k' hour format does not give expected results

    The docs (including ICU docs) say that the k pattern should give "hour in day (1~24)".

    https://github.com/dart-lang/intl/blob/4b385517037485e3243d6915453215af315add27/lib/src/intl/date_format.dart#L154

    However I cannot seem to obtain 24; all I can get is 0:

    final date = DateTime(2019, 6, 10, 0, 30);
    print(DateFormat('k:mm').format(date)); // result: 0:30
    print(DateFormat('kk:mm').format(date)); // result: 00:30
    

    I would have expected both of these to give 24:30.

    Reviewed by amake at 2019-06-10 08:13
  • 5. Regression between 1.12.2 and 1.13.0 with angular1

    From @a14n on November 20, 2015 16:59

    I have a private angular1 project where pub build works with 1.12.2 but fails with 1.13.0. Here is the error I get:

    Loading source assets... 
    Loading di/module_transformer, initialize/build/loader_replacer, observe, smoke/src/default_transformer and initialize transformers... 
    Loading angular transformers... 
    Building xxx_admin... (1.2s) 
    [Error from InjectorGenerator on xxx_admin|web/main.dart]:
    Unable to resolve asset ID for "dart:core"
    Build error:
    Transform InjectorGenerator on xxx_admin|web/main.dart threw error: <rethrow>
    Caused by Could not resolve dart:core
    #0      AnalysisTask._safelyPerform (package:analyzer/src/generated/engine.dart:6762:7)
    #1      AnalysisTask.perform (package:analyzer/src/generated/engine.dart:6727:7)
    #2      AnalysisContextImpl._cacheDartResolutionData (package:analyzer/src/generated/engine.dart:2414:79)
    #3      AnalysisContextImpl._getDartResolutionData (package:analyzer/src/generated/engine.dart:3046:17)
    #4      AnalysisContextImpl._getDartResolutionData2 (package:analyzer/src/generated/engine.dart:3077:14)
    #5      AnalysisContextImpl.computeLibraryElement (package:analyzer/src/generated/engine.dart:1192:58)
    #6      ResolverImpl._performResolve.<anonymous closure>.<anonymous closure> (package:code_transformers/src/resolver_impl.dart:157:25)
    #7      MappedListIterable.elementAt (dart:_internal/iterable.dart:413)
    #8      ListIterable.toList (dart:_internal/iterable.dart:219)
    #9      ResolverImpl._performResolve.<anonymous closure> (package:code_transformers/src/resolver_impl.dart:158:10)
    #10     _RootZone.runUnary (dart:async/zone.dart:1149)
    #11     _Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:502)
    #12     _Future._propagateToListeners (dart:async/future_impl.dart:585)
    #13     _Future._completeWithValue (dart:async/future_impl.dart:376)
    #14     _Future._asyncComplete.<anonymous closure> (dart:async/future_impl.dart:430)
    #15     _microtaskLoop (dart:async/schedule_microtask.dart:43)
    #16     _microtaskLoopEntry (dart:async/schedule_microtask.dart:52)
    #17     _runPendingImmediateCallback (dart:isolate-patch/isolate_patch.dart:96)
    #18     _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:151)
    
    
    package:analyzer/src/generated/engine.dart 2115:11       AnalysisContextImpl.recordResolveDartLibraryTaskResults
    package:analyzer/src/generated/engine.dart 5304:98       AnalysisContextImpl_AnalysisTaskResultRecorder.visitResolveDartLibraryTask
    package:analyzer/src/generated/engine.dart 14327:50      ResolveDartLibraryTask.accept
    package:analyzer/src/generated/engine.dart 6732:12       AnalysisTask.perform
    package:analyzer/src/generated/engine.dart 2414:79       AnalysisContextImpl._cacheDartResolutionData
    package:analyzer/src/generated/engine.dart 3046:17       AnalysisContextImpl._getDartResolutionData
    package:analyzer/src/generated/engine.dart 3077:14       AnalysisContextImpl._getDartResolutionData2
    package:analyzer/src/generated/engine.dart 1192:58       AnalysisContextImpl.computeLibraryElement
    package:code_transformers/src/resolver_impl.dart 157:25  ResolverImpl._performResolve.<fn>.<fn>
    dart:_internal/iterable.dart 413                         MappedListIterable.elementAt
    dart:_internal/iterable.dart 219                         ListIterable.toList
    package:code_transformers/src/resolver_impl.dart 158:10  ResolverImpl._performResolve.<fn>
    dart:async/zone.dart 1149                                _RootZone.runUnary
    dart:async/future_impl.dart 502                          _Future._propagateToListeners.handleValueCallback
    dart:async/future_impl.dart 585                          _Future._propagateToListeners
    dart:async/future_impl.dart 376                          _Future._completeWithValue
    dart:async/future_impl.dart 430                          _Future._asyncComplete.<fn>
    dart:async/schedule_microtask.dart 43                    _microtaskLoop
    dart:async/schedule_microtask.dart 52                    _microtaskLoopEntry
    dart:isolate-patch/isolate_patch.dart 96                 _runPendingImmediateCallback
    dart:isolate-patch/isolate_patch.dart 151                _RawReceivePortImpl._handleMessage
    
    package:analyzer/src/generated/engine.dart 2115:11       AnalysisContextImpl.recordResolveDartLibraryTaskResults
    package:analyzer/src/generated/engine.dart 5304:98       AnalysisContextImpl_AnalysisTaskResultRecorder.visitResolveDartLibraryTask
    package:analyzer/src/generated/engine.dart 14327:50      ResolveDartLibraryTask.accept
    package:analyzer/src/generated/engine.dart 6732:12       AnalysisTask.perform
    package:analyzer/src/generated/engine.dart 2414:79       AnalysisContextImpl._cacheDartResolutionData
    package:analyzer/src/generated/engine.dart 3046:17       AnalysisContextImpl._getDartResolutionData
    package:analyzer/src/generated/engine.dart 3077:14       AnalysisContextImpl._getDartResolutionData2
    package:analyzer/src/generated/engine.dart 1192:58       AnalysisContextImpl.computeLibraryElement
    package:code_transformers/src/resolver_impl.dart 157:25  ResolverImpl._performResolve.<fn>.<fn>
    dart:_internal                                           ListIterable.toList
    package:code_transformers/src/resolver_impl.dart 158:10  ResolverImpl._performResolve.<fn>
    
    
    

    Copied from original issue: dart-lang/sdk#25009

    Reviewed by kasperl at 2015-11-27 08:41
  • 6. Generated library names won't pass linting with generate_from_arb

    Currently there's no way to specify the library name that generate_from_arb produces. This means if you run the linter against a generated library that it will fail.

    The analyzer was relaxed to allow library names to be omitted so that's one option. Another option is to have a flag that allows the library name to be prefixed. A further option is to read the pubspec and get the library name from that and then based on the path determine the library name based on the conventions.

    The flag is probably the most straightforward of those options.

    Reviewed by donny-dont at 2015-10-27 21:47
  • 7. Dart internationalization library is an unusable mess - It needs a total redesign

    Originally opened as dart-lang/sdk#15796

    This issue was originally filed by @Emasoft


    Internationalization in Dart it's a mess, and it's a big stumbling-block.

    Read the following article for an in depth explanation:

    http://japhr.blogspot.it/2013/12/code-generation-and-polymer-i18n.html

    We are at the verge of 2014. We need a modern internationalization system integrated right into Dart.

    Those are the features we need:

    • TRANSPARENCY : Once you write the code for a web page in a certain language, you must be able to localize it without going back and change anything of the original dart or html code. Switching between languages should be independent from the structure or the code of the page. For example a single call to a method at page load should localize automatically all strings and numerical values behind the scenes.
    • INTEGRATED : Localization data should be integrated into the components (both for native or Polymer elements). Localization data should be portable like the elements and recognized at the language level. Missing or partial localizations should be marked as error. All international standards of metric units should be included and automatically parsed from strings, dates or numbers, with explicit conversion methods when the identification is not possible.
    • AUTOMATED : The right localization, if present, should be automatically activated according to the browser language or location. The existence of localization data should be enough to make the localization happen. An explicitly statement must be provided to disable this feature. In this way just copying a new localization file for a specific language in the same folder of the web app sources should activate the localization, without changing any other file.

    Thank you.

    Reviewed by DartBot at 2015-06-05 22:33
  • 8. findSystemLocale in Browser returns de in Chrome+FF but de_DE in Safari (Mac)

    Moving from https://github.com/dart-lang/sdk/issues/31175

    https://github.com/MikeMitterer wrote:

    final String locale = await findSystemLocale(); print(locale)

    Dartium: de Chrome 61.03: de FF 56.0: de Safari 11.0: de_DE

    Cmdline locale:

    LANG="de_AT.UTF-8" LC_COLLATE="de_AT.UTF-8" LC_CTYPE="de_DE.UTF-8" LC_MESSAGES="de_AT.UTF-8" LC_MONETARY="de_AT.UTF-8" LC_NUMERIC="de_AT.UTF-8" LC_TIME="de_AT.UTF-8" LC_ALL= // OS --------------------------------------------------------------------------- ProductName: Mac OS X ProductVersion: 10.11.6 BuildVersion: 15G1611 Darwin Kernel Version 15.6.0: Sun Jun 4 21:43:07 PDT 2017; root:xnu-3248.70.3~1/RELEASE_X86_64

    GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin15) Copyright (C) 2007 Free Software Foundation, Inc.

    // Software installed ----------------------------------------------------------- java version "1.8.0_141" Java(TM) SE Runtime Environment (build 1.8.0_141-b15) Java HotSpot(TM) 64-Bit Server VM (build 25.141-b15, mixed mode)

    Dart VM version: 1.24.2 (Thu Jun 22 08:42:17 2017) on "macos_x64" Pub 1.24.2

    NPM: 5.3.0

    Reviewed by alan-knight at 2017-10-20 18:22
  • 9. intl test timing out on Dartium bots

    <img src="https://avatars.githubusercontent.com/u/2119553?v=3" align="left" width="96" height="96"hspace="10"> Issue by vsmenon Originally opened as dart-lang/sdk#19544


    This test is timing out sporadically on drt and dartium on different OSes. Started in the past day.

    FAILED: none-drt-checked release_x64 pkg/intl/test/date_time_format_http_request_test Expected: Pass Actual: Timeout CommandOutput[content_shell]:

    stdout:

    READY

    stderr: [9292:9292:0619/030744:3196644067:ERROR:browser_main_loop.cc(163)] Running without the SUID sandbox! See https://code.google.com/p/chromium/wiki/LinuxSUIDSandboxDevelopment for more information on developing with the sandbox on. [9292:9292:0619/030744:3197010234:WARNING:webrtc_internals.cc(52)] Could not get the download directory.

    To retest, run: /mnt/data/b/build/slave/dartium-lucid64-full-be/build/src/dart//tools/testing/bin/linux/dart /mnt/data/b/build/slave/dartium-lucid64-full-be/build/src/dart/tools/testing/dart/http_server.dart -p 39869 -c 38498 --build-directory=/mnt/data/b/build/slave/dartium-lucid64-full-be/build/src/out/Release --runtime=drt

    Command[content_shell]: /mnt/data/b/build/slave/dartium-lucid64-full-be/build/src/out/Release/content_shell --no-timeout --dump-render-tree http://127.0.0.1:39869/root_build/generated_tests/none-drt-checked/pkg_intl_test_date_time_format_http_request_test/test.html?crossOriginPort=38498 Took 0:04:00.209000

    Short reproduction command (experimental):     python tools/test.py -rdrt -mrelease -ax64 --checked -t240 pkg/intl/test/date_time_format_http_request_test

    Done none-drt-checked release_x64 pkg/intl/test/date_time_format_http_request_test: fail @@@[email protected]@@

    Reviewed by DartBot at 2015-06-05 22:33
  • 10. DartFormat should throw on parsing '32/12/2014' with format 'dd/MM/yyyy'

    <img src="https://avatars.githubusercontent.com/u/1206632?v=3" align="left" width="96" height="96"hspace="10"> Issue by a14n Originally opened as dart-lang/sdk#17169


    I'm on Dart SDK version 1.2.0-dev.5.15 with intl-0.9.5.

    Parsing '32/12/2014' with format 'dd/MM/yyyy' gives '2015-01-01' instead of throwing a FormatException.

        import 'package:intl/intl.dart';     main() {       print(new DateFormat('dd/MM/yyyy').parse('32/12/2014'));       // displays 2015-01-01 00:00:00.000     }

    Reviewed by DartBot at 2015-06-05 22:33
  • 11. pkg/intl/test/message_extraction/message_extraction_test is flaky

    <img src="https://avatars.githubusercontent.com/u/5449880?v=3" align="left" width="96" height="96"hspace="10"> Issue by iposva-google Originally opened as dart-lang/sdk#17130


    FAILED: none-vm-checked debug_ia32 pkg/intl/test/message_extraction/message_extraction_test Expected: Pass Actual: RuntimeError CommandOutput[vm]:

    stdout: unittest-suite-wait-for-done ERROR: Test round trip message extraction, translation, code generation, and printing   Test failed: Caught FileSystemException: Cannot delete file, path = 'e:\b\build\slave\vm-win32-debug-be\build\dart\pkg\intl\test\message_extraction\intl_messages.json' (OS Error: The process cannot access the file because it is being used by another process.      , errno = 32)   file_impl.dart 561 _File.throwIfError   file_impl.dart 309 _File._deleteSync   file_system_entity.dart 390 FileSystemEntity.deleteSync   pkg\intl\test\message_extraction\message_extraction_test.dart 51:37 deleteGeneratedFiles.<fn>   dart:_internal/iterable.dart 39 ListIterable.forEach   pkg\intl\test\message_extraction\message_extraction_test.dart 50:46 deleteGeneratedFiles   pkg\intl\test\message_extraction\message_extraction_test.dart 36:25 main.<fn>   package:unittest/src/test_case.dart 111:31 _run.<fn>   dart:async/zone.dart 717 _rootRunUnary   dart:async/zone.dart 449 _ZoneDelegate.runUnary   dart:async/zone.dart 654 _CustomizedZone.runUnary   dart:async/future_impl.dart 449 _Future._propagateToListeners.handleValueCallback   dart:async/future_impl.dart 532 _Future._propagateToListeners   dart:async/future_impl.dart 303 _Future._complete   dart:async/future_impl.dart 354 _Future._asyncComplete.<fn>   dart:async/zone.dart 710 _rootRun   dart:async/zone.dart 440 _ZoneDelegate.run   dart:async/zone.dart 650 _CustomizedZone.run   dart:async/zone.dart 561 _BaseZone.runGuarded   dart:async/zone.dart 586 _BaseZone.bindCallback.<fn>   dart:async/schedule_microtask.dart 23 _asyncRunCallbackLoop   dart:async/schedule_microtask.dart 32 _asyncRunCallback   dart:isolate-patch/isolate_patch.dart 119 _RawReceivePortImpl._handleMessage

    0 PASSED, 0 FAILED, 1 ERRORS

    stderr: Unhandled exception: Exception: Some tests failed.

    ­0 SimpleConfiguration.onDone (package:unittest/src/simple_configuration.dart:209:9)

    ­1 _completeTests (package:unittest/unittest.dart:663:17)

    ­2 _runTest (package:unittest/unittest.dart:612:19)

    ­3 _nextTestCase (package:unittest/unittest.dart:532:11)

    ­4 _asyncRunCallbackLoop (dart:async/schedule_microtask.dart:23)

    ­5 _asyncRunCallback (dart:async/schedule_microtask.dart:32)

    ­6 _asyncRunCallback (dart:async/schedule_microtask.dart:36)

    ­7 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:119)

    Command[vm]: build\DebugIA32\dart.exe --ignore-unrecognized-flags --enable_asserts --enable_type_checks --package-root=build/DebugIA32/packages/ e:\b\build\slave\vm-win32-debug-be\build\dart\pkg\intl\test\message_extraction\message_extraction_test.dart Took 0:00:01.794000

    Short reproduction command (experimental):     python tools/test.py --copy-coredumps --write-debug-log --write-test-outcome-log --checked -t120 pkg/intl/test/message_extraction/message_extraction_test

    Reviewed by DartBot at 2015-06-05 22:33
  • 12. Number skeleton support?

    Are there any plans to support number skeletons as shown here? As of now complex ICU message formats don't seem to supported as {views, plural, one{1 view} other{{views, number, ::compact-short} views}} returns Undefined parameter - views, number, ::compact-short views.

    Reviewed by Reprevise at 2022-04-27 14:35
  • 13. Cannot format a number using decimal comma

    This code works: var numFormat = NumberFormat('#,##0.##');

    This one produces an error which makes no sense to me: var numFormat = NumberFormat('#.##0,##');

    Reviewed by nicolasvahidzein at 2022-04-23 15:49
  • 14. Unsupported locale 'fur_Latn_IT'

    The locale fur_Latn_IT is not supported by Dart but it's a valid locale.

    How to reproduce:

    import 'package:intl/intl.dart'; // for date format
    
    void main() {
      NumberFormat.currency(locale: 'fur_Latn_IT').format(2.3);
    }
    

    The output:

    Uncaught Error: Invalid argument(s): Invalid locale "fur_Latn_IT"
    

    I know it's a tricky one but a few user has this crash on our App.

    Reviewed by AdrienAudouard at 2022-04-07 09:50
  • 15. Add a parser when the date time format is without delimiter

    Create a way of parse date time format without delimiter without break change.

    test('No delimiter 4 digits year', () {
        final timestamp = "20190614071930";
        final result = DateFormat('yyyyMMddHHmmss').parseNoDelimiter(timestamp);
        expect(result, DateTime(2019, 06, 14, 07, 19, 30));
    

    A date time format like 'yyyyMMddHHmmss' now can be parsed calling DateFormat(String).parseNoDelimiter(String)

    close #452 close #210 close #445 close #278

    Reviewed by jhionan at 2022-03-16 05:56
  • 16. Possibility to display 12-hour format for de locale

    If the locale is set to de, I cannot display the time in 12-hour format like so:

    DateFormat('jm', 'de').format(DateTime.now())
    

    While I realize that Germany mostly uses the 24-hour format, I would like to offer the possibility to display the time in the 12-hour format. If I change my settings in Android to German, it is possible to use the 12-hour format.

    Reviewed by solkaz at 2022-03-12 16:41

Related

COVID-19 application made with Flutter, following Test Driven Development (TDD) and Clean Architecture along with Internationalization with JSON.
COVID-19 application made with Flutter, following Test Driven Development (TDD) and Clean Architecture along with Internationalization with JSON.

Covid App COVID-19 application made with Flutter, following Test Driven Development (TDD) and Clean Architecture along with Internationalization with

May 24, 2021
Flutter demo for internationalization.

Localizing your application 1. Introduction We are going to localize our application using the intl package. This guide is based on Flutter Docs - Int

Dec 23, 2021
The project of the empty template with Flutter has built the basic framework to realize the functions of internationalization, theme peeling etc.
The project of the empty template with Flutter has built the basic framework to realize the functions of internationalization, theme peeling etc.

flutter-bloc-app-template ?? The project of the empty template with Flutter has built the basic framework to realize the functions of internationaliza

May 21, 2022
Note provider - Note App using Provider state management, Sqflite and Localization for two language Arabic and English.

note_provider Sqflite with provider statemanagement Getting Started This project is a starting point for a Flutter application. A few resources to get

Jan 1, 2022
A tool which automatically generates Flutter localization resources from CSV and Excel files.

flappy_translator A tool which automatically generates Flutter localization resources from CSV and Excel files. This is especially useful as any team

Apr 8, 2022
A basic boilerplate template for starting a Flutter GetX project. GetX, Dio, MVVM, get CLI, Localization, Pagination etc are implemented.
A basic boilerplate template for starting a Flutter GetX project. GetX, Dio, MVVM, get CLI, Localization, Pagination etc are implemented.

Flutter GetX Template (GetX, Dio, MVVM) This Flutter Template using GetX package for State management, routing and Dependency Injection (bindings). We

May 24, 2022
Flutter localization in easy steps
Flutter localization in easy steps

localize_and_translate Flutter localization in easy steps Share your love to this ❤️ Screenshots Tutorial Video Arabic : https://www.youtube.com/watch

Jan 18, 2022
TOML localization for Flutter

toml_localizations A minimal TOML localization package for Flutter. TOML is a minimal, easy to read, configuration file format, which allows you to re

Mar 8, 2022
Yet another localization approach in Flutter
Yet another localization approach in Flutter

Flutter Global Summit Vol.2 schedule Source code of the mobile application that displays the schedule of the Flutter Global Summit Vol.2 conference th

Mar 24, 2022
Kurdish localization for flutter

Flutter Kurdish Localization ?? This package provides unofficial localization su

May 14, 2022
"FlutterMoneyFormatter" is a Flutter extension to formatting various types of currencies according to the characteristics you like, without having to be tied to any localization.

FlutterMoneyFormatter FlutterMoneyFormatter is a Flutter extension to formatting various types of currencies according to the characteristics you like

May 18, 2022
Flutter project. The sample of Localization.

localization A new Flutter project. Getting Started This project is a starting point for a Flutter application. A few resources to get you started if

Jan 5, 2022
Flutter plugin, support android/ios.Support crop, flip, rotate, color martix, mix image, add text. merge multi images.
Flutter plugin, support android/ios.Support crop, flip, rotate, color martix, mix image, add text. merge multi images.

image_editor The version of readme pub and github may be inconsistent, please refer to github. Use native(objc,kotlin) code to handle image data, it i

May 15, 2022
A wrapper around our Cocoa and Java client library SDKs, providing iOS and Android support for those using Flutter and Dart.
A wrapper around our Cocoa and Java client library SDKs, providing iOS and Android support for those using Flutter and Dart.

Ably Flutter Plugin A Flutter plugin wrapping the ably-cocoa (iOS) and ably-java (Android) client library SDKs for Ably, the platform that powers sync

May 5, 2022
A Flutter Plugin for Volume Control and Monitoring, support iOS and Android
A Flutter Plugin for Volume Control and Monitoring, support iOS and Android

flutter_volume A flutter plugin for volume control and monitoring, support iOS and Android 手把手带你写 Flutter 系统音量插件 https://www.yuque.com/befovy/share/fl

May 3, 2022
A powerful official extension library of Tab/TabBar/TabView, which support to scroll ancestor or child Tabs when current is overscroll, and set scroll direction and cache extent.

extended_tabs Language: English | 中文简体 A powerful official extension library of Tab/TabBar/TabView, which support to scroll ancestor or child Tabs whe

May 25, 2022
This perfect starter kit is an app based on React Native and UI Kitten library with Light and Dark themes support.
This perfect starter kit is an app based on React Native and UI Kitten library with Light and Dark themes support.

Kitten Tricks This perfect starter kit is an app based on React Native and UI Kitten library with Light and Dark themes support. It’s completely free

May 23, 2022
Drag and Drop for Dart web apps with mouse and touch support.

Dart Drag and Drop Drag and Drop for Dart web apps with mouse and touch support. GitHub | Pub | Demos and Examples Features Use any HTML Element as Dr

Apr 22, 2022
Easiest way to add support for light and dark theme in your flutter app.
Easiest way to add support for light and dark theme in your flutter app.

Adaptive Theme Easiest way to add support for light and dark theme in your Flutter app. It allows to manually set light or dark theme and also lets yo

May 20, 2022