2012-05-10 49 views

回答

0

使用的ResourceBundle其中有一個答案,你的解決方案

查覈在BB網站的鏈接 http://docs.blackberry.com/en/developers/deliverables/12002/Localizing_BlackBerry_Application_projects_655976_11.jsp

這可能幫助你創造一個ResourceBundle 下面是一個示例程序,從英語轉換爲法語,反之亦然按一下按鈕

public class Screen extends MainScreen implements AppResource{ 
    LabelField lf1,lf2; 
    ResourceBundle rb; 
    ButtonField Convertor; 
    boolean eng; 
    Screen() 
    { 

     Convertor=new ButtonField("Convert to French"); 
     eng=true; 

     rb=ResourceBundle.getBundle(AppResource.BUNDLE_ID, AppResource.BUNDLE_NAME); 
     lf1=new LabelField(rb.getString(LABEL)); 
     lf2=new LabelField(rb.getString(TEXT)); 
     add(lf1); 
     add(lf2); 
     add(Convertor); 
    } 

    protected boolean navigationClick(int status, int time) { 
     // TODO Auto-generated method stub 

     Field f=getFieldWithFocus(); 

      if(f==Convertor) 
      { 
       if(eng==true) 
       { 
        Locale.setDefault(Locale.get(Locale.LOCALE_fr, null)); 
        lf1.setText(rb.getString(LABEL)); 
        lf2.setText(rb.getString(TEXT)); 
        eng=false; 
        Convertor.setLabel("Convert to English"); 

       } 
       else if(eng==false) 
       { 

       Locale.setDefault(Locale.get(Locale.LOCALE_en, null)); 
       lf1.setText(rb.getString(LABEL)); 
       lf2.setText(rb.getString(TEXT)); 

       eng=true; 
       Convertor.setLabel("Convert to French"); 

       } 

      } 

     return super.navigationClick(status, time); 
    } 
} 
+0

對不起。我對此有點新鮮。我不確定什麼是資源文件。請告訴我更多關於它的信息。該應用程序是由其他人開發的。我只是上傳它。 – ambit

+0

如果我沒有錯,這是爲了本地化實際應用的內容。我只想在西班牙語的BB應用程序世界中描述我的應用程序。目前,我的應用程序的說明是英文的。 – ambit

+0

你可以loaclise它 – Yatin

相關問題