I am using the demo theme and standard admin theme. There are two translations missing in the modules/backend/lang/en/lang.php file: forgot_password and login
I added these translations to the file, but when I updated October CMS core they disappeared. They should be under the account section.
'account' => [
'impersonate' => 'Impersonate User',
'impersonate_confirm' => 'Are you sure you want to impersonate this user? You can revert to your original state by logging out.',
'impersonate_success' => 'You are now impersonating this user',
'impersonate_working' => 'Impersonating...',
'impersonating' => 'Impersonating :full_name',
'stop_impersonating' => 'Stop impersonating',
'signed_in_as' => 'Signed in as :full_name',
'sign_out' => 'Sign Out',
'login_prompt' => 'Welcome back! Please login to your account to continue.',
'login_placeholder' => 'username',
'password_placeholder' => 'password',
'enter_email' => 'Enter your email',
'email_placeholder' => 'email',
'apply' => 'Apply',
'cancel' => 'Cancel',
'delete' => 'Delete',
'ok' => 'OK',
// 'login' => 'Sign In',
// 'forgot_password' => 'Forgot your password?',
],
It seems unusual that this would be overlooked so perhaps I am missing something, but maybe it is a bug.
Furthermore, I am trying to add these translations somewhere they wont get overridden. I found this article Override Translations with a Plugin · October CMS Tricks, created a plugin, and applied the code, but it doesn’t work.
In Plugin.php I added
use Event;
use Lang;
class Plugin extends PluginBase
{
public function boot()
{
// we enable language overriding
Event::listen('translator.beforeResolve', function ($key, $replace, $locale) {
$plugin = 'neat.api'; // Replace this string with the path of the plugin this is being executed from
// Check the translation doesn't originate from this plugin
if (substr($key, 0, strlen($plugin)) != $plugin) {
// Contruct a possible translation path
$path = $plugin . '::lang.' . str_replace('::', '.', $key);
// Retrieve its results
$result = Lang::get($path);
// If an overriding translation is found, return it
if ($result != $path) {
return $result;
}
}
});
}
Then I added the translations to plugins/neat/api/lang/en/lang.php
<?php return [
'plugin' => [
'name' => 'API',
'description' => ''
],
'backend' => [
'lang' => [
'account' => [
'login' => 'Login',
'forgot_password' => 'Forgot your password?',
],
],
],
];
Can anyone advise me on how to add the missing translations without them getting overridden?