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

Side by Side Diff: ui/base/l10n/l10n_util_plurals.h

Issue 1049513002: Use the ICU syntax message for plural formatting (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: ios whitelist update Created 5 years, 8 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
« no previous file with comments | « ui/base/l10n/l10n_util.cc ('k') | ui/base/l10n/l10n_util_plurals.cc » ('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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // This file contains utility functions for dealing with pluralization of 5 // This file contains utility functions for dealing with pluralization of
6 // localized content. 6 // localized content.
7 7
8 #ifndef UI_BASE_L10N_L10N_UTIL_PLURALS_H_ 8 #ifndef UI_BASE_L10N_L10N_UTIL_PLURALS_H_
9 #define UI_BASE_L10N_L10N_UTIL_PLURALS_H_ 9 #define UI_BASE_L10N_L10N_UTIL_PLURALS_H_
10 10
11 #include <string> 11 #include <string>
12 #include <vector> 12 #include <vector>
13 13
14 #include "base/memory/scoped_ptr.h" 14 #include "base/memory/scoped_ptr.h"
15 #include "third_party/icu/source/i18n/unicode/plurfmt.h" 15 #include "third_party/icu/source/i18n/unicode/msgfmt.h"
16 #include "third_party/icu/source/i18n/unicode/plurrule.h" 16 #include "third_party/icu/source/i18n/unicode/plurrule.h"
17 17
18 namespace l10n_util { 18 namespace l10n_util {
19 19
20 // Returns a PluralRules for the current locale. 20 // Returns a PluralRules for the current locale.
21 scoped_ptr<icu::PluralRules> BuildPluralRules(); 21 scoped_ptr<icu::PluralRules> BuildPluralRules();
22 22
23 // Returns a PluralFormat from |message_ids|. |message_ids| must be size 6 and 23 // Formats |number| using MessageFormat |format| and appends the result
24 // in order: default, singular, zero, two, few, many. 24 // to |append_to|.
25 scoped_ptr<icu::PluralFormat> BuildPluralFormat( 25 // |format| has to be generated with ICU's plural message format.
26 const std::vector<int>& message_ids); 26 // See http://userguide.icu-project.org/formatparse/messages
27 void FormatNumberInPlural(const icu::MessageFormat& format, int number,
28 icu::UnicodeString* append_to, UErrorCode* err);
27 29
28 } // namespace l10n_util 30 } // namespace l10n_util
29 31
30 #endif // UI_BASE_L10N_L10N_UTIL_PLURALS_H_ 32 #endif // UI_BASE_L10N_L10N_UTIL_PLURALS_H_
OLDNEW
« no previous file with comments | « ui/base/l10n/l10n_util.cc ('k') | ui/base/l10n/l10n_util_plurals.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698