Need fix for Norwegian language in WeatherPlugin

  • Hi Dr.Best ,


    There is an error in WeatherPlugin (MSNWeather.py) where a not that much used local language within Norway is set as standard weather language for Norway. Could this be fixed?


    old code:


    Code
            elif language == "no-NO": # hack
                language = "nn-NO"


    should be:


    Code
            elif language == "no-NO": # hack
                language = "nb-NO"


    Thanks!

    - FoxyRabbit - Peter Pan team -

  • Well, I can see why there was a # hack in the code. It turns out that the time format for Norwegian standard language is unusual compared to every other language. Norwegian standard language (nb-NO) have timeformat '%H.%M.%S' and the all other countries is '%H:%M:%S'. There must be som bug from MSN Weather forecast regarding Norway. This will unfortunately require another hack in plugin.py


    something like this:

    Code
                        language = config.osd.language.value.replace("_","-")
                        if language == "no-NO": # hack
                            c =  time.strptime(item.observationtime, "%H.%M.%S")
                        else:
                            c =  time.strptime(item.observationtime, "%H:%M:%S")


    And there is som Norwegian hack in the setup.py file also that should be corrected.


    from this:

    Code
                elif language == "no-NO": # hack
                    language = "nn-NO"

    to this:


    Code
                elif language == "no-NO": # hack
                    language = "nb-NO"

    - FoxyRabbit - Peter Pan team -

    Edited 2 times, last by FoxyRabbit: Merged a post created by FoxyRabbit into this post. ().

  • This is even more simple and the #hack for Norwegian Language is not needed anymore



    Code
    currentWeather.observationtime = items.attrib.get("observationtime").encode("utf-8", 'ignore').replace(".",":")

    Everything in life that's any fun is either immoral, illegal or fattening