Changeset 1070 for trunk/jabberit_messenger/java_source/src/nu/fw/jeti/util
- Timestamp:
- 07/02/09 13:38:44 (15 years ago)
- 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 /** 2 2 * @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 *7 3 * Created on - 30/06/2009 8 4 */ … … 10 6 package nu.fw.jeti.util; 11 7 8 import java.nio.charset.Charset; 9 import java.nio.charset.CharsetDecoder; 12 10 import java.util.*; 13 11 … … 21 19 private static HashMap messagesLangPlugins; 22 20 21 private static String getEncoding() 22 { 23 CharsetDecoder decoder = Charset.defaultCharset().newDecoder(); 24 String charsetType = decoder.charset().toString(); 25 26 return charsetType; 27 } 28 23 29 public static String getText(String type, String messageID) 24 30 { … … 39 45 //remove & 40 46 int i = translation.indexOf("&"); 41 if (i > -1)42 {47 48 if ( i > -1 ) 43 49 translation = translation.substring(0, i) + translation.substring(i + 1, translation.length()); 44 }45 50 46 51 return translation; … … 58 63 if( translation == null ) 59 64 { 60 int dotPos = messageID.lastIndexOf('.');65 translation = (String)messagesLangPlugins.get(messageID); 61 66 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 } 66 76 } 67 77 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; 69 87 } 70 88 … … 169 187 Locale myLocale = null; 170 188 171 if( myLanguage != "")189 if( !myLanguage.equals("") && !myCountry.equals("") ) 172 190 myLocale = new Locale(myLanguage, myCountry); 173 191 else 174 192 myLocale = new Locale("en", "US"); 175 176 System.out.println("Valor de myLocale : " + myLocale);177 193 178 194 I18N.loadLanguages(myLocale); -
trunk/jabberit_messenger/java_source/src/nu/fw/jeti/util/Preferences.java
r1064 r1070 104 104 { 105 105 /** 106 * @ author(s) : Alexandre Correia - alexandrecorreia@celepar.pr.gov.br107 * @ 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 ) 108 108 */ 109 109 110 110 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")); 113 113 mapMessages.put("chat", tempList); 114 114 mapMessages.put("available", tempList); 115 115 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")); 119 119 mapMessages.put("dnd", tempList); 120 120 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")); 123 123 mapMessages.put("away", tempList); 124 124 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")); 128 128 mapMessages.put("xa", tempList); 129 129 … … 145 145 { 146 146 mapMessages.putAll(jetiExtension.getMessages()); 147 //removed save message version check because it gives problems when148 //the server has removed the messages so there is no version149 // if(jetiExtension.getXmlVersion()==null)150 // {//on extension not found set save to true to try to overwrite151 // save = true;152 // }153 // else154 // {155 // try156 // {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 saven163 // }164 147 } 165 148 … … 172 155 { 173 156 mapMessages.put(convertPresenceKey(key), value); 174 //if(save)backend.savePreferences(map,mapMessages);175 157 } 176 158
Note: See TracChangeset
for help on using the changeset viewer.