RADIUSdesk

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

developers_corner:rd_translate [2017/04/25 10:21] (current)
admin created
Line 1: Line 1:
 +====== Multiple Language support for RADIUSdesk ======
 +===== Some background =====
 +  * This section will provide some background on how we ended at the current implementation of multiple language support in RADIUSdesk.
 +  * RADIUSdesk is divided into two sections.
 +    * The GUI component which uses ExtJs and is purely in JavaScript.
 +    * The //engine// which as of this date is split between CakePHP v2 and CakePHP v3 with the end goal to have everything migrated to CakePHP v3.
 +  * In the past we used to store translatable phrases used by ExtJS in a MySQL database and extract those phrases based on the language setting once a person authenticated to RADIUSdesk.
 +  * This proved to not scale well and we then created a workaround.
 +  * This workaround will be discussed in detail in the next section.
 +  * For CakePHP v2 we use the built in translation functionality along with a .po file. This will be discussed lated in this document. ​
 +
 +===== Adding a new language to the Viewer / GUI component using ExtJs =====
 +  * The index.html file sources a file with translated phrases.
 +  * Adding a new language one can simply make a copy of index.html and change its content to source another file with translated phrases.
 +  * Here is an extract from /​usr/​share/​nginx/​html/​rd/​index.html
 +<code html>
 +<​!DOCTYPE HTML>
 +<html manifest="">​
 +<​head>​
 +    <meta http-equiv="​X-UA-Compatible"​ content="​IE=edge">​
 +    <meta charset="​UTF-8">​
 +    <meta name="​viewport"​ content="​width=device-width,​ initial-scale=1,​ maximum-scale=1,​ user-scalable=no">​
 +
 +    <​title>​Rd</​title>​
 +    <!-- The singletons file is the one that needs to be tweaked -->
 +    <script type="​text/​javascript"​ charset="​utf-8"​ src="​resources/​js/​singletons.js"></​script>​
 +    <script type="​text/​javascript"​ charset="​utf-8"​ src="​resources/​js/​config.js"></​script>​
 +</​code>​
 + 
 +  * Lets assume I want to create a German translation then I can do the following.
 +<code bash>
 +#Create a copy of the singletons.js file and modify it for your language.
 +cp /​usr/​share/​nginx/​html/​rd/​resources/​js/​singletons.js /​usr/​share/​nginx/​html/​rd/​resources/​js/​singletons_de.js
 +#After you modified all the strings also copy it to the optimised JavaScript Code's folder
 +cp /​usr/​share/​nginx/​html/​rd/​resources/​js/​singletons_de.js /​usr/​share/​nginx/​html/​rd/​build/​production/​Rd/​resources/​js/​
 +
 +#Make a Copy if the index.html to indicate the language
 +cp /​usr/​share/​nginx/​html/​rd/​index.html /​usr/​share/​nginx/​html/​rd/​index_de.html
 +
 +#Change the index_de.html file so that it sources the singletons_de.js file 
 +#Save it 
 +
 +#If you use the optimised JavaScript code (which you actually should) copy also
 +cp /​usr/​share/​nginx/​html/​rd/​build/​production/​Rd/​index.html /​usr/​share/​nginx/​html/​rd/​build/​production/​Rd/​index_de.html
 +#Change the index_de.html file so that it sources the singletons_de.js file 
 +#Save it 
 +#
 +
 +</​code>​
 +  * After you made those changes you can go to <​ip_address>/​rd/​index_de.html or <​ip_address>/​rd/​build/​production/​Rd/​index_de.html to test things out.