Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
OpnSense
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kulya
OpnSense
Commits
a4f9af68
Commit
a4f9af68
authored
Sep 27, 2016
by
Franco Fichtner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wizard: add language selection; closes #648
(cherry picked from commit
2a76c4ab
)
parent
2e3cf91c
Changes
6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
165 additions
and
135 deletions
+165
-135
system.inc
src/etc/inc/system.inc
+16
-0
Menu.xml
src/opnsense/mvc/app/models/OPNsense/Base/Menu/Menu.xml
+3
-1
setup.xml
src/wizard/setup.xml
+5
-0
guiconfig.inc
src/www/guiconfig.inc
+14
-20
system_general.php
src/www/system_general.php
+98
-114
wizard.php
src/www/wizard.php
+29
-0
No files found.
src/etc/inc/system.inc
View file @
a4f9af68
...
...
@@ -228,6 +228,22 @@ function system_resolvconf_generate($dynupdate = false)
return
0
;
}
function
get_locale_list
()
{
$locales
=
array
();
/* first one is the default */
$locales
[
'en_US'
]
=
gettext
(
'English'
);
$locales
[
'zh_CN'
]
=
gettext
(
'Chinese (Simplified)'
);
$locales
[
'fr_FR'
]
=
gettext
(
'French'
);
$locales
[
'de_DE'
]
=
gettext
(
'German'
);
$locales
[
'it_IT'
]
=
gettext
(
'Italian'
);
$locales
[
'ja_JP'
]
=
gettext
(
'Japanese'
);
$locales
[
'ru_RU'
]
=
gettext
(
'Russian'
);
return
$locales
;
}
function
get_country_codes
()
{
$dn_cc
=
array
();
...
...
src/opnsense/mvc/app/models/OPNsense/Base/Menu/Menu.xml
View file @
a4f9af68
...
...
@@ -56,7 +56,9 @@
<Log
VisibleName=
"Log File"
url=
"/diag_logs_gateways.php"
/>
</Gateways>
<Settings
order=
"20"
cssClass=
"fa fa-cogs fa-fw"
>
<General
order=
"100"
url=
"/system_general.php"
/>
<General
order=
"100"
url=
"/system_general.php"
>
<workAround
url=
"/system_general.php*"
/>
</General>
<Administration
order=
"200"
url=
"/system_advanced_admin.php"
/>
<Logging
order=
"300"
url=
"/diag_logs_settings.php"
/>
<Notifications
order=
"400"
url=
"/system_advanced_notifications.php"
/>
...
...
src/wizard/setup.xml
View file @
a4f9af68
...
...
@@ -68,6 +68,11 @@
<validate>
^[a-z0-9.|-]+$
</validate>
<message>
Domain name field is invalid
</message>
</field>
<field>
<name>
Language
</name>
<type>
language_select
</type>
<bindstofield>
system->language
</bindstofield>
</field>
<field>
<name>
Primary DNS Server
</name>
<type>
input
</type>
...
...
src/www/guiconfig.inc
View file @
a4f9af68
...
...
@@ -49,25 +49,6 @@ session_write_close();
/* CSRF END: THANK YOU FOR YOUR COOPERATION */
function
set_language
()
{
global
$config
;
$lang
=
'en_US'
;
if
(
!
empty
(
$config
[
'system'
][
'language'
]))
{
$lang
=
$config
[
'system'
][
'language'
];
}
$lang_encoding
=
$lang
.
'.UTF-8'
;
$textdomain
=
'OPNsense'
;
putenv
(
'LANG='
.
$lang_encoding
);
setlocale
(
LC_ALL
,
$lang_encoding
);
textdomain
(
$textdomain
);
bindtextdomain
(
$textdomain
,
'/usr/local/share/locale'
);
bind_textdomain_codeset
(
$textdomain
,
$lang_encoding
);
}
function
get_current_theme
()
{
global
$config
;
...
...
@@ -89,7 +70,20 @@ function html_safe($text)
header
(
"X-Frame-Options: SAMEORIGIN"
);
set_language
();
/* set language */
$lang
=
'en_US'
;
if
(
!
empty
(
$config
[
'system'
][
'language'
]))
{
$lang
=
$config
[
'system'
][
'language'
];
}
$lang_encoding
=
$lang
.
'.UTF-8'
;
$textdomain
=
'OPNsense'
;
putenv
(
'LANG='
.
$lang_encoding
);
setlocale
(
LC_ALL
,
$lang_encoding
);
textdomain
(
$textdomain
);
bindtextdomain
(
$textdomain
,
'/usr/local/share/locale'
);
bind_textdomain_codeset
(
$textdomain
,
$lang_encoding
);
require_once
(
"authgui.inc"
);
...
...
src/www/system_general.php
View file @
a4f9af68
This diff is collapsed.
Click to expand it.
src/www/wizard.php
View file @
a4f9af68
...
...
@@ -749,6 +749,35 @@ function showchange() {
echo
"<br /> "
.
$field
[
'description'
];
}
break
;
case
"language_select"
:
$languagelist
=
get_locale_list
();
if
(
$field
[
'displayname'
])
{
echo
"<td width=
\"
22%
\"
align=
\"
right
\"
class=
\"
vncellreq
\"
>
\n
"
;
echo
$field
[
'displayname'
];
echo
":</td>
\n
"
;
}
else
if
(
!
$field
[
'dontdisplayname'
])
{
echo
"<td width=
\"
22%
\"
align=
\"
right
\"
class=
\"
vncellreq
\"
>
\n
"
;
echo
fixup_string
(
$field
[
'name'
]);
echo
":</td>"
;
}
if
(
!
$field
[
'dontcombinecells'
])
echo
"<td class=
\"
vtable
\"
>"
;
echo
"<select class='form-control' name='
{
$name
}
'>
\n
"
;
foreach
(
$languagelist
as
$langkey
=>
$langval
)
{
$SELECTED
=
""
;
if
(
$value
==
$langkey
)
$SELECTED
=
" selected=
\"
selected
\"
"
;
echo
"<option value=
\"
"
.
htmlspecialchars
(
$langkey
)
.
"
\"
{
$SELECTED
}
>"
;
echo
htmlspecialchars
(
$langval
);
echo
"</option>
\n
"
;
}
echo
"</select>
\n
"
;
if
(
$field
[
'description'
]
<>
""
)
{
echo
"<br /> "
.
$field
[
'description'
];
}
break
;
case
"timezone_select"
:
$timezonelist
=
get_zoneinfo
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment