-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
JS files with translations in client/lang dir are not used #138
Comments
Thanks for reporting this. Can you please confirm the following:
|
Awesome, that's good context to have, thank you for that. That seems to indicate that there's a problem with pulling in translations from a project (or at least from js translation files) rather than those being hardcoded which has been a problem with mfa in the past. Something similar to this was patched in silverstripe/admin and released in 1.13.3 - are you using at least 1.13.3 of the admin module? |
Thanks for having a look. I require silverstripe/recipe-cms 4.13 what results in silverstripe/admin at 1.13.13 If you look at the MFA module, in BaseHandlerTrait this line seems to tell Requirements where to look voor translation JS files: This line is not present at the moment in the TOTP module so I think Requirements is not aware of the JS translations of this module. When I expose client/lang and add this line to the class Method in the method named applyRequirements all seems to be working fine:
|
Linked PRs have been merged, they'll be automatically tagged |
Issue:
translations provided in JS files are not used
(except for the ones that are loaded in PHP, like in Method->getUnavailableMessage and RegisterHandler->getSupportText which results in partially translated screens)
This is the result when I load a site in Dutch. The English text is the fallback in bundle.js, the Dutch comes from _t in PHP (not JS)
Steps:
When I edit the fallback translation of TOTPRegister.INTRO in client/dist/js/bundle.js I see that fallback string in the second step of setting up MFA (/Security/login/default/mfa). So the English fallback text is used and not the translations in en.js or any of the localised variants.
I think the fix should be:
Requirements::add_i18n_javascript('silverstripe/totp-authenticator: client/dist/lang');
Note: This is similar to #85
PRs
The text was updated successfully, but these errors were encountered: