day_of_week translated to German

Hi,

once again I found something not working :-)

    private function setDateDisplay() {        
    	var now = Time.now();
	    var date = Date.info(now, Time.FORMAT_LONG);
        var heute = date.day_of_week(); 

        if (heute == "Thu"){
            var Wochentag = "Do";
        }
	    var dateString = Lang.format("$1$, $2$ $3$, $4$", Wochentag, date.day, date.month, date.year]);
	    var dateDisplay = View.findDrawableById("DateDisplay");      
	    dateDisplay.setText(dateString);	    	
    }

Now I wonder:

- why doesn't the if function work (I mean in the debugger I see that "heute" has the Value "Thu" and is a Lang.string

Second try:

Why doesn't the dictionairy work? I must admit that I'm not yet to familiar with them but should work according to 

https://developer.garmin.com/connect-iq/api-docs/Toybox/Lang/Dictionary.html

    private function setDateDisplay() {        
    	var now = Time.now();
	    var date = Date.info(now, Time.FORMAT_LONG);
        var heute = date.day_of_week(); 

        var myDict = {
            "Mon" => "Mo",
            "Tue" => "Di",
            "Wed" => "Mi",
            "Thu" => "Do",
            "Fri" => "Fr",
            "Sat" => "Sa",
            "Son" => "So"
        };

	    var dateString = Lang.format("$1$, $2$ $3$, $4$", [myDict.get(heute), date.day, date.month, date.year]);
	    var dateDisplay = View.findDrawableById("DateDisplay");      
	    dateDisplay.setText(dateString);	    	
    }

Can anybody give me the right solution for 1 and 2?

Mean theoretically they should both work !?!

Regards Marcus

  • ;-))

    Found that out as well - that the debugger is showing me english day_of_weeks but my watch doesn't need the translation and is already showing me the right days.

    But nevertheless and most important of all - it's a good example for the usage of dictionaires and besides - one should also be able to set up language sensitiv dictionairies. But for my personal use I'm pretty happy with what I got now  :-).

    But good input to get an idea of where to improve when you would wanna bring s.th. to market or just make it a little more professional.

    Thx!