Restructured the baseline to remove extra src/main directory structure. Added eclipes project file
git-svn-id: http://webgoat.googlecode.com/svn/branches/webgoat-6.0@485 4033779f-a91e-0410-96ef-6bf7bf53c507
This commit is contained in:
41
java/org/owasp/webgoat/util/WebGoatI18N.java
Normal file
41
java/org/owasp/webgoat/util/WebGoatI18N.java
Normal file
@ -0,0 +1,41 @@
|
||||
package org.owasp.webgoat.util;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Locale;
|
||||
import java.util.ResourceBundle;
|
||||
|
||||
import org.owasp.webgoat.session.WebgoatContext;
|
||||
|
||||
public class WebGoatI18N {
|
||||
|
||||
private static HashMap<String,ResourceBundle> labels= new HashMap<String,ResourceBundle>();
|
||||
private static String defaultLanguage ;
|
||||
private static String currentLanguage;
|
||||
|
||||
public WebGoatI18N(WebgoatContext context){
|
||||
Locale l = new Locale(context.getDefaultLanguage());
|
||||
WebGoatI18N.defaultLanguage=context.getDefaultLanguage();
|
||||
labels.put(context.getDefaultLanguage(),ResourceBundle.getBundle("WebGoatLabels_english",l));
|
||||
}
|
||||
|
||||
public static void loadLanguage(String language){
|
||||
Locale l = new Locale(language);
|
||||
labels.put(language, ResourceBundle.getBundle("WebGoatLabels_english",l));
|
||||
}
|
||||
|
||||
public static void setCurrentLanguage(String language){
|
||||
WebGoatI18N.currentLanguage=language;
|
||||
}
|
||||
|
||||
public static String get(String strName) {
|
||||
if(labels.containsKey(WebGoatI18N.currentLanguage)){
|
||||
return labels.get(WebGoatI18N.currentLanguage).getString(strName);
|
||||
}
|
||||
else {
|
||||
return labels.get(WebGoatI18N.defaultLanguage).getString(strName);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
Reference in New Issue
Block a user