diff --git a/core/java/android/webkit/L10nUtils.java b/core/java/android/webkit/L10nUtils.java new file mode 100644 index 0000000000000..962492e08de62 --- /dev/null +++ b/core/java/android/webkit/L10nUtils.java @@ -0,0 +1,54 @@ +/* + * Copyright (C) 2010 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.webkit; + +import android.content.Context; + +import java.util.List; +import java.util.Vector; + +/** + * @hide + */ +public class L10nUtils { + + // These array elements must be kept in sync with those defined in + // external/chromium/android/app/l10n_utils.h + private static int[] mIdsArray = { + com.android.internal.R.string.autofill_address_name_separator, // IDS_AUTOFILL_DIALOG_ADDRESS_NAME_SEPARATOR + com.android.internal.R.string.autofill_address_summary_name_format, // IDS_AUTOFILL_DIALOG_ADDRESS_SUMMARY_NAME_FORMAT + com.android.internal.R.string.autofill_address_summary_separator, // IDS_AUTOFILL_DIALOG_ADDRESS_SUMMARY_SEPARATOR + com.android.internal.R.string.autofill_address_summary_format // IDS_AUTOFILL_DIALOG_ADDRESS_SUMMARY_FORMAT + }; + + private static List mStrings; + + public static void loadStrings(Context context) { + if (mStrings != null) { + return; + } + + mStrings = new Vector(mIdsArray.length); + for (int i = 0; i < mIdsArray.length; i++) { + mStrings.add(context.getResources().getString(mIdsArray[i])); + } + } + + public static String getLocalisedString(int id) { + return mStrings.get(id); + } +} diff --git a/core/java/android/webkit/WebView.java b/core/java/android/webkit/WebView.java index b6683406dbb43..72b4e360305ad 100644 --- a/core/java/android/webkit/WebView.java +++ b/core/java/android/webkit/WebView.java @@ -917,6 +917,8 @@ public class WebView extends AbsoluteLayout if (privateBrowsing) { startPrivateBrowsing(); } + + L10nUtils.loadStrings(context); } /* diff --git a/core/res/res/values/strings.xml b/core/res/res/values/strings.xml index 1d2ab1ebb454f..8b9bc43ebf550 100755 --- a/core/res/res/values/strings.xml +++ b/core/res/res/values/strings.xml @@ -1683,7 +1683,21 @@ Tip: double-tap to zoom in and out. - AutoFill this form + AutoFill + + + \u0020 + + $1$2$3 + + + ,\u0020 + + $1$2$3