Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b8460ba4 authored by Ben Murdoch's avatar Ben Murdoch
Browse files

Localise the regular expressions that AutoFill uses.

Improve the AutoFill experience on non-English web pages
by using localised regular expressions.

This essentially cherry picks the localised strings from
Chromium CL:
http://codereview.chromium.org/6113005

Requires a change in external/chromium, see:
Ie927514cae7b7390c5a291dfae4dcfe3782bb5b7

Change-Id: I9c0544e67bf0333abcb9ea607855ff92f69bff8e
parent 46054e0c
Loading
Loading
Loading
Loading
+37 −1
Original line number Diff line number Diff line
@@ -32,7 +32,43 @@ public class L10nUtils {
        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
        com.android.internal.R.string.autofill_address_summary_format,      // IDS_AUTOFILL_DIALOG_ADDRESS_SUMMARY_FORMAT
        com.android.internal.R.string.autofill_attention_ignored_re,        // IDS_AUTOFILL_ATTENTION_IGNORED_RE
        com.android.internal.R.string.autofill_region_ignored_re,           // IDS_AUTOFILL_REGION_IGNORED_RE
        com.android.internal.R.string.autofill_company_re,                  // IDS_AUTOFILL_COMPANY_RE
        com.android.internal.R.string.autofill_address_line_1_re,           // IDS_AUTOFILL_ADDRESS_LINE_1_RE
        com.android.internal.R.string.autofill_address_line_1_label_re,     // IDS_AUTOFILL_ADDRESS_LINE_1_LABEL_RE
        com.android.internal.R.string.autofill_address_line_2_re,           // IDS_AUTOFILL_ADDRESS_LINE_2_RE
        com.android.internal.R.string.autofill_address_line_3_re,           // IDS_AUTOFILL_ADDRESS_LINE_3_RE
        com.android.internal.R.string.autofill_country_re,                  // IDS_AUTOFILL_COUNTRY_RE
        com.android.internal.R.string.autofill_zip_code_re,                 // IDS_AUTOFILL_ZIP_CODE_RE
        com.android.internal.R.string.autofill_zip_4_re,                    // IDS_AUTOFILL_ZIP_4_RE
        com.android.internal.R.string.autofill_city_re,                     // IDS_AUTOFILL_CITY_RE
        com.android.internal.R.string.autofill_state_re,                    // IDS_AUTOFILL_STATE_RE
        com.android.internal.R.string.autofill_address_type_same_as_re,     // IDS_AUTOFILL_SAME_AS_RE
        com.android.internal.R.string.autofill_address_type_use_my_re,      // IDS_AUTOFILL_USE_MY_RE
        com.android.internal.R.string.autofill_billing_designator_re,       // IDS_AUTOFILL_BILLING_DESIGNATOR_RE
        com.android.internal.R.string.autofill_shipping_designator_re,      // IDS_AUTOFILL_SHIPPING_DESIGNATOR_RE
        com.android.internal.R.string.autofill_email_re,                    // IDS_AUTOFILL_EMAIL_RE
        com.android.internal.R.string.autofill_username_re,                 // IDS_AUTOFILL_USERNAME_RE
        com.android.internal.R.string.autofill_name_re,                     // IDS_AUTOFILL_NAME_RE
        com.android.internal.R.string.autofill_name_specific_re,            // IDS_AUTOFILL_NAME_SPECIFIC_RE
        com.android.internal.R.string.autofill_first_name_re,               // IDS_AUTOFILL_FIRST_NAME_RE
        com.android.internal.R.string.autofill_middle_initial_re,           // IDS_AUTOFILL_MIDDLE_INITIAL_RE
        com.android.internal.R.string.autofill_middle_name_re,              // IDS_AUTOFILL_MIDDLE_NAME_RE
        com.android.internal.R.string.autofill_last_name_re,                // IDS_AUTOFILL_LAST_NAME_RE
        com.android.internal.R.string.autofill_phone_re,                    // IDS_AUTOFILL_PHONE_RE
        com.android.internal.R.string.autofill_area_code_re,                // IDS_AUTOFILL_AREA_CODE_RE
        com.android.internal.R.string.autofill_phone_prefix_re,             // IDS_AUTOFILL_PHONE_PREFIX_RE
        com.android.internal.R.string.autofill_phone_suffix_re,             // IDS_AUTOFILL_PHONE_SUFFIX_RE
        com.android.internal.R.string.autofill_phone_extension_re,          // IDS_AUTOFILL_PHONE_EXTENSION_RE
        com.android.internal.R.string.autofill_name_on_card_re,             // IDS_AUTOFILL_NAME_ON_CARD_RE
        com.android.internal.R.string.autofill_name_on_card_contextual_re,  // IDS_AUTOFILL_NAME_ON_CARD_CONTEXTUAL_RE
        com.android.internal.R.string.autofill_card_cvc_re,                 // IDS_AUTOFILL_CARD_CVC_RE
        com.android.internal.R.string.autofill_card_number_re,              // IDS_AUTOFILL_CARD_NUMBER_RE
        com.android.internal.R.string.autofill_expiration_month_re,         // IDS_AUTOFILL_EXPIRATION_MONTH_RE
        com.android.internal.R.string.autofill_expiration_date_re,          // IDS_AUTOFILL_EXPIRATION_DATE_RE
        com.android.internal.R.string.autofill_card_ignored_re              // IDS_AUTOFILL_CARD_IGNORED_RE
    };

    private static List<String> mStrings;
+109 −0
Original line number Diff line number Diff line
@@ -1869,6 +1869,115 @@
         e.g. (John Smith)(, )(123 Main Street) -->
    <string name="autofill_address_summary_format">$1$2$3</string>

    <!-- Do not translate. Regex used by AutoFill. -->
    <string name="autofill_attention_ignored_re">attention|attn</string>

    <!-- Do not translate. Regex used by AutoFill. -->
    <string name="autofill_region_ignored_re">province|region|other<!-- es -->|provincia<!-- pt-BR, pt-PT -->|bairro|suburb</string>

    <!-- Do not translate. Regex used by AutoFill. -->
    <string name="autofill_company_re">company|business|organization|organisation|department<!-- de-DE -->|firma|firmenname<!-- es -->|empresa<!-- fr-FR -->|societe|société<!-- it-IT -->|ragione.?sociale<!-- ja-JP -->|会社<!-- ru -->|название.?компании<!-- zh-CN -->|单位|公司</string>

    <!-- Do not translate. Regex used by AutoFill. -->
    <string name="autofill_address_line_1_re">address.?line|address1|addr1|street<!-- de-DE -->|strasse|straße|hausnummer|housenumber<!-- en-GB -->|house.?name<!-- es -->|direccion|dirección<!-- fr-FR -->|adresse<!-- it-IT -->|indirizzo<!-- ja-JP -->|住所1<!-- pt-BR, pt-PT -->|morada|endereço<!-- ru -->|Адрес<!-- zh-CN -->|地址</string>

    <!-- Do not translate. Regex used by AutoFill. -->
    <string name="autofill_address_line_1_label_re">address<!-- fr-FR -->|adresse<!-- it-IT -->|indirizzo<!-- ja-JP -->|住所<!-- zh-CN -->|地址</string>

    <!-- Do not translate. Regex used by AutoFill. -->
    <string name="autofill_address_line_2_re">address.?line2|address2|addr2|street|suite|unit<!-- de-DE -->|adresszusatz|ergänzende.?angaben<!-- es -->|direccion2|colonia|adicional<!-- fr-FR -->|addresssuppl|complementnom|appartement<!-- it-IT -->|indirizzo2<!-- ja-JP -->|住所2</string>

    <!-- Do not translate. Regex used by AutoFill. -->
    <string name="autofill_address_line_3_re">address.?line3|address3|addr3|street|line3<!-- es -->|municipio<!-- fr-FR -->|batiment|residence<!-- it-IT -->|indirizzo3</string>

    <!-- Do not translate. Regex used by AutoFill. -->
    <string name="autofill_country_re">country|location<!-- ja-JP -->|国<!-- zh-CN -->|国家</string>

    <!-- Do not translate. Regex used by AutoFill. -->
    <string name="autofill_zip_code_re">zip|postal|post code|pcode|^1z$<!-- de-DE -->|postleitzahl<!-- es -->|cp<!-- fr-FR -->|cdp<!-- it-IT -->|cap<!-- ja-JP -->|郵便番号<!-- pt-BR, pt-PT -->|codigo|codpos|cep<!-- ru -->|Почтовый.?Индекс<!--zh-CN -->|邮政编码|邮编<!-- zh-TW -->|郵遞區號</string>

    <!-- Do not translate. Regex used by AutoFill. -->
    <string name="autofill_zip_4_re">zip|^-$|post2<!-- pt-BR, pt-PT -->|codpos2</string>

    <!-- Do not translate. Regex used by AutoFill. -->
    <string name="autofill_city_re">city|town<!-- de-DE -->|ort|stadt<!-- en-AU -->|suburb<!-- es -->|ciudad|provincia|localidad|poblacion<!-- fr-FR -->|ville|commune<!-- it-IT -->|localita<!-- ja-JP -->|市区町村<!-- pt-BR, pt-PT -->|cidade<!-- ru -->|Город<!-- zh-CN -->|市<!-- zh-TW -->|分區</string>

    <!-- Do not translate. Regex used by AutoFill. -->
    <string name="autofill_state_re">state|county|region|province<!-- de-DE -->|land<!-- en-UK -->|county|principality<!-- ja-JP -->|都道府県<!-- pt-BR, pt-PT -->|estado|provincia<!-- ru -->|область<!-- zh-CN -->|省<!-- zh-TW -->|地區</string>

    <!-- Do not translate. Regex used by AutoFill. -->
    <string name="autofill_address_type_same_as_re">same as</string>

    <!-- Do not translate. Regex used by AutoFill. -->
    <string name="autofill_address_type_use_my_re">use my</string>

    <!-- Do not translate. Regex used by AutoFill. -->
    <string name="autofill_billing_designator_re">bill</string>

    <!-- Do not translate. Regex used by AutoFill. -->
    <string name="autofill_shipping_designator_re">ship</string>

    <!-- Do not translate. Regex used by AutoFill. -->
    <string name="autofill_email_re">e.?mail<!-- ja-JP -->|メールアドレス<!-- ru -->|Электронной.?Почты<!-- zh-CN -->|邮件|邮箱<!-- zh-TW -->|電郵地址</string>

    <!-- Do not translate. Regex used by AutoFill. -->
    <string name="autofill_username_re">user.?name|user.?id<!-- de-DE -->|vollständiger.?name<!-- zh-CN -->|用户名</string>

    <!-- Do not translate. Regex used by AutoFill. -->
    <string name="autofill_name_re">^name|full.?name|your.?name|customer.?name|firstandlastname<!-- es -->|nombre.*y.*apellidos<!-- fr-FR -->|^nom<!-- ja-JP -->|お名前|氏名<!-- pt-BR, pt-PT -->|^nome<!-- zh-CN -->|姓名</string>

    <!-- Do not translate. Regex used by AutoFill. -->
    <string name="autofill_name_specific_re">^name<!-- fr-FR -->|^nom<!-- pt-BR, pt-PT -->|^nome</string>

    <!-- Do not translate. Regex used by AutoFill. -->

    <string name="autofill_first_name_re">irst.*name|initials|fname|first$<!-- de-DE -->|vorname<!-- es -->|nombre<!-- fr-FR -->|forename|prénom|prenom<!-- ja-JP -->|名<!-- pt-BR, pt-PT -->|nome<!-- ru -->|Имя</string>

    <!-- Do not translate. Regex used by AutoFill. -->
    <string name="autofill_middle_initial_re">middle.*initial|m\\.i\\.|mi$</string>

    <!-- Do not translate. Regex used by AutoFill. -->
    <string name="autofill_middle_name_re">middle.*name|mname|middle$<!-- es -->|apellido.?materno|lastlastname</string>

    <!-- Do not translate. Regex used by AutoFill. -->
    <string name="autofill_last_name_re">last.*name|lname|surname|last$<!-- de-DE -->|nachname<!-- es -->|apellidos<!-- fr-FR -->|famille|^nom<!-- it-IT -->|cognome<!-- ja-JP -->|姓<!-- pt-BR, pt-PT -->|morada|apelidos|surename|sobrenome<!-- ru -->|Фамилия</string>

    <!-- Do not translate. Regex used by AutoFill. -->
    <string name="autofill_phone_re">phone<!-- de-DE -->|telefonnummer<!-- es -->|telefono|teléfono<!-- fr-FR -->|telfixe<!-- ja-JP -->|電話<!-- pt-BR, pt-PT -->|telefone|telemovel<!-- ru -->|телефон<!-- zh-CN -->|电话</string>

    <!-- Do not translate. Regex used by AutoFill. -->
    <string name="autofill_area_code_re">area code</string>

    <!-- Do not translate. Regex used by AutoFill. -->
    <string name="autofill_phone_prefix_re">^-$|\\)$|prefix<!-- fr-FR -->|preselection<!-- pt-BR, pt-PT -->|ddd</string>

    <!-- Do not translate. Regex used by AutoFill. -->
    <string name="autofill_phone_suffix_re">^-$|suffix</string>

    <!-- Do not translate. Regex used by AutoFill. -->
    <string name="autofill_phone_extension_re">ext<!-- pt-BR, pt-PT -->|ramal</string>

    <!-- Do not translate. Regex used by AutoFill. -->
    <string name="autofill_name_on_card_re">card.?holder|name.?on.?card|ccname|owner<!-- de-DE -->|karteninhaber<!-- es -->|nombre.*tarjeta<!-- fr-FR -->|nom.*carte<!-- it-IT -->|nome.*cart<!-- ja-JP -->|名前<!-- ru -->|Имя.*карты<!-- zh-CN -->|信用卡开户名|开户名|持卡人姓名<!-- zh-TW -->|持卡人姓名</string>

    <!-- Do not translate. Regex used by AutoFill. -->
    <string name="autofill_name_on_card_contextual_re">name</string>

    <!-- Do not translate. Regex used by AutoFill. -->
    <string name="autofill_card_cvc_re">verification|card identification|cvn|security code|cvv code|cvc</string>

    <!-- Do not translate. Regex used by AutoFill. -->
    <string name="autofill_card_number_re">number|card.?#|card.?no|ccnum<!-- de-DE -->|nummer<!-- es -->|credito|numero|número<!-- fr-FR -->|numéro<!-- ja-JP -->|カード番号<!-- ru -->|Номер.*карты<!-- zh-CN -->|信用卡号|信用卡号码<!-- zh-TW -->|信用卡卡號</string>

    <!-- Do not translate. Regex used by AutoFill. -->
    <string name="autofill_expiration_month_re">expir|exp.*month|exp.*date|ccmonth<!-- de-DE -->|gueltig|gültig|monat<!-- es -->|fecha<!-- fr-FR -->|date.*exp<!-- it-IT -->|scadenza<!-- ja-JP -->|有効期限<!-- pt-BR, pt-PT -->|validade<!-- ru -->|Срок действия карты<!-- zh-CN -->|月</string>

    <!-- Do not translate. Regex used by AutoFill. -->
    <string name="autofill_expiration_date_re">exp|^/|year<!-- de-DE -->|ablaufdatum|gueltig|gültig|yahr<!-- es -->|fecha<!-- it-IT -->|scadenza<!-- ja-JP -->|有効期限<!-- pt-BR, pt-PT -->|validade<!-- ru -->|Срок действия карты<!-- zh-CN -->|年|有效期</string>

    <!-- Do not translate. Regex used by AutoFill. -->
    <string name="autofill_card_ignored_re">^card</string>

    <!-- Title of an application permission, listed so the user can choose whether
        they want to allow the application to do this. -->
    <string name="permlab_readHistoryBookmarks">read Browser\'s history and bookmarks</string>