Skip to content
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

More localizations #15101

Merged
merged 15 commits into from
Jul 18, 2024
14 changes: 12 additions & 2 deletions app/Helpers/Helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -1440,7 +1441,6 @@ public static function mapLegacyLocale($language_code = null)

foreach (self::$language_map as $legacy => $new) {
if ($language_code == $legacy) {
Log::debug('Current language is '.$legacy.', using '.$new.' instead');
return $new;
}
}
Expand All @@ -1451,19 +1451,29 @@ public static function mapLegacyLocale($language_code = null)

public static function mapBackToLegacyLocale($new_locale = null)
{

if (strlen($new_locale) <= 4) {
return $new_locale; //"new locale" apparently wasn't quite so new
}

// 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)
{
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Controllers/CustomFieldsetsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ public function associate(Request $request, $id) : RedirectResponse
return redirect()->route('fieldsets.show', [$id])->with('success', trans('admin/custom_fields/message.field.create.assoc_success'));
}

return redirect()->route('fieldsets.show', [$id])->with('error', 'No field selected.');
return redirect()->route('fieldsets.show', [$id])->with('error', trans('admin/custom_fields/message.field.none_selected'));
}

/**
Expand Down
6 changes: 3 additions & 3 deletions app/Http/Controllers/Licenses/LicenseCheckoutController.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,14 +94,14 @@ protected function findLicenseSeatToCheckout($license, $seatId)

if (! $licenseSeat) {
if ($seatId) {
throw new \Illuminate\Http\Exceptions\HttpResponseException(redirect()->route('licenses.index')->with('error', 'This Seat is not available for checkout.'));
throw new \Illuminate\Http\Exceptions\HttpResponseException(redirect()->route('licenses.index')->with('error', trans('admin/licenses/message.checkout.unavailable')));
}

throw new \Illuminate\Http\Exceptions\HttpResponseException(redirect()->route('licenses.index')->with('error', 'There are no available seats for this license.'));
throw new \Illuminate\Http\Exceptions\HttpResponseException(redirect()->route('licenses.index')->with('error', trans('admin/licenses/message.checkout.not_enough_seats')));
}

if (! $licenseSeat->license->is($license)) {
throw new \Illuminate\Http\Exceptions\HttpResponseException(redirect()->route('licenses.index')->with('error', 'The license seat provided does not match the license.'));
throw new \Illuminate\Http\Exceptions\HttpResponseException(redirect()->route('licenses.index')->with('error', trans('admin/licenses/message.checkout.mismatch')));
}

return $licenseSeat;
Expand Down
14 changes: 7 additions & 7 deletions app/Http/Transformers/ActionlogsTransformer.php
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ public function changedInfo(array $clean_meta)

$clean_meta['rtd_location_id']['old'] = $clean_meta['rtd_location_id']['old'] ? "[id: ".$clean_meta['rtd_location_id']['old']."] ". $oldRtdName : '';
$clean_meta['rtd_location_id']['new'] = $clean_meta['rtd_location_id']['new'] ? "[id: ".$clean_meta['rtd_location_id']['new']."] ". $newRtdName : '';
$clean_meta['Default Location'] = $clean_meta['rtd_location_id'];
$clean_meta[trans('admin/hardware/form.default_location')] = $clean_meta['rtd_location_id'];
unset($clean_meta['rtd_location_id']);
}

Expand All @@ -272,7 +272,7 @@ public function changedInfo(array $clean_meta)

$clean_meta['location_id']['old'] = $clean_meta['location_id']['old'] ? "[id: ".$clean_meta['location_id']['old']."] ". $oldLocationName : '';
$clean_meta['location_id']['new'] = $clean_meta['location_id']['new'] ? "[id: ".$clean_meta['location_id']['new']."] ". $newLocationName : '';
$clean_meta['Current Location'] = $clean_meta['location_id'];
$clean_meta[trans('admin/locations/message.current_location')] = $clean_meta['location_id'];
unset($clean_meta['location_id']);
}

Expand All @@ -287,7 +287,7 @@ public function changedInfo(array $clean_meta)
$clean_meta['model_id']['old'] = "[id: ".$clean_meta['model_id']['old']."] ".$oldModelName;
$clean_meta['model_id']['new'] = "[id: ".$clean_meta['model_id']['new']."] ".$newModelName; /** model is required at asset creation */

$clean_meta['Model'] = $clean_meta['model_id'];
$clean_meta[trans('admin/hardware/form.model')] = $clean_meta['model_id'];
unset($clean_meta['model_id']);
}
if(array_key_exists('company_id', $clean_meta)) {
Expand All @@ -300,7 +300,7 @@ public function changedInfo(array $clean_meta)

$clean_meta['company_id']['old'] = $clean_meta['company_id']['old'] ? "[id: ".$clean_meta['company_id']['old']."] ". $oldCompanyName : trans('general.unassigned');
$clean_meta['company_id']['new'] = $clean_meta['company_id']['new'] ? "[id: ".$clean_meta['company_id']['new']."] ". $newCompanyName : trans('general.unassigned');
$clean_meta['Company'] = $clean_meta['company_id'];
$clean_meta[trans('general.company')] = $clean_meta['company_id'];
unset($clean_meta['company_id']);
}
if(array_key_exists('supplier_id', $clean_meta)) {
Expand All @@ -313,7 +313,7 @@ public function changedInfo(array $clean_meta)

$clean_meta['supplier_id']['old'] = $clean_meta['supplier_id']['old'] ? "[id: ".$clean_meta['supplier_id']['old']."] ". $oldSupplierName : trans('general.unassigned');
$clean_meta['supplier_id']['new'] = $clean_meta['supplier_id']['new'] ? "[id: ".$clean_meta['supplier_id']['new']."] ". $newSupplierName : trans('general.unassigned');
$clean_meta['Supplier'] = $clean_meta['supplier_id'];
$clean_meta[trans('general.supplier')] = $clean_meta['supplier_id'];
unset($clean_meta['supplier_id']);
}
if(array_key_exists('status_id', $clean_meta)) {
Expand All @@ -326,11 +326,11 @@ public function changedInfo(array $clean_meta)

$clean_meta['status_id']['old'] = $clean_meta['status_id']['old'] ? "[id: ".$clean_meta['status_id']['old']."] ". $oldStatusName : trans('general.unassigned');
$clean_meta['status_id']['new'] = $clean_meta['status_id']['new'] ? "[id: ".$clean_meta['status_id']['new']."] ". $newStatusName : trans('general.unassigned');
$clean_meta['Status'] = $clean_meta['status_id'];
$clean_meta[trans('general.status_label')] = $clean_meta['status_id'];
unset($clean_meta['status_id']);
}
if(array_key_exists('asset_eol_date', $clean_meta)) {
$clean_meta['EOL date'] = $clean_meta['asset_eol_date'];
$clean_meta[trans('admin/hardware/form.eol_date')] = $clean_meta['asset_eol_date'];
unset($clean_meta['asset_eol_date']);
}

Expand Down
2 changes: 1 addition & 1 deletion app/Http/Transformers/LicenseSeatsTransformer.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public function transformLicenseSeat(LicenseSeat $seat, $seat_count = 0)
];

if ($seat_count != 0) {
$array['name'] = 'Seat '.$seat_count;
$array['name'] = trans('admin/licenses/general.seat_count', ['count' => $seat_count]);
}

$permissions_array['available_actions'] = [
Expand Down
2 changes: 2 additions & 0 deletions public/js/build/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,8 @@ $(document).ready(function () {
*/
placeholder: '',
allowClear: true,
language: $('meta[name="language"]').attr('content'),
dir: $('meta[name="language-direction"]').attr('content'),
ajax: {
// the baseUrl includes a trailing slash
url: baseUrl + 'api/v1/' + endpoint + '/selectlist',
Expand Down
2 changes: 2 additions & 0 deletions public/js/dist/all.js
Original file line number Diff line number Diff line change
Expand Up @@ -59443,6 +59443,8 @@ $(document).ready(function () {
*/
placeholder: '',
allowClear: true,
language: $('meta[name="language"]').attr('content'),
dir: $('meta[name="language-direction"]').attr('content'),
ajax: {
// the baseUrl includes a trailing slash
url: baseUrl + 'api/v1/' + endpoint + '/selectlist',
Expand Down
3 changes: 3 additions & 0 deletions public/js/select2/i18n/af.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions public/js/select2/i18n/ar.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions public/js/select2/i18n/az.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions public/js/select2/i18n/bg.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions public/js/select2/i18n/bn.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions public/js/select2/i18n/bs.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading