×

Discussion Board

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

    How to change language on .WGZ?

    Hiii everybody !
    Please tell me how to change language on WGZ file.I open it with WinRar but i don't know how to change

  2. #2
    Nokia Developer Champion
    Join Date
    Nov 2007
    Location
    Rome, Italy
    Posts
    2,406

    Re: How to change language on .WGZ?

    Hi truonghan,

    I'm not sure I've correctly understood your question. Anyway, if you want to localize a Widget in different languages, you could check out this Wiki article:

    http://wiki.forum.nokia.com/index.ph...strings_in_WRT

    Hope it helps,
    Pit

  3. #3
    Nokia Developer Expert
    Join Date
    Jun 2008
    Location
    Tampere
    Posts
    833

    Re: How to change language on .WGZ?

    truonghan you should be able to switch language by simply copying stuff around in the widget folder. Locate your locale folder (xx.lproj) and overwrite the similar named files in the widget root. But please make take backup before you start hacking around

    Personally I would like to select myself which language I'm using in widgets and in software in general. So I started to think more elegant and programming orientated solution for this problem and came up with a little code snippet. Be warned - it has not been tested throughout.

    Code:
    function languageChanged(){
    
    	startWidget();
    }
    
    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;
    }
    Basically with this you can implement localization in the standard way and still provide the possibility to switch the language.
    (note that this does only cover translated string values)

    -Ilkka

Similar Threads

  1. Change language for alert soft button in j2me
    By trandinhduy in forum Mobile Java General
    Replies: 2
    Last Post: 2009-05-04, 07:49
  2. how to change my mobile's language setting?
    By alkming in forum General Development Questions
    Replies: 1
    Last Post: 2009-04-21, 13:50
  3. Change to Malay Language
    By sotd666 in forum General Development Questions
    Replies: 1
    Last Post: 2006-12-26, 17:50
  4. Dynamic language change for Help file
    By vishalm in forum Symbian
    Replies: 1
    Last Post: 2006-12-02, 11:56
  5. Change of language
    By mc1483bis in forum General Development Questions
    Replies: 1
    Last Post: 2004-07-30, 07:49

Posting Permissions

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