Skip to content

Commit

Permalink
Merge pull request #6 from sjinks/add-translations
Browse files Browse the repository at this point in the history
Add translations
  • Loading branch information
sjinks authored Jan 28, 2022
2 parents 32915ed + 72bbf93 commit 0d6ab2f
Show file tree
Hide file tree
Showing 6 changed files with 248 additions and 15 deletions.
4 changes: 2 additions & 2 deletions inc/class-adminsettings.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public function register_settings(): void {
],
'help' => __(
// phpcs:ignore WordPress.WP.I18n.NonSingularStringLiteralText
'<em>Discouraged</em>: user verificatoin is not required (e.g., in the interest of minimizing disruption to the user interaction flow).<br/>'
'<em>Discouraged</em>: user verification is not required (e.g., in the interest of minimizing disruption to the user interaction flow).<br/>'
. '<em>Preferred</em>: user verification (like entering a PIN code) is preferred but not required for successful authentication.<br/>'
. '<em>Required</em>: user verification is required for successful authentication. Please note that not all browsers support this setting.<br/>',
'two-factor-provider-webauthn'
Expand Down Expand Up @@ -116,7 +116,7 @@ public function register_settings(): void {
'help' => __(
// phpcs:ignore WordPress.WP.I18n.NonSingularStringLiteralText
'Chrome for Android sometimes ignores the AppID extension required for interoperability between the old U2F and the modern WebAuthn protocol.<br/>'
. 'When enabled, this compatibility enables the check whther the security key used was registered with U2F and if so, forces the use of the AppID extension.',
. 'When enabled, this hack enables the check whether the security key used was registered with U2F and if so, forces the use of the AppID extension.',
'two-factor-provider-webauthn'
),
]
Expand Down
8 changes: 4 additions & 4 deletions inc/class-ajax.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public function admin_init(): void {

private function verify_nonce( string $nonce ): void {
if ( false === check_ajax_referer( $nonce, false, false ) ) {
wp_send_json_error( __( 'The nonce has expired. Please reload the page and try again', 'two-factor-provider-webauthn' ), 400 );
wp_send_json_error( __( 'The nonce has expired. Please reload the page and try again.', 'two-factor-provider-webauthn' ), 400 );
}
}

Expand Down Expand Up @@ -81,7 +81,7 @@ public function wp_ajax_webauthn_register(): void {
/** @var mixed */
$context = unserialize( base64_decode( $context ) ); // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions.serialize_unserialize
if ( ! ( $context instanceof RegistrationContext ) ) {
throw new UnexpectedValueException( __( 'Unable to retrieve the registration context', 'two-factor-provider-webauthn' ) );
throw new UnexpectedValueException( __( 'Unable to retrieve the registration context.', 'two-factor-provider-webauthn' ) );
}

// We cannot use WordPress sanitization functions here: the credential must not be altered.
Expand All @@ -91,7 +91,7 @@ public function wp_ajax_webauthn_register(): void {
// phpcs:ignore WordPress.Security.NonceVerification.Missing, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
$credential = $_POST['credential'] ?? null; // Dangerous to sanitize; the code will validate the value
if ( ! is_string( $credential ) ) {
throw new InvalidArgumentException( __( 'Bad request', 'two-factor-provider-webauthn' ) );
throw new InvalidArgumentException( __( 'Bad request.', 'two-factor-provider-webauthn' ) );
}

/** @var mixed */
Expand All @@ -117,7 +117,7 @@ public function wp_ajax_webauthn_register(): void {
'nonce' => wp_create_nonce( "webauthn-register_key_{$user->ID}" ),
] );
} else {
throw new InvalidArgumentException( __( 'Bad request', 'two-factor-provider-webauthn' ) );
throw new InvalidArgumentException( __( 'Bad request.', 'two-factor-provider-webauthn' ) );
}
} catch ( Throwable $e ) {
wp_send_json_error( $e->getMessage(), 400 );
Expand Down
4 changes: 2 additions & 2 deletions inc/class-webauthn-provider.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ public function validate_authentication( $user ) {
/** @var mixed */
$context = unserialize( base64_decode( $context ) ); // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions.serialize_unserialize -- the value was stored serialize()'d
if ( ! ( $context instanceof AuthenticationContext ) ) {
throw new UnexpectedValueException( __( 'Unable to retrieve the authentication context', 'two-factor-provider-webauthn' ) );
throw new UnexpectedValueException( __( 'Unable to retrieve the authentication context.', 'two-factor-provider-webauthn' ) );
}

// We cannot use WordPress sanitization functions here: the response from webauthn must not be altered.
Expand All @@ -115,7 +115,7 @@ public function validate_authentication( $user ) {
// phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.NonceVerification.Missing
$response = $_POST['webauthn_response'] ?? null; // Dangerous to sanitize; the code will validate the value
if ( ! is_string( $response ) ) {
throw new InvalidArgumentException( __( 'Bad request', 'two-factor-provider-webauthn' ) );
throw new InvalidArgumentException( __( 'Bad request.', 'two-factor-provider-webauthn' ) );
}

/** @var mixed $credential */
Expand Down
Binary file added lang/two-factor-provider-webauthn-ru_RU.mo
Binary file not shown.
233 changes: 233 additions & 0 deletions lang/two-factor-provider-webauthn-ru_RU.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,233 @@
# Copyright (C) 2022 Volodymyr Kolesnykov
# This file is distributed under the MIT.
msgid ""
msgstr ""
"Project-Id-Version: WebAuthn Provider for Two Factor 1.0.0\n"
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/two-factor-"
"provider-webauthn\n"
"POT-Creation-Date: 2022-01-28T06:26:54+02:00\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: WP-CLI 2.5.0\n"
"X-Domain: two-factor-provider-webauthn\n"

#. Plugin Name of the plugin
msgid "WebAuthn Provider for Two Factor"
msgstr "WebAuthn Provider for Two Factor"

#. Description of the plugin
msgid "WebAuthn Provider for Two Factor plugin."
msgstr "WebAuthn Provider для плагина Two Factor."

#. Author of the plugin
msgid "Volodymyr Kolesnykov"
msgstr "Владимир Колесников"

#: inc/class-admin.php:29
msgid "TwoFactor WebAuthn Settings"
msgstr "Настройки TwoFactor WebAuthn"

#: inc/class-admin.php:29
msgid "TwoFactor WebAuthn"
msgstr "TwoFactor WebAuthn"

#: inc/class-adminsettings.php:47
msgid "Authenticator Attachment Modality"
msgstr ""

#: inc/class-adminsettings.php:54
msgctxt "Authenticator attachment modality"
msgid "None"
msgstr "Нет"

#: inc/class-adminsettings.php:55
msgctxt "Authenticator attachment modality"
msgid "Cross-platform"
msgstr "Кросс-платформенная"

#: inc/class-adminsettings.php:56
msgctxt "Authenticator attachment modality"
msgid "Platform"
msgstr "Платформозависимая"

#: inc/class-adminsettings.php:58
msgid ""
"<em>Platform attachment</em> is for authenticators physically bound to a "
"client device (like a fingerprint scanner on a smartphone).<br/><em>Cross-"
"platform attachment</em> is for removable authenticators which can \"roam\" "
"between client devices (like a security key).<br/>Consider using <em>None</"
"em> if you do not need to restrict your users to the specific class of "
"authenticators.<br/><a href=\"https://www.w3.org/TR/webauthn-2/"
"#authenticator-attachment-modality\">Details</a>"
msgstr ""

#: inc/class-adminsettings.php:71
msgid "User Verification Requirement"
msgstr "Требование проверки пользователя"

#: inc/class-adminsettings.php:78
msgctxt "User Verification Requirement"
msgid "Discouraged"
msgstr "Не проверять"

#: inc/class-adminsettings.php:79
msgctxt "User Verification Requirement"
msgid "Preferred"
msgstr "По возможности"

#: inc/class-adminsettings.php:80
msgctxt "User Verification Requirement"
msgid "Required"
msgstr "Обязательно проверять"

#: inc/class-adminsettings.php:82
msgid ""
"<em>Discouraged</em>: user verification is not required (e.g., in the "
"interest of minimizing disruption to the user interaction flow).<br/"
"><em>Preferred</em>: user verification (like entering a PIN code) is "
"preferred but not required for successful authentication.<br/><em>Required</"
"em>: user verification is required for successful authentication. Please "
"note that not all browsers support this setting.<br/>"
msgstr ""

#: inc/class-adminsettings.php:94
msgid "Timeout"
msgstr "Таймаут"

#: inc/class-adminsettings.php:101
msgid ""
"The default timeout for security key operations, in seconds. Set to 0 to use "
"the browser default value."
msgstr "Значение таймаута для операций с ключами безопасности по умолчанию (в секундах). Установите в 0 для использования значения браузера по умолчанию."

#: inc/class-adminsettings.php:110
msgid "U2F compatibility hack"
msgstr "Хак для совместивости с U2F"

#: inc/class-adminsettings.php:116
msgid ""
"Chrome for Android sometimes ignores the AppID extension required for "
"interoperability between the old U2F and the modern WebAuthn protocol.<br/"
">When enabled, this hack enables the check whether the security key used was "
"registered with U2F and if so, forces the use of the AppID extension."
msgstr ""
"Chrome для Android иногда иенорирует расширение AppID, необходимое для "
"функциональной соместимости между старым протоколом U2F и новым протоколом "
"WebAuthn.<br/>Разрешение данного хака включает проверку, был ли ключ "
"зарегистрирован при помощи U2F; если да, то поддержка AppID включается "
"принудительно."

#: inc/class-ajax.php:32
msgid "The nonce has expired. Please reload the page and try again."
msgstr ""
"Срок действия одноразового номера истёк. Пожалуйста, обновите страницу и "
"попытайтесь выполнить действие снова."

#: inc/class-ajax.php:84
msgid "Unable to retrieve the registration context."
msgstr "Не удалось получить контекст регистрации."

#: inc/class-ajax.php:94 inc/class-ajax.php:120
#: inc/class-webauthn-provider.php:118
msgid "Bad request."
msgstr "Неверный запрос."

#: inc/class-ajax.php:147
msgid "Key name cannot be empty."
msgstr "Имя ключа не может быть пустым."

#: inc/class-ajax.php:156
msgid "Failed to rename the key."
msgstr "Не удалось переименовать ключ."

#: inc/class-key-table.php:33
msgid "Name"
msgstr "Имя"

#: inc/class-key-table.php:34
msgid "Counter"
msgstr "Счётчик"

#: inc/class-key-table.php:35
msgid "Added"
msgstr "Добавлен"

#: inc/class-key-table.php:36
msgid "Last Used"
msgstr "Последнее использование"

#: inc/class-key-table.php:57
msgid "Rename"
msgstr "Переименовать"

#: inc/class-key-table.php:63
msgid "Revoke"
msgstr "Отозвать"

#: inc/class-webauthn-credential-store.php:121
msgid "New Key"
msgstr "Новый ключ"

#: inc/class-webauthn-provider.php:47
msgctxt "Provider label"
msgid "WebAuthn"
msgstr "WebAuthn"

#: inc/class-webauthn-provider.php:59
msgid ""
"WebAuthn requires an HTTPS connection. Please use an alternative second "
"factor method."
msgstr ""
"Для использования WebAuthn требуется соединение HTTPS. Пожалуйста, "
"воспользуйтесь альтернативным методом двухфакторной аутентификации."

#: inc/class-webauthn-provider.php:107
msgid "Unable to retrieve the authentication context."
msgstr "Не удалось получить контекст аутентификации."

#: views/login.php:2
msgid "Please insert (and tap) your security key."
msgstr "Пожалуйста, вставьте и коснитесь ключа безопасности."

#: views/user-options.php:3
msgid ""
"Requires an HTTPS connection. Please configure your security keys in the <a "
"href=\"#webauthn-security-keys-section\">Security Keys (WebAuthn)</a> "
"section below."
msgstr "Требуется безопасное соединение (HTTPS). Для управления ключами воспользуйтесь секцией <a href=\"#webauthn-security-keys-section\">Ключи безопасности (WebAuthn)</a>"

#: views/user-profile.php:10
msgid "Security Keys (WebAuthn)"
msgstr "Ключи безопасности (WebAuthn)"

#: views/user-profile.php:14
msgid "You need to enable JavaScript to manage security keys."
msgstr "Для управления ключами безопасности необходимо включить JavaScript."

#: views/user-profile.php:21
msgid ""
"WebAuthn requires an HTTPS connection. You will be unable to add new "
"security keys over HTTP."
msgstr "Для WebAuthn требуется соединение HTTPS. Добавление новых ключей по HTTP невозможно."

#: views/user-profile.php:28
msgid "Key name:"
msgstr "Имя ключа:"

#: views/user-profile.php:30
msgctxt "security key"
msgid "Register New Key"
msgstr "Зарегистрировать новый ключ"

#: views/user-profile.php:53
msgid "Are you sure to revoke this key?"
msgstr "Вы уверены, что хотите отозвать данный ключ?"

#: views/user-profile.php:62
msgid "New name:"
msgstr "Новое имя:"
14 changes: 7 additions & 7 deletions lang/two-factor-provider-webauthn.pot
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"POT-Creation-Date: 2022-01-28T02:02:32+02:00\n"
"POT-Creation-Date: 2022-01-28T06:32:00+02:00\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"X-Generator: WP-CLI 2.5.0\n"
"X-Domain: two-factor-provider-webauthn\n"
Expand Down Expand Up @@ -77,7 +77,7 @@ msgid "Required"
msgstr ""

#: inc/class-adminsettings.php:82
msgid "<em>Discouraged</em>: user verificatoin is not required (e.g., in the interest of minimizing disruption to the user interaction flow).<br/><em>Preferred</em>: user verification (like entering a PIN code) is preferred but not required for successful authentication.<br/><em>Required</em>: user verification is required for successful authentication. Please note that not all browsers support this setting.<br/>"
msgid "<em>Discouraged</em>: user verification is not required (e.g., in the interest of minimizing disruption to the user interaction flow).<br/><em>Preferred</em>: user verification (like entering a PIN code) is preferred but not required for successful authentication.<br/><em>Required</em>: user verification is required for successful authentication. Please note that not all browsers support this setting.<br/>"
msgstr ""

#: inc/class-adminsettings.php:94
Expand All @@ -93,21 +93,21 @@ msgid "U2F compatibility hack"
msgstr ""

#: inc/class-adminsettings.php:116
msgid "Chrome for Android sometimes ignores the AppID extension required for interoperability between the old U2F and the modern WebAuthn protocol.<br/>When enabled, this compatibility enables the check whther the security key used was registered with U2F and if so, forces the use of the AppID extension."
msgid "Chrome for Android sometimes ignores the AppID extension required for interoperability between the old U2F and the modern WebAuthn protocol.<br/>When enabled, this hack enables the check whether the security key used was registered with U2F and if so, forces the use of the AppID extension."
msgstr ""

#: inc/class-ajax.php:32
msgid "The nonce has expired. Please reload the page and try again"
msgid "The nonce has expired. Please reload the page and try again."
msgstr ""

#: inc/class-ajax.php:84
msgid "Unable to retrieve the registration context"
msgid "Unable to retrieve the registration context."
msgstr ""

#: inc/class-ajax.php:94
#: inc/class-ajax.php:120
#: inc/class-webauthn-provider.php:118
msgid "Bad request"
msgid "Bad request."
msgstr ""

#: inc/class-ajax.php:147
Expand Down Expand Up @@ -156,7 +156,7 @@ msgid "WebAuthn requires an HTTPS connection. Please use an alternative second f
msgstr ""

#: inc/class-webauthn-provider.php:107
msgid "Unable to retrieve the authentication context"
msgid "Unable to retrieve the authentication context."
msgstr ""

#: views/login.php:2
Expand Down

0 comments on commit 0d6ab2f

Please sign in to comment.