Ignore:
Timestamp:
07/02/09 13:38:44 (15 years ago)
Author:
alexandrecorreia
Message:

Ticket #474 - Arquivos modificados para a tradução do Applet.

Location:
trunk/jabberit_messenger/java_source/src/nu/fw/jeti/util
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/jabberit_messenger/java_source/src/nu/fw/jeti/util/I18N.java

    r1064 r1070  
    1 /* 
     1/** 
    22 * @Author(s) - Alexndre Correia 
    3  * 
    4  * This class is a wrapper for easier i18n of Jeti.  
    5  * It uses the standard i18n mechanisms given by Java.  
    6  *  
    73 * Created on - 30/06/2009 
    84 */ 
     
    106package nu.fw.jeti.util; 
    117 
     8import java.nio.charset.Charset; 
     9import java.nio.charset.CharsetDecoder; 
    1210import java.util.*; 
    1311 
     
    2119        private static HashMap messagesLangPlugins; 
    2220         
     21        private static String getEncoding() 
     22        { 
     23                CharsetDecoder decoder = Charset.defaultCharset().newDecoder(); 
     24        String charsetType = decoder.charset().toString(); 
     25         
     26        return charsetType; 
     27        } 
     28 
    2329        public static String getText(String type, String messageID) 
    2430        { 
     
    3945                //remove & 
    4046                int i = translation.indexOf("&"); 
    41                 if (i > -1) 
    42                 { 
     47                 
     48                if ( i > -1 ) 
    4349                        translation = translation.substring(0, i) + translation.substring(i + 1, translation.length()); 
    44                 } 
    4550 
    4651                return translation; 
     
    5863                if( translation == null ) 
    5964                { 
    60                         int dotPos = messageID.lastIndexOf('.'); 
     65                        translation = (String)messagesLangPlugins.get(messageID); 
    6166                         
    62                         if ( dotPos > 0 ) 
    63                                 messageID = messageID.substring(dotPos+1); 
    64                          
    65                         return messageID.replace('_',' ');                       
     67                        if( translation == null ) 
     68                        { 
     69                                int dotPos = messageID.lastIndexOf('.'); 
     70                                 
     71                                if ( dotPos > 0 ) 
     72                                        messageID = messageID.substring(dotPos+1); 
     73                                 
     74                                return messageID.replace('_',' '); 
     75                        } 
    6676                } 
    6777 
    68                 return translation;  
     78                // Encoding UTF-8/ISO-8859-1             
     79                try 
     80                { 
     81 
     82                        translation = new String(translation.getBytes("UTF-8"), "UTF-8"); 
     83 
     84                }catch(Exception e){} 
     85 
     86                return translation; 
    6987        } 
    7088 
     
    169187                Locale myLocale   = null; 
    170188 
    171                 if( myLanguage != "" ) 
     189                if( !myLanguage.equals("") && !myCountry.equals("") ) 
    172190                        myLocale = new Locale(myLanguage, myCountry); 
    173191                else 
    174192                        myLocale = new Locale("en", "US"); 
    175  
    176                 System.out.println("Valor de myLocale : " + myLocale); 
    177193                 
    178194                I18N.loadLanguages(myLocale); 
  • trunk/jabberit_messenger/java_source/src/nu/fw/jeti/util/Preferences.java

    r1064 r1070  
    104104        { 
    105105                /** 
    106                  * @author(s) : Alexandre Correia - alexandrecorreia@celepar.pr.gov.br 
    107                  * @brief : Adicionado as traduções para os items do menu ( presença ) 
     106                 * @Author(s) : Alexandre Correia - alexandrecorreia@celepar.pr.gov.br 
     107                 * @description : Adicionado as traducoes para os items do menu ( presenca ) 
    108108                 */ 
    109109                 
    110110                List tempList = new ArrayList(10); 
    111                         tempList.add("Disponível"); 
    112                         tempList.add("Livre p/ Chat"); 
     111                        tempList.add(I18N.gettext("initMessages.Available")); 
     112                        tempList.add(I18N.gettext("initMessages.Free_for_Chat")); 
    113113                        mapMessages.put("chat", tempList); 
    114114                        mapMessages.put("available", tempList); 
    115115                        tempList = new ArrayList(10); 
    116                         tempList.add("Em reunião"); 
    117                         tempList.add("Ocupado"); 
    118                         tempList.add("Trabalhando"); 
     116                        tempList.add(I18N.gettext("initMessages.In_a_meeting")); 
     117                        tempList.add(I18N.gettext("initMessages.Busy")); 
     118                        tempList.add(I18N.gettext("initMessages.Working")); 
    119119                        mapMessages.put("dnd", tempList); 
    120120                        tempList = new ArrayList(10); 
    121                         tempList.add("No telefone"); 
    122                         tempList.add("Volto Logo"); 
     121                        tempList.add(I18N.gettext("initMessages.On_the_phone")); 
     122                        tempList.add(I18N.gettext("initMessages.Be_right_back")); 
    123123                        mapMessages.put("away", tempList); 
    124124                        tempList = new ArrayList(10); 
    125                         tempList.add("Férias"); 
    126                         tempList.add("Em casa"); 
    127                         tempList.add("Ausente"); 
     125                        tempList.add(I18N.gettext("initMessages.On_vacation")); 
     126                        tempList.add(I18N.gettext("initMessages.Gone_home")); 
     127                        tempList.add(I18N.gettext("initMessages.Extend_Away")); 
    128128                        mapMessages.put("xa", tempList); 
    129129                 
     
    145145        { 
    146146                mapMessages.putAll(jetiExtension.getMessages()); 
    147                 //removed save message version check because it gives problems when 
    148                 //the server has removed the messages so there is no version 
    149 //              if(jetiExtension.getXmlVersion()==null) 
    150 //              {//on extension not found set save to true to try to overwrite 
    151 //                      save = true; 
    152 //              } 
    153 //              else  
    154 //              { 
    155 //                      try 
    156 //                      { 
    157 //                              //save if loaded xml version <= own xmlversion (backwards compatible) 
    158 //                              save = (Integer.parseInt(jetiExtension.getXmlVersion().substring(1)) <= Integer.parseInt(JetiPrivateExtension.XML_VERSION.substring(1))); 
    159 //                      } 
    160 //                      catch (Exception e) 
    161 //                      { 
    162 //                      } //exception not saven 
    163 //              } 
    164147        } 
    165148 
     
    172155        { 
    173156                mapMessages.put(convertPresenceKey(key), value); 
    174                 //if(save)backend.savePreferences(map,mapMessages); 
    175157        } 
    176158         
Note: See TracChangeset for help on using the changeset viewer.