2,231 Views 2 Replies Last post: Feb 14, 2008 9:36 PM by wsajapan RSS
Bronze 4 posts since
Nov 28, 2006
Currently Being Moderated

Jan 15, 2008 10:54 PM

[bug]: the Spark's language plugin don't list all language menus

 

when I want to add the QQtransport code for Spark,I found a bug for language plugi.

 

 

I got the code from svn , http://svn.igniterealtime.org/svn/repos/spark/trunk

 

 

code version is : 9772 .

 

 

spark_lc01.jpg is the bug for .

 

 

Then I read the code ,and I found that why bug happened.

 

 

In   the method "addLanguage ",

 

 

It used " if (locale.getLanguage().equals(language)) "  to check Locale.

 

 

but getLanguage() for "zh_CN"  and "xx_YY",only ge "zh" or "xx".

 

 

also ,locale.getDisplayLanguage(locale) for "zn_CN" is same of for "zn_TW".

 

 

My code for fix this bug:

 

 

 


   private void addLanguage(String language) {

        for (final Locale locale : locales) {

            if (locale.toString().equals(language)) {//fix it,by lizongbo

                Action action = new AbstractAction() {

                    public void actionPerformed(ActionEvent e) {

                        final LocalPreferences preferences = SettingsManager.

                                getLocalPreferences();

                        preferences.setLanguage(locale.toString());// fix it ,by lizongbo

                        SettingsManager.saveSettings();



                        int ok = JOptionPane.showConfirmDialog(SparkManager.

                                getMainWindow(),

                                Res.getString("message.restart.required"),

                                Res.

                                getString("title.confirmation"),

                                JOptionPane.YES_NO_OPTION);

                        if (ok == JOptionPane.YES_OPTION) {

                            SparkManager.getMainWindow().shutdown();

                        }

                    }

                };

                // change the menu label ,by lizongbo

                String label = locale.getDisplayLanguage(locale);

                if (locale.getDisplayCountry(locale) != null &&

                    locale.getDisplayCountry(locale).trim().length() > 0) {

                    label = label + "-" + locale.getDisplayCountry(locale).trim();

                }

                action.putValue(Action.NAME, label);

                languageMenu.add(action);

                break;

            }

        }

    }


 

 

 

 

 

 

after fix the bug ,we can see all of the available language menus.

 

 

see: spark_lc02.jpg

 

 

 

 

 

 

 

 

 

 

 

Attachments:
Tags: plugin, i18n, chinese
Daniel Henninger KeyContributor 2,951 posts since
Aug 10, 2005
Currently Being Moderated
Jan 20, 2008 8:44 PM in response to: lizongbo
Re: [bug]: the Spark's language plugin don't list all language menus

Howdy!  Just added this fix in SVN.

Bronze 1 posts since
Feb 14, 2008
Currently Being Moderated
Feb 14, 2008 9:36 PM in response to: Daniel Henninger
Re: [bug]: the Spark's language plugin don't list all language menus

Dear jadestorm,

 

Where can I get his plugin?

 

Thanks,

Chris

More Like This

  • Retrieving data ...

Bookmarked By (0)