else
alt_table_row_color($k);
- $support = ($lang == 'en_GB') ||
+ $support = ($lang == 'C') ||
$_SESSION['get_text']->check_support($lang, $charset);
if (function_exists('gettext') && !$support && !get_post('DisplayAll')) continue;
if (function_exists('gettext') && check_value('DisplayAll'))
label_cell($support ? _("Yes") :_("No"));
- if (!$available && ($lang != 'en_GB')) // manually installed language
+ if (!$available && ($lang != 'C')) // manually installed language
button_cell('Edit'.$id, _("Edit"), _('Edit non standard language configuration'),
ICON_EDIT);
elseif (check_pkg_upgrade($installed, $available)) // outdated or not installed language in repo
else
label_cell('');
- if (($id !== null) && ($lang != $currlang) && ($lang != 'en_GB')) {
+ if (($id !== null) && ($lang != $currlang) && ($lang != 'C')) {
delete_button_cell('Delete'.$id, _('Delete'));
submit_js_confirm('Delete'.$id,
sprintf(_("You are about to remove language \'%s\'.\nDo you want to continue ?"),
$lshort = strtr($up, '-','');
$ushort = strtr($low, '-','');
- $set = setlocale(LC_ALL, $lang_code.".".$encoding,
- $lang_code.".".$up, $lang_code.".".$low,
- $lang_code.".".$ushort, $lang_code.".".$lshort);
-
+ if ($lang_code == 'C')
+ $set = setlocale(LC_ALL,'C');
+ else
+ $set = setlocale(LC_ALL, $lang_code.".".$encoding,
+ $lang_code.".".$up, $lang_code.".".$low,
+ $lang_code.".".$ushort, $lang_code.".".$lshort);
+
setlocale(LC_NUMERIC, 'C'); // important for numeric presentation etc.
if ($set === false)
{
global $dflt_lang;
$this->name = $name;
- $this->code = $code ? $code : ($dflt_lang ? $dflt_lang : 'en_GB');
+ $this->code = $code ? $code : ($dflt_lang ? $dflt_lang : 'C');
$this->encoding = $encoding;
$this->dir = $dir;
}
$test['comments'] = array();
$fname = $path_to_root.'/lang';
- $test['test'][] = $fname;
+ $test['test'] = $fname;
if (!(is_dir($fname) && is_writable($fname))) {
$test['result'] = false;
$test['comments'][] = _("Languages folder should be writeable.");
+ return $test;
}
$fname = $path_to_root.'/lang/installed_languages.inc';
- $test['test'][] = $fname;
+ $test['test'] = $fname;
if (!(is_file($fname) && is_writable($fname))) {
$test['result'] = false;
$test['comments'][] = _("Languages configuration file should be writeable.");
+ return $test;
}
$langs = array();
foreach ($installed_languages as $lang) {
+
+ if ($lang['code'] == 'C') continue; // no translation (English)
$langs[] = $lang['code'];
- if ($lang['code'] == 'en_GB') continue; // native FA language
-
+
$file = $path_to_root.'/lang/'.$lang['code'].'/LC_MESSAGES/'.$lang['code'];
if (@$lang['version'])
$file .= '-'.$lang['version'];
return $test;
}
-function tst_dbconfig()
+function tst_dbconfig($install)
{
global $path_to_root;
$test['descr'] = _('Database auth file');
- $test['type'] = 2;
$test['test'] = $path_to_root.'/config_db.php';
- $test['result'] = is_file($test['test']) && !is_writable($test['test']);
- $test['comments'][] = sprintf(_("'%s' file should be read-only if you do not plan to add or change companies"), $test['test']);
+ if ($install) {
+ $test['type'] = 3;
+ $writable = check_write($test['test']);
+ $test['result'] = $writable==1;
+ $test['comments'][] = $writable == 0 ?
+ sprintf(_("Can't write '%s' file. Check FA directory write permissions."), $test['test'])
+ : sprintf(_("'%s' file exists."), $test['test']);
+ } else {
+ $test['type'] = 2;
+ $test['result'] = is_file($test['test']) && !is_writable($test['test']);
+ $test['comments'][] = sprintf(_("'%s' file should be read-only if you do not plan to add or change companies"), $test['test']);
+ }
return $test;
}
global $test_level;
if ($install)
- $system_tests = array('tst_php', 'tst_phpmysql', 'tst_system', 'tst_config',
+ $system_tests = array('tst_php', 'tst_phpmysql', 'tst_system', 'tst_dbconfig',
+ 'tst_config',
'tst_subdirs', 'tst_langs', 'tst_tmpdir', 'tst_sessionpath', 'tst_extconfig'
);
else
//
function install($pref, $force)
{
- global $db_version;
+ global $db_version, $dflt_lang;
if (!$this->preconf)
return false;
if (!db_query($sql))
return false;
}
+ $this->update_lang_cfg();
return update_company_prefs(array('version_id'=>$db_version), $pref);
}
//
} else
return true;
}
+
+ function update_lang_cfg()
+ {
+ global $dflt_lang, $installed_languages;
+
+ foreach($installed_languages as $n => $lang) {
+ if ($lang['code'] == 'en_GB') {
+ $installed_languages[$n] = 'C';
+ if ($dflt_lang == 'en_GB')
+ $dflt_lang = 'C';
+ write_lang();
+ }
+ }
+ }
}
$install = new fa2_3;
ALTER TABLE `0_supp_trans` ADD COLUMN `tax_included` tinyint(1) NOT NULL default '0';
ALTER TABLE `0_purch_orders` ADD COLUMN `tax_included` tinyint(1) NOT NULL default '0';
+UPDATE `crm_persons` SET `lang`='C' WHERE `lang`='en_GB';
+UPDATE `crm_users` SET `language`='C' WHERE `language`='en_GB';
-- Dumping data for table `0_crm_persons`
--
-INSERT INTO `0_crm_persons` VALUES(1, 'Beefeater', '', NULL, NULL, NULL, NULL, NULL, '', 'en_GB', '', 0);
+INSERT INTO `0_crm_persons` VALUES(1, 'Beefeater', '', NULL, NULL, NULL, NULL, NULL, '', 'C', '', 0);
INSERT INTO `0_crm_persons` VALUES(2, 'Ghostbusters', '', NULL, NULL, NULL, NULL, NULL, '', NULL, '', 0);
-INSERT INTO `0_crm_persons` VALUES(3, 'Brezan', '', NULL, NULL, NULL, NULL, NULL, '', 'en_GB', '', 0);
+INSERT INTO `0_crm_persons` VALUES(3, 'Brezan', '', NULL, NULL, NULL, NULL, NULL, '', 'C', '', 0);
INSERT INTO `0_crm_persons` VALUES(4, 'Beefeater', 'Main Branch', NULL, '', '', '', '', '', NULL, '', 0);
INSERT INTO `0_crm_persons` VALUES(5, 'Ghostbusters', 'Main Branch', NULL, 'Address 1\nAddress 2\nAddress 3', '', '', '', '', NULL, '', 0);
INSERT INTO `0_crm_persons` VALUES(6, 'Brezan', 'Main Branch', NULL, 'Address 1\nAddress 2\nAddress 3', '', '', '', '', NULL, '', 0);
-INSERT INTO `0_crm_persons` VALUES(7, 'Junk Beer', 'Contact', NULL, 'Address 1\nAddress 2\nAddress 3', '+45 55667788', '', '', '', 'en_GB', '', 0);
+INSERT INTO `0_crm_persons` VALUES(7, 'Junk Beer', 'Contact', NULL, 'Address 1\nAddress 2\nAddress 3', '+45 55667788', '', '', '', 'C', '', 0);
INSERT INTO `0_crm_persons` VALUES(8, 'Lucky Luke', 'Luke', NULL, 'Address 1\nAddress 2\nAddress 3', '(111) 222.333.444', '', '', '', NULL, '', 0);
-INSERT INTO `0_crm_persons` VALUES(9, 'Money Makers', 'Makers', NULL, 'Address 1\nAddress 2\nAddress 3', '+44 444 555 666', '', '', '', 'en_GB', '', 0);
+INSERT INTO `0_crm_persons` VALUES(9, 'Money Makers', 'Makers', NULL, 'Address 1\nAddress 2\nAddress 3', '+44 444 555 666', '', '', '', 'C', '', 0);
-- --------------------------------------------------------