rodauth-i18n 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +78 -14
- data/lib/rodauth/features/i18n.rb +99 -1
- data/locales/pt.yml +244 -0
- data/rodauth-i18n.gemspec +1 -2
- metadata +3 -21
- data/CHANGELOG.md +0 -5
- data/lib/rodauth/i18n/feature.rb +0 -65
- data/lib/rodauth/i18n/railtie.rb +0 -13
- data/lib/rodauth/i18n.rb +0 -29
- data/lib/rodauth-i18n.rb +0 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8b0cc8e3763b320a13f457addc4195eb46c11d1313068d2bd872b2b2f276805b
|
4
|
+
data.tar.gz: 28e406079c1ce8777d7db7b132c8cbdcb9b688ac9fea97eb6d62cb7bdc14bd3e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c180a031e73fd0ca82e34b206f2b7f841b19ae3cb534ca8f5dd3f25ea5e33f9209e23007d9f3dea9e46c5c60945de67642c147450c6cbf36534c925f02fe002a
|
7
|
+
data.tar.gz: b57892ee7404a04e77a8dcb1ed490de6744413cda20623c1d4564fa4a1dc81055926e9f3c89f9f27f9ea5991bb58c30e22de859be2dd0d2da3e91ede01c6cf2b
|
data/README.md
CHANGED
@@ -1,13 +1,15 @@
|
|
1
1
|
# rodauth-i18n
|
2
2
|
|
3
|
-
Provides [I18n] integration for [Rodauth] authentication framework.
|
3
|
+
Provides [I18n] integration for [Rodauth] authentication framework.
|
4
|
+
|
5
|
+
It also includes built-in translations for various languages, which you are encouraged to extend :pray:
|
4
6
|
|
5
7
|
## Installation
|
6
8
|
|
7
9
|
Add this line to your application's Gemfile:
|
8
10
|
|
9
11
|
```ruby
|
10
|
-
gem "rodauth-i18n"
|
12
|
+
gem "rodauth-i18n", "~> 0.2"
|
11
13
|
```
|
12
14
|
|
13
15
|
And then execute:
|
@@ -33,16 +35,7 @@ plugin :rodauth do
|
|
33
35
|
end
|
34
36
|
```
|
35
37
|
|
36
|
-
|
37
|
-
|
38
|
-
```rb
|
39
|
-
require "rodauth/i18n"
|
40
|
-
|
41
|
-
# adds built-in locale files to I18n's load path
|
42
|
-
Rodauth::I18n.add
|
43
|
-
```
|
44
|
-
|
45
|
-
See the [Rails Internationalization Guide] on how to set the locale.
|
38
|
+
This will make translations go through the [I18n] gem, and will automatically load translations for locales specified in `I18n.available_locales` (if unset, translations for *all* locales will be loaded).
|
46
39
|
|
47
40
|
### Per configuration translations
|
48
41
|
|
@@ -78,7 +71,7 @@ i18n_cascade? false
|
|
78
71
|
|
79
72
|
### Copying translations
|
80
73
|
|
81
|
-
In Rails, you can copy built-in translations into your app via the `rodauth:i18n:translations` generator, which receives a list of locales to copy translations for:
|
74
|
+
In a Rails app, you can copy built-in translations into your app via the `rodauth:i18n:translations` generator, which receives a list of locales to copy translations for:
|
82
75
|
|
83
76
|
```sh
|
84
77
|
$ rails generate rodauth:i18n:translations en hr
|
@@ -86,7 +79,7 @@ $ rails generate rodauth:i18n:translations en hr
|
|
86
79
|
# create config/locales/rodauth.hr.yml
|
87
80
|
```
|
88
81
|
|
89
|
-
|
82
|
+
On other web frameworks, you can copy the translation files directly from the `locales/` directory.
|
90
83
|
|
91
84
|
### Raising on missing translations
|
92
85
|
|
@@ -120,6 +113,77 @@ You can pass any custom options to the `I18n.translate` method via `i18n_options
|
|
120
113
|
i18n_options { { exception_handler: -> (*args) { ... } } }
|
121
114
|
```
|
122
115
|
|
116
|
+
## Localized routes
|
117
|
+
|
118
|
+
If you want to prefix your routes with current locale, you can do so as
|
119
|
+
follows:
|
120
|
+
|
121
|
+
```rb
|
122
|
+
prefix do
|
123
|
+
if I18n.locale == I18n.default_locale
|
124
|
+
"/auth"
|
125
|
+
else
|
126
|
+
"/#{I18n.locale}/auth"
|
127
|
+
end
|
128
|
+
end
|
129
|
+
```
|
130
|
+
```rb
|
131
|
+
route do |r|
|
132
|
+
# ...
|
133
|
+
all_locales = I18n.available_locales.map(&:to_s) - [I18n.default_locale.to_s]
|
134
|
+
# routes requests starting with `(/:locale)/auth/*`
|
135
|
+
r.on [*all_locales, true], "auth" do |locale|
|
136
|
+
rails_request.params[:locale] = locale || I18n.default_locale # if using Rails
|
137
|
+
r.rodauth
|
138
|
+
break
|
139
|
+
end
|
140
|
+
end
|
141
|
+
```
|
142
|
+
|
143
|
+
## Bundling translations in your Rodauth plugin
|
144
|
+
|
145
|
+
To make texts in your Rodauth plugin translatable, use the `translatable_method` macro. Macros for defining flash messages, button texts, and page titles internally call `translatable_method`, and are thus automatically translatable.
|
146
|
+
|
147
|
+
```rb
|
148
|
+
# lib/rodauth/features/foo.rb
|
149
|
+
module Rodauth
|
150
|
+
Feature.define(:foo, :Foo) do
|
151
|
+
translatable_method :foo_message, "This message is translatable"
|
152
|
+
error_flash "Flash messages are automatically translatable", "foo"
|
153
|
+
button "Translatable button text", "foo"
|
154
|
+
view "foo", "Translatable page title", "foo"
|
155
|
+
end
|
156
|
+
end
|
157
|
+
```
|
158
|
+
|
159
|
+
You can then define translations in the `locales/` directory in your gem root:
|
160
|
+
|
161
|
+
```yml
|
162
|
+
# locales/en.yml
|
163
|
+
en:
|
164
|
+
rodauth:
|
165
|
+
foo_message: "..."
|
166
|
+
foo_error_flash: "..."
|
167
|
+
foo_button: "..."
|
168
|
+
foo_page_title: "..."
|
169
|
+
```
|
170
|
+
|
171
|
+
Then, to have rodauth-i18n load your translations, register the directory when loading the feature:
|
172
|
+
|
173
|
+
```rb
|
174
|
+
# lib/rodauth/features/foo.rb
|
175
|
+
module Rodauth
|
176
|
+
Feature.define(:foo, :Foo) do
|
177
|
+
# ...
|
178
|
+
def post_configure
|
179
|
+
super
|
180
|
+
i18n_register File.expand_path("#{__dir__}/../../../locales") if features.include?(:i18n)
|
181
|
+
end
|
182
|
+
# ...
|
183
|
+
end
|
184
|
+
end
|
185
|
+
```
|
186
|
+
|
123
187
|
## Development
|
124
188
|
|
125
189
|
Run tests with Rake:
|
@@ -1 +1,99 @@
|
|
1
|
-
require "
|
1
|
+
require "i18n"
|
2
|
+
|
3
|
+
module Rodauth
|
4
|
+
Feature.define(:i18n, :I18n) do
|
5
|
+
auth_value_method :i18n_cascade?, true
|
6
|
+
auth_value_method :i18n_raise_on_missing_translations?, false
|
7
|
+
auth_value_method :i18n_fallback_to_untranslated?, false
|
8
|
+
auth_value_method :i18n_options, {}
|
9
|
+
|
10
|
+
auth_value_methods(
|
11
|
+
:i18n_namespace,
|
12
|
+
:i18n_available_locales,
|
13
|
+
)
|
14
|
+
|
15
|
+
auth_methods(
|
16
|
+
:i18n_locale,
|
17
|
+
)
|
18
|
+
|
19
|
+
def post_configure
|
20
|
+
super
|
21
|
+
i18n_register File.expand_path("#{__dir__}/../../../locales")
|
22
|
+
end
|
23
|
+
|
24
|
+
def translate(name, default)
|
25
|
+
i18n_translate(name, default)
|
26
|
+
end
|
27
|
+
|
28
|
+
def i18n_locale
|
29
|
+
::I18n.locale
|
30
|
+
end
|
31
|
+
|
32
|
+
private
|
33
|
+
|
34
|
+
def i18n_translate(name, default, **options)
|
35
|
+
::I18n.translate(i18n_translation_key(name),
|
36
|
+
scope: i18n_scope,
|
37
|
+
locale: i18n_locale,
|
38
|
+
raise: i18n_raise_on_missing_translations?,
|
39
|
+
default: i18n_default(name, default),
|
40
|
+
**i18n_options,
|
41
|
+
**options
|
42
|
+
)
|
43
|
+
end
|
44
|
+
|
45
|
+
def i18n_translation_key(name)
|
46
|
+
[*i18n_namespace, name].join(".")
|
47
|
+
end
|
48
|
+
|
49
|
+
def i18n_default(name, fallback)
|
50
|
+
default = []
|
51
|
+
default << name if i18n_namespace && i18n_cascade?
|
52
|
+
default << fallback if i18n_fallback_to_untranslated? && !i18n_raise_on_missing_translations?
|
53
|
+
default
|
54
|
+
end
|
55
|
+
|
56
|
+
def i18n_namespace
|
57
|
+
self.class.configuration_name
|
58
|
+
end
|
59
|
+
|
60
|
+
def i18n_register(directory)
|
61
|
+
files = i18n_files(directory)
|
62
|
+
files.each { |file| i18n_add(file) }
|
63
|
+
i18n_reload
|
64
|
+
end
|
65
|
+
|
66
|
+
# Returns list of translation files in given directory based on
|
67
|
+
# available locales.
|
68
|
+
def i18n_files(directory)
|
69
|
+
locales = i18n_available_locales
|
70
|
+
pattern = locales ? "{#{locales.join(",")}}" : "*"
|
71
|
+
|
72
|
+
Dir["#{directory}/#{pattern}.yml"]
|
73
|
+
end
|
74
|
+
|
75
|
+
# User-defined translations have most likely already been loaded at this
|
76
|
+
# point, so we prepend built-in translations to the load path to ensure we
|
77
|
+
# don't override them.
|
78
|
+
def i18n_add(file)
|
79
|
+
::I18n.load_path.unshift(file) unless ::I18n.load_path.include?(file)
|
80
|
+
end
|
81
|
+
|
82
|
+
# Ensure we pick up new entries in the load path.
|
83
|
+
def i18n_reload
|
84
|
+
::I18n.reload!
|
85
|
+
end
|
86
|
+
|
87
|
+
# Returns available locales if they have been set.
|
88
|
+
def i18n_available_locales
|
89
|
+
::I18n.available_locales if ::I18n.available_locales_initialized?
|
90
|
+
end
|
91
|
+
|
92
|
+
def i18n_scope
|
93
|
+
"rodauth"
|
94
|
+
end
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
require "rodauth/i18n/login_password_requirements_base"
|
99
|
+
Rodauth::I18n.include Rodauth::I18n::LoginPasswordRequirementsBase
|
data/locales/pt.yml
ADDED
@@ -0,0 +1,244 @@
|
|
1
|
+
pt:
|
2
|
+
rodauth:
|
3
|
+
account_expiration_error_flash: Não pode aceder a esta conta, visto que expirou
|
4
|
+
active_sessions_error_flash: Esta sessão foi encerrada
|
5
|
+
add_recovery_codes_button: Adicionar autenticação por códigos de recuperação
|
6
|
+
add_recovery_codes_error_flash: Não foi possível adicionar os códigos de recuperação
|
7
|
+
add_recovery_codes_heading: "<h2>Adicionar mais Códigos de Recuperação</h2>"
|
8
|
+
add_recovery_codes_page_title: Autenticação por Códigos de Recuperação
|
9
|
+
already_an_account_with_this_login_message: já existe uma conta com este login
|
10
|
+
attempt_to_create_unverified_account_error_flash: A conta que tentou criar está à espera de verificação
|
11
|
+
attempt_to_login_to_unverified_account_error_flash: A conta que tentou aceder está à espera de verificação
|
12
|
+
change_login_button: Modificar Login
|
13
|
+
change_login_error_flash: Houve um erro a modificar o seu login
|
14
|
+
change_login_needs_verification_notice_flash: Foi-lhe enviado por email um link para verificar a sua modificação de login
|
15
|
+
change_login_notice_flash: O seu login foi modificado
|
16
|
+
change_login_page_title: Modificar Login
|
17
|
+
change_password_button: Modificar palavra-passe
|
18
|
+
change_password_error_flash: Houve um erro a mudar a sua palavra-passe
|
19
|
+
change_password_notice_flash: A sua palavra-passe foi mudada
|
20
|
+
change_password_page_title: Mudar palavra-passe
|
21
|
+
close_account_button: Fechar conta
|
22
|
+
close_account_error_flash: Houve um erro ao fechar a sua conta
|
23
|
+
close_account_notice_flash: A sua conta foi fechada
|
24
|
+
close_account_page_title: Fechar conta
|
25
|
+
confirm_password_button: Confirmar palavra-passe
|
26
|
+
confirm_password_error_flash: Houve um erro a confirmar a sua palavra-passe
|
27
|
+
confirm_password_link_text: Insira a palavra-passe
|
28
|
+
confirm_password_notice_flash: A palavra-passe foi confirmada
|
29
|
+
confirm_password_page_title: Confirme a palavra-passe
|
30
|
+
contains_null_byte_message: contém um byte nulo
|
31
|
+
create_account_button: Criar conta
|
32
|
+
create_account_error_flash: Houve um erro ao criar a sua conta
|
33
|
+
create_account_link_text: Criar uma nova conta
|
34
|
+
create_account_notice_flash: A sua conta foi criada
|
35
|
+
create_account_page_title: Criar conta
|
36
|
+
email_auth_email_recently_sent_error_flash: Foi-lhe recentemente enviado por email um link para login
|
37
|
+
email_auth_email_sent_notice_flash: Foi-lhe enviado um email com um link para fazer login na sua conta
|
38
|
+
email_auth_email_subject: Link de Login
|
39
|
+
email_auth_error_flash: Houve um erro ao fazer login
|
40
|
+
email_auth_page_title: Login
|
41
|
+
email_auth_request_button: Enviar Link de Login por Email
|
42
|
+
email_auth_request_error_flash: Houve um erro ao requisitar um link de autenticação por email
|
43
|
+
email_subject_prefix: ''
|
44
|
+
expired_jwt_access_token_message: token de Acesso JWT expirada
|
45
|
+
global_logout_label: Encerrar todas as sessões activas?
|
46
|
+
input_field_label_suffix: ''
|
47
|
+
invalid_jwt_format_error_message: Formato JWT inválido ou claim no Authorization header
|
48
|
+
invalid_password_message: palavra-passe inválida
|
49
|
+
invalid_recovery_code_error_flash: Erro ao atenticar através do código de recuperação
|
50
|
+
invalid_recovery_code_message: Código de recuperação inválido
|
51
|
+
json_non_post_error_message: método não-POST usado na API JSON
|
52
|
+
json_not_accepted_error_message: Accept Header não suportado. Deve aceitar "application/json" ou um tipo de conteúdo compatível
|
53
|
+
jwt_refresh_invalid_token_message: token JWT refresh inválida
|
54
|
+
jwt_refresh_without_access_token_message: sem token JWT de acesso disponibilizada durante o refresh
|
55
|
+
login_button: Login
|
56
|
+
login_confirm_label: Confirmar %{login_label}
|
57
|
+
login_does_not_meet_requirements_message: login inválido, não satisfaz os requisitos
|
58
|
+
login_error_flash: Houve um erro ao efectuar o login
|
59
|
+
login_form_footer_links_heading: <h2 class="rodauth-login-form-footer-links-heading">Outras opções</h2>
|
60
|
+
login_label: Login
|
61
|
+
login_lockout_error_flash: De momento esta conta está bloqueada e não pode ser acedida
|
62
|
+
login_not_valid_email_message: não é um endereço de e-mail
|
63
|
+
login_notice_flash: Login efectuado com sucesso
|
64
|
+
login_page_title: Login
|
65
|
+
login_too_long_message: máximo %{login_maximum_length} caracteres
|
66
|
+
login_too_short_message: mínimo %{login_minimum_length} caracteres
|
67
|
+
logins_do_not_match_message: logins não coincidem
|
68
|
+
logout_button: Encerrar sessão
|
69
|
+
logout_notice_flash: A sessão foi encerrada
|
70
|
+
logout_page_title: Encerrar sessão
|
71
|
+
multi_phase_login_page_title: Login
|
72
|
+
need_password_notice_flash: Login reconhecido, por favor insira a sua palavra-passe
|
73
|
+
new_password_label: Nova palavra-passe
|
74
|
+
no_current_sms_code_error_flash: Sem código SMS para esta conta
|
75
|
+
no_matching_email_auth_key_error_flash: 'Houve um erro ao fazer login:: chave de autenticação email inválida'
|
76
|
+
no_matching_login_message: sem login correspondente
|
77
|
+
no_matching_reset_password_key_error_flash: 'Houve um erro ao recuperar a sua palavra-passe: chave de recuperação inválida ou expirada'
|
78
|
+
no_matching_unlock_account_key_error_flash: 'Houve um erro ao desbloquear a sua conta: chave de desbloqueio inválida ou expirada'
|
79
|
+
no_matching_verify_account_key_error_flash: 'Houve um erro ao verificar a sua conta: chave de verificação de conta inválida'
|
80
|
+
no_matching_verify_login_change_key_error_flash: 'Houve um erro ao verificar a sua modificação de login: chave de verificação para modificação de login inválida'
|
81
|
+
non_json_request_error_message: Apenas requests no formato JSON são permitidos
|
82
|
+
otp_already_setup_error_flash: Já configurou a autenticação TOTP
|
83
|
+
otp_auth_button: Autenticar utilizando TOTP
|
84
|
+
otp_auth_error_flash: Erro ao iniciar sessão através de autenticação TOTP
|
85
|
+
otp_auth_form_footer: ''
|
86
|
+
otp_auth_label: Código de Autenticação
|
87
|
+
otp_auth_link_text: Autenticar utilizando TOTP
|
88
|
+
otp_auth_page_title: Insira o código de autenticação
|
89
|
+
otp_disable_button: Desactivar Autenticação TOTP
|
90
|
+
otp_disable_error_flash: Erro ao desactivar a autenticação TOTP
|
91
|
+
otp_disable_link_text: Desactivar Autenticação TOTP
|
92
|
+
otp_disable_notice_flash: Autenticação TOTP foi desactivada
|
93
|
+
otp_disable_page_title: Desactivar Autenticação TOTP
|
94
|
+
otp_invalid_auth_code_message: Código de autenticação inválido
|
95
|
+
otp_invalid_secret_message: secret inválido
|
96
|
+
otp_lockout_error_flash: Código de autenticação TOTP foi bloqueado devido a várias tentativas falhadas
|
97
|
+
otp_provisioning_uri_label: URL de Provisioninamento
|
98
|
+
otp_secret_label: Secret
|
99
|
+
otp_setup_button: Configurar Autenticação TOTP
|
100
|
+
otp_setup_error_flash: Erro ao configurar a autenticação TOTP
|
101
|
+
otp_setup_link_text: Configurar Autenticação TOTP
|
102
|
+
otp_setup_notice_flash: A Autenticação TOTP está configurada
|
103
|
+
otp_setup_page_title: Configurar Autenticação TOTP
|
104
|
+
password_authentication_required_error_flash: Necessita de confirmar a sua palavra-passe para continuar
|
105
|
+
password_changed_email_subject: Palavra-passe modificada
|
106
|
+
password_confirm_label: Confirmar %{password_label}
|
107
|
+
password_does_not_meet_requirements_message: palavra-passe inválida, não satisfaz os requisitos
|
108
|
+
password_expiration_error_flash: A sua palavra-passe expirou e precisa de ser modificada
|
109
|
+
password_in_dictionary_message: é uma palavra num dicionário
|
110
|
+
password_invalid_pattern_message: inclui uma sequência de caracteres comum
|
111
|
+
password_is_one_of_the_most_common_message: é uma das palavras-chave mais comuns
|
112
|
+
password_label: Palavra-passe
|
113
|
+
password_not_changeable_yet_error_flash: A sua palavra-passe ainda não pode ser mudada
|
114
|
+
password_not_enough_character_groups_message: não inclui letras maiúsculas, letras minúsculas e números
|
115
|
+
password_same_as_previous_password_message: igual à palavra-passe anterior
|
116
|
+
password_too_many_repeating_characters_message: contém muitos caracteres repetidos sucessivamente
|
117
|
+
password_too_short_message: mínimo %{password_minimum_length} caracteres
|
118
|
+
passwords_do_not_match_message: palavras-chave não coincidem
|
119
|
+
recovery_auth_button: Autenticar por Código de Recuperação
|
120
|
+
recovery_auth_link_text: Autenticar utilizando Código de Recuperação
|
121
|
+
recovery_auth_page_title: Insira o Código de Recuperação
|
122
|
+
recovery_codes_added_notice_flash: Foram adicionados mais Códigos de Recuperação
|
123
|
+
recovery_codes_label: Código de Recuperação
|
124
|
+
recovery_codes_link_text: Ver Códigos de Recuperação de Autenticação
|
125
|
+
recovery_codes_page_title: Ver Códigos de Recuperação de Autenticação
|
126
|
+
remember_button: Modificar configurações de "Lembrar-me"
|
127
|
+
remember_disable_label: Desactivar "Lembrar-me"
|
128
|
+
remember_error_flash: Houve um erro ao actualizar a sua configuração de "Lembrar-me"
|
129
|
+
remember_forget_label: Esquecer-me
|
130
|
+
remember_notice_flash: A sua configuração de "Lembrar-me" foi actualizada
|
131
|
+
remember_page_title: Modificar configuração de "Lembrar-me"
|
132
|
+
remember_remember_label: Lembrar-me
|
133
|
+
require_login_error_flash: Por favor faça login para continuar
|
134
|
+
resend_verify_account_page_title: Reenviar Email de Verificação
|
135
|
+
reset_password_button: Recuperar palavra-passe
|
136
|
+
reset_password_email_recently_sent_error_flash: Foi-lhe enviado recentemente um email com um link para recuperar a sua palavra-passe
|
137
|
+
reset_password_email_sent_notice_flash: Foi-lhe enviado um email com um link para recuperar a sua palavra-passe
|
138
|
+
reset_password_email_subject: Recuperar palavra-passe
|
139
|
+
reset_password_error_flash: Houve um erro ao recuperar a sua palavra-passe
|
140
|
+
reset_password_explanatory_text: "<p>Se esqueceu a sua palavra-passe, pode fazer um pedido de recuperação:</p>"
|
141
|
+
reset_password_notice_flash: A sua palavra-passe foi recuperada
|
142
|
+
reset_password_page_title: Recuperar palavra-passe
|
143
|
+
reset_password_request_button: Pedir recuperação da palavra-passe
|
144
|
+
reset_password_request_error_flash: Houve um erro ao efectuar o pedido de recuperação de palavra-passe
|
145
|
+
reset_password_request_link_text: Esqueceu-se da palavra-passe?
|
146
|
+
reset_password_request_page_title: Pedir Recuperação de Palavra-chave
|
147
|
+
same_as_current_login_message: igual ao login actual
|
148
|
+
same_as_existing_password_message: palavra-passe inválida, igual à palavra-passe actual
|
149
|
+
session_expiration_error_flash: Esta sessão expirou, por favor faça login novamente
|
150
|
+
single_session_error_flash: Esta sessão foi terminada dado que outra sessão ficou activa
|
151
|
+
sms_already_setup_error_flash: Autenticação SMS já foi configurada
|
152
|
+
sms_auth_button: Autenticar através de código SMS
|
153
|
+
sms_auth_link_text: Autenticar utilizando código SMS
|
154
|
+
sms_auth_page_title: Autenticar através de código SMS
|
155
|
+
sms_code_label: Código SMS
|
156
|
+
sms_confirm_button: Confirme o número para SMS de Backup
|
157
|
+
sms_confirm_notice_flash: Autenticação SMS foi configurada
|
158
|
+
sms_confirm_page_title: Confirme o número para SMS de Backup
|
159
|
+
sms_disable_button: Desactivar Autenticação de Backup por SMS
|
160
|
+
sms_disable_error_flash: Erro ao desactivar a autenticação por SMS
|
161
|
+
sms_disable_link_text: Desactivar Autenticação por SMS
|
162
|
+
sms_disable_notice_flash: Autenticação por SMS foi desactivada
|
163
|
+
sms_disable_page_title: Desactivar Autenticação de Backup por SMS
|
164
|
+
sms_invalid_code_error_flash: Erro ao autenticar através de código SMS
|
165
|
+
sms_invalid_code_message: código SMS inválido
|
166
|
+
sms_invalid_confirmation_code_error_flash: Código de confirmação SMS inválido ou desactualizado, deverá configurar a autenticação SMS novamente
|
167
|
+
sms_invalid_phone_message: número de telefone para SMS inválido
|
168
|
+
sms_lockout_error_flash: Autenticação SMS foi bloqueada
|
169
|
+
sms_needs_confirmation_error_flash: Autenticação SMS necessita de confirmação
|
170
|
+
sms_not_setup_error_flash: Autenticação SMS ainda não foi configurada
|
171
|
+
sms_phone_label: Número de Telefone
|
172
|
+
sms_request_button: Enviar código SMS
|
173
|
+
sms_request_notice_flash: Código de autenticação SMS enviado
|
174
|
+
sms_request_page_title: Enviar código SMS
|
175
|
+
sms_setup_button: Configurar número SMS de Backup
|
176
|
+
sms_setup_error_flash: Erro ao configurar a autenticação através de SMS
|
177
|
+
sms_setup_link_text: Configurar Autenticação SMS de Backup
|
178
|
+
sms_setup_page_title: Configurar número SMS de Backup
|
179
|
+
two_factor_already_authenticated_error_flash: Já foi autenticado através de multifactor
|
180
|
+
two_factor_auth_notice_flash: Foi autenticado através de multifactor
|
181
|
+
two_factor_auth_page_title: Autenticar utilizando um factor adicional
|
182
|
+
two_factor_disable_button: Remover todos os métodos de Autenticação Multifactor
|
183
|
+
two_factor_disable_error_flash: Não foi possível remover todos os métodos de autenticação multifactor
|
184
|
+
two_factor_disable_link_text: Remover todos os métodos de Autenticação Multifactor
|
185
|
+
two_factor_disable_notice_flash: Todos os métodos de Autenticação Multifactor foram desactivados
|
186
|
+
two_factor_disable_page_title: Remover todos os métodos de Autenticação Multifactor
|
187
|
+
two_factor_manage_page_title: Gerir Autenticação Multifactor
|
188
|
+
two_factor_need_authentication_error_flash: Deverá autenticar-se através de um factor adicional antes de continuar
|
189
|
+
two_factor_not_setup_error_flash: Esta conta não foi configurada para autenticação multifactor
|
190
|
+
two_factor_remove_heading: "<h2>Remover Autenticação Multifactor</h2>"
|
191
|
+
two_factor_setup_heading: "<h2>Configurar Autenticação Multifactor</h2>"
|
192
|
+
unlock_account_button: Desbloquear Conta
|
193
|
+
unlock_account_email_recently_sent_error_flash: Foi-lhe enviado um email recentemente com um link para desbloquear a conta
|
194
|
+
unlock_account_email_subject: Desbloquear Conta
|
195
|
+
unlock_account_error_flash: Houve um erro ao desbloquear a sua conta
|
196
|
+
unlock_account_explanatory_text: "<p>Esta conta está actualmente bloqueada. Pode desbloquear a conta:</p>"
|
197
|
+
unlock_account_notice_flash: A sua conta foi desbloqueada
|
198
|
+
unlock_account_page_title: Desbloquear Conta
|
199
|
+
unlock_account_request_button: Pedir desbloqueio de conta
|
200
|
+
unlock_account_request_explanatory_text: "<p>Esta conta está actualmente bloqueada. Pode fazer um pedido para a conta ser desbloqueada:</p>"
|
201
|
+
unlock_account_request_notice_flash: Foi-lhe enviado um email com um link para desbloquear a conta
|
202
|
+
unlock_account_request_page_title: Pedir desbloqueio de conta
|
203
|
+
unverified_account_message: conta não-verificada, por favor verifique a conta antes de fazer login
|
204
|
+
unverified_change_login_error_flash: Por favor verifique esta conta antes de modificar o login
|
205
|
+
verify_account_button: Verificar Conta
|
206
|
+
verify_account_email_recently_sent_error_flash: Foi-lhe enviado um email recentemente com um link para verificar a sua conta
|
207
|
+
verify_account_email_sent_notice_flash: Foi-lhe enviado um email com um link para verificar a sua conta
|
208
|
+
verify_account_email_subject: Verificar Conta
|
209
|
+
verify_account_error_flash: Não foi possível verificar a conta
|
210
|
+
verify_account_notice_flash: A sua conta foi verificada
|
211
|
+
verify_account_page_title: Verificar Conta
|
212
|
+
verify_account_resend_button: Reenviar email de verificação
|
213
|
+
verify_account_resend_error_flash: Não foi possível reenviar o email de verificação de conta
|
214
|
+
verify_account_resend_explanatory_text: "<p>Se já não possui o email para verificar a conta, pode pedir que lhe seja reenviado:</p>"
|
215
|
+
verify_account_resend_link_text: Reenviar informação de verificação de conta
|
216
|
+
verify_login_change_button: Verificar modificação de Login
|
217
|
+
verify_login_change_duplicate_account_error_flash: Não foi possível proceder à modificação de login porque já existe uma conta com o novo login
|
218
|
+
verify_login_change_email_subject: Verificar modificação de Login
|
219
|
+
verify_login_change_error_flash: Não foi possível verificar a modificação de login
|
220
|
+
verify_login_change_notice_flash: A sua modificação de login foi verificada
|
221
|
+
verify_login_change_page_title: Verificar modificação de Login
|
222
|
+
view_recovery_codes_button: Ver códigos de recuperação para autenticação
|
223
|
+
view_recovery_codes_error_flash: Não foi possível visualizar os códigos de recuperação
|
224
|
+
webauthn_auth_button: Autenticar com WebAuthn
|
225
|
+
webauthn_auth_error_flash: Erro ao autenticar com WebAuthn
|
226
|
+
webauthn_auth_link_text: Autenticar com WebAuthn
|
227
|
+
webauthn_auth_page_title: Autenticar com WebAuthn
|
228
|
+
webauthn_duplicate_webauthn_id_message: tentativa de adicionar um id webauthn duplicado
|
229
|
+
webauthn_invalid_auth_param_message: parâmetro de autenticação webauthn inválido
|
230
|
+
webauthn_invalid_remove_param_message: deve seleccionar um autenticador webauthn válido para remover
|
231
|
+
webauthn_invalid_setup_param_message: parâmetro de configuração webauthn inválido
|
232
|
+
webauthn_invalid_sign_count_message: credencial webauthn tem um sign count inválido
|
233
|
+
webauthn_login_error_flash: Houve um erro a autenticar utilizando WebAuthn
|
234
|
+
webauthn_not_setup_error_flash: Esta conta não foi configurada para autenticação WebAuthn
|
235
|
+
webauthn_remove_button: Removee Autenticador WebAuthn
|
236
|
+
webauthn_remove_error_flash: Erro ao remover autenticador WebAuthn
|
237
|
+
webauthn_remove_link_text: Remover autenticador WebAuthn
|
238
|
+
webauthn_remove_notice_flash: O autenticador WebAuthn foi removido
|
239
|
+
webauthn_remove_page_title: Remover Autenticador WebAuthn
|
240
|
+
webauthn_setup_button: Configurar Autenticação WebAuthn
|
241
|
+
webauthn_setup_error_flash: Erro ao configurar a autenticação WebAuthn
|
242
|
+
webauthn_setup_link_text: Configurar Autenticação WebAuthn
|
243
|
+
webauthn_setup_notice_flash: A Autenticação WebAuthn está agora configurada
|
244
|
+
webauthn_setup_page_title: Configurar Autenticação WebAuthn
|
data/rodauth-i18n.gemspec
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |spec|
|
4
4
|
spec.name = "rodauth-i18n"
|
5
|
-
spec.version = "0.
|
5
|
+
spec.version = "0.2.0"
|
6
6
|
spec.authors = ["Janko Marohnić"]
|
7
7
|
spec.email = ["janko@hey.com"]
|
8
8
|
|
@@ -21,7 +21,6 @@ Gem::Specification.new do |spec|
|
|
21
21
|
spec.add_development_dependency "minitest"
|
22
22
|
spec.add_development_dependency "minitest-hooks"
|
23
23
|
spec.add_development_dependency "capybara"
|
24
|
-
spec.add_development_dependency "sqlite3"
|
25
24
|
spec.add_development_dependency "tilt"
|
26
25
|
spec.add_development_dependency "bcrypt"
|
27
26
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rodauth-i18n
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Janko Marohnić
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-12-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rodauth
|
@@ -80,20 +80,6 @@ dependencies:
|
|
80
80
|
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
|
-
- !ruby/object:Gem::Dependency
|
84
|
-
name: sqlite3
|
85
|
-
requirement: !ruby/object:Gem::Requirement
|
86
|
-
requirements:
|
87
|
-
- - ">="
|
88
|
-
- !ruby/object:Gem::Version
|
89
|
-
version: '0'
|
90
|
-
type: :development
|
91
|
-
prerelease: false
|
92
|
-
version_requirements: !ruby/object:Gem::Requirement
|
93
|
-
requirements:
|
94
|
-
- - ">="
|
95
|
-
- !ruby/object:Gem::Version
|
96
|
-
version: '0'
|
97
83
|
- !ruby/object:Gem::Dependency
|
98
84
|
name: tilt
|
99
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -129,18 +115,14 @@ executables: []
|
|
129
115
|
extensions: []
|
130
116
|
extra_rdoc_files: []
|
131
117
|
files:
|
132
|
-
- CHANGELOG.md
|
133
118
|
- LICENSE.txt
|
134
119
|
- README.md
|
135
120
|
- lib/generators/rodauth/i18n/translations_generator.rb
|
136
|
-
- lib/rodauth-i18n.rb
|
137
121
|
- lib/rodauth/features/i18n.rb
|
138
|
-
- lib/rodauth/i18n.rb
|
139
|
-
- lib/rodauth/i18n/feature.rb
|
140
122
|
- lib/rodauth/i18n/login_password_requirements_base.rb
|
141
|
-
- lib/rodauth/i18n/railtie.rb
|
142
123
|
- locales/en.yml
|
143
124
|
- locales/hr.yml
|
125
|
+
- locales/pt.yml
|
144
126
|
- rodauth-i18n.gemspec
|
145
127
|
homepage: https://github.com/janko/rodauth-i18n
|
146
128
|
licenses:
|
data/CHANGELOG.md
DELETED
data/lib/rodauth/i18n/feature.rb
DELETED
@@ -1,65 +0,0 @@
|
|
1
|
-
require "rodauth/i18n/login_password_requirements_base"
|
2
|
-
require "i18n"
|
3
|
-
|
4
|
-
module Rodauth
|
5
|
-
Feature.define(:i18n) do
|
6
|
-
include Rodauth::I18n::LoginPasswordRequirementsBase
|
7
|
-
|
8
|
-
auth_value_method :i18n_cascade?, true
|
9
|
-
auth_value_method :i18n_raise_on_missing_translations?, false
|
10
|
-
auth_value_method :i18n_fallback_to_untranslated?, false
|
11
|
-
auth_value_method :i18n_options, {}
|
12
|
-
|
13
|
-
auth_value_methods(
|
14
|
-
:i18n_namespace,
|
15
|
-
)
|
16
|
-
|
17
|
-
auth_methods(
|
18
|
-
:i18n_locale,
|
19
|
-
)
|
20
|
-
|
21
|
-
def translate(name, default)
|
22
|
-
i18n_translate(name, default)
|
23
|
-
end
|
24
|
-
|
25
|
-
def i18n_locale
|
26
|
-
::I18n.locale
|
27
|
-
end
|
28
|
-
|
29
|
-
private
|
30
|
-
|
31
|
-
def i18n_translate(name, default, **options)
|
32
|
-
::I18n.translate(i18n_translation_key(name),
|
33
|
-
scope: i18n_scope,
|
34
|
-
locale: i18n_locale,
|
35
|
-
raise: i18n_raise_on_missing_translations?,
|
36
|
-
default: i18n_default(name, default),
|
37
|
-
**i18n_options,
|
38
|
-
**options
|
39
|
-
)
|
40
|
-
end
|
41
|
-
|
42
|
-
def i18n_translation_key(name)
|
43
|
-
[*i18n_namespace, name].join(".")
|
44
|
-
end
|
45
|
-
|
46
|
-
def i18n_default(name, fallback)
|
47
|
-
default = []
|
48
|
-
default << name if i18n_namespace && i18n_cascade?
|
49
|
-
default << fallback if i18n_fallback_to_untranslated? && !i18n_raise_on_missing_translations?
|
50
|
-
default
|
51
|
-
end
|
52
|
-
|
53
|
-
def i18n_namespace
|
54
|
-
self.class.configuration_name
|
55
|
-
end
|
56
|
-
|
57
|
-
def i18n_scope
|
58
|
-
"rodauth"
|
59
|
-
end
|
60
|
-
end
|
61
|
-
|
62
|
-
# Assign feature and feature configuration to constants for introspection.
|
63
|
-
I18n::Feature = FEATURES[:i18n]
|
64
|
-
I18n::FeatureConfiguration = FEATURES[:i18n].configuration
|
65
|
-
end
|
data/lib/rodauth/i18n/railtie.rb
DELETED
data/lib/rodauth/i18n.rb
DELETED
@@ -1,29 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require "i18n"
|
4
|
-
require "rodauth/i18n/railtie" if defined?(Rails)
|
5
|
-
|
6
|
-
module Rodauth
|
7
|
-
module I18n
|
8
|
-
def self.add(locales = nil)
|
9
|
-
::I18n.load_path.concat files(locales)
|
10
|
-
end
|
11
|
-
|
12
|
-
def self.files(locales = nil)
|
13
|
-
directory_pattern = "{#{directories.join(",")}}"
|
14
|
-
|
15
|
-
if ::I18n.available_locales_initialized?
|
16
|
-
locales ||= ::I18n.available_locales
|
17
|
-
file_pattern = "{#{locales.join(",")}}"
|
18
|
-
else
|
19
|
-
file_pattern = "*"
|
20
|
-
end
|
21
|
-
|
22
|
-
Dir["#{directory_pattern}/#{file_pattern}.yml"]
|
23
|
-
end
|
24
|
-
|
25
|
-
def self.directories
|
26
|
-
@directories ||= [File.expand_path("#{__dir__}/../../locales")]
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
data/lib/rodauth-i18n.rb
DELETED