2 *******************************************************************************
\r
3 * Copyright (C) 2004-2010, International Business Machines Corporation and *
\r
4 * others. All Rights Reserved. *
\r
5 *******************************************************************************
\r
8 package com.ibm.icu.dev.tool.ime.translit;
\r
10 import java.awt.Image;
\r
11 import java.awt.im.spi.InputMethod;
\r
12 import java.awt.im.spi.InputMethodDescriptor;
\r
13 import java.util.Locale;
\r
14 import java.util.MissingResourceException;
\r
15 import java.util.ResourceBundle;
\r
18 * The TransliteratorInputMethodDescriptor class is used to identify this package
\r
19 * as an input method editor.
\r
22 public class TransliteratorInputMethodDescriptor implements InputMethodDescriptor {
\r
24 private ResourceBundle rb = null;
\r
27 * Creates the Transliterator IME this is automatically callled by the
\r
28 * JVM when the Transliterator IME is selected from the input method list.
\r
30 * @return InputMethod The Transliterator IME object.
\r
32 public InputMethod createInputMethod() throws Exception {
\r
33 return new TransliteratorInputMethod();
\r
37 * Get the list of locales that this IME supports.
\r
39 * @return Locale[] This will always have one locale. By default
\r
40 * we just return the current locale. Therefore
\r
41 * the Transliterator IME works in all locales.
\r
43 // use the current active locale
\r
44 public Locale[] getAvailableLocales() {
\r
45 return new Locale[] {Locale.getDefault()};
\r
49 * The Transliterator IME does not support dynamic locales. The Transliterator
\r
50 * IME's functionality does not depend upon any locale.
\r
52 * @return boolean This will always be false.
\r
54 public boolean hasDynamicLocaleList() {
\r
59 * Obtain the localized name of the Transliterator IME
\r
61 * @param inputLocale the requested input method locale
\r
62 * @param displayLanguage The requested translation of the Transliterator IME
\r
63 * @return the localized name for the Transliterator IME
\r
65 public String getInputMethodDisplayName(Locale inputLocale,
\r
66 Locale displayLanguage) {
\r
70 rb = ResourceBundle.getBundle("com.ibm.icu.dev.tool.ime.translit.Transliterator", displayLanguage);
\r
71 name = rb.getString("name");
\r
73 catch (MissingResourceException m) {
\r
74 // use a hardcoded value
\r
75 name = "Transliterator";
\r
81 * Get the icon for the Transliterator IME. This is not supported.
\r
83 * @param inputLocale (This is ignored).
\r
85 * @return Image This will always be null.
\r
87 public Image getInputMethodIcon(Locale inputLocale) {
\r