[Qgis-user] localisation of date fails in QGIS 3.2

Alessandro Pasotti apasotti at gmail.com
Thu Aug 9 00:29:35 PDT 2018


On Thu, Aug 9, 2018 at 9:23 AM, Reginald Carlier <
Reginald.Carlier at ingelmunster.be> wrote:

> Thanks a lot Alessandro,
>
>
>
> That works perfectly.
>

Glad it helped.


btw, this is a side-effect of the recent changes in QGIS locale: we are now
using setting a "default locale" (from QGIS settings) when QGIS starts, and
that locale is used through the whole QGIS application.

If you change the default locale in the settings, please remember to
restart QGIS.




>
> Reginald Carlier
> Deskundige GIS
> <https://www.ingelmunster.be/>
> Gemeente Ingelmunster ,  Oostrozebekestraat
> <https://maps.google.com/?q=Oostrozebekestraat+4+,+8770+Ingelmunster&entry=gmail&source=g>
>  4
> <https://maps.google.com/?q=Oostrozebekestraat+4+,+8770+Ingelmunster&entry=gmail&source=g>
> ,
> <https://maps.google.com/?q=Oostrozebekestraat+4+,+8770+Ingelmunster&entry=gmail&source=g>
>   8770
> <https://maps.google.com/?q=Oostrozebekestraat+4+,+8770+Ingelmunster&entry=gmail&source=g>
>   Ingelmunster
> <https://maps.google.com/?q=Oostrozebekestraat+4+,+8770+Ingelmunster&entry=gmail&source=g>
> T *+32 51 33 74 39* <+32%2051%2033%2074%2039>
> *www.ingelmunster.be* <http://www.ingelmunster.be/>
> [image: Facebook] <https://www.facebook.com/Ingelmunster/> [image:
> instagram] <https://www.instagram.com/ingelmunster/> [image: pinterest]
> <https://www.pinterest.com/ingelmunster/> [image: twitter]
> <https://twitter.com/ingelmunster>
> *Raadpleeg onze disclaimer *
> <http://www.ingelmunster.be/email-disclaimer.html>
> *Van:* Alessandro Pasotti [mailto:apasotti at gmail.com]
> *Verzonden:* donderdag 9 augustus 2018 9:10
> *Aan:* Reginald Carlier
> *CC:* Nyall Dawson [via OSGeo.org]; qgis-user at lists.osgeo.org
> *Onderwerp:* Re: [Qgis-user] localisation of date fails in QGIS 3.2
>
>
>
> Reginald,
>
>
>
>
>
> Using QT:
>
>
>
> locale = QLocale(QLocale.Japanese)
>
> locale.toString(QDate.currentDate())
>
>
>
> And, if you want to use the same settings that you set in QGIS, just use
> the default locale:
>
>
>
> locale = QLocale() # Default locale from QGIS options/settings
>
> locale.toString(QDate.currentDate())
>
>
>
>
>
>
>
>
>
> On Thu, Aug 9, 2018 at 8:54 AM, Reginald Carlier <Reginald.Carlier@
> ingelmunster.be> wrote:
>
> I forgot to mention that I import datetime as follows:
>
>
>
> from datetime import datetime
>
>
>
> In the console I get the same result as from my script.
>
> Maybe I should use QCoreApplication.translate or some other explicit way
> to tell python to translate a string from English to Dutch?
>
>
>
> Regards,
>
>
>
> Reginald Carlier
>
> Deskundige GIS
>
> *Fout! Bestandsnaam niet opgegeven.* <https://www.ingelmunster.be/>
>
> Gemeente Ingelmunster
>
> ,
>
> Oostrozebekestraat
> <https://maps.google.com/?q=Oostrozebekestraat+4+%0D%0A+%0D%0A+%0D%0A+,+%0D%0A+%0D%0A+%0D%0A+8770+%0D%0A+%0D%0A+%0D%0A+%0D%0A+%0D%0A+%0D%0A+Ingelmunster&entry=gmail&source=g>
>  4
>
> ,
> <https://maps.google.com/?q=Oostrozebekestraat+4+%0D%0A+%0D%0A+%0D%0A+,+%0D%0A+%0D%0A+%0D%0A+8770+%0D%0A+%0D%0A+%0D%0A+%0D%0A+%0D%0A+%0D%0A+Ingelmunster&entry=gmail&source=g>
>
>
> 8770
> <https://maps.google.com/?q=Oostrozebekestraat+4+%0D%0A+%0D%0A+%0D%0A+,+%0D%0A+%0D%0A+%0D%0A+8770+%0D%0A+%0D%0A+%0D%0A+%0D%0A+%0D%0A+%0D%0A+Ingelmunster&entry=gmail&source=g>
>
>
>
> Ingelmunster
> <https://maps.google.com/?q=Oostrozebekestraat+4+%0D%0A+%0D%0A+%0D%0A+,+%0D%0A+%0D%0A+%0D%0A+8770+%0D%0A+%0D%0A+%0D%0A+%0D%0A+%0D%0A+%0D%0A+Ingelmunster&entry=gmail&source=g>
>
> T
>
> *+32 51 33 74 39* <+32%2051%2033%2074%2039>
>
> *www.ingelmunster.be* <http://www.ingelmunster.be/>
>
> *Fout! Bestandsnaam niet opgegeven.*
> <https://www.facebook.com/Ingelmunster/>
>
> *Fout! Bestandsnaam niet opgegeven.*
> <https://www.instagram.com/ingelmunster/>
>
> *Fout! Bestandsnaam niet opgegeven.*
> <https://www.pinterest.com/ingelmunster/>
>
> *Fout! Bestandsnaam niet opgegeven.* <https://twitter.com/ingelmunster>
>
> *Raadpleeg onze disclaimer *
> <http://www.ingelmunster.be/email-disclaimer.html>
>
> *Van:* Nyall Dawson [via OSGeo.org] [mailto:ml+s1560n5373899h69@
> n6.nabble.com]
> *Verzonden:* donderdag 9 augustus 2018 8:4
> <https://maps.google.com/?q=Oostrozebekestraat+4+%0D%0A+%0D%0A+%0D%0A+,+%0D%0A+%0D%0A+%0D%0A+8770+%0D%0A+%0D%0A+%0D%0A+%0D%0A+%0D%0A+%0D%0A+Ingelmunster&entry=gmail&source=g>
> 3
> *Aan:* Reginald Carlier
> *Onderwerp:* Re: localisation of date fails in QGIS 3.2
>
>
>
> On Thu, 9 Aug 2018 at 16:39, Reginald Carlier
> <[hidden email] <http://user/SendEmail.jtp?type=node&node=5373899&i=0>>
> wrote:
>
>
> >
> > 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?
>
>
> Do you see the same from a standalone python console? (I'm not sure
> that this issue is related to QGIS at all or whether it's a Python
> specific thing).
>
> Nyall
> _______________________________________________
> Qgis-user mailing list
> [hidden email] <http://user/SendEmail.jtp?type=node&node=5373899&i=1>
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user
> ------------------------------
>
> *If you reply to this email, your message will be added to the discussion
> below:*
>
> http://osgeo-org.1560.x6.nabble.com/localisation-of-
> date-fails-in-QGIS-3-2-tp5372703p5373899.html
>
> To start a new topic under QGIS - User, email
> ml+s1560n4125267h77 at n6.nabble.com
> To unsubscribe from QGIS, click here
> <http://osgeo-org.1560.x6.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=4099105&code=UmVnaW5hbGQuQ2FybGllckBpbmdlbG11bnN0ZXIuYmV8NDA5OTEwNXw3OTAxNjMzMzQ=>
> .
> NAML
> <http://osgeo-org.1560.x6.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>
>
> _______________________________________________
> Qgis-user mailing list
> Qgis-user at lists.osgeo.org
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user
>
>
>
>
> --
>
> Alessandro Pasotti
> w3:   www.itopen.it
>



-- 
Alessandro Pasotti
w3:   www.itopen.it
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20180809/bf63f9f8/attachment.html>


More information about the Qgis-user mailing list