how to get string from different locales in Android?

NOTE If your minimum API is 17+, go straight to the bottom of this answer. Otherwise, read on… NOTE If you are using App Bundles, you need to make sure you either disable language splitting or install the different language dynamically. See https://stackoverflow.com/a/51054393 for this. If you don’t do this, it will always use the … Read more

How to format a number using comma as thousands separator in C?

If your printf supports the ‘ flag (as required by POSIX 2008 printf()), you can probably do it just by setting your locale appropriately. Example: #include <stdio.h> #include <locale.h> int main(void) { setlocale(LC_NUMERIC, “”); printf(“%’d\n”, 1123456789); return 0; } And build & run: $ ./example 1,123,456,789 Tested on Mac OS X & Linux (Ubuntu 10.10).

git log output encoding issues on Windows 10 CLI terminal

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

Android context.getResources.updateConfiguration() deprecated

Inspired by Calligraphy, I ended up creating a context wrapper. In my case, I need to overwrite system language to provide my app users with the option of changing app language but this can be customized with any logic that you need to implement. import android.annotation.TargetApi; import android.content.Context; import android.content.ContextWrapper; import android.content.res.Configuration; import android.os.Build; import … Read more

How does one change the language of the command line interface of Git?

Add these lines to your ~/.bashrc, ~/.bash_profile or ~/.zprofile to force git to display all messages in English: # Set Git language to English #alias git=”LANG=en_US git” alias git=”LANG=en_GB git” The alias needs to override LC_ALL on some systems, when the environment variable LC_ALL is set, which has precedence over LANG. See the UNIX Specification … Read more

How to change the locale in chrome browser

Open chrome, go to chrome://settings/languages On the left, you should see a list of languages. Use mouse to drag the language you want to the top, that will change the order for the values in Accept-language of requests. If you still don’t see the language you prefer, it may be cookies. Go to cookies and … Read more

Set Locale programmatically

Hope this help(in onResume): Locale locale = new Locale(“ru”); Locale.setDefault(locale); Configuration config = getBaseContext().getResources().getConfiguration(); config.locale = locale; getBaseContext().getResources().updateConfiguration(config, getBaseContext().getResources().getDisplayMetrics());

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)