What's new

How to add a new language into GUI

oldgringo

Regular Contributor
Hi guys,

A few days ago I had to add a new language into router‘s GUI. So if you need something similar, here is a short description of how-to do it.

Core of everything is a *.dict file in router/www directory. It’s a file with more than 1500 sentences which have to be translated into required language. So a few hours of typing.

...tap, tap, tap..

Phew! Finally! I did it! :D
And it’s almost done, you have to add only a few lines into 3 additional files. So here we go step by step. Example here is for Slovak translation (including zipped SK.dict file), added rows are in blue.

Step 1:
.../router/www/Lang_Hdr
Code:
[Language type]
CHAR_set=UTF-8
PASS_LANG=Language:
LANG_select=Select Language
LANG_EN=English
...
[B][COLOR="Blue"]LANG_SK=Slovensky[/COLOR]
[/B][End of Language Type]

Step 2:
.../router/httpd/httpd.c
Code:
struct language_table language_tables[] = {
		{"en-us", "EN"},
		{"en", "EN"},
		...
[B][COLOR="Blue"]		{"sk", "SK"},
		{"sk-SK", "SK"},
[/COLOR][/B]		{NULL, NULL}
};

Step 3:
.../router/www/state.js
Code:
function show_selected_language(){
		switch($("preferred_lang").value){
			case 'EN':{
				$('selected_lang').innerHTML = "English";
				break;
			}
			...
[B][COLOR="Blue"]			case 'SK':{
				$('selected_lang').innerHTML = "Slovensky";
				break;
			}		
[/COLOR][/B]		}
}

function addOnlineHelp(obj, keywordArray){
		var faqLang = {
			EN : "en",
			...
			[B][COLOR="Blue"]SK : "en"[/COLOR][/B]
		}
function search_supportsite(obj){
		var faqLang = {
			EN : "en",
			...
			[B][COLOR="Blue"]SK : "en"[/COLOR][/B]
		}

And that’s all, everything is now prepared for building of a new firmware package. Dict file covers translation for 90% of texts, that's the maximum at this moment. Good luck! ;)
 

Attachments

Latest threads

Support SNBForums w/ Amazon

If you'd like to support SNBForums, just use this link and buy anything on Amazon. Thanks!

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!
Back
Top