ICU-114 make getDisplayName static

X-SVN-Rev: 531
This commit is contained in:
Alan Liu 2000-01-11 19:39:06 +00:00
parent 2394473ce8
commit 66e286def7
2 changed files with 16 additions and 4 deletions

View file

@ -339,6 +339,13 @@ private:
*/
static const char* RB_DISPLAY_NAME_PREFIX;
/**
* Prefix for resource bundle key for the display name for a
* transliterator SCRIPT. The ID is appended to this to form the key.
* The resource bundle value should be a String.
*/
static const char* RB_SCRIPT_DISPLAY_NAME_PREFIX;
/**
* Resource bundle key for display name pattern.
* The resource bundle value should be a String forming a
@ -651,7 +658,8 @@ public:
* display to the user in the default locale. See {@link
* #getDisplayName(Locale)} for details.
*/
virtual UnicodeString& getDisplayName(UnicodeString& result) const;
static UnicodeString& getDisplayName(const UnicodeString& ID,
UnicodeString& result);
/**
* Returns a name for this transliterator that is appropriate for
@ -671,8 +679,9 @@ public:
* localized.
* @see java.text.MessageFormat
*/
virtual UnicodeString& getDisplayName(const Locale& inLocale,
UnicodeString& result) const;
static UnicodeString& getDisplayName(const UnicodeString& ID,
const Locale& inLocale,
UnicodeString& result);
/**
* Returns the filter used by this transliterator, or <tt>null</tt>

View file

@ -43,6 +43,7 @@ TransliteratorTest::runIndexedTest(int32_t index, bool_t exec,
void TransliteratorTest::TestInstantiation() {
int32_t n = Transliterator::countAvailableIDs();
UnicodeString name;
for (int32_t i=0; i<n; ++i) {
UnicodeString id = Transliterator::getAvailableID(i);
if (id.length() < 1) {
@ -51,6 +52,8 @@ void TransliteratorTest::TestInstantiation() {
continue;
}
Transliterator* t = Transliterator::createInstance(id);
name.truncate(0);
Transliterator::getDisplayName(id, name);
if (t == 0) {
errln(UnicodeString("FAIL: Couldn't create ") + id);
// When createInstance fails, it deletes the failing
@ -62,7 +65,7 @@ void TransliteratorTest::TestInstantiation() {
--i; // Compensate for deleted entry
}
} else {
logln(UnicodeString("OK: ") + id);
logln(UnicodeString("OK: ") + name + " (" + id + ")");
}
delete t;
}