Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(136)

Side by Side Diff: pkg/intl/lib/date_format.dart

Issue 14604009: Add a dateSymbols getter to DateFormat, useful to get e.g. the list of weekday names (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | pkg/intl/test/date_time_format_test_core.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 part of intl; 5 part of intl;
6 6
7 // TODO(efortuna): Customized pattern system -- suggested by i18n needs 7 // TODO(efortuna): Customized pattern system -- suggested by i18n needs
8 // feedback on appropriateness. 8 // feedback on appropriateness.
9 /** 9 /**
10 * DateFormat is for formatting and parsing dates in a locale-sensitive 10 * DateFormat is for formatting and parsing dates in a locale-sensitive
(...skipping 516 matching lines...) Expand 10 before | Expand all | Expand 10 after
527 527
528 /** Return the pattern that we use to format dates.*/ 528 /** Return the pattern that we use to format dates.*/
529 get pattern => _pattern; 529 get pattern => _pattern;
530 530
531 /** Return the skeletons for our current locale. */ 531 /** Return the skeletons for our current locale. */
532 Map get _availableSkeletons { 532 Map get _availableSkeletons {
533 return dateTimePatterns[locale]; 533 return dateTimePatterns[locale];
534 } 534 }
535 535
536 /** 536 /**
537 * Return the [DateSymbol] information for the locale. This can be useful
538 * to find lists like the names of weekdays or months in a locale, but
539 * the structure of this data may change, and it's generally better to go
540 * through the [format] and [parse] APIs. If the locale isn't present, or
541 * is uninitialized, returns null;
542 */
543 DateSymbols get dateSymbols => dateTimeSymbols[_locale];
544
545 /**
537 * Set the locale. If the locale can't be found, we also look up 546 * Set the locale. If the locale can't be found, we also look up
538 * based on alternative versions, e.g. if we have no 'en_CA' we will 547 * based on alternative versions, e.g. if we have no 'en_CA' we will
539 * look for 'en' as a fallback. It will also translate en-ca into en_CA. 548 * look for 'en' as a fallback. It will also translate en-ca into en_CA.
540 * Null is also considered a valid value for [newLocale], indicating 549 * Null is also considered a valid value for [newLocale], indicating
541 * to use the default. 550 * to use the default.
542 */ 551 */
543 _setLocale(String newLocale) { 552 _setLocale(String newLocale) {
544 _locale = Intl.verifiedLocale(newLocale, localeExists); 553 _locale = Intl.verifiedLocale(newLocale, localeExists);
545 } 554 }
546 555
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
581 _DateFormatField _match(String pattern) { 590 _DateFormatField _match(String pattern) {
582 for (var i = 0; i < _matchers.length; i++) { 591 for (var i = 0; i < _matchers.length; i++) {
583 var regex = _matchers[i]; 592 var regex = _matchers[i];
584 var match = regex.firstMatch(pattern); 593 var match = regex.firstMatch(pattern);
585 if (match != null) { 594 if (match != null) {
586 return _fieldConstructors[i](match.group(0), this); 595 return _fieldConstructors[i](match.group(0), this);
587 } 596 }
588 } 597 }
589 } 598 }
590 } 599 }
OLDNEW
« no previous file with comments | « no previous file | pkg/intl/test/date_time_format_test_core.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698