diff options
author | Yana Stamcheva <yana@jitsi.org> | 2008-02-21 13:44:22 +0000 |
---|---|---|
committer | Yana Stamcheva <yana@jitsi.org> | 2008-02-21 13:44:22 +0000 |
commit | baecaaf2daf7daa5f3b86d0ce9e3cbd6532e3da9 (patch) | |
tree | e740ff03a5a2ab74862db3f4d69f5a5af02816fb /src | |
parent | f1c43bbaf829609e8110cde00fd982b7de42e89d (diff) | |
download | jitsi-baecaaf2daf7daa5f3b86d0ce9e3cbd6532e3da9.zip jitsi-baecaaf2daf7daa5f3b86d0ce9e3cbd6532e3da9.tar.gz jitsi-baecaaf2daf7daa5f3b86d0ce9e3cbd6532e3da9.tar.bz2 |
Remove i18n resources from:
- MSN account registration wizard
- RSS account registration wizard
- SIP account registration wizard
- SSH account registration wizard
- Yahoo account registration wizard
- ZeroConf account registration wizard
- Whiteboard plugin
- Plugin Manager plugin
Diffstat (limited to 'src')
18 files changed, 369 insertions, 296 deletions
diff --git a/src/net/java/sip/communicator/plugin/msnaccregwizz/Resources.java b/src/net/java/sip/communicator/plugin/msnaccregwizz/Resources.java index 9ac6a46..4ce8fc4 100644 --- a/src/net/java/sip/communicator/plugin/msnaccregwizz/Resources.java +++ b/src/net/java/sip/communicator/plugin/msnaccregwizz/Resources.java @@ -11,54 +11,91 @@ import java.io.*; import java.util.*; import net.java.sip.communicator.util.*; + /** - * The Messages class manages the access to the internationalization - * properties files. + * The <tt>Resources</tt> class manages the access to the internationalization + * properties files and the image resources used in this plugin. + * * @author Yana Stamcheva */ -public class Resources { - +public class Resources +{ private static Logger log = Logger.getLogger(Resources.class); - private static final String BUNDLE_NAME + /** + * The name of the resource, where internationalization strings for this + * plugin are stored. + */ + private static final String STRING_RESOURCE_NAME + = "resources.languages.plugin.msnaccregwizz.resources"; + + /** + * The name of the resource, where paths to images used in this bundle are + * stored. + */ + private static final String IMAGE_RESOURCE_NAME = "net.java.sip.communicator.plugin.msnaccregwizz.resources"; - private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle - .getBundle(BUNDLE_NAME); + /** + * The string resource bundle. + */ + private static final ResourceBundle STRING_RESOURCE_BUNDLE + = ResourceBundle.getBundle(STRING_RESOURCE_NAME); + + /** + * The image resource bundle. + */ + private static final ResourceBundle IMAGE_RESOURCE_BUNDLE + = ResourceBundle.getBundle(IMAGE_RESOURCE_NAME); + /** + * A constant pointing to the MSN protocol logo image. + */ public static ImageID MSN_LOGO = new ImageID("protocolIcon"); - + + /** + * A constant pointing to the Aim protocol wizard page image. + */ public static ImageID PAGE_IMAGE = new ImageID("pageImage"); /** * Returns an internationalized string corresponding to the given key. + * * @param key The key of the string. * @return An internationalized string corresponding to the given key. */ - public static String getString(String key) { - try { - return RESOURCE_BUNDLE.getString(key); - - } catch (MissingResourceException e) { - + public static String getString(String key) + { + try + { + return STRING_RESOURCE_BUNDLE.getString(key); + } + catch (MissingResourceException e) + { return '!' + key + '!'; } } /** * Loads an image from a given image identifier. + * * @param imageID The identifier of the image. * @return The image for the given identifier. */ - public static byte[] getImage(ImageID imageID) { + public static byte[] getImage(ImageID imageID) + { byte[] image = new byte[100000]; - String path = Resources.getString(imageID.getId()); - try { + String path = IMAGE_RESOURCE_BUNDLE.getString(imageID.getId()); + + try + { Resources.class.getClassLoader() .getResourceAsStream(path).read(image); - } catch (IOException e) { + } + catch (IOException e) + { log.error("Failed to load image:" + path, e); } @@ -68,16 +105,18 @@ public class Resources { /** * Represents the Image Identifier. */ - public static class ImageID { + public static class ImageID + { private String id; - private ImageID(String id) { + private ImageID(String id) + { this.id = id; } - public String getId() { + public String getId() + { return id; } } - } diff --git a/src/net/java/sip/communicator/plugin/msnaccregwizz/resources.properties b/src/net/java/sip/communicator/plugin/msnaccregwizz/resources.properties index 55b2bce..38492c7 100755 --- a/src/net/java/sip/communicator/plugin/msnaccregwizz/resources.properties +++ b/src/net/java/sip/communicator/plugin/msnaccregwizz/resources.properties @@ -1,11 +1,2 @@ -protocolName=MSN -protocolDescription=A protocol to connect and chat on the MSN Service. -uin=Email: -password=Password: -rememberPassword=Remember password -uinAndPassword=ID and Password -existingAccount=* The account you entered is already installed. -error=Error - protocolIcon=resources/images/protocol/msn/msn16x16.png -pageImage=resources/images/protocol/msn/msn64x64.png +pageImage=resources/images/protocol/msn/msn64x64.png
\ No newline at end of file diff --git a/src/net/java/sip/communicator/plugin/pluginmanager/PluginManagerActivator.java b/src/net/java/sip/communicator/plugin/pluginmanager/PluginManagerActivator.java index 388b8c9..a459b60 100644 --- a/src/net/java/sip/communicator/plugin/pluginmanager/PluginManagerActivator.java +++ b/src/net/java/sip/communicator/plugin/pluginmanager/PluginManagerActivator.java @@ -26,20 +26,20 @@ public class PluginManagerActivator implements BundleActivator private static ConfigurationService configService; /** - * Starts this bundle and adds the <tt>PluginManagerConfigForm</tt> contained + * Starts this bundle and adds the <td>PluginManagerConfigForm</tt> contained * in it to the configuration window obtained from the <tt>UIService</tt>. */ public void start(BundleContext bc) throws Exception { bundleContext = bc; - + ServiceReference uiServiceRef = bc.getServiceReference(UIService.class.getName()); - + uiService = (UIService) bc.getService(uiServiceRef); - + ConfigurationWindow configWindow = uiService.getConfigurationWindow(); - + if(configWindow != null) { PluginManagerConfigForm pluginManager diff --git a/src/net/java/sip/communicator/plugin/pluginmanager/Resources.java b/src/net/java/sip/communicator/plugin/pluginmanager/Resources.java index 5ef476b..da97508 100644 --- a/src/net/java/sip/communicator/plugin/pluginmanager/Resources.java +++ b/src/net/java/sip/communicator/plugin/pluginmanager/Resources.java @@ -16,55 +16,90 @@ import javax.swing.*; import net.java.sip.communicator.util.*; /** - * The Messages class manages the access to the internationalization - * properties files. + * The <tt>Resources</tt> class manages the access to the internationalization + * properties files and the image resources used in this plugin. + * * @author Yana Stamcheva */ -public class Resources { - +public class Resources +{ private static Logger log = Logger.getLogger(Resources.class); - private static final String BUNDLE_NAME + /** + * The name of the resource, where internationalization strings for this + * plugin are stored. + */ + private static final String STRING_RESOURCE_NAME + = "resources.languages.plugin.pluginmanager.resources"; + + /** + * The name of the resource, where paths to images used in this bundle are + * stored. + */ + private static final String IMAGE_RESOURCE_NAME = "net.java.sip.communicator.plugin.pluginmanager.resources"; + /** + * The name of the resource, where color constants used in this bundle are + * stored. + */ private static final String COLOR_BUNDLE_NAME = "resources.colors.colorResources"; - private static final ResourceBundle RESOURCE_BUNDLE - = ResourceBundle.getBundle(BUNDLE_NAME); + /** + * The string resource bundle. + */ + private static final ResourceBundle STRING_RESOURCE_BUNDLE + = ResourceBundle.getBundle(STRING_RESOURCE_NAME); + + /** + * The image resource bundle. + */ + private static final ResourceBundle IMAGE_RESOURCE_BUNDLE + = ResourceBundle.getBundle(IMAGE_RESOURCE_NAME); + /** + * The color resource bundle. + */ private static final ResourceBundle COLOR_RESOURCE_BUNDLE = ResourceBundle.getBundle(COLOR_BUNDLE_NAME); /** * Returns an internationalized string corresponding to the given key. + * * @param key The key of the string. * @return An internationalized string corresponding to the given key. */ - public static String getString(String key) { - try { - return RESOURCE_BUNDLE.getString(key); - - } catch (MissingResourceException e) { - + public static String getString(String key) + { + try + { + return STRING_RESOURCE_BUNDLE.getString(key); + } + catch (MissingResourceException e) + { return '!' + key + '!'; } } /** * Loads an image from a given image identifier. + * * @param imageID The identifier of the image. * @return The image for the given identifier. */ - public static ImageIcon getImage(String imageID) { + public static ImageIcon getImage(String imageID) + { BufferedImage image = null; - String path = Resources.getString(imageID); - try { + String path = IMAGE_RESOURCE_BUNDLE.getString(imageID); + try + { image = ImageIO.read(Resources.class.getClassLoader() .getResourceAsStream(path)); - - } catch (IOException e) { + } + catch (IOException e) + { log.error("Failed to load image:" + path, e); } @@ -73,18 +108,23 @@ public class Resources { /** * Loads an image from a given image identifier. + * * @param imageID The identifier of the image. * @return The image for the given identifier. */ - public static byte[] getImageInBytes(String imageID) { + public static byte[] getImageInBytes(String imageID) + { byte[] image = new byte[100000]; - String path = Resources.getString(imageID); - try { + String path = IMAGE_RESOURCE_BUNDLE.getString(imageID); + + try + { Resources.class.getClassLoader() .getResourceAsStream(path).read(image); - - } catch (IOException e) { + } + catch (IOException e) + { log.error("Failed to load image:" + path, e); } diff --git a/src/net/java/sip/communicator/plugin/pluginmanager/resources.properties b/src/net/java/sip/communicator/plugin/pluginmanager/resources.properties index 5934d14..86029c6 100644 --- a/src/net/java/sip/communicator/plugin/pluginmanager/resources.properties +++ b/src/net/java/sip/communicator/plugin/pluginmanager/resources.properties @@ -1,14 +1,3 @@ -activate=Activate -desactivate=Desactivate -install=Install -uninstall=Uninstall -update=Update -new=New -plugins=Plug-ins -cancel=Cancel -url=URL -showSystemBundles=Show system bundles -system=System installedStateIcon=resources/images/plugin/pluginmanager/installed.png desactivatedStateIcon=resources/images/plugin/pluginmanager/desactivated.png startingStateIcon=resources/images/plugin/pluginmanager/starting.png diff --git a/src/net/java/sip/communicator/plugin/rssaccregwizz/Resources.java b/src/net/java/sip/communicator/plugin/rssaccregwizz/Resources.java index cde8560..df944c3 100644 --- a/src/net/java/sip/communicator/plugin/rssaccregwizz/Resources.java +++ b/src/net/java/sip/communicator/plugin/rssaccregwizz/Resources.java @@ -12,9 +12,9 @@ import java.util.*; import net.java.sip.communicator.util.*; /** - * The Messages class manages the access to the internationalization - * properties files. - * + * The <tt>Resources</tt> class manages the access to the internationalization + * properties files and the image resources used in this plugin. + * * @author Emil Ivov */ public class Resources @@ -22,18 +22,45 @@ public class Resources private static Logger log = Logger.getLogger(Resources.class); - private static final String BUNDLE_NAME + /** + * The name of the resource, where internationalization strings for this + * plugin are stored. + */ + private static final String STRING_RESOURCE_NAME + = "resources.languages.plugin.rssaccregwizz.resources"; + + /** + * The name of the resource, where paths to images used in this bundle are + * stored. + */ + private static final String IMAGE_RESOURCE_NAME = "net.java.sip.communicator.plugin.rssaccregwizz.resources"; - private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle - .getBundle(BUNDLE_NAME); + /** + * The string resource bundle. + */ + private static final ResourceBundle STRING_RESOURCE_BUNDLE + = ResourceBundle.getBundle(STRING_RESOURCE_NAME); + + /** + * The image resource bundle. + */ + private static final ResourceBundle IMAGE_RESOURCE_BUNDLE + = ResourceBundle.getBundle(IMAGE_RESOURCE_NAME); + + /** + * A constant pointing to the RSS protocol logo image. + */ + public static ImageID RSS_LOGO = new ImageID("protocolIcon"); - public static ImageID GIBBERISH_LOGO = new ImageID("protocolIcon"); - + /** + * A constant pointing to the RSS protocol wizard page image. + */ public static ImageID PAGE_IMAGE = new ImageID("pageImage"); /** * Returns an internationalized string corresponding to the given key. + * * @param key The key of the string. * @return An internationalized string corresponding to the given key. */ @@ -41,8 +68,7 @@ public class Resources { try { - return RESOURCE_BUNDLE.getString(key); - + return STRING_RESOURCE_BUNDLE.getString(key); } catch (MissingResourceException exc) { @@ -52,6 +78,7 @@ public class Resources /** * Loads an image from a given image identifier. + * * @param imageID The identifier of the image. * @return The image for the given identifier. */ @@ -59,12 +86,11 @@ public class Resources { byte[] image = new byte[100000]; - String path = Resources.getString(imageID.getId()); + String path = IMAGE_RESOURCE_BUNDLE.getString(imageID.getId()); try { Resources.class.getClassLoader() .getResourceAsStream(path).read(image); - } catch (IOException exc) { diff --git a/src/net/java/sip/communicator/plugin/rssaccregwizz/RssAccountRegistrationWizard.java b/src/net/java/sip/communicator/plugin/rssaccregwizz/RssAccountRegistrationWizard.java index 929e74e..9bc8d79 100644 --- a/src/net/java/sip/communicator/plugin/rssaccregwizz/RssAccountRegistrationWizard.java +++ b/src/net/java/sip/communicator/plugin/rssaccregwizz/RssAccountRegistrationWizard.java @@ -63,7 +63,7 @@ public class RssAccountRegistrationWizard */ public byte[] getIcon() { - return Resources.getImage(Resources.GIBBERISH_LOGO); + return Resources.getImage(Resources.RSS_LOGO); } /** diff --git a/src/net/java/sip/communicator/plugin/rssaccregwizz/resources.properties b/src/net/java/sip/communicator/plugin/rssaccregwizz/resources.properties index 9571bad..4e33838 100644 --- a/src/net/java/sip/communicator/plugin/rssaccregwizz/resources.properties +++ b/src/net/java/sip/communicator/plugin/rssaccregwizz/resources.properties @@ -1,12 +1,2 @@ -protocolName=RSS -protocolDescription=Add your preferred RSS feeds into SIP Communicator ! -error=Error -rssAccountExist=RSS account already exists! -rssAccountInfo=This wizard will create an RSS account for you.\n\n\ -Note that you could have only one RSS account!\n\n\ -You can add RSS feeds to your contact list using the "Add contact" wizard. Fill in the contact address field with the URI of the RSS feed you would like to add. -rssAccountInfoTitle=RSS Account Information -rssAccountAttention=Please read attentively the information provided below! - protocolIcon=resources/images/protocol/rss/rss-online.png pageImage=resources/images/protocol/rss/rss64x64.png diff --git a/src/net/java/sip/communicator/plugin/sipaccregwizz/Resources.java b/src/net/java/sip/communicator/plugin/sipaccregwizz/Resources.java index 3e6f00c..8300ad3 100644 --- a/src/net/java/sip/communicator/plugin/sipaccregwizz/Resources.java +++ b/src/net/java/sip/communicator/plugin/sipaccregwizz/Resources.java @@ -11,20 +11,42 @@ import java.io.*; import java.util.*; import net.java.sip.communicator.util.*; + /** - * The Messages class manages the access to the internationalization - * properties files. + * The <tt>Resources</tt> class manages the access to the internationalization + * properties files and the image resources used in this plugin. + * * @author Yana Stamcheva */ public class Resources { private static Logger log = Logger.getLogger(Resources.class); - private static final String BUNDLE_NAME + /** + * The name of the resource, where internationalization strings for this + * plugin are stored. + */ + private static final String STRING_RESOURCE_NAME + = "resources.languages.plugin.sipaccregwizz.resources"; + + /** + * The name of the resource, where paths to images used in this bundle are + * stored. + */ + private static final String IMAGE_RESOURCE_NAME = "net.java.sip.communicator.plugin.sipaccregwizz.resources"; - private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle - .getBundle(BUNDLE_NAME); + /** + * The string resource bundle. + */ + private static final ResourceBundle STRING_RESOURCE_BUNDLE + = ResourceBundle.getBundle(STRING_RESOURCE_NAME); + + /** + * The image resource bundle. + */ + private static final ResourceBundle IMAGE_RESOURCE_BUNDLE + = ResourceBundle.getBundle(IMAGE_RESOURCE_NAME); public static ImageID SIP_LOGO = new ImageID("protocolIcon"); @@ -35,30 +57,38 @@ public class Resources { * @param key The key of the string. * @return An internationalized string corresponding to the given key. */ - public static String getString(String key) { - try { - return RESOURCE_BUNDLE.getString(key); - - } catch (MissingResourceException e) { + public static String getString(String key) + { + try + { + return STRING_RESOURCE_BUNDLE.getString(key); + } + catch (MissingResourceException e) + { return '!' + key + '!'; } } /** * Loads an image from a given image identifier. + * * @param imageID The identifier of the image. * @return The image for the given identifier. */ - public static byte[] getImage(ImageID imageID) { + public static byte[] getImage(ImageID imageID) + { byte[] image = new byte[100000]; - String path = Resources.getString(imageID.getId()); - try { + String path = IMAGE_RESOURCE_BUNDLE.getString(imageID.getId()); + + try + { Resources.class.getClassLoader() .getResourceAsStream(path).read(image); - - } catch (IOException e) { + } + catch (IOException e) + { log.error("Failed to load image:" + path, e); } @@ -68,16 +98,18 @@ public class Resources { /** * Represents the Image Identifier. */ - public static class ImageID { + public static class ImageID + { private String id; - private ImageID(String id) { + private ImageID(String id) + { this.id = id; } - public String getId() { + public String getId() + { return id; } } - } diff --git a/src/net/java/sip/communicator/plugin/sipaccregwizz/resources.properties b/src/net/java/sip/communicator/plugin/sipaccregwizz/resources.properties index 61954c3..7025db1 100755 --- a/src/net/java/sip/communicator/plugin/sipaccregwizz/resources.properties +++ b/src/net/java/sip/communicator/plugin/sipaccregwizz/resources.properties @@ -1,24 +1,2 @@ -protocolName=SIP -protocolDescription=The SIP protocol -uin=SIP id -password=Password -rememberPassword=Remember password -uinAndPassword=ID and Password -advancedOptions=Advanced Options -ovverideServerOps=Override server default options -registrar=Registrar -serverPort=Server port -proxy=Proxy -proxyPort=Proxy port -preferredTransport=Preferred transport -yes=Yes -no=No -existingAccount=* The account you entered is already installed. -enablePresence=Enable presence (SIMPLE) -forceP2PPresence=Force peer-to-peer presence mode -offlineContactPollingPeriod=Offline contacts polling period (in s.) -subscriptionExpiration=Default subscription duration (in s.) -presenceOptions=Presence Options - protocolIcon=resources/images/protocol/sip/sip16x16.png -pageImage=resources/images/protocol/sip/sip64x64.png +pageImage=resources/images/protocol/sip/sip64x64.png
\ No newline at end of file diff --git a/src/net/java/sip/communicator/plugin/sshaccregwizz/Resources.java b/src/net/java/sip/communicator/plugin/sshaccregwizz/Resources.java index d71f075..bf0fa66 100644 --- a/src/net/java/sip/communicator/plugin/sshaccregwizz/Resources.java +++ b/src/net/java/sip/communicator/plugin/sshaccregwizz/Resources.java @@ -20,9 +20,9 @@ import java.util.*; import net.java.sip.communicator.util.*; /** - * The Messages class manages the access to the internationalization - * properties files. - * + * The <tt>Resources</tt> class manages the access to the internationalization + * properties files and the image resources used in this plugin. + * * @author Shobhit Jindal */ public class Resources @@ -30,11 +30,31 @@ public class Resources private static Logger log = Logger.getLogger(Resources.class); - private static final String BUNDLE_NAME + /** + * The name of the resource, where internationalization strings for this + * plugin are stored. + */ + private static final String STRING_RESOURCE_NAME + = "resources.languages.plugin.sshaccregwizz.resources"; + + /** + * The name of the resource, where paths to images used in this bundle are + * stored. + */ + private static final String IMAGE_RESOURCE_NAME = "net.java.sip.communicator.plugin.sshaccregwizz.resources"; - private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle - .getBundle(BUNDLE_NAME); + /** + * The string resource bundle. + */ + private static final ResourceBundle STRING_RESOURCE_BUNDLE + = ResourceBundle.getBundle(STRING_RESOURCE_NAME); + + /** + * The image resource bundle. + */ + private static final ResourceBundle IMAGE_RESOURCE_BUNDLE + = ResourceBundle.getBundle(IMAGE_RESOURCE_NAME); public static ImageID SSH_LOGO = new ImageID("protocolIcon"); @@ -49,8 +69,7 @@ public class Resources { try { - return RESOURCE_BUNDLE.getString(key); - + return STRING_RESOURCE_BUNDLE.getString(key); } catch (MissingResourceException exc) { @@ -60,6 +79,7 @@ public class Resources /** * Loads an image from a given image identifier. + * * @param imageID The identifier of the image. * @return The image for the given identifier. */ @@ -67,23 +87,23 @@ public class Resources { byte[] image=null; InputStream inputStream; - - String path = Resources.getString(imageID.getId()); - + + String path = IMAGE_RESOURCE_BUNDLE.getString(imageID.getId()); + try { inputStream = Resources.class.getClassLoader() .getResourceAsStream(path); - + image = new byte[inputStream.available()]; - + inputStream.read(image); } catch (IOException exc) { log.error("Failed to load image:" + path, exc); } - + return image; } @@ -104,5 +124,4 @@ public class Resources return id; } } - } diff --git a/src/net/java/sip/communicator/plugin/sshaccregwizz/resources.properties b/src/net/java/sip/communicator/plugin/sshaccregwizz/resources.properties index 6512d0e..b4ff955 100644 --- a/src/net/java/sip/communicator/plugin/sshaccregwizz/resources.properties +++ b/src/net/java/sip/communicator/plugin/sshaccregwizz/resources.properties @@ -1,10 +1,2 @@ -protocolName=SSH -protocolDescription=A Protocol to connect to remote machines over SSH. -accountID=Account ID: -identityFile=Identitity File: -knownHosts=Known Hosts: -accountDetails=SSH Account Details -existingAccount=* The account you entered is already installed. - protocolIcon=resources/images/protocol/ssh/ssh-online.png -pageImage=resources/images/protocol/ssh/ssh64x64.png +pageImage=resources/images/protocol/ssh/ssh64x64.png
\ No newline at end of file diff --git a/src/net/java/sip/communicator/plugin/whiteboard/Resources.java b/src/net/java/sip/communicator/plugin/whiteboard/Resources.java index 41eecd0..4e5c9a0 100644 --- a/src/net/java/sip/communicator/plugin/whiteboard/Resources.java +++ b/src/net/java/sip/communicator/plugin/whiteboard/Resources.java @@ -14,12 +14,11 @@ import java.util.*; import javax.imageio.*; import javax.swing.*; -import net.java.sip.communicator.impl.gui.i18n.*; import net.java.sip.communicator.util.*; /** - * The Messages class manages the access to the internationalization properties - * files. + * The <tt>Resources</tt> class manages the access to the internationalization + * properties files and the image resources used in this plugin. * * @author Yana Stamcheva */ @@ -28,11 +27,32 @@ public class Resources private static Logger log = Logger.getLogger(Resources.class); - private static final String BUNDLE_NAME = - "net.java.sip.communicator.plugin.whiteboard.resources"; + /** + * The name of the resource, where internationalization strings for this + * plugin are stored. + */ + private static final String STRING_RESOURCE_NAME + = "resources.languages.plugin.whiteboard.resources"; + + /** + * The name of the resource, where paths to images used in this bundle are + * stored. + */ + private static final String IMAGE_RESOURCE_NAME + = "net.java.sip.communicator.plugin.whiteboard.resources"; + + /** + * The string resource bundle. + */ + private static final ResourceBundle STRING_RESOURCE_BUNDLE + = ResourceBundle.getBundle(STRING_RESOURCE_NAME); + + /** + * The image resource bundle. + */ + private static final ResourceBundle IMAGE_RESOURCE_BUNDLE + = ResourceBundle.getBundle(IMAGE_RESOURCE_NAME); - private static final ResourceBundle RESOURCE_BUNDLE = - ResourceBundle.getBundle(BUNDLE_NAME); /** * Returns an internationalized string corresponding to the given key. @@ -44,7 +64,7 @@ public class Resources { try { - String resourceString = RESOURCE_BUNDLE.getString(key); + String resourceString = STRING_RESOURCE_BUNDLE.getString(key); int mnemonicIndex = resourceString.indexOf('&'); @@ -77,7 +97,7 @@ public class Resources { try { - String resourceString = RESOURCE_BUNDLE.getString(key); + String resourceString = STRING_RESOURCE_BUNDLE.getString(key); resourceString = MessageFormat.format( resourceString, (Object[]) params); @@ -110,7 +130,7 @@ public class Resources { try { - String resourceString = RESOURCE_BUNDLE.getString(key); + String resourceString = STRING_RESOURCE_BUNDLE.getString(key); int mnemonicIndex = resourceString.indexOf('&'); @@ -135,13 +155,13 @@ public class Resources { BufferedImage image = null; - String path = Resources.getString(imageID); + String path = IMAGE_RESOURCE_BUNDLE.getString(imageID); + try { image = ImageIO.read(Resources.class.getClassLoader() .getResourceAsStream(path)); - } catch (IOException e) { @@ -150,29 +170,4 @@ public class Resources return new ImageIcon(image); } - - /** - * Loads an image from a given image identifier. - * - * @param imageID The identifier of the image. - * @return The image for the given identifier. - */ - public static byte[] getImageInBytes(String imageID) - { - byte[] image = new byte[100000]; - - String path = Resources.getString(imageID); - try - { - Resources.class.getClassLoader().getResourceAsStream(path).read( - image); - - } - catch (IOException e) - { - log.error("Failed to load image:" + path, e); - } - - return image; - } }
\ No newline at end of file diff --git a/src/net/java/sip/communicator/plugin/whiteboard/resources.properties b/src/net/java/sip/communicator/plugin/whiteboard/resources.properties index 0b4fe51..c9e78b4 100644 --- a/src/net/java/sip/communicator/plugin/whiteboard/resources.properties +++ b/src/net/java/sip/communicator/plugin/whiteboard/resources.properties @@ -24,52 +24,4 @@ squareIcon=resources/images/plugin/whiteboard/square.png straightLineIcon=resources/images/plugin/whiteboard/straight_line.png textIcon=resources/images/plugin/whiteboard/text.png text2Icon=resources/images/plugin/whiteboard/text2.png -inviteIcon=resources/images/plugin/whiteboard/inviteDialogIcon.png - -reason=Reason -accept=&Accept -reject=&Reject -ignore=&Ignore -invitationReceived=Invitation received -invitationReceivedFormInfo={0} has invited you to join {1} whiteboard. You could accept, reject or ignore this invitation. -invitation=Invitation text -whiteboardTitle=Whiteboard [Beta] -whiteboardMenuItemText=Whiteboard -whiteboardMenuItemNotSupportedTooltip=This contact does not support whiteboarding -cancel=Cancel -yes=Yes -no=No -doNotAskAgain=Do not ask me again. -closeSessionQuestion=Would you like to end current session ? If you choose "yes" the current session will be ended, otherwise only your whiteboard window will be closed. -file=File -draw=Draw -new=New -save=Save -open=Open -copy=Copy -paste=Paste -pen=Pen -select=Select -line=Line -rectangle=Rectangle -fillRectangle=Filled rectangle -text=Text -image=Image -polygon=Polygon -fillPolygon=Filled polygon -polyline=Polyline -circle=Circle -fillCircle=Filled circle -color=Color -modification=Modification -thickness=Thickness: -send=Send -print=Print -exit=Exit -edit=Edit -grid=Grid -deselect=Deselect -delete=Delete -properties=Properties -help=Help -About=About +inviteIcon=resources/images/plugin/whiteboard/inviteDialogIcon.png
\ No newline at end of file diff --git a/src/net/java/sip/communicator/plugin/yahooaccregwizz/Resources.java b/src/net/java/sip/communicator/plugin/yahooaccregwizz/Resources.java index cca7c2c..1655955 100644 --- a/src/net/java/sip/communicator/plugin/yahooaccregwizz/Resources.java +++ b/src/net/java/sip/communicator/plugin/yahooaccregwizz/Resources.java @@ -11,20 +11,42 @@ import java.io.*; import java.util.*; import net.java.sip.communicator.util.*; + /** - * The Messages class manages the access to the internationalization - * properties files. + * The <tt>Resources</tt> class manages the access to the internationalization + * properties files and the image resources used in this plugin. + * * @author Yana Stamcheva */ -public class Resources { - +public class Resources +{ private static Logger log = Logger.getLogger(Resources.class); - private static final String BUNDLE_NAME + /** + * The name of the resource, where internationalization strings for this + * plugin are stored. + */ + private static final String STRING_RESOURCE_NAME + = "resources.languages.plugin.yahooaccregwizz.resources"; + + /** + * The name of the resource, where paths to images used in this bundle are + * stored. + */ + private static final String IMAGE_RESOURCE_NAME = "net.java.sip.communicator.plugin.yahooaccregwizz.resources"; - private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle - .getBundle(BUNDLE_NAME); + /** + * The string resource bundle. + */ + private static final ResourceBundle STRING_RESOURCE_BUNDLE + = ResourceBundle.getBundle(STRING_RESOURCE_NAME); + + /** + * The image resource bundle. + */ + private static final ResourceBundle IMAGE_RESOURCE_BUNDLE + = ResourceBundle.getBundle(IMAGE_RESOURCE_NAME); public static ImageID YAHOO_LOGO = new ImageID("protocolIcon"); @@ -35,12 +57,14 @@ public class Resources { * @param key The key of the string. * @return An internationalized string corresponding to the given key. */ - public static String getString(String key) { - try { - return RESOURCE_BUNDLE.getString(key); - - } catch (MissingResourceException e) { - + public static String getString(String key) + { + try + { + return STRING_RESOURCE_BUNDLE.getString(key); + } + catch (MissingResourceException e) + { return '!' + key + '!'; } } @@ -50,15 +74,18 @@ public class Resources { * @param imageID The identifier of the image. * @return The image for the given identifier. */ - public static byte[] getImage(ImageID imageID) { + public static byte[] getImage(ImageID imageID) + { byte[] image = new byte[100000]; - String path = Resources.getString(imageID.getId()); - try { + String path = IMAGE_RESOURCE_BUNDLE.getString(imageID.getId()); + try + { Resources.class.getClassLoader() .getResourceAsStream(path).read(image); - - } catch (IOException e) { + } + catch (IOException e) + { log.error("Failed to load image:" + path, e); } @@ -68,14 +95,17 @@ public class Resources { /** * Represents the Image Identifier. */ - public static class ImageID { + public static class ImageID + { private String id; - private ImageID(String id) { + private ImageID(String id) + { this.id = id; } - public String getId() { + public String getId() + { return id; } } diff --git a/src/net/java/sip/communicator/plugin/yahooaccregwizz/resources.properties b/src/net/java/sip/communicator/plugin/yahooaccregwizz/resources.properties index 214f814..ca27ad0 100644 --- a/src/net/java/sip/communicator/plugin/yahooaccregwizz/resources.properties +++ b/src/net/java/sip/communicator/plugin/yahooaccregwizz/resources.properties @@ -1,11 +1,2 @@ -protocolName=YAHOO -protocolDescription=A protocol to connect and chat on the Yahoo Service. -uin=Username: -password=Password: -rememberPassword=Remember password -uinAndPassword=ID and Password -existingAccount=* The account you entered is already installed. -error=Error - protocolIcon=resources/images/protocol/yahoo/yahoo16x16.png -pageImage=resources/images/protocol/yahoo/yahoo64x64.png +pageImage=resources/images/protocol/yahoo/yahoo64x64.png
\ No newline at end of file diff --git a/src/net/java/sip/communicator/plugin/zeroconfaccregwizz/Resources.java b/src/net/java/sip/communicator/plugin/zeroconfaccregwizz/Resources.java index a064d3d..ad709cb 100644 --- a/src/net/java/sip/communicator/plugin/zeroconfaccregwizz/Resources.java +++ b/src/net/java/sip/communicator/plugin/zeroconfaccregwizz/Resources.java @@ -14,7 +14,8 @@ import net.java.sip.communicator.util.*; /** * The Resources class manages the access to the internationalization - * properties files. + * properties files and the images properties file. + * * @author Christian Vincenot * @author Maxime Catelin */ @@ -23,11 +24,31 @@ public class Resources private static Logger log = Logger.getLogger(Resources.class); - private static final String BUNDLE_NAME + /** + * The name of the resource, where internationalization strings for this + * plugin are stored. + */ + private static final String STRING_RESOURCE_NAME + = "resources.languages.plugin.zeroconfaccregwizz.resources"; + + /** + * The name of the resource, where paths to images used in this bundle are + * stored. + */ + private static final String IMAGE_RESOURCE_NAME = "net.java.sip.communicator.plugin.zeroconfaccregwizz.resources"; - private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle - .getBundle(BUNDLE_NAME); + /** + * The string resource bundle. + */ + private static final ResourceBundle STRING_RESOURCE_BUNDLE + = ResourceBundle.getBundle(STRING_RESOURCE_NAME); + + /** + * The image resource bundle. + */ + private static final ResourceBundle IMAGE_RESOURCE_BUNDLE + = ResourceBundle.getBundle(IMAGE_RESOURCE_NAME); public static ImageID ZEROCONF_LOGO = new ImageID("protocolIcon"); @@ -42,8 +63,7 @@ public class Resources { try { - return RESOURCE_BUNDLE.getString(key); - + return STRING_RESOURCE_BUNDLE.getString(key); } catch (MissingResourceException exc) { @@ -60,7 +80,7 @@ public class Resources { byte[] image = new byte[100000]; - String path = Resources.getString(imageID.getId()); + String path = IMAGE_RESOURCE_BUNDLE.getString(imageID.getId()); try { Resources.class.getClassLoader() @@ -96,5 +116,4 @@ public class Resources return id; } } - } diff --git a/src/net/java/sip/communicator/plugin/zeroconfaccregwizz/resources.properties b/src/net/java/sip/communicator/plugin/zeroconfaccregwizz/resources.properties index a0d1a8a..fea2e2f 100644 --- a/src/net/java/sip/communicator/plugin/zeroconfaccregwizz/resources.properties +++ b/src/net/java/sip/communicator/plugin/zeroconfaccregwizz/resources.properties @@ -1,12 +1,2 @@ -protocolName=Zeroconf -protocolDescription=The Zeroconf (Bonjour) service protocol. -userID=User ID: -firstname=Firname: -password=Password: -rememberPassword=Remember password -userAndPassword=Identification -existingAccount=* A Bonjour account already exists. You can only install a single Bonjour account. -error=Error - protocolIcon=resources/images/protocol/zeroconf/zeroconf-color-16.png -pageImage=resources/images/protocol/zeroconf/zeroconf-color-64.png +pageImage=resources/images/protocol/zeroconf/zeroconf-color-64.png
\ No newline at end of file |