mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-07 18:51:41 +09:00
Add option to force the language for a domain
This commit is contained in:
parent
48cd4a2794
commit
424242ff74
5 changed files with 44 additions and 26 deletions
|
|
@ -253,7 +253,11 @@ class Context
|
|||
$set_lang_cookie = false;
|
||||
self::set('lang_supported', $enabled_langs);
|
||||
|
||||
if($lang_type = self::get('l'))
|
||||
if (!empty($site_module_info->settings->language) && !empty($site_module_info->settings->force_language))
|
||||
{
|
||||
$lang_type = $site_module_info->settings->language;
|
||||
}
|
||||
elseif ($lang_type = self::get('l'))
|
||||
{
|
||||
if($_COOKIE['lang_type'] !== $lang_type)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -82,21 +82,24 @@ class Domains extends Base
|
|||
// Get language list.
|
||||
Context::set('supported_lang', Lang::getSupportedList());
|
||||
Context::set('enabled_lang', Config::get('locale.enabled_lang'));
|
||||
if ($domain_info && $domain_info->settings->language)
|
||||
if ($domain_info && !empty($domain_info->settings->language))
|
||||
{
|
||||
$domain_lang = $domain_info->settings->language;
|
||||
$domain_lang = $domain_info->settings->language ?? 'default';
|
||||
$domain_force_lang = $domain_info->settings->force_language ?? false;
|
||||
}
|
||||
else
|
||||
{
|
||||
$domain_lang = 'default';
|
||||
$domain_force_lang = false;
|
||||
}
|
||||
Context::set('domain_lang', $domain_lang);
|
||||
Context::set('domain_force_lang', $domain_force_lang);
|
||||
|
||||
// Get timezone list.
|
||||
Context::set('timezones', DateTime::getTimezoneList());
|
||||
if ($domain_info && $domain_info->settings->timezone)
|
||||
if ($domain_info && !empty($domain_info->settings->timezone))
|
||||
{
|
||||
$domain_timezone = $domain_info->settings->timezone;
|
||||
$domain_timezone = $domain_info->settings->timezone ?? '';
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -149,19 +152,22 @@ class Domains extends Base
|
|||
// Get language list.
|
||||
Context::set('supported_lang', Lang::getSupportedList());
|
||||
Context::set('enabled_lang', Config::get('locale.enabled_lang'));
|
||||
if ($domain_info && $domain_info->settings->language)
|
||||
if ($domain_info && !empty($domain_info->settings->language))
|
||||
{
|
||||
$domain_lang = $domain_info->settings->language;
|
||||
$domain_lang = $domain_info->settings->language ?? 'default';
|
||||
$domain_force_lang = $domain_info->settings->force_language ?? false;
|
||||
}
|
||||
else
|
||||
{
|
||||
$domain_lang = 'default';
|
||||
$domain_force_lang = false;
|
||||
}
|
||||
Context::set('domain_lang', $domain_lang);
|
||||
Context::set('domain_force_lang', $domain_force_lang);
|
||||
|
||||
// Get timezone list.
|
||||
Context::set('timezones', DateTime::getTimezoneList());
|
||||
if ($domain_info && $domain_info->settings->timezone)
|
||||
if ($domain_info && !empty($domain_info->settings->timezone))
|
||||
{
|
||||
$domain_timezone = $domain_info->settings->timezone;
|
||||
}
|
||||
|
|
@ -328,6 +334,7 @@ class Domains extends Base
|
|||
{
|
||||
throw new Exception('msg_lang_is_not_enabled');
|
||||
}
|
||||
$vars->force_lang = isset($vars->force_lang) ? toBool($vars->force_lang) : false;
|
||||
|
||||
// Validate the default time zone.
|
||||
$timezone_list = DateTime::getTimezoneList();
|
||||
|
|
@ -356,6 +363,7 @@ class Domains extends Base
|
|||
'title' => $vars->title,
|
||||
'subtitle' => $vars->subtitle,
|
||||
'language' => $vars->default_lang,
|
||||
'force_language' => $vars->force_lang,
|
||||
'timezone' => $vars->default_timezone,
|
||||
'meta_keywords' => $vars->meta_keywords,
|
||||
'meta_description' => $vars->meta_description,
|
||||
|
|
|
|||
|
|
@ -106,6 +106,7 @@ $lang->cmd_https_port = 'HTTPS Port';
|
|||
$lang->cmd_index_module_srl = 'Main Module';
|
||||
$lang->cmd_index_document_srl = 'Main Document';
|
||||
$lang->cmd_default_language = 'Default Language';
|
||||
$lang->cmd_force_default_language = 'Force';
|
||||
$lang->cmd_any_domain = 'Any Domain';
|
||||
$lang->cmd_new_domain = 'Add New Domain';
|
||||
$lang->cmd_edit_domain = 'Edit Domain';
|
||||
|
|
|
|||
|
|
@ -105,6 +105,7 @@ $lang->cmd_https_port = 'HTTPS 포트';
|
|||
$lang->cmd_index_module_srl = '메인 모듈';
|
||||
$lang->cmd_index_document_srl = '메인 문서';
|
||||
$lang->cmd_default_language = '기본 언어';
|
||||
$lang->cmd_force_default_language = '강제 적용';
|
||||
$lang->cmd_any_domain = '모든 도메인';
|
||||
$lang->cmd_new_domain = '새 도메인 추가';
|
||||
$lang->cmd_edit_domain = '도메인 정보 수정';
|
||||
|
|
|
|||
|
|
@ -18,14 +18,14 @@
|
|||
<input type="text" name="title" value="{$domain_info ? escape($domain_info->settings->title) : ''}" class="lang_code" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="x_control-group">
|
||||
<label class="x_control-label">{$lang->site_subtitle}</label>
|
||||
<div class="x_controls">
|
||||
<input type="text" name="subtitle" value="{$domain_info ? escape($domain_info->settings->subtitle) : ''}" class="lang_code" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="x_control-group">
|
||||
<label class="x_control-label" for="domain">{$lang->domain}</label>
|
||||
<div class="x_controls">
|
||||
|
|
@ -36,21 +36,21 @@
|
|||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="x_control-group">
|
||||
<label class="x_control-label" for="http_port">{$lang->cmd_http_port}</label>
|
||||
<div class="x_controls">
|
||||
<input type="number" name="http_port" id="http_port" size="5" value="{($domain_info && $domain_info->http_port) ? $domain_info->http_port : ''}" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="x_control-group">
|
||||
<label class="x_control-label" for="https_port">{$lang->cmd_https_port}</label>
|
||||
<div class="x_controls">
|
||||
<input type="number" name="https_port" id="https_port" size="5" value="{($domain_info && $domain_info->https_port) ? $domain_info->https_port : ''}" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="x_control-group">
|
||||
<label class="x_control-label" for="domain_security">{$lang->use_ssl}</label>
|
||||
<div class="x_controls">
|
||||
|
|
@ -61,21 +61,21 @@
|
|||
<div class="x_help-block">{lang('admin.about_use_ssl')}</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="x_control-group">
|
||||
<label class="x_control-label" for="index_module_srl">{$lang->cmd_index_module_srl}</label>
|
||||
<div class="x_controls">
|
||||
<input class="module_search" type="text" id="index_module_srl" name="index_module_srl" value="{$index_module_srl}" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="x_control-group">
|
||||
<label class="x_control-label" for="index_document_srl">{$lang->cmd_index_document_srl}</label>
|
||||
<div class="x_controls">
|
||||
<input type="number" name="index_document_srl" id="index_document_srl" value="{($domain_info && $domain_info->index_document_srl) ? $domain_info->index_document_srl : ''}"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="x_control-group">
|
||||
<label class="x_control-label" for="default_lang">{$lang->default_lang}</label>
|
||||
<div class="x_controls">
|
||||
|
|
@ -83,9 +83,13 @@
|
|||
<option value="default" selected="selected"|cond="$domain_lang === 'default'">{$lang->follow_default_lang}</option>
|
||||
<option value="{$key}" loop="$enabled_lang => $key" selected="selected"|cond="$key == $domain_lang">{$supported_lang[$key]['name']}</option>
|
||||
</select>
|
||||
|
||||
<label class="x_inline" for="force_lang">
|
||||
<input type="checkbox" name="force_lang" id="force_lang" value="Y" checked="checked"|cond="$domain_force_lang" /> {$lang->cmd_force_default_language}
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="x_control-group">
|
||||
<label class="x_control-label" for="default_timezone">{$lang->timezone}</label>
|
||||
<div class="x_controls">
|
||||
|
|
@ -95,7 +99,7 @@
|
|||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="x_control-group">
|
||||
<label class="x_control-label" for="meta_keywords">{$lang->site_meta_keywords}</label>
|
||||
<div class="x_controls">
|
||||
|
|
@ -109,7 +113,7 @@
|
|||
<input type="text" name="meta_description" id="meta_description" value="{$domain_info ? $domain_info->settings->meta_description : ''}" class="lang_code" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="x_control-group">
|
||||
<label class="x_control-label" for="html_header">{$lang->input_header_script}</label>
|
||||
<div class="x_controls" style="margin-right:14px">
|
||||
|
|
@ -117,7 +121,7 @@
|
|||
<div class="x_help-block">{$lang->detail_input_header_script}</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="x_control-group">
|
||||
<label class="x_control-label" for="html_footer">{$lang->input_footer_script}</label>
|
||||
<div class="x_controls" style="margin-right:14px">
|
||||
|
|
@ -125,7 +129,7 @@
|
|||
<div class="x_help-block">{$lang->detail_input_footer_script}</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="x_control-group">
|
||||
<label class="x_control-label">{$lang->allow_use_favicon}</label>
|
||||
<div class="x_controls">
|
||||
|
|
@ -140,7 +144,7 @@
|
|||
<span class="x_help-block">{$lang->about_use_favicon}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="x_control-group">
|
||||
<label class="x_control-label">{$lang->allow_use_mobile_icon}</label>
|
||||
<div class="x_controls">
|
||||
|
|
@ -155,7 +159,7 @@
|
|||
<span class="x_help-block">{$lang->detail_use_mobile_icon}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="x_control-group">
|
||||
<label class="x_control-label">{$lang->cmd_site_default_image}</label>
|
||||
<div class="x_controls">
|
||||
|
|
@ -169,7 +173,7 @@
|
|||
<span class="x_help-block">{$lang->about_site_default_image}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="x_control-group">
|
||||
<label class="x_control-label" for="color_scheme">{lang('admin.cmd_site_default_color_scheme')}</label>
|
||||
<div class="x_controls">
|
||||
|
|
@ -181,12 +185,12 @@
|
|||
<div class="x_help-block">{lang('admin.about_site_default_color_scheme')}</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="x_clearfix btnArea">
|
||||
<div class="x_pull-right">
|
||||
<button type="submit" class="x_btn x_btn-primary">{$lang->cmd_save}</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</form>
|
||||
</section>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue