From 57582bbd08d59f8dc79bc06e433c8d02aec7e6b0 Mon Sep 17 00:00:00 2001 From: "efortuna@google.com" Date: Wed, 27 Jun 2012 22:49:06 +0000 Subject: [PATCH] Add intl to apidoc, and some minor comment formatting cleanup. Review URL: https://chromiumcodereview.appspot.com//10692018 git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@9192 260f80e4-7a28-3924-810f-c04153c831b5 --- lib/i18n/bidi_formatter.dart | 8 +------- lib/i18n/bidi_utils.dart | 4 ---- lib/i18n/date_format.dart | 9 +++++---- lib/i18n/intl.dart | 22 +++++++++++++--------- lib/i18n/intl_message.dart | 13 +++++-------- tests/lib/i18n/bidi_format_test.dart | 3 +-- tests/lib/i18n/bidi_utils_test.dart | 2 +- tests/lib/i18n/date_time_format_test.dart | 2 +- tests/lib/i18n/intl_message_test.dart | 5 +---- utils/apidoc/apidoc.dart | 1 + 10 files changed, 29 insertions(+), 40 deletions(-) diff --git a/lib/i18n/bidi_formatter.dart b/lib/i18n/bidi_formatter.dart index b78f2696652..40c6233803a 100644 --- a/lib/i18n/bidi_formatter.dart +++ b/lib/i18n/bidi_formatter.dart @@ -2,13 +2,9 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -#library('bidi_formatter'); - -#import('bidi_utils.dart'); - /** * Bidi stands for Bi-directional text. - * According to http://en.wikipedia.org/wiki/Bi-directional_text: + * According to [Wikipedia](http://en.wikipedia.org/wiki/Bi-directional_text): * Bi-directional text is text containing text in both text directionalities, * both right-to-left (RTL) and left-to-right (LTR). It generally involves text * containing different types of alphabets, but may also refer to boustrophedon, @@ -57,8 +53,6 @@ * then up to the caller to insert the return value in the output. */ -#import('dart:web'); - class BidiFormatter { /** The direction of the surrounding text (the context). */ diff --git a/lib/i18n/bidi_utils.dart b/lib/i18n/bidi_utils.dart index 1eaa56b040f..a666ab4d1f5 100644 --- a/lib/i18n/bidi_utils.dart +++ b/lib/i18n/bidi_utils.dart @@ -2,8 +2,6 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -#library('bidi_utils'); - /** * Bidi stands for Bi-directional text. * According to http://en.wikipedia.org/wiki/Bi-directional_text: @@ -22,8 +20,6 @@ * bidi functionality in the given directional context, instead of using * bidi_utils.dart directly. */ - -/** Class containing constants to represent the directionality of text. */ class TextDirection { static final LTR = const TextDirection._('LTR', 'ltr'); static final RTL = const TextDirection._('RTL', 'rtl'); diff --git a/lib/i18n/date_format.dart b/lib/i18n/date_format.dart index 1941f604b5a..dfc9412cc16 100644 --- a/lib/i18n/date_format.dart +++ b/lib/i18n/date_format.dart @@ -46,7 +46,9 @@ * Items marked with '#' work differently than in Java. * * The count of pattern letters determine the format. - * **Text**: + * + * **Text**: + * * * 4 or more pattern letters--use full form, * * less than 4--use short or abbreviated form if one exists. * In parsing, we will always try long format, then short. @@ -106,8 +108,6 @@ * that point, the parse of the run fails. */ -#library('date_format'); - class DateFormat { /** Definition of how this object formats dates. */ @@ -126,7 +126,8 @@ class DateFormat { * given the pattern. */ // TODO(efortuna): Hear back from i18n about Time Zones and the "core set" - // of skeleton patterns. + // of skeleton patterns. When this is complete, also properly comment these + // so the documentation is available on api_docs. // Example of how this looks in the US // locale. static final String Hm = 'Hm'; // HH:mm diff --git a/lib/i18n/intl.dart b/lib/i18n/intl.dart index 3598fc1ac3c..07e9bb70eda 100644 --- a/lib/i18n/intl.dart +++ b/lib/i18n/intl.dart @@ -1,17 +1,21 @@ +// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +#library('intl'); + +#import('dart:web'); + +#source('intl_message.dart'); +#source('date_format.dart'); +#source('bidi_formatter.dart'); +#source('bidi_utils.dart'); + /** - * Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file - * for details. All rights reserved. Use of this source code is governed by a - * BSD-style license that can be found in the LICENSE file. - * * Internationalization object providing access to message formatting objects, * date formatting, parsing, bidirectional text relative to a specific locale. */ -#library('Intl'); - -#import('intl_message.dart'); -#import('date_format.dart'); - class Intl { /** diff --git a/lib/i18n/intl_message.dart b/lib/i18n/intl_message.dart index 1c8c4a90ed6..a2d2ae3fe77 100644 --- a/lib/i18n/intl_message.dart +++ b/lib/i18n/intl_message.dart @@ -7,10 +7,10 @@ * * * _message example: - * '''I see ${Intl.plural(num_people, - * {'0': 'no one at all', - * '1': 'one other person', - * 'other': '$num_people other people'})} in $place.'''' + * '''I see ${Intl.plural(num_people, + * {'0': 'no one at all', + * '1': 'one other person', + * 'other': '$num_people other people'})} in $place.'''' * * Usage examples: * today(date) => intl.message( @@ -29,13 +29,10 @@ * * Calling `msg({'num_people': 2, 'place': 'Athens'});` would * produce "I see 2 other people in Athens." as output. - * * * See tests/message_format_test.dart for more examples. */ - -#library('intl_message'); + //TODO(efortuna): documentation example involving the offset parameter? class IntlMessage { diff --git a/tests/lib/i18n/bidi_format_test.dart b/tests/lib/i18n/bidi_format_test.dart index 03cc2cc4aaa..2cbe61e48f6 100644 --- a/tests/lib/i18n/bidi_format_test.dart +++ b/tests/lib/i18n/bidi_format_test.dart @@ -5,8 +5,7 @@ #library('bidi_format_test'); -#import('../../../lib/i18n/bidi_formatter.dart'); -#import('../../../lib/i18n/bidi_utils.dart'); +#import('../../../lib/i18n/intl.dart'); #import('../../../lib/unittest/unittest.dart'); /** diff --git a/tests/lib/i18n/bidi_utils_test.dart b/tests/lib/i18n/bidi_utils_test.dart index d4f838e9e47..397f6dbe791 100644 --- a/tests/lib/i18n/bidi_utils_test.dart +++ b/tests/lib/i18n/bidi_utils_test.dart @@ -5,7 +5,7 @@ #library('bidi_utils_test'); -#import('../../../lib/i18n/bidi_utils.dart'); +#import('../../../lib/i18n/intl.dart'); #import('../../../lib/unittest/unittest.dart'); /** diff --git a/tests/lib/i18n/date_time_format_test.dart b/tests/lib/i18n/date_time_format_test.dart index 624a09a3d4b..168fe7fdbf3 100644 --- a/tests/lib/i18n/date_time_format_test.dart +++ b/tests/lib/i18n/date_time_format_test.dart @@ -6,7 +6,7 @@ #library('date_time_format_test'); -#import('../../../lib/i18n/date_format.dart'); +#import('../../../lib/i18n/intl.dart'); #import('../../../lib/unittest/unittest.dart'); /** diff --git a/tests/lib/i18n/intl_message_test.dart b/tests/lib/i18n/intl_message_test.dart index 72533b14462..9a11ae369db 100644 --- a/tests/lib/i18n/intl_message_test.dart +++ b/tests/lib/i18n/intl_message_test.dart @@ -6,12 +6,9 @@ #library('intl_message_test'); #import('../../../lib/i18n/intl.dart'); -#import('../../../lib/i18n/intl_message.dart'); #import('../../../lib/unittest/unittest.dart'); -/** - * Tests the MessageFormat library in dart. - */ +/** Tests the MessageFormat library in dart. */ class Person { String firstName, lastName; diff --git a/utils/apidoc/apidoc.dart b/utils/apidoc/apidoc.dart index 0cdf0dca6e1..38872318a14 100644 --- a/utils/apidoc/apidoc.dart +++ b/utils/apidoc/apidoc.dart @@ -130,6 +130,7 @@ void main() { world.getOrAddLibrary('dart:json'); world.getOrAddLibrary('${doc.scriptDir}/../../lib/math/math.dart'); world.getOrAddLibrary('${doc.scriptDir}/../../lib/unittest/unittest.dart'); + world.getOrAddLibrary('${doc.scriptDir}/../../lib/i18n/intl.dart'); world.getOrAddLibrary('dart:uri'); world.getOrAddLibrary('dart:utf'); world.getOrAddLibrary('dart:web');