File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1313// others are added from the current set until they get updated.
1414$ ok_system_calls = [
1515 "pinc/forum_interface_phpbb3.inc " ,
16- "pinc/languages.inc " ,
1716 "pinc/phpbb3.inc " ,
1817 "pinc/POFile.inc " ,
1918 "pinc/Project.inc " ,
Original file line number Diff line number Diff line change 77include_once ($ relPath .'lang_data.inc ' );
88include_once ($ relPath .'iso_lang_list.inc ' );
99
10+ use Symfony \Component \Process \Process ;
11+
1012function lang_code ($ language_code )
1113{
1214 global $ locales ;
@@ -120,14 +122,20 @@ function lang_direction($langcode = false)
120122 */
121123function get_installed_system_locales ()
122124{
123- static $ system_locales = [];
124- if ($ system_locales ) {
125- return $ system_locales ;
125+ static $ utf8_locales = [];
126+ if ($ utf8_locales ) {
127+ return $ utf8_locales ;
128+ }
129+
130+ $ process = new Process (["locale " , "-a " ]);
131+ $ process ->run ();
132+ if (!$ process ->isSuccessful ()) {
133+ throw new RuntimeException ("Failed loading system locales. " );
126134 }
127135
128- exec ( " locale -a " , $ system_locales );
136+ $ system_locales = explode ( "\n " , $ process -> getOutput () );
129137
130- // exclude all non- UTF-8 locales
138+ // only include UTF-8 locales, but strip the .utf8 off the end
131139 $ utf8_locales = [];
132140 foreach ($ system_locales as $ locale ) {
133141 if (endswith ($ locale , '.utf8 ' )) {
You can’t perform that action at this time.
0 commit comments