×

Discussion Board

Results 1 to 2 of 2
  1. #1
    Registered User
    Join Date
    Oct 2009
    Posts
    3

    Is there any way in WRT applications to select the language at runtime?

    HI ,

    Nokia N97 device having two languages,please let me know how to install other languages on devices??

    Also let me know is there any way in WRT applications to select the language at runtime??


    Thanks,
    santy

  2. #2
    Nokia Developer Moderator
    Join Date
    Jun 2008
    Location
    Tampere
    Posts
    833

    Re: Is there any way in WRT applications to select the language at runtime?

    Hello,

    You cannot change the phone language from WRT, but if you have localized widget, and you want to provide the user possibility to change the language at the runtime you can do the following:


    Code:
    function init()
    {	
    	//localized text strings are loaded from correspoding javascript file
    	document.getElementById("message").innerHTML = qtn_hello_message;
    	
    	document.getElementById("message").innerHTML += "<br/>"+ tr['qtn_hello'] +" "+ tr['qtn_world'];
    }
    
    function languageChanged(){
    
    	init();
    }
    
    function loadLangPack(locale){
       		
    	switch(locale) {
    		case "fi":
    			replaceScript("localizedStrings.js","fi.lproj/localizedStrings.js", languageChanged);
    			break;
    	
    		case "fr":
    			replaceScript("localizedStrings.js","fr.lproj/localizedStrings.js",languageChanged);
    			break;
    		case "default":
    			replaceScript("localizedStrings.js","localizedStrings.js",languageChanged);		
    	}
    }
    
    function replaceScript(filename, newfile, onloadComplete){
    	var scripts = document.getElementsByTagName("script");
    	
    	var script;
    	
    	//search & destroy
    	for(var i=0; i< scripts.length; i++){
    		if(scripts[i].src.indexOf(filename) != -1 ){
    			
    			script = scripts[i];
    						
    			for (var property in script) { 
    				delete script[property];
    			}
    			script.parentNode.replaceChild(createCodeTag(newfile, onloadComplete), script); 
        					
    			break;
    		}
    	}
    }
    
    function createCodeTag(src, callback){	
    
    	var head = document.getElementsByTagName('head');
    	var scriptElement = document.createElement('script');
    	scriptElement.type = "text/javascript";
    	scriptElement.onload = callback; 
    	scriptElement.src =  src;
    	return scriptElement;
    }
    However that only covers js files.
    You have to implement changing of images and css by your self

    Br,
    Ilkka - FN

    Ps.
    Merry Xmas!

Similar Threads

  1. Maemo Repositorys Down?
    By beaua in forum Nokia N9
    Replies: 29
    Last Post: 2010-05-30, 16:20
  2. Language not asked during installation
    By Jeepy in forum Symbian Signed Support, Application Packaging and Distribution and Security
    Replies: 12
    Last Post: 2009-10-26, 05:35
  3. Applications crashing in Cingular-branded 6682. Feedback appreciated.
    By Razor1973 in forum General Development Questions
    Replies: 3
    Last Post: 2006-01-27, 13:11
  4. 3300: Crash on installing Java applications from Memory Card
    By Jhn314 in forum Mobile Java General
    Replies: 0
    Last Post: 2003-08-19, 14:18
  5. Menu Select button using List object
    By abstractworlds in forum Mobile Java General
    Replies: 4
    Last Post: 2002-12-09, 13:08

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •