mirror of
https://github.com/getgrav/grav-plugin-admin.git
synced 2025-11-05 04:46:03 +01:00
Process lang strings needed in the JS files and add them to the window.translations object
This commit is contained in:
26
admin.php
26
admin.php
@@ -336,6 +336,32 @@ class AdminPlugin extends Plugin
|
|||||||
|
|
||||||
// Get theme for admin
|
// Get theme for admin
|
||||||
$this->theme = $this->config->get('plugins.admin.theme', 'grav');
|
$this->theme = $this->config->get('plugins.admin.theme', 'grav');
|
||||||
|
|
||||||
|
$assets = $this->grav['assets'];
|
||||||
|
$translations = 'if (!window.translations) window.translations = {}; ' . PHP_EOL . 'window.translations.PLUGIN_ADMIN = {};' . PHP_EOL;
|
||||||
|
|
||||||
|
$strings = ['EVERYTHING_UP_TO_DATE',
|
||||||
|
'UPDATES_ARE_AVAILABLE',
|
||||||
|
'IS_AVAILABLE_FOR_UPDATE',
|
||||||
|
'AND',
|
||||||
|
'IS_NOW_AVAILABLE',
|
||||||
|
'CURRENT',
|
||||||
|
'UPDATE_GRAV_NOW',
|
||||||
|
'TASK_COMPLETED',
|
||||||
|
'UPDATE',
|
||||||
|
'UPDATING_PLEASE_WAIT',
|
||||||
|
'GRAV_SYMBOLICALLY_LINKED',
|
||||||
|
'OF_YOUR',
|
||||||
|
'OF_THIS',
|
||||||
|
'HAVE_AN_UPDATE_AVAILABLE',
|
||||||
|
'UPDATE_AVAILABLE',
|
||||||
|
'DAYS'];
|
||||||
|
|
||||||
|
foreach($strings as $string) {
|
||||||
|
$translations .= 'translations.PLUGIN_ADMIN.' . $string .' = "' . $this->admin->translate('PLUGIN_ADMIN.' . $string) . '"; ' . PHP_EOL;;
|
||||||
|
}
|
||||||
|
|
||||||
|
$assets->addInlineJs($translations);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user