Git Product home page Git Product logo

i18n's Introduction

Overview

This repository is home to Dart internationalization (i18n) and localization (l10n) related packages.

Packages

Package Description Version Status
intl Contains code to deal with internationalized/localized messages, date and number formatting and parsing, bi-directional text, and other internationalization issues. pub package Stable
intl_translation Contains code to localize apps to different locales, by extracting to ARB files and generating code to retrieve messages from ARB files. pub package Stable
intl4x A lightweight modular library for internationalization (i18n) functionality. Pub Experimental
messages A data-based, easy, safe, and small localization (l10n) library. Pub Experimental

Publishing automation

For information about our publishing automation and release process, see https://github.com/dart-lang/ecosystem/wiki/Publishing-automation.

For additional information about contributing, see our contributing page.

i18n's People

Contributors

aam avatar alan-knight avatar anqit avatar creisman avatar crelier avatar davidmorgan avatar dependabot[bot] avatar devoncarew avatar dgrove avatar efortuna avatar floitschg avatar franklinyow avatar jamesblasco avatar keertip avatar kevmoo avatar lrhn avatar madsager avatar mosuem avatar munificent avatar natebosch avatar nex3 avatar pikaju avatar sanekyy avatar scheglov avatar sgjesse avatar sigmundch avatar sofiadomingues avatar utamori avatar whesse avatar zainurrehmankhan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

i18n's Issues

Misleading docs for intl DateFormat.formatDuration

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


We can save other developers' time by documentation that this method always returns an empty string:

  /**
   * Returns a date string indicating how long ago (3 hours, 2 minutes)
   * something has happened or how long in the future something will happen
   * given a [reference] DateTime relative to the current time.
   */
  String formatDuration(DateTime reference) {
    return '';
  }

Or, better yet, implement the method :)

(please triage to Area=Pkg and CC alanknight)

DateFormat cannot parse time zones

Originally opened as dart-lang/sdk#16801

This issue was originally filed by [email protected]


What steps will reproduce the problem?
        test('> parseForIssueReport', () {
            final DateFormat rfc822Formatter = new DateFormat("EEE, dd MMM yyyy HH:mm:ss Z","en_US");
            final DateTime dt = rfc822Formatter.parse("Wed, 02 Oct 2002 15:00:00 +0230");

            expect(dt.timeZoneOffset.inMinutes, 150);
        }); // end of 'parseForIssueReport' test

What is the expected output? What do you see instead?
+230 should be 150 minutes!

What version of the product are you using? On what operating system?
Dart SDK 1.1.3 + intl 0.9.4

DateFormat Format and Parse should be reversible

Originally opened as dart-lang/sdk#10173

This issue was originally filed by [email protected]


What steps will reproduce the problem?

  1. Using the DataFormat class, format a date to a String without any delimiters. Like so, new DateFormat("yyyyMMddHHmm")
  2. Using the same DateFormat, parse the output string from the first step.
    3.

What is the expected output? What do you see instead?
I should have the same DateTime that I just formatted. DateFormat Format and Parse should be reversible.

What version of the product are you using? On what operating system?
Dart Editor version 0.5.0_r21823
Dart SDK version 0.5.0.1_r21823

Please provide any additional information below.
Link to Code on GitHub Gist, https://gist.github.com/amscotti/5451406

DateFormat inconsistency with yyyy

Reported by [email protected], Today (7 hours ago)
What steps will reproduce the problem?

  1. Create a DateFormat: new DateFormat("yyyyMMdd");
  2. format any arbitrary time with it: f.format(new DateTime.now())
  3. try and reparse the same date

What is the expected output? What do you see instead?
An exception occurs, instead I'd have expected the dateformat to be able to parse a date that was formatted by it back again. I think this is caused by yyyy being formatted as a single 4 digit year but being parsed differently somehow.

What version of the product are you using?
Dart 1.9.3

On what operating system?
Linux

What browser (if applicable)?
Dartium

Please provide any additional information below.

Today (6 hours ago) Delete comment Project Member #352 gzoechi
DateFormat.parse() expects a string not a DateTime. A String generated from DateTime can be parsed without intl like DateTime.parse(new DateTime.now().toString()). If you want to use DateFormat.parse() you need to pass an appropriate format string.
Today (6 hours ago) Delete comment #353 [email protected]
I called DateFormat.parse using the same DateFormat generated in step 1, like this:

var format = new DateFormat("yyyyMMdd");
var timeStr = format.format(new DateTime.now());
var reparsed = format.parse(timeStr);

The third line of this will panic

move from SDK issue tracker: https://code.google.com/p/dart/issues/detail?id=23345

DateFormat Format and Parse should be reversible

Originally opened as dart-lang/sdk#10173

This issue was originally filed by [email protected]


What steps will reproduce the problem?

  1. Using the DataFormat class, format a date to a String without any delimiters. Like so, new DateFormat("yyyyMMddHHmm")
  2. Using the same DateFormat, parse the output string from the first step.
    3.

What is the expected output? What do you see instead?
I should have the same DateTime that I just formatted. DateFormat Format and Parse should be reversible.

What version of the product are you using? On what operating system?
Dart Editor version 0.5.0_r21823
Dart SDK version 0.5.0.1_r21823

Please provide any additional information below.
Link to Code on GitHub Gist, https://gist.github.com/amscotti/5451406

Suggestion: provide mechanism like initializeNumberFormatting for NumberFormat to minimize JS code

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


The current implementation of NumberFormat will generate symbols of all supported languages into JS file. It is about 24KB. Though not very big, it will be better if it can be implemented like what DateFormat is -- using en_US as default, and loading other symbols with initDateFormatting and other methods. Thus, the application can implement lazy load and other mechanism to minimize the JS code size.

intl package: replace Intl.plural with PluralFormat

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


The intl package has Intl.plural which currently just forwards to Intl.select. It requires you to pass in "howMany" which presumably is either a plural category or number as described in:

http://unicode.org/reports/tr35/tr35-numbers.html#Language_Plural_Rules

But it does nothing to calculate the plural category for a given locale. It also doesn't have any templating facility to allow including the actual number within the text selected for the given plural category.

The intlx package (http://pub.dartlang.org/packages/intlx) has PluralFormat which takes a Map of cases, each of which can contain a pattern to replace with the actual number, and a locale to use to calculate plural categories, and then formats integers accordingly. The calculation of plural categories requires using a plural rules parser ahead of time to generate plural rules code for each locale which can be loaded into the application.

Demo: http://seaneagan.me/intlx/
Docs: http://seaneagan.me/intlx/docs/intlx/Plural.html

Proposal: move PluralFormat to the intl package and remove Intl.plural.

Add a mechanism for finding locale from Windows in non-browser context

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


We currently don't have a mechanism for finding the locale from windows. The mechanism of asking systeminfo and parsing the result was incredibly slow and didn't work properly anyway. I believe we would need to add some sort of native API call to get the information reasonably.

Be able to get a list of locales that have messages

We can ask if there are messages for a particular locale, but we can't get the list. It would be useful to do so, with the caveat that it's probably just the direct list, not taking into account substitutions, so if we have en, that would handle en_US, en_CA, etc., but we'd only have en in the list, as we don't have a way of going backwards to find all the possibilities.

Move Bidi static methods to instance methods on TextDirection

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


In package:intl, Bidi acts as a namespace for static methods, which is generally an anti-pattern in dart, since dart libraries can act as namespaces for static methods, so a separate "bidi.dart" library maybe. However, most of these methods are duplicated for both TextDirections (RTL and LTR), so it seems like making them polymorphic to TextDirection would make sense. For a basic idea of what this would look like, see:

https://gist.github.com/seaneagan/5957736

Of course they wouldn't make sense for TextDirection.UNKNOWN, but I don't think TextDirection.UNKNOWN is necessary. I think it would make more sense just to reuse null for that concept.

Another option would be to keep them as static/top-level methods which receive a TextDirection, but that doesn't feel quite as nice.

Intl package: add NumberFormat support for multiple group sizes

Originally opened as dart-lang/sdk#17969

This issue was originally filed by [email protected]


Feature request for Intl NumberFormat:

Some number systems require more than one grouping size when formatting numbers. For example, see the Indian Numbering System, which groups by ten-thousands rather than by hundred-thousands: http://en.wikipedia.org/wiki/Indian_Numbering_System. This would render 1,00,000 rather than 100,000; which would require a number format of something like "#,##,##­0"

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
    }

Allow application-level deferred libraries to have separate message catalogs

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


If the application wants to use deferred libraries for portions of itself, it would be best if the message catalog for that portion was loaded along with it. Right now the Intl.message calls are global, and we don't have a way to indicate a scope for the lookup, so that might require an API change. Alternatively, the implementation could remain as a single lookup but be a composite and have parts of it loaded when the application library is loaded.There are two issues there. One is identifying which messages need to be in which deferred chunks. That shouldn't be too bad, because we can base it off which file the message is implemented in and which chunk of the application that is. The second is having a runtime hook of some sort to load the messages when that deferred part of the application is loaded. That probably has to be done by convention, because we don't have that in the language.

Intl.select code generation error

This code

String languages(String locale) => Intl.select(locale, 
   {
     "fr" : "frensh",
     "en" : "english"
    },
    name: "languages", 
    args: [locale]);

is generated by intl:generate_from_arb with in locale FR likes that :

static languages(locale) => "{locale, select, fr {Français } en {Anglais }}";    

When I use the default locale (en) it work well with this angulardart code

    <select class="form-control"  ng-model="localeSelected">
        <option ng-repeat="language in ownerProfile['languages']" value="{{language}}">{{intl.languages(language)}}</option>
    </select>

But with the fr locale the value {locale, select, fr {Français } en {Anglais }} is instead of Français

When I edit the generated intl_fr.dart generated file and replace

  static languages(locale) => "{locale, select, fr {Français } en {Anglais }}";

by

static languages(locale) => {"fr":"Français","en":"Anglais"}[locale];

all works fine
I don't understand why the behaviour is different between the default locale code and a selected locale

Intl.plural does not work as documented - no way to use discrete values

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


What steps will reproduce the problem?

From the documentation @­ https://api.dartlang.org/docs/channels/stable/latest/intl/Intl.html

'''I see ${Intl.plural(num_people,
          {'0': 'no one at all',
           '1': 'one other person',
           'other': '$num_people other people'})} in $place.''''

What is the expected output? What do you see instead?

This would not work as Intl.plural expecte named args, ie
Intl.plural(num_people, one: "one", other: "other");

The problem with named arguments is that you have no way to pass
values for when num_people = 5, ie

Intl.plural(num_people, 5: "five", other: "other");

would not work as 5 is not an expected name for an argument

What version of the product are you using? On what operating system?

Dart VM version: 1.0.0.3_r30188 (Tue Nov 12 01:15:45 2013) on "linux_x64"
Ubuntu 13.10

Multiple Translations

If in your application you import a package, which is translated
and in your application create a translation, you get:

Duplicated library name 'messages_all'.
library messages_all;

when using the generate_from_arb functionality.
This applies also to the library in the translated files, e.g. messages_es

The cause is that in generate_localized.dart, the library name(s) are hardcoded.

generate_from_arb.dart allows to specify a file prefix, e.g.
--generated-file-prefix=base-

I suggest to use the file prefix also for the library names.

Misleading docs in DateFormat

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


From: http://api.dartlang.org/docs/releases/latest/intl/DateFormat.html

Consider this example from the docs:

  import 'package:intl/date_symbol_data_local.dart';
  initializeDateFormatting("en_US", null).then((_) => runMyCode());

The en_US locale is pre-loaded, so the call to initializeDateFormatting is not required. I suggest we take that out so as not to mislead developers into thinking that's required. Instead, let's use a locale that is not preloaded.

Thanks!

Also, while you are in there :) can you also add a simple example?

    import 'package:intl/intl.dart';
    
    main() {
      var now = new DateTime.now();
      var formatter = new DateFormat('yyyy-MM-dd');
      String formatted = formatter.format(now);
      print(formatted); // something like 2013-04-20
    }

pkg/intl/test/find_default_locale_standalone_test - fails on my Mac

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


At revision 31751, Mac 10.9

FAIL: Find system locale standalone
  Expected: not 'xx_YY'
    Actual: 'xx_YY'

  package:unittest/src/simple_configuration.dart 137:7 SimpleConfiguration.onExpectFailure
  package:unittest/src/simple_configuration.dart 15:28 _ExpectFailureHandler.fail
  package:unittest/src/expect.dart 117:9 DefaultFailureHandler.failMatch
  package:unittest/src/expect.dart 75:29 expect
  pkg/intl/test/find_default_locale_standalone_test.dart 24:9 verifyLocale
  package:unittest/unittest.dart 468:28 invoke1.<fn>
  package:unittest/unittest.dart 705:19 _guardAsync
  package:unittest/unittest.dart 465:23 invoke1
  dart:async/future_impl.dart 453 _Future._propagateToListeners.<fn>
  dart:async/zone.dart 683 _rootRun
  dart:async/zone.dart 832 _RootZone.run
  dart:async/future_impl.dart 445 _Future._propagateToListeners
  dart:async/future_impl.dart 303 _Future._complete
  dart:async/future_impl.dart 354 _Future._asyncComplete.<fn>
  dart:async/schedule_microtask.dart 18 _asyncRunCallback
  dart:isolate-patch/isolate_patch.dart 119 _RawReceivePortImpl._handleMessage

Add a mechanism for finding locale from Windows in non-browser context

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


We currently don't have a mechanism for finding the locale from windows. The mechanism of asking systeminfo and parsing the result was incredibly slow and didn't work properly anyway. I believe we would need to add some sort of native API call to get the information reasonably.

Allow application-level deferred libraries to have separate message catalogs

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


If the application wants to use deferred libraries for portions of itself, it would be best if the message catalog for that portion was loaded along with it. Right now the Intl.message calls are global, and we don't have a way to indicate a scope for the lookup, so that might require an API change. Alternatively, the implementation could remain as a single lookup but be a composite and have parts of it loaded when the application library is loaded.There are two issues there. One is identifying which messages need to be in which deferred chunks. That shouldn't be too bad, because we can base it off which file the message is implemented in and which chunk of the application that is. The second is having a runtime hook of some sort to load the messages when that deferred part of the application is loaded. That probably has to be done by convention, because we don't have that in the language.

package:intl - support list gender message selection

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


The intl package currently has Intl.gender to select messages based on gender. In addition when dealing with lists of people, languages have different rules to determine the gender. See:

CLDR:

http://unicode.org/reports/tr35/tr35-general.html#List_Gender

ICU:

http://icu-project.org/apiref/icu4j/com/ibm/icu/util/GenderInfo.html

Once issue #331 is fixed, it may be nice to have a method to complement it, which can select a message based on list gender. This could either be added to Intl.gender by making the "gender" argument also accept an Iterable, or a new method such as Intl.listGender.

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.

intl package: add CLDR-based Iterable formatting

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


The intlx package (http://pub.dartlang.org/packages/intlx) has an IterableFormat API which formats Iterables using locale specific separators. See the following links for more information:

Demo: http://seaneagan.me/intlx/
Docs: http://seaneagan.me/intlx/docs/intlx/IterableFormat.html

This should be moved to the intl package.

Misleading docs in DateFormat

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


From: http://api.dartlang.org/docs/releases/latest/intl/DateFormat.html

Consider this example from the docs:

  import 'package:intl/date_symbol_data_local.dart';
  initializeDateFormatting("en_US", null).then((_) => runMyCode());

The en_US locale is pre-loaded, so the call to initializeDateFormatting is not required. I suggest we take that out so as not to mislead developers into thinking that's required. Instead, let's use a locale that is not preloaded.

Thanks!

Also, while you are in there :) can you also add a simple example?

    import 'package:intl/intl.dart';
    
    main() {
      var now = new DateTime.now();
      var formatter = new DateFormat('yyyy-MM-dd');
      String formatted = formatter.format(now);
      print(formatted); // something like 2013-04-20
    }

intl package: add CLDR-based duration / age formatting

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


The intl package currently has unimplemented methods on DateFormat for this called formatDuration and formatDurationFrom. This is the wrong location for these APIs. Arbitrary DateFormat patterns don't match up to the corresponding CLDR data model.

The intlx package (http://pub.dartlang.org/packages/intlx) has DurationFormat which formats Durations, e.g. "5 minutes" or "5 min" and AgeFormat which formats DateTimes offset from now, e.g. "In 5 minutes" or "5 minutes ago" using CLDR data. See the following:

Demo: http://seaneagan.me/intlx/
Docs:
  http://seaneagan.me/intlx/docs/intlx/DurationFormat.html
  http://seaneagan.me/intlx/docs/intlx/AgeFormat.html

Proposal: move DurationFormat and AgeFormat to intl package and remove DateFormat.formatDuration/formatDurationFrom.

Multiple Translations

If in your application you import a package, which is translated
and in your application create a translation, you get:

Duplicated library name 'messages_all'.
library messages_all;

when using the generate_from_arb functionality.
This applies also to the library in the translated files, e.g. messages_es

The cause is that in generate_localized.dart, the library name(s) are hardcoded.

generate_from_arb.dart allows to specify a file prefix, e.g.
--generated-file-prefix=base-

I suggest to use the file prefix also for the library names.

Simplify deployment of intl apps

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


When a Dart app, which uses the intl package, is pub-built and compiled into JavaScript, dart2js creates 80 pattern and 80 symbol JSON files under the packages/intl directory. These 160 JSON files (2 per each existing locale whether used in the app or not) in turn must be loaded over to the server and downloaded by the clients. Is there a way to merge these files into one file? Is it not possible to keep the files for only the locales that the app requires. It seems to me that internationalization could be handled much more efficiently than it currently is.
////////////////////////////////////////////////////////////////////////////////////
Editor: 1.0.0_r30798 (2013-12-02)
OS: Windows 7 - amd64 (6.1)
JVM: 1.7.0_45

projects: 7

open dart files: 0

auto-run pub: true
localhost resolves to: 127.0.0.1
mem max/total/free: 1778 / 963 / 618 MB
thread count: 27
index: 1830668 relationships in 317984 keys in 1318 sources

SDK installed: true
Dartium installed: true

Allow making use of native JS Intl object if available

If we're in most modern browsers (not Safari or IE10 yet) then there's an Intl namespace available with NumberFormat, DateFormat and Collation. We should look at exposing that functionality. We probably can't outright replace our own because we need something that will work outside the browser, has less less implementation variation, etc., but we should permit it, and exposing Collation would fill a big gap.

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.

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

pkg/intl/test/find_default_locale_standalone_test fails on localized(russian) Windows

Originally opened as dart-lang/sdk#7501

This issue was originally filed by @aam


===
FAILED: none-vm release_ia32 pkg/intl/test/find_default_locale_standalone_test
Expected: pass
Actual: fail

stdout:
unittest-suite-wait-for-done
FAIL: Find system locale standalone
  Expected: not 'xx_YY'
       but: was 'xx_YY'.

  #­0 DefaultFailureHandler.fail (file:///D:/g/dart-repo/dart/pkg/unittest/lib/src/expect.dart:86:5)
  #­1 DefaultFailureHandler.failMatch (file:///D:/g/dart-repo/dart/pkg/unittest/lib/src/expect.dart:90:9)
  #­2 expect (file:///D:/g/dart-repo/dart/pkg/unittest/lib/src/expect.dart:55:29)
  #­3 verifyLocale.verifyLocale (file:///D:/g/dart-repo/dart/pkg/intl/test/find_default_locale_standalone_test.dart:23:9)
  #­4 _SpreadArgsHelper.invoke1.invoke1.<anonymous closure> (file:///D:/g/dart-repo/dart/pkg/unittest/lib/unittest.dart:434:29)
  #­5 guardAsync (file:///D:/g/dart-repo/dart/pkg/unittest/lib/unittest.dart:766:19)
===

Root cause is findSystemLocale() in pkg/intl/lib/intl_standalone.dart is looking for string prefixed with 'System Locale:' in stdout of systeminfo command, but on russian Windows the prefix is in russian:

===
D:\g\dart-repo\dart>systeminfo
...
Язык системы: ru;Русский
Язык ввода: ru;Русский
...
===

DateFormat cannot parse time zones

Originally opened as dart-lang/sdk#16801

This issue was originally filed by [email protected]


What steps will reproduce the problem?
        test('> parseForIssueReport', () {
            final DateFormat rfc822Formatter = new DateFormat("EEE, dd MMM yyyy HH:mm:ss Z","en_US");
            final DateTime dt = rfc822Formatter.parse("Wed, 02 Oct 2002 15:00:00 +0230");

            expect(dt.timeZoneOffset.inMinutes, 150);
        }); // end of 'parseForIssueReport' test

What is the expected output? What do you see instead?
+230 should be 150 minutes!

What version of the product are you using? On what operating system?
Dart SDK 1.1.3 + intl 0.9.4

DateFormat docs don't agree with behavior and behavior doesn't agree with DateTime

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


to reproduce:
var d = DateTime.parse('0001-02-03'); // iso 8601 requires 0-padding.
DateTime.parse('1-2-3'); // FormatException. we expect this.
var f = new DateFormat('yyyy-MM-dd');
     // the docs here (ctrl+f search for "number")
     // https://api.dartlang.org/docs/channels/stable/latest/intl/DateFormat.html
     // say that yyyy is supposed to 0-pad.
f.format(d); // yields '1-02-03'.
     // that's not right, year was supposed to be 0-padded.

// let's try the example from the docs:
var f2 = new DateFormat('yyyyy.MMMMM.dd GGG hh:mm aaa');
var d2 = DateTime.parse('1996-07-10 12:08');
f2.format(d2);
// yields '1996.J.10 AD 12:08 PM', but the docs say it yields '01996.July.10 AD 12:08 PM'
// notice how the promised output has 0-padding, but the actual doesn't.
// also the promised output spells out 'July', but the actual doesn't.

the lack of 0-padding is annoying because DateTime.parse demands 0-padding,
but DateFormat won't produce it, so i get exceptions when i
send the output of one to the other.

Dart VM version: 1.0.2.1_r30821 (Tue Dec 3 12:51:29 2013) on "linux_x64"

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.