mirror of
https://github.com/getnamingo/registry.git
synced 2025-07-03 09:33:25 +02:00
Added Arabic language support in CP
This commit is contained in:
parent
bb050b170e
commit
9b57cc60af
6 changed files with 1563 additions and 17 deletions
|
@ -88,7 +88,7 @@ $container->set('view', function ($container) {
|
||||||
]);
|
]);
|
||||||
|
|
||||||
// Known set of languages
|
// Known set of languages
|
||||||
$allowedLanguages = ['en_US', 'uk_UA', 'jp_JP', 'fr_FR', 'pt_PT', 'es_ES']; // Add more as needed
|
$allowedLanguages = ['en_US', 'uk_UA', 'jp_JP', 'fr_FR', 'pt_PT', 'es_ES', 'ar_SA'];
|
||||||
|
|
||||||
if (isset($_SESSION['_lang']) && in_array($_SESSION['_lang'], $allowedLanguages)) {
|
if (isset($_SESSION['_lang']) && in_array($_SESSION['_lang'], $allowedLanguages)) {
|
||||||
// Use regex to validate the format: two letters, underscore, two letters
|
// Use regex to validate the format: two letters, underscore, two letters
|
||||||
|
@ -111,6 +111,8 @@ $container->set('view', function ($container) {
|
||||||
$lang = '日本語';
|
$lang = '日本語';
|
||||||
} elseif ($uiLang === 'ua') {
|
} elseif ($uiLang === 'ua') {
|
||||||
$lang = 'Українська';
|
$lang = 'Українська';
|
||||||
|
} elseif ($uiLang === 'ar') {
|
||||||
|
$lang = 'العربية';
|
||||||
} else {
|
} else {
|
||||||
$lang = ucfirst(trim(strstr($lang_full, ' (', true)));
|
$lang = ucfirst(trim(strstr($lang_full, ' (', true)));
|
||||||
}
|
}
|
||||||
|
@ -126,6 +128,7 @@ $container->set('view', function ($container) {
|
||||||
|
|
||||||
$view->getEnvironment()->addGlobal('uiLang', $uiLang);
|
$view->getEnvironment()->addGlobal('uiLang', $uiLang);
|
||||||
$view->getEnvironment()->addGlobal('lang', $lang);
|
$view->getEnvironment()->addGlobal('lang', $lang);
|
||||||
|
$view->getEnvironment()->addGlobal('_lang', substr($desiredLanguage, 0, 2));
|
||||||
$view->getEnvironment()->addGlobal('flash', $container->get('flash'));
|
$view->getEnvironment()->addGlobal('flash', $container->get('flash'));
|
||||||
|
|
||||||
$staticDir = '/var/www/cp/public/static';
|
$staticDir = '/var/www/cp/public/static';
|
||||||
|
|
1506
cp/lang/ar_SA/messages.po
Normal file
1506
cp/lang/ar_SA/messages.po
Normal file
File diff suppressed because it is too large
Load diff
|
@ -1,5 +1,5 @@
|
||||||
<!doctype html>
|
<!doctype html>
|
||||||
<html lang="en">
|
<html lang="{{ _lang ?: 'en' }}" dir="{{ _lang == 'ar' or _lang == 'ar_SA' ? 'rtl' : 'ltr' }}">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8"/>
|
<meta charset="utf-8"/>
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover"/>
|
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover"/>
|
||||||
|
@ -7,18 +7,6 @@
|
||||||
<title>{% block title %}{% endblock %} | Namingo</title>
|
<title>{% block title %}{% endblock %} | Namingo</title>
|
||||||
<!-- CSS files -->
|
<!-- CSS files -->
|
||||||
{% if route_is('domains') or route_is('applications') or route_is('contacts') or route_is('hosts') or route_is('epphistory') or route_is('registrars') or route_is('transactions') or route_is('overview') or route_is('reports') or route_is('transfers') or route_is('users') or is_current_url('ticketview') or route_is('poll') or route_is('log') or route_is('invoices') or route_is('registry/tlds') or route_is('profile') %}{% include 'partials/css-tables.twig' %}{% else %}{% include 'partials/css.twig' %}{% endif %}
|
{% if route_is('domains') or route_is('applications') or route_is('contacts') or route_is('hosts') or route_is('epphistory') or route_is('registrars') or route_is('transactions') or route_is('overview') or route_is('reports') or route_is('transfers') or route_is('users') or is_current_url('ticketview') or route_is('poll') or route_is('log') or route_is('invoices') or route_is('registry/tlds') or route_is('profile') %}{% include 'partials/css-tables.twig' %}{% else %}{% include 'partials/css.twig' %}{% endif %}
|
||||||
<style>
|
|
||||||
@import url('/assets/fonts/inter/inter.css');
|
|
||||||
:root {
|
|
||||||
--tblr-font-sans-serif: "Inter", -apple-system, BlinkMacSystemFont, San Francisco, Segoe UI, Roboto, Helvetica Neue, sans-serif;
|
|
||||||
}
|
|
||||||
@supports (font-variation-settings: normal) {
|
|
||||||
:root {
|
|
||||||
--tblr-font-sans-serif: "InterVariable", -apple-system, BlinkMacSystemFont, San Francisco, Segoe UI, Roboto, Helvetica Neue, sans-serif;
|
|
||||||
font-optical-sizing: auto;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
</head>
|
</head>
|
||||||
<body{% if screen_mode == 'dark' %} data-bs-theme="dark"{% endif %}>
|
<body{% if screen_mode == 'dark' %} data-bs-theme="dark"{% endif %}>
|
||||||
<div class="page">
|
<div class="page">
|
||||||
|
@ -45,6 +33,7 @@
|
||||||
<a href="/lang?es_ES" class="dropdown-item"><span class="flag flag-country-es"></span> Español</a>
|
<a href="/lang?es_ES" class="dropdown-item"><span class="flag flag-country-es"></span> Español</a>
|
||||||
<a href="/lang?pt_PT" class="dropdown-item"><span class="flag flag-country-pt"></span> Português</a>
|
<a href="/lang?pt_PT" class="dropdown-item"><span class="flag flag-country-pt"></span> Português</a>
|
||||||
<a href="/lang?jp_JP" class="dropdown-item"><span class="flag flag-country-jp"></span> 日本語</a>
|
<a href="/lang?jp_JP" class="dropdown-item"><span class="flag flag-country-jp"></span> 日本語</a>
|
||||||
|
<a href="/lang?ar_SA" class="dropdown-item"><span class="flag flag-country-sa"></span> العربية</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,7 +1,14 @@
|
||||||
|
{% if _lang == 'ar' or _lang == 'ar_SA' %}
|
||||||
|
<link href="/assets/css/tabler.rtl.min.css" rel="stylesheet"/>
|
||||||
|
<link href="/assets/css/tabler-flags.rtl.min.css" rel="stylesheet"/>
|
||||||
|
<link href="/assets/css/tabler-payments.rtl.min.css" rel="stylesheet"/>
|
||||||
|
<link href="/assets/css/tabler-vendors.rtl.min.css" rel="stylesheet"/>
|
||||||
|
{% else %}
|
||||||
<link href="/assets/css/tabler.min.css" rel="stylesheet"/>
|
<link href="/assets/css/tabler.min.css" rel="stylesheet"/>
|
||||||
<link href="/assets/css/tabler-flags.min.css" rel="stylesheet"/>
|
<link href="/assets/css/tabler-flags.min.css" rel="stylesheet"/>
|
||||||
<link href="/assets/css/tabler-payments.min.css" rel="stylesheet"/>
|
<link href="/assets/css/tabler-payments.min.css" rel="stylesheet"/>
|
||||||
<link href="/assets/css/tabler-vendors.min.css" rel="stylesheet"/>
|
<link href="/assets/css/tabler-vendors.min.css" rel="stylesheet"/>
|
||||||
|
{% endif %}
|
||||||
{% if screen_mode == 'dark' %}
|
{% if screen_mode == 'dark' %}
|
||||||
<link href="/assets/css/tabulator-dark.min.css" rel="stylesheet">
|
<link href="/assets/css/tabulator-dark.min.css" rel="stylesheet">
|
||||||
{% else %}
|
{% else %}
|
||||||
|
@ -9,13 +16,30 @@
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<link href="/assets/css/sweetalert2.min.css" rel="stylesheet">
|
<link href="/assets/css/sweetalert2.min.css" rel="stylesheet">
|
||||||
<style>
|
<style>
|
||||||
|
@import url('/assets/fonts/inter/inter.css');
|
||||||
|
:root {
|
||||||
|
--tblr-font-sans-serif: "Inter", -apple-system, BlinkMacSystemFont, San Francisco, Segoe UI, Roboto, Helvetica Neue, sans-serif;
|
||||||
|
}
|
||||||
|
@supports (font-variation-settings: normal) {
|
||||||
|
:root {
|
||||||
|
--tblr-font-sans-serif: "InterVariable", -apple-system, BlinkMacSystemFont, San Francisco, Segoe UI, Roboto, Helvetica Neue, sans-serif;
|
||||||
|
font-optical-sizing: auto;
|
||||||
|
}
|
||||||
|
}
|
||||||
.small-dropdown .dropdown-item {
|
.small-dropdown .dropdown-item {
|
||||||
padding: 0.25rem 1.5rem;
|
padding: 0.25rem 1.5rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.small-dropdown .flag {
|
.small-dropdown .flag {
|
||||||
width: 20px;
|
width: 20px;
|
||||||
height: 15px;
|
height: 15px;
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
}
|
}
|
||||||
|
{% if _lang == 'ar' or _lang == 'ar_SA' %}
|
||||||
|
[dir="rtl"] {
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
[dir="rtl"] .small-dropdown .dropdown-item {
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
{% endif %}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -1,15 +1,39 @@
|
||||||
|
{% if _lang == 'ar' or _lang == 'ar_SA' %}
|
||||||
|
<link href="/assets/css/tabler.rtl.min.css" rel="stylesheet"/>
|
||||||
|
<link href="/assets/css/tabler-flags.rtl.min.css" rel="stylesheet"/>
|
||||||
|
<link href="/assets/css/tabler-payments.rtl.min.css" rel="stylesheet"/>
|
||||||
|
<link href="/assets/css/tabler-vendors.rtl.min.css" rel="stylesheet"/>
|
||||||
|
{% else %}
|
||||||
<link href="/assets/css/tabler.min.css" rel="stylesheet"/>
|
<link href="/assets/css/tabler.min.css" rel="stylesheet"/>
|
||||||
<link href="/assets/css/tabler-flags.min.css" rel="stylesheet"/>
|
<link href="/assets/css/tabler-flags.min.css" rel="stylesheet"/>
|
||||||
<link href="/assets/css/tabler-payments.min.css" rel="stylesheet"/>
|
<link href="/assets/css/tabler-payments.min.css" rel="stylesheet"/>
|
||||||
<link href="/assets/css/tabler-vendors.min.css" rel="stylesheet"/>
|
<link href="/assets/css/tabler-vendors.min.css" rel="stylesheet"/>
|
||||||
|
{% endif %}
|
||||||
<style>
|
<style>
|
||||||
|
@import url('/assets/fonts/inter/inter.css');
|
||||||
|
:root {
|
||||||
|
--tblr-font-sans-serif: "Inter", -apple-system, BlinkMacSystemFont, San Francisco, Segoe UI, Roboto, Helvetica Neue, sans-serif;
|
||||||
|
}
|
||||||
|
@supports (font-variation-settings: normal) {
|
||||||
|
:root {
|
||||||
|
--tblr-font-sans-serif: "InterVariable", -apple-system, BlinkMacSystemFont, San Francisco, Segoe UI, Roboto, Helvetica Neue, sans-serif;
|
||||||
|
font-optical-sizing: auto;
|
||||||
|
}
|
||||||
|
}
|
||||||
.small-dropdown .dropdown-item {
|
.small-dropdown .dropdown-item {
|
||||||
padding: 0.25rem 1.5rem;
|
padding: 0.25rem 1.5rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.small-dropdown .flag {
|
.small-dropdown .flag {
|
||||||
width: 20px;
|
width: 20px;
|
||||||
height: 15px;
|
height: 15px;
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
}
|
}
|
||||||
|
{% if _lang == 'ar' or _lang == 'ar_SA' %}
|
||||||
|
[dir="rtl"] {
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
[dir="rtl"] .small-dropdown .dropdown-item {
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
{% endif %}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -230,7 +230,7 @@ To customize the landing page, copy `index.twig` to `index.custom.twig` using `c
|
||||||
|
|
||||||
To change the default language of the control panel, you must edit the `/var/www/cp/.env` file and replace the language values (`LANG`/`UI_LANG`) with your desired settings.
|
To change the default language of the control panel, you must edit the `/var/www/cp/.env` file and replace the language values (`LANG`/`UI_LANG`) with your desired settings.
|
||||||
|
|
||||||
For the `LANG` variable, the supported values are `en_US`, `uk_UA`, `es_ES`, `pt_PT`, `jp_JP`, and `fr_FR`. For the `UI_LANG` variable, use `us`, `ua`, `es`, `pt`, `jp`, or `fr`.
|
For the `LANG` variable, the supported values are `en_US`, `uk_UA`, `es_ES`, `pt_PT`, `jp_JP`, `ar_SA`, and `fr_FR`. For the `UI_LANG` variable, use `us`, `ua`, `es`, `pt`, `jp`, `ar`, or `fr`.
|
||||||
|
|
||||||
To apply your changes, save the file, refresh the control panel, and clear the cache using the following command: `php /var/www/cp/bin/clear_cache.php` The new language settings will take effect immediately.
|
To apply your changes, save the file, refresh the control panel, and clear the cache using the following command: `php /var/www/cp/bin/clear_cache.php` The new language settings will take effect immediately.
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue