mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 544414 - Handle locales correctly on Android r=blassey,sayre, a=blocking-fennec
This commit is contained in:
parent
6f02ac1273
commit
f17c106434
@ -42,6 +42,7 @@ import java.util.*;
|
||||
import java.util.zip.*;
|
||||
import java.nio.*;
|
||||
import java.lang.reflect.*;
|
||||
import java.text.*;
|
||||
|
||||
import android.os.*;
|
||||
import android.app.*;
|
||||
@ -125,11 +126,25 @@ class GeckoAppShell
|
||||
else
|
||||
downloadDir = new File(Environment.getExternalStorageDirectory().getPath(), "download");
|
||||
GeckoAppShell.putenv("DOWNLOADS_DIRECTORY=" + downloadDir.getPath());
|
||||
GeckoAppShell.putenv("LANG=" + Locale.getDefault().toString());
|
||||
|
||||
putLocaleEnv();
|
||||
|
||||
loadLibs(apkName);
|
||||
}
|
||||
|
||||
private static void putLocaleEnv() {
|
||||
GeckoAppShell.putenv("LANG=" + Locale.getDefault().toString());
|
||||
NumberFormat nf = NumberFormat.getInstance();
|
||||
if (nf instanceof DecimalFormat) {
|
||||
DecimalFormat df = (DecimalFormat)nf;
|
||||
DecimalFormatSymbols dfs = df.getDecimalFormatSymbols();
|
||||
|
||||
GeckoAppShell.putenv("LOCALE_DECIMAL_POINT=" + dfs.getDecimalSeparator());
|
||||
GeckoAppShell.putenv("LOCALE_THOUSANDS_SEP=" + dfs.getGroupingSeparator());
|
||||
GeckoAppShell.putenv("LOCALE_GROUPING=" + (char)df.getGroupingSize());
|
||||
}
|
||||
}
|
||||
|
||||
public static void runGecko(String apkPath, String args, String url) {
|
||||
// run gecko -- it will spawn its own thread
|
||||
GeckoAppShell.nativeInit();
|
||||
|
@ -1009,9 +1009,16 @@ js_InitRuntimeNumberState(JSContext *cx)
|
||||
number_constants[NC_MIN_VALUE].dval = u.d;
|
||||
|
||||
#ifndef HAVE_LOCALECONV
|
||||
rt->thousandsSeparator = JS_strdup(cx, "'");
|
||||
rt->decimalSeparator = JS_strdup(cx, ".");
|
||||
rt->numGrouping = JS_strdup(cx, "\3\0");
|
||||
const char* thousands_sep = getenv("LOCALE_THOUSANDS_SEP");
|
||||
const char* decimal_point = getenv("LOCALE_DECIMAL_POINT");
|
||||
const char* grouping = getenv("LOCALE_GROUPING");
|
||||
|
||||
rt->thousandsSeparator =
|
||||
JS_strdup(cx, thousands_sep ? thousands_sep : "'");
|
||||
rt->decimalSeparator =
|
||||
JS_strdup(cx, decimal_point ? decimal_point : ".");
|
||||
rt->numGrouping =
|
||||
JS_strdup(cx, grouping ? grouping : "\3\0");
|
||||
#else
|
||||
struct lconv *locale = localeconv();
|
||||
rt->thousandsSeparator =
|
||||
|
Loading…
Reference in New Issue
Block a user