mirror of
https://github.com/BookStackApp/BookStack.git
synced 2025-05-30 12:38:12 +08:00
Made fixes to es languge files and users page
Fixed PHP formatting error in ES lang file and added tests to cover. Made user edit page more responsive on smaller devices. Fixed 'cancel' button on profile screen when the user does not have permission to manage users.
This commit is contained in:
@ -3,13 +3,24 @@
|
||||
class LanguageTest extends TestCase
|
||||
{
|
||||
|
||||
public function test_js_endpoint_for_each_language() {
|
||||
protected $langs;
|
||||
|
||||
/**
|
||||
* LanguageTest constructor.
|
||||
*/
|
||||
public function setUp()
|
||||
{
|
||||
parent::setUp();
|
||||
$this->langs = array_diff(scandir(resource_path('lang')), ['..', '.']);
|
||||
}
|
||||
|
||||
public function test_js_endpoint_for_each_language()
|
||||
{
|
||||
|
||||
$langs = array_diff(scandir(resource_path('lang')), ['..', '.']);
|
||||
$visibleKeys = ['common', 'components', 'entities', 'errors'];
|
||||
|
||||
$this->asEditor();
|
||||
foreach ($langs as $lang) {
|
||||
foreach ($this->langs as $lang) {
|
||||
setting()->putUser($this->getEditor(), 'language', $lang);
|
||||
$transResp = $this->get('/translations');
|
||||
foreach ($visibleKeys as $key) {
|
||||
@ -18,4 +29,20 @@ class LanguageTest extends TestCase
|
||||
}
|
||||
}
|
||||
|
||||
public function test_all_lang_files_loadable()
|
||||
{
|
||||
$files = array_diff(scandir(resource_path('lang/en')), ['..', '.']);
|
||||
foreach ($this->langs as $lang) {
|
||||
foreach ($files as $file) {
|
||||
$loadError = false;
|
||||
try {
|
||||
$translations = trans(str_replace('.php', '', $file), [], $lang);
|
||||
} catch (\Exception $e) {
|
||||
$loadError = true;
|
||||
}
|
||||
$this->assertFalse($loadError, "Translation file {$lang}/{$file} failed to load");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user