Add a class that stores localised strings used by libchromium.
These are loaded by the first WebView to be instantiated and read over JNI by libchromium in external/chromium/android/app/l10n_util.cc Change-Id: I43d6e5a061691689d28cba2697fedcd27548af08
This commit is contained in:
54
core/java/android/webkit/L10nUtils.java
Normal file
54
core/java/android/webkit/L10nUtils.java
Normal file
@@ -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<String> mStrings;
|
||||
|
||||
public static void loadStrings(Context context) {
|
||||
if (mStrings != null) {
|
||||
return;
|
||||
}
|
||||
|
||||
mStrings = new Vector<String>(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);
|
||||
}
|
||||
}
|
||||
@@ -917,6 +917,8 @@ public class WebView extends AbsoluteLayout
|
||||
if (privateBrowsing) {
|
||||
startPrivateBrowsing();
|
||||
}
|
||||
|
||||
L10nUtils.loadStrings(context);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -1683,7 +1683,21 @@
|
||||
<string name="double_tap_toast">Tip: double-tap to zoom in and out.</string>
|
||||
|
||||
<!-- Text to show in the auto complete drop down list on a text view when the browser can auto fill the entire form -->
|
||||
<string name="autofill_this_form">AutoFill this form</string>
|
||||
<string name="autofill_this_form">AutoFill</string>
|
||||
|
||||
<!-- String used to separate FirstName and LastName when writing out a local name
|
||||
e.g. John<separator>Smith [CHAR-LIMIT=NONE]-->
|
||||
<string name="autofill_address_name_separator">\u0020</string>
|
||||
<!-- Format string for displaying a name. $1 is First Name, $2 is autofill_address_name_separator, $3 is Last Name.
|
||||
e.g. (John)( )(Smith) -->
|
||||
<string name="autofill_address_summary_name_format">$1$2$3</string>
|
||||
|
||||
<!-- String used to separate Name and Address Line 1
|
||||
e.g. John Smith<separator>123 Main Street [CHAR-LIMIT=NONE]-->
|
||||
<string name="autofill_address_summary_separator">,\u0020</string>
|
||||
<!-- Format string for displaying a name and address summary. $1 is the Full Name, $2 is autofill_address_summary_separator, $3 is the Address
|
||||
e.g. (John Smith)(, )(123 Main Street) -->
|
||||
<string name="autofill_address_summary_format">$1$2$3</string>
|
||||
|
||||
<!-- Title of an application permission, listed so the user can choose whether
|
||||
they want to allow the application to do this. -->
|
||||
|
||||
Reference in New Issue
Block a user