How to handle non supported languages?

I have a load of week day name strings in resources\resources-dan, resources\resources-eng, resources\resources-por folders.

However if a user has a language that doesn't have one of these folder for example Polish then the following function causes a crash as there isn't a resource file to load. So how, using this structure system do I set a default langauge of say English if Polish cannot be found? Or do I have to create one for EVERY language and just have them as English if I don't support that language?

weekday_abbr_cache = [

Ui.loadResource(Rez.Strings.day0Abbr),

Ui.loadResource(Rez.Strings.day1Abbr),

Ui.loadResource(Rez.Strings.day2Abbr),

Ui.loadResource(Rez.Strings.day3Abbr),

Ui.loadResource(Rez.Strings.day4Abbr),

Ui.loadResource(Rez.Strings.day5Abbr),

Ui.loadResource(Rez.Strings.day6Abbr)

];

return weekday_abbr_cache[day];
  • Are you only concerned about month of the year and days of the week? If so, then you don't actually need to create resource files for those. For my UTC Titanium watch face I don't have any language based resources and instead use Time::Gregorian.info() method which will return the abbreviated day of the week string (based on the system language setting) automagically (ie. today I get "FRI" for English and "VEN" when I switch to Fran?ais).

    var timeNow = Time.now();
    var timeInfo = Time.Gregorian.info(timeNow, Time.FORMAT_MEDIUM);
    var dayOfWeekStr = timeInfo.day_of_week.toUpper();


    If you have other strings that you want to translate, then I suggest you put the default language (English) in resources/strings/strings.xml and then add resources-fre/strings/strings.xml for French, etc. That way, the French (or Spanish or Dutch or whatever) strings will be used if the user's language is so configured and for all other languages the more generic (default) strings will be used. I do this in my METAR/TAF widget where I support English (default), French, Dutch, German and Spanish.

    Cheers,
    Douglas
  • WOW. In older versions of the SDK it didnt have all the full weekdays name and months plus the abbreviated versions. So they are all there now for all languages?! If so WOW!

    However... :-(

    Just tried your sample code (thanks) and just get FRI reglardless of the language in the simulator
  • WOW. In older versions of the SDK it didnt have all the full weekdays name and months plus the abbreviated versions. So they are all there now for all languages?! If so WOW!


    Yes, as far as I've tested (with about 7 languages) they are all there.


    However... :-(

    Just tried your sample code (thanks) and just get FRI reglardless of the language in the simulator


    Yeah, for whatever reason the simulator only uses the "language" setting for selecting code-based resources. However, on the actual devices (confirmed on F3, D2 Bravo, F5, F5X), the configured language for the watch will result in the proper day of week and month names and abbreviations. I think the language not affecting the Gregorian.info() method within the simulator was reported as a bug a long time ago but it hasn't been actioned yet.

    Cheers,
    Douglas
  • I only support english in my stuff, but when I get screen shots of my apps where I see a date, it's always in the user's selected language on the watch. Like douglas said, you don't see this in the sim (I think the language there is used used to include the proper resource override for a language or something)

    The only thing I'll do is limit the length of the string (using substring). An example in english is "wed" and "thur", where I allow for 3 characteristics and display "wed" or "thu"
  • INTERESTING. However I need the full long versions, Monday, January etc. I wonder if Garmin could:

    1) Verifty that all languages are supported for days of week and month names without the need for resource files on ALL devices!?
    2) Fix the simulator!
    3) Correct the dox

    The month and day_of_week never return the full long name even if the long version is requested. The dox say contradict themselves as they say they don't return Monday January but then in the description say they don't!

    As I can only test on the 935 if I remove the resouce files for say Gre then I might remove functionality for Greek users of my watchface on a 920

    So without a way to get the long versions I'm stuck with the resource files for the long versions. But maybe I can ditch the abbreviated strings in the resource files and hope that I get the correct translation on all devices for all languages. Is that realistic?

    Thanks all
  • Former Member
    Former Member
    I'll have to do a little more digging to find out all the languages. These are all handled on device firmware and will differ in different regions (i.e. NA release versions of many devices don't have the code space to hold CHN character sets, etc...). So in certain circumstances, it's just not going to happen and that's a device level limitation, not CIQ. We give you access to what is on the device.

    In the simulator We've discussed what it looks like to implement language selection for this, but haven't come down on the solution yet.

    The documentation is currently correct. Each device may have a slightly different implementation of what it provides (i.e. Tue vs. Tues), but both medium and long format currently give abbreviated names for days, months, etc.