How can I list all available windows locales in python console?
>>> import locale >>> locale.locale_alias
>>> import locale >>> locale.locale_alias
You might get some idea from the Locale class. Call getAvailableLocales() then iterate the array & getDisplayCountry(). If it is the first time you’ve seen that country name, add it to an expandable list (e.g. an ArrayList instance). E.G. In Java, but the 3 classes from java.util are all available in Android. import java.util.*; class … Read more
The locale is set during execution, not in the JRXML. Using Java, set the REPORT_LOCALE parameter for the report’s parameter map. For example: InputStream reportTemplate = getReportTemplate(); JRDataSource dataSource = getDataSource(); java.util.Map parameters = getParameters(); java.util.Locale locale = new Locale( “en”, “US” ); parameters.put( JRParameter.REPORT_LOCALE, locale ); JasperFillManager.fillReport( reportTemplate, parameters, dataSource ); Using Jaspersoft Studio, … Read more
Use the special folders in System.Environment var path = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments); var subFolderPath = Path.Combine(path, “sub folder”);
You will need to subtract the time zone offset of your local time zone from the Date instance, before you pass it to format from date-fns. For example: const dt = new Date(‘2017-12-12’); const dtDateOnly = new Date(dt.valueOf() + dt.getTimezoneOffset() * 60 * 1000); console.log(format(dtDateOnly, ‘YYYY-MM-DD’)); // Always “2017-12-12” Problem You want to handle only … Read more
Okay, I experimented a bit and found out that Windows Git commands actually need UNIX variables like LC_ALL in order to display Polish (or other UTF-8 characters) correctly. Just try this command: set LC_ALL=C.UTF-8 Then enjoy the result. Here is what happened on my console (font “Consolas”, no chcp necessary): Update: Well, in order for … Read more
The example given by Rob is great, but isn’t threadsafe. Here’s a version that works with threads: import locale import threading from datetime import datetime from contextlib import contextmanager LOCALE_LOCK = threading.Lock() @contextmanager def setlocale(name): with LOCALE_LOCK: saved = locale.setlocale(locale.LC_ALL) try: yield locale.setlocale(locale.LC_ALL, name) finally: locale.setlocale(locale.LC_ALL, saved) # Let’s set a non-US locale locale.setlocale(locale.LC_ALL, ‘de_DE.UTF-8’) … Read more
Our game Gemsweeper has been translated to 8 different languages. Some things I have learned during that process: If the translator is given single sentences to translate, make sure that he knows about the context that each sentence is used in. Otherwise he might provide one possible translation, but not the one you meant. Tools … Read more
I summarize here the solution to be found on: http://blog.lobraun.de/2009/04/11/mercurial-on-mac-os-x-valueerror-unknown-locale-utf-8/ I added these lines to my .bash_profile: export LC_ALL=en_US.UTF-8 export LANG=en_US.UTF-8 I reloaded the profile: source ~/.bash_profile I then ran ipython again: ipython notebook Changing locales The above will work for the English language in a US locale. One may want different settings. At the … Read more