languagelist.java

来自「webwork source」· Java 代码 · 共 51 行

JAVA
51
字号
/* * WebWork, Web Application Framework * * Distributable under Apache license. * See terms of license at opensource.org */package webwork.examples.i18n;import webwork.action.ActionSupport;import java.io.IOException;import java.io.InputStream;import java.util.Map;import java.util.Properties;/** * This code is an adaptation of the I18N example from the JavaWorld article by Govind Seshadri. * http://www.javaworld.com/javaworld/jw-03-2000/jw-03-ssj-jsp_p.html */public class LanguageList   extends ActionSupport{   // Attributes ----------------------------------------------------   static Properties languages;      static   {      // This never changes, so we do it once only      languages = new Properties();            // We read the values from a file so that it is easy to change      try      {         InputStream in = LanguageList.class.getResourceAsStream("languages.properties");         languages.load(in);         in.close();         } catch (IOException e)      {         e.printStackTrace(System.err);         System.err.println("Could not read list of languages");         languages.put("en", "English"); // Default so we at least get something      }   }      // Public --------------------------------------------------------   public Map getLanguages()   {      return languages;   }}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?