-
Notifications
You must be signed in to change notification settings - Fork 459
Adding a new Language to Shepherd
Translation is accomplished utilising the Java JSTL library under under lib/jstl-1.2.jar
in which key value pairs are stored in .properties
files within the i18n package in the Security Shepherd Project. The key remains the same across all .properties
files and the value is the translation in a particular language.
The language of the application is changed/set in the user's session in two ways;
- A user selects a language from the drop down
- The application receives the value from the browser header "Accept-Language"
-
You should have your Eclipse and MySQL set up for Security Shepherd properly, this allows you to run the application. This Youtube video can help you to set up https://www.youtube.com/watch?v=uWk0NOSpyQc.
-
After you open the application in Eclipse the
.properties
file for translation is located under OwaspSecurityShepherd->src->i18n-> (challenges,cheatsheets,lessons,moduleGenerics and servlets).
Tip: To view the project in a user friendly way click the down triangle (beside the project list) and select Package Presentation-> Hierarchical.
3.Now you can start!
.properties files are key value pair documents used for translation. English text is stored in files that contain no underscore;
zf8ed52591579339e590e0726c7b24009f3ac54cdff1b81a65db1688d86efb3a.properties
and all other translations is a copy of this file with an underscore and language code;
- Irish:
zf8ed52591579339e590e0726c7b24009f3ac54cdff1b81a65db1688d86efb3a_ga.properties
- Spanish:
zf8ed52591579339e590e0726c7b24009f3ac54cdff1b81a65db1688d86efb3a_es.properties
- China:
zf8ed52591579339e590e0726c7b24009f3ac54cdff1b81a65db1688d86efb3a_zh.properties
Within each of these files is a key and a value which looks like this;
title.question.xss = What is Cross Site Scripting (XSS)?
example.xss.1 = <SCRIPT><a>alert('XSS')</a></SCRIPT>
Now create a new .properties
file firstly for English if it doesn't exist under the corresponds directory where your JSP or Servlet is located. For instance if your JSP is under src/jsp/challenges/HASH.jsp store your .properties
file under src/i18n/challenges/HASH.properties
For files that are in a language other than english create a copy of the English file and add the underscore and country code as outlined in the section "Working with Properties Files".