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

Side by Side Diff: lib/i18n/bidi_utils.dart

Issue 10692018: Add intl to apidoc, and some minor comment formatting cleanup. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 5 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 | « lib/i18n/bidi_formatter.dart ('k') | lib/i18n/date_format.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 #library('bidi_utils');
6
7 /** 5 /**
8 * Bidi stands for Bi-directional text. 6 * Bidi stands for Bi-directional text.
9 * According to http://en.wikipedia.org/wiki/Bi-directional_text: 7 * According to http://en.wikipedia.org/wiki/Bi-directional_text:
10 * Bi-directional text is text containing text in both text directionalities, 8 * Bi-directional text is text containing text in both text directionalities,
11 * both right-to-left (RTL) and left-to-right (LTR). It generally involves text 9 * both right-to-left (RTL) and left-to-right (LTR). It generally involves text
12 * containing different types of alphabets, but may also refer to boustrophedon, 10 * containing different types of alphabets, but may also refer to boustrophedon,
13 * which is changing text directionality in each row. 11 * which is changing text directionality in each row.
14 * 12 *
15 * This file provides some utility classes for determining directionality of 13 * This file provides some utility classes for determining directionality of
16 * text, switching CSS layout from LTR to RTL, and other normalizing utilities 14 * text, switching CSS layout from LTR to RTL, and other normalizing utilities
17 * needed when switching between RTL and LTR formatting. 15 * needed when switching between RTL and LTR formatting.
18 * 16 *
19 * It defines the TextDirection class which is used to represent directionality 17 * It defines the TextDirection class which is used to represent directionality
20 * of text, 18 * of text,
21 * In most cases, it is preferable to use bidi_formatter.dart, which provides 19 * In most cases, it is preferable to use bidi_formatter.dart, which provides
22 * bidi functionality in the given directional context, instead of using 20 * bidi functionality in the given directional context, instead of using
23 * bidi_utils.dart directly. 21 * bidi_utils.dart directly.
24 */ 22 */
25
26 /** Class containing constants to represent the directionality of text. */
27 class TextDirection { 23 class TextDirection {
28 static final LTR = const TextDirection._('LTR', 'ltr'); 24 static final LTR = const TextDirection._('LTR', 'ltr');
29 static final RTL = const TextDirection._('RTL', 'rtl'); 25 static final RTL = const TextDirection._('RTL', 'rtl');
30 // If the directionality of the text cannot be determined and we are not using 26 // If the directionality of the text cannot be determined and we are not using
31 // the context direction (or if the context direction is unknown), then the 27 // the context direction (or if the context direction is unknown), then the
32 // text falls back on the more common ltr direction. 28 // text falls back on the more common ltr direction.
33 static final UNKNOWN = const TextDirection._('UNKNOWN', 'ltr'); 29 static final UNKNOWN = const TextDirection._('UNKNOWN', 'ltr');
34 30
35 /** 31 /**
36 * Textual representation of the directionality constant. One of 32 * Textual representation of the directionality constant. One of
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after
388 384
389 /** 385 /**
390 * Check the directionality of [str], return true if the piece of 386 * Check the directionality of [str], return true if the piece of
391 * text should be laid out in RTL direction. If [isHtml] is true, the string 387 * text should be laid out in RTL direction. If [isHtml] is true, the string
392 * is HTML or HTML-escaped. 388 * is HTML or HTML-escaped.
393 */ 389 */
394 static bool detectRtlDirectionality(String str, [bool isHtml]) { 390 static bool detectRtlDirectionality(String str, [bool isHtml]) {
395 return estimateDirection(str, isHtml) == TextDirection.RTL; 391 return estimateDirection(str, isHtml) == TextDirection.RTL;
396 } 392 }
397 } 393 }
OLDNEW
« no previous file with comments | « lib/i18n/bidi_formatter.dart ('k') | lib/i18n/date_format.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698