Hi Reginald,
I couldn’t find the post where you describe your problem. I just tried your code, this is the result from QGIS 3.2 (Windows) Python console, auto-locale German Germany (de_DE): import datetime vandaag = datetime.datetime.now() dag = vandaag.day maand = vandaag.strftime("%B") jaar = vandaag.year datum = str(dag) + " " + maand + " " + str(jaar) print(datum) 9 August 2018 *but* when I override the locale to nl_BE I still get the same output as with the auto-locale. import locale print(locale.getlocale()) (None, None) So I believe the locale is somehow not determinable for Python and a fallback is used. Doing : import locale print(locale.getlocale()) (None, None) locale.setlocale(locale.LC_ALL, 'nl_BE') 'nl_BE' print(locale.getlocale()) ('nl_BE', 'ISO8859-1') import datetime vandaag = datetime.datetime.now() dag = vandaag.day maand = vandaag.strftime("%B") jaar = vandaag.year datum = str(dag) + " " + maand + " " + str(jaar) print(datum) 9 augustus 2018 does the trick though. There should be a way to get the set locale from PyQGIS somehow though … Hth, Frank Von: Qgis-user <qgis-user-boun...@lists.osgeo.org> Im Auftrag von Reginald Carlier Gesendet: Donnerstag, 9. August 2018 08:40 An: Nyall Dawson <nyall.daw...@gmail.com>; 'qgis-user@lists.osgeo.org' <qgis-user@lists.osgeo.org> Betreff: Re: [Qgis-user] localisation of date fails in QGIS 3.2 Hi Nyall, Somehow my post shows the code but my previous post doesn't. Anyway this is how the code looks: vandaag = datetime.now() dag = vandaag.day maand = vandaag.strftime("%B") jaar = vandaag.year datum = str(dag) + " " + maand + " " + str(jaar) I suspect that maybe strftime changed in python 3.6? Regards, Reginald Carlier Deskundige GIS <https://www.ingelmunster.be/> Gemeente Ingelmunster , Oostrozebekestraat 4 , 8770 Ingelmunster T <tel:+32%2051%2033%2074%2039> +32 51 33 74 39 <http://www.ingelmunster.be/> www.ingelmunster.be <https://www.facebook.com/Ingelmunster/> <https://www.instagram.com/ingelmunster/> <https://www.pinterest.com/ingelmunster/> <https://twitter.com/ingelmunster> <http://www.ingelmunster.be/email-disclaimer.html> Raadpleeg onze disclaimer -----Oorspronkelijk bericht----- Van: Nyall Dawson [mailto:nyall.daw...@gmail.com] Verzonden: donderdag 9 augustus 2018 8:36 Aan: Reginald Carlier CC: qgis-user Onderwerp: Re: [Qgis-user] localisation of date fails in QGIS 3.2 On Mon, 30 Jul 2018 at 19:22, Reginald <reginald.carl...@ingelmunster.be <mailto:reginald.carl...@ingelmunster.be> > wrote: > > Hi, > > I have a script that was adapted to python 3.6 and runs fine on QGIS 3.2. > The problem I'm having is that the date shows up in english. > Under Extra > Options > Algemeen i have: > Vertaling gebruikers-interface --> Nederlands > Locale Dutch Belgium (nl_BE) > > Also if I choose for "Systeemlocale negeren" (ignore system locale) I still > get the date in english. > My code looks like this and works fine in QGIS 2.18: > > I think you forgot to include the code? Can you re-share? Nyall
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________ Qgis-user mailing list Qgis-user@lists.osgeo.org List info: https://lists.osgeo.org/mailman/listinfo/qgis-user Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user