mirror of
https://github.com/snipe/snipe-it.git
synced 2024-11-09 23:24:06 -08:00
Added language support for select2
Signed-off-by: snipe <snipe@snipe.net>
This commit is contained in:
parent
78bd950daa
commit
4a9bd95ed3
|
@ -64,6 +64,7 @@ class Helper
|
|||
'nl' => 'nl-NL', // Dutch
|
||||
'no' => 'no-NO', // Norwegian
|
||||
'pl' => 'pl-PL', // Polish
|
||||
'pt' => 'pt-PT', // Portuguese
|
||||
'ro' => 'ro-RO', // Romanian
|
||||
'ru' => 'ru-RU', // Russian
|
||||
'sk' => 'sk-SK', // Slovak
|
||||
|
@ -1440,7 +1441,6 @@ class Helper
|
|||
|
||||
foreach (self::$language_map as $legacy => $new) {
|
||||
if ($language_code == $legacy) {
|
||||
Log::debug('Current language is '.$legacy.', using '.$new.' instead');
|
||||
return $new;
|
||||
}
|
||||
}
|
||||
|
@ -1451,6 +1451,7 @@ class Helper
|
|||
|
||||
public static function mapBackToLegacyLocale($new_locale = null)
|
||||
{
|
||||
|
||||
if (strlen($new_locale) <= 4) {
|
||||
return $new_locale; //"new locale" apparently wasn't quite so new
|
||||
}
|
||||
|
@ -1458,12 +1459,21 @@ class Helper
|
|||
// This does a *reverse* search against our new language map array - given the value, find the *key* for it
|
||||
$legacy_locale = array_search($new_locale, self::$language_map);
|
||||
|
||||
if($legacy_locale !== false) {
|
||||
if ($legacy_locale !== false) {
|
||||
return $legacy_locale;
|
||||
}
|
||||
return $new_locale; // better that you have some weird locale that doesn't fit into our mappings anywhere than 'void'
|
||||
}
|
||||
|
||||
public static function determineLanguageDirection() {
|
||||
return in_array(app()->getLocale(),
|
||||
[
|
||||
'ar-SA',
|
||||
'fa-IR',
|
||||
'he-IL'
|
||||
]) ? 'rtl' : 'ltr';
|
||||
}
|
||||
|
||||
|
||||
static public function getRedirectOption($request, $id, $table, $asset_id = null)
|
||||
{
|
||||
|
|
Binary file not shown.
BIN
public/js/dist/all.js
vendored
BIN
public/js/dist/all.js
vendored
Binary file not shown.
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"/js/build/app.js": "/js/build/app.js?id=d47043e03f80612693d9b9034d94e28f",
|
||||
"/js/build/app.js": "/js/build/app.js?id=842cc33168d973ac10d35eb664be2a2c",
|
||||
"/css/dist/skins/skin-red.css": "/css/dist/skins/skin-red.css?id=44bf834f2110504a793dadec132a5898",
|
||||
"/css/dist/skins/skin-blue.css": "/css/dist/skins/skin-blue.css?id=f677207c6cf9678eb539abecb408c374",
|
||||
"/css/build/overrides.css": "/css/build/overrides.css?id=004835e70ed3ae2e2340162b7a37c752",
|
||||
|
@ -21,6 +21,66 @@
|
|||
"/css/dist/all.css": "/css/dist/all.css?id=0f9956c66f93c6417f69f0134c6ae128",
|
||||
"/css/dist/signature-pad.css": "/css/dist/signature-pad.css?id=6a89d3cd901305e66ced1cf5f13147f7",
|
||||
"/css/dist/signature-pad.min.css": "/css/dist/signature-pad.min.css?id=6a89d3cd901305e66ced1cf5f13147f7",
|
||||
"/js/select2/i18n/af.js": "/js/select2/i18n/af.js?id=4f6fcd73488ce79fae1b7a90aceaecde",
|
||||
"/js/select2/i18n/ar.js": "/js/select2/i18n/ar.js?id=65aa8e36bf5da57ff4e3f22a835ab035",
|
||||
"/js/select2/i18n/az.js": "/js/select2/i18n/az.js?id=270c257daf8140a0cf23ad5de6f8ed1b",
|
||||
"/js/select2/i18n/bg.js": "/js/select2/i18n/bg.js?id=39b8be30d4f06779839cfaaa415d0690",
|
||||
"/js/select2/i18n/bn.js": "/js/select2/i18n/bn.js?id=6d42b4dd5665d0fa28f06994eedb4899",
|
||||
"/js/select2/i18n/bs.js": "/js/select2/i18n/bs.js?id=91624382358e95086b80f00fa0bd6955",
|
||||
"/js/select2/i18n/build.txt": "/js/select2/i18n/build.txt?id=c9fb9399ed170dfbc76c0d3b26267c1f",
|
||||
"/js/select2/i18n/ca.js": "/js/select2/i18n/ca.js?id=a166b745933a48ce3d0580a74210617d",
|
||||
"/js/select2/i18n/cs.js": "/js/select2/i18n/cs.js?id=4f43e8e7d33aa1e6aadf3286c7e379e9",
|
||||
"/js/select2/i18n/da.js": "/js/select2/i18n/da.js?id=766346afe4dd72c003242cfb1cbe2617",
|
||||
"/js/select2/i18n/de.js": "/js/select2/i18n/de.js?id=8a1c222b0204c8faaf6d3c07c961d8aa",
|
||||
"/js/select2/i18n/dsb.js": "/js/select2/i18n/dsb.js?id=56372c92d2f1bcb2b8e382981dca0546",
|
||||
"/js/select2/i18n/el.js": "/js/select2/i18n/el.js?id=27097f071856a0f4e82298fe407d1eac",
|
||||
"/js/select2/i18n/en.js": "/js/select2/i18n/en.js?id=cf932ba09a98fe11bde8e1f3dd5e2cfa",
|
||||
"/js/select2/i18n/es.js": "/js/select2/i18n/es.js?id=66dbc2652fb1b769bf29058e707b43c8",
|
||||
"/js/select2/i18n/et.js": "/js/select2/i18n/et.js?id=2b96fd98289dc3fc5e61f21e6e1a7d52",
|
||||
"/js/select2/i18n/eu.js": "/js/select2/i18n/eu.js?id=adfe5c97b72c20bb0afbc0968b440e50",
|
||||
"/js/select2/i18n/fa.js": "/js/select2/i18n/fa.js?id=3b5bd1961cfd0a6f96ac4cd2ea16c243",
|
||||
"/js/select2/i18n/fi.js": "/js/select2/i18n/fi.js?id=614ec42aa9baaf687ab9ff44705dfd2e",
|
||||
"/js/select2/i18n/fr.js": "/js/select2/i18n/fr.js?id=05e0542fcfe6df5ab074a377dc1a5a9b",
|
||||
"/js/select2/i18n/gl.js": "/js/select2/i18n/gl.js?id=d99b1fedaa86d011818cfbab11dd355c",
|
||||
"/js/select2/i18n/he.js": "/js/select2/i18n/he.js?id=e420ff6cd3ed77ab9271c9b3d441442c",
|
||||
"/js/select2/i18n/hi.js": "/js/select2/i18n/hi.js?id=70640d41628f36284af78b22ea8b283b",
|
||||
"/js/select2/i18n/hr.js": "/js/select2/i18n/hr.js?id=a2b092cc1147f07b978145d407c67fa1",
|
||||
"/js/select2/i18n/hsb.js": "/js/select2/i18n/hsb.js?id=fa3b55265efe8f4182d5e65a1a506252",
|
||||
"/js/select2/i18n/hu.js": "/js/select2/i18n/hu.js?id=6ec6039cb8a354e2bc6a1794f729caae",
|
||||
"/js/select2/i18n/hy.js": "/js/select2/i18n/hy.js?id=c7babaeef5a625566434ea79b19d4c7e",
|
||||
"/js/select2/i18n/id.js": "/js/select2/i18n/id.js?id=04debded514d3962bb74f05532e793d4",
|
||||
"/js/select2/i18n/is.js": "/js/select2/i18n/is.js?id=3ddd9a6a97e93e1910210c9eefc1bca1",
|
||||
"/js/select2/i18n/it.js": "/js/select2/i18n/it.js?id=be4fe8d365b5916432504d1f98e2e0af",
|
||||
"/js/select2/i18n/ja.js": "/js/select2/i18n/ja.js?id=170ae885d74f1634271e1eb470cb4621",
|
||||
"/js/select2/i18n/ka.js": "/js/select2/i18n/ka.js?id=2083264a54f0873f55468affa796d61e",
|
||||
"/js/select2/i18n/km.js": "/js/select2/i18n/km.js?id=c23089cb06ca871153ba9bfe8458a378",
|
||||
"/js/select2/i18n/ko.js": "/js/select2/i18n/ko.js?id=e7be6c20e67393698a0f05971e9720c1",
|
||||
"/js/select2/i18n/lt.js": "/js/select2/i18n/lt.js?id=23c7ce903300fc118947994b9cdd16cb",
|
||||
"/js/select2/i18n/lv.js": "/js/select2/i18n/lv.js?id=08e62128eac1d0e8ac32cfaf75f2ec9f",
|
||||
"/js/select2/i18n/mk.js": "/js/select2/i18n/mk.js?id=dabbb90871300ce3a295969bc0260420",
|
||||
"/js/select2/i18n/ms.js": "/js/select2/i18n/ms.js?id=4ba82c9a51ce975fe0e4eff5f6eece65",
|
||||
"/js/select2/i18n/nb.js": "/js/select2/i18n/nb.js?id=da2fce143f2794208e36dc8520e4c36a",
|
||||
"/js/select2/i18n/ne.js": "/js/select2/i18n/ne.js?id=3d79fd3f08dbfd0973cf91dd6a62bccd",
|
||||
"/js/select2/i18n/nl.js": "/js/select2/i18n/nl.js?id=997868a37ed89062ad7b19c9a88f1bb0",
|
||||
"/js/select2/i18n/pl.js": "/js/select2/i18n/pl.js?id=6031b4f164521f58dfec7d1e46238861",
|
||||
"/js/select2/i18n/ps.js": "/js/select2/i18n/ps.js?id=38dfa47af9e086eece5a333d711abc79",
|
||||
"/js/select2/i18n/pt-BR.js": "/js/select2/i18n/pt-BR.js?id=e1b294433e7fc3175842ce37b9f15014",
|
||||
"/js/select2/i18n/pt.js": "/js/select2/i18n/pt.js?id=33b4a3b44d437614b83497e36c138ca9",
|
||||
"/js/select2/i18n/ro.js": "/js/select2/i18n/ro.js?id=f75cb460ec3b98b4b9017e9513ca20cf",
|
||||
"/js/select2/i18n/ru.js": "/js/select2/i18n/ru.js?id=934aa95f5b5f32c72c80857bb2622074",
|
||||
"/js/select2/i18n/sk.js": "/js/select2/i18n/sk.js?id=33d02cef8d110f358acd1624f7f79ffe",
|
||||
"/js/select2/i18n/sl.js": "/js/select2/i18n/sl.js?id=131a78bc075237a13750ead3807683d2",
|
||||
"/js/select2/i18n/sq.js": "/js/select2/i18n/sq.js?id=5636b60d29c9bdd55f18a4585746b6d1",
|
||||
"/js/select2/i18n/sr-Cyrl.js": "/js/select2/i18n/sr-Cyrl.js?id=f254bb8c4c7ce00d9d17e9e91945ad9b",
|
||||
"/js/select2/i18n/sr.js": "/js/select2/i18n/sr.js?id=5ed85a48f483d17a7ad102832cb11ea1",
|
||||
"/js/select2/i18n/sv.js": "/js/select2/i18n/sv.js?id=7a9c2f71e7779a263b2cf3520b1aa611",
|
||||
"/js/select2/i18n/th.js": "/js/select2/i18n/th.js?id=f38c20b0221b68924d6c8f0773cb252d",
|
||||
"/js/select2/i18n/tk.js": "/js/select2/i18n/tk.js?id=7c572a68c78fb798f11f7d8c78ebb9d6",
|
||||
"/js/select2/i18n/tr.js": "/js/select2/i18n/tr.js?id=b5a0643d1545f4a3e1622e65e46ddc7c",
|
||||
"/js/select2/i18n/uk.js": "/js/select2/i18n/uk.js?id=8cede7f4803c7dbd1e8261bfa1932b7c",
|
||||
"/js/select2/i18n/vi.js": "/js/select2/i18n/vi.js?id=097a5b75b3e146e2d94ab8e1510be607",
|
||||
"/js/select2/i18n/zh-CN.js": "/js/select2/i18n/zh-CN.js?id=2cff662ec5f972b4613566cf5988cda2",
|
||||
"/js/select2/i18n/zh-TW.js": "/js/select2/i18n/zh-TW.js?id=04554a227c2ba0f3bb6ca3d2e01e5440",
|
||||
"/css/webfonts/fa-brands-400.ttf": "/css/webfonts/fa-brands-400.ttf?id=0141634c24336be626e05c8b77d1fa27",
|
||||
"/css/webfonts/fa-brands-400.woff2": "/css/webfonts/fa-brands-400.woff2?id=b3cf7a6dd618bd392f3ddcc61343a463",
|
||||
"/css/webfonts/fa-regular-400.ttf": "/css/webfonts/fa-regular-400.ttf?id=9cf69d99de9d83f82466a647f5cb1f94",
|
||||
|
@ -33,7 +93,7 @@
|
|||
"/css/dist/bootstrap-table.css": "/css/dist/bootstrap-table.css?id=5f79123a6750afd34dbf565faec3dda3",
|
||||
"/js/build/vendor.js": "/js/build/vendor.js?id=e27070bdbc5fce3bfd132b952d641fd6",
|
||||
"/js/dist/bootstrap-table.js": "/js/dist/bootstrap-table.js?id=e5918703a22f8992c4c98f1dbbecb8f7",
|
||||
"/js/dist/all.js": "/js/dist/all.js?id=a12331d6be1bd143c3d24719ba56ff3f",
|
||||
"/js/dist/all.js": "/js/dist/all.js?id=01108f9d8f4f67b20669f0c25a64eb5d",
|
||||
"/css/dist/skins/skin-green.min.css": "/css/dist/skins/skin-green.min.css?id=0a82a6ae6bb4e58fe62d162c4fb50397",
|
||||
"/css/dist/skins/skin-green-dark.min.css": "/css/dist/skins/skin-green-dark.min.css?id=553ee68741b5a392037abcf04da80adc",
|
||||
"/css/dist/skins/skin-black.min.css": "/css/dist/skins/skin-black.min.css?id=76482123f6c70e866d6b971ba91de7bb",
|
||||
|
|
|
@ -219,6 +219,8 @@ $(document).ready(function () {
|
|||
*/
|
||||
placeholder: '',
|
||||
allowClear: true,
|
||||
language: $('meta[name="language"]').attr('content'),
|
||||
dir: $('meta[name="language-direction"]').attr('content'),
|
||||
|
||||
ajax: {
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}"
|
||||
dir="{{ in_array(app()->getLocale(),['ar-SA','fa-IR', 'he-IL']) ? 'rtl' : 'ltr' }}">
|
||||
dir="{{ Helper::determineLanguageDirection() }}">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
|
@ -24,6 +24,8 @@ dir="{{ in_array(app()->getLocale(),['ar-SA','fa-IR', 'he-IL']) ? 'rtl' : 'ltr'
|
|||
|
||||
|
||||
<meta name="csrf-token" content="{{ csrf_token() }}">
|
||||
<meta name="language" content="{{ Helper::mapBackToLegacyLocale(app()->getLocale()) }}">
|
||||
<meta name="language-direction" content="{{ Helper::determineLanguageDirection() }}">
|
||||
<meta name="baseUrl" content="{{ config('app.url') }}/">
|
||||
|
||||
<script nonce="{{ csrf_token() }}">
|
||||
|
@ -947,8 +949,11 @@ dir="{{ in_array(app()->getLocale(),['ar-SA','fa-IR', 'he-IL']) ? 'rtl' : 'ltr'
|
|||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
{{-- Javascript files --}}
|
||||
<script src="{{ url(mix('js/dist/all.js')) }}" nonce="{{ csrf_token() }}"></script>
|
||||
<script src="{{ url('js/select2/i18n/'.Helper::mapBackToLegacyLocale(app()->getLocale()).'.js') }}"></script>
|
||||
|
||||
<!-- v5-beta: This pGenerator call must remain here for v5 - until fixed - so that the JS password generator works for the user create modal. -->
|
||||
<script src="{{ url('js/pGenerator.jquery.js') }}"></script>
|
||||
|
|
|
@ -40,7 +40,13 @@ mix
|
|||
.minify("./public/css/dist/signature-pad.css");
|
||||
|
||||
/**
|
||||
* Copy, minify and version signature-pad.css
|
||||
* Copy and version select2
|
||||
*/
|
||||
mix
|
||||
.copy("./node_modules/select2/dist/js/i18n", "./public/js/select2/i18n")
|
||||
|
||||
/**
|
||||
* Copy and version fontawesome
|
||||
*/
|
||||
mix
|
||||
.copy("./node_modules/@fortawesome/fontawesome-free/webfonts", "./public/css/webfonts")
|
||||
|
|
Loading…
Reference in a new issue