Permalink
Browse files

Makes phpPgAdmin core full UTF-8 only.

Translations, db connexions and html pages are now all in UTF-8. In
consequence:
  * we remove everything about recode stuffs
  * recode all lang/ translation files to UTF-8
  * force UTF-8 in htmlentities
  • Loading branch information...
ioguix committed Dec 30, 2011
1 parent 3c0c7c0 commit 6ca9379bd6b5cda35589951564fa77e1fafb41dd
Showing with 7,604 additions and 33,809 deletions.
  1. +17 −44 TRANSLATORS
  2. +8 −8 admin.php
  3. +1 −1 ajax-ac-insert.php
  4. +3 −6 all_db.php
  5. +17 −14 classes/Misc.php
  6. +0 −13 classes/database/Postgres.php
  7. +2 −5 dataexport.php
  8. +2 −2 display.php
  9. +2 −2 functions.php
  10. +1 −1 history.php
  11. +0 −15 lang/README
  12. +36 −38 lang/afrikaans.php
  13. +0 −2 lang/arabic.php
  14. +1 −3 lang/catalan.php
  15. +314 −316 lang/chinese-sim.php
  16. +511 −513 lang/chinese-tr.php
  17. +978 −980 lang/chinese-utf8-zh_CN.php
  18. +1 −3 lang/chinese-utf8-zh_TW.php
  19. +0 −18 lang/convert.awk
  20. +1 −3 lang/czech.php
  21. +177 −180 lang/danish.php
  22. +22 −24 lang/dutch.php
  23. +1 −3 lang/english.php
  24. +584 −586 lang/french.php
  25. +1 −3 lang/galician.php
  26. +1 −3 lang/german.php
  27. +753 −756 lang/greek.php
  28. +1 −3 lang/hebrew.php
  29. +1 −3 lang/hungarian.php
  30. +54 −56 lang/italian.php
  31. +819 −821 lang/japanese.php
  32. +0 −71 lang/lang2xml
  33. +1 −3 lang/lithuanian.php
  34. +460 −462 lang/mongol.php
  35. +1 −3 lang/polish.php
  36. +465 −467 lang/portuguese-br.php
  37. +271 −273 lang/portuguese-pt.php
  38. +0 −635 lang/recoded/afrikaans.php
  39. +0 −596 lang/recoded/arabic.php
  40. +0 −1,023 lang/recoded/catalan.php
  41. +0 −372 lang/recoded/chinese-sim.php
  42. +0 −598 lang/recoded/chinese-tr.php
  43. +0 −980 lang/recoded/chinese-utf8-zh_CN.php
  44. +0 −990 lang/recoded/chinese-utf8-zh_TW.php
  45. +0 −1,023 lang/recoded/czech.php
  46. +0 −633 lang/recoded/danish.php
  47. +0 −481 lang/recoded/dutch.php
  48. +0 −1,024 lang/recoded/english.php
  49. +0 −1,024 lang/recoded/french.php
  50. +0 −1,035 lang/recoded/galician.php
  51. +0 −978 lang/recoded/german.php
  52. +0 −871 lang/recoded/greek.php
  53. +0 −630 lang/recoded/hebrew.php
  54. +0 −1,027 lang/recoded/hungarian.php
  55. +0 −740 lang/recoded/italian.php
  56. +0 −983 lang/recoded/japanese.php
  57. +0 −1,024 lang/recoded/lithuanian.php
  58. +0 −540 lang/recoded/mongol.php
  59. +0 −871 lang/recoded/polish.php
  60. +0 −1,024 lang/recoded/portuguese-br.php
  61. +0 −623 lang/recoded/portuguese-pt.php
  62. +0 −884 lang/recoded/romanian.php
  63. +0 −1,020 lang/recoded/russian-utf8.php
  64. +0 −601 lang/recoded/russian.php
  65. +0 −769 lang/recoded/slovak.php
  66. +0 −1,024 lang/recoded/spanish.php
  67. +0 −580 lang/recoded/swedish.php
  68. +0 −764 lang/recoded/turkish.php
  69. +0 −600 lang/recoded/ukrainian.php
  70. +1 −3 lang/romanian.php
  71. +1 −3 lang/russian-utf8.php
  72. +513 −515 lang/russian.php
  73. +1 −3 lang/slovak.php
  74. +388 −390 lang/spanish.php
  75. +235 −237 lang/swedish.php
  76. +1 −1 lang/translations.php
  77. +420 −422 lang/turkish.php
  78. +517 −520 lang/ukrainian.php
  79. +2 −26 libraries/lib.inc.php
  80. +2 −2 schemas.php
  81. +2 −2 sequences.php
  82. +3 −3 servers.php
  83. +5 −5 tables.php
  84. +4 −4 tblproperties.php
  85. +2 −2 views.php
View
@@ -3,25 +3,17 @@ Translator Info
If you like phpPgAdmin, then why not translate it into your native language?
-Translation is slightly complicated in phpPgAdmin compared to other PHP
-software, since we support viewing database encodings that are different to
-your language encoding.
-
-Also, there are quite a large number of strings to be translated. Partial
+There are quite a large number of strings to be translated. Partial
translations are better than no translations at all, and a rough guide is that
the strings are in the order from most important to least important in the
language file. You can ask the developers list if you don't know what a
certain string means.
-To translate messages, you will need to install GNU Recode on your computer.
-
-GNU Recode: http://www.gnu.org/software/recode/recode.html
+We tried keeping translation easy in phpPgAdmin by using ONLY the UTF-8 charset.
+Make sure to always work on UTF-8 files when creating a new translation or
+editing an existing one.
-Your favourite OS should have a GNU Recode package available. (See bottom for
-details.)
-
-Once you have Recode installed, these are the steps to creating a new
-translation:
+To Create a new translation:
1. Go to the lang/ subdirectory
@@ -30,9 +22,13 @@ translation:
3. Update the comment at the top of the file. Put yourself as the language
maintainer. Edit the 'applang' variable and put your language's name in it,
in your language.
-
- Edit the 'appcharset' variable and put in the name of the encoding for your
- language.
+ Edit the 'applocale' and put your language code according to the standart:
+ http://www.ietf.org/rfc/rfc1766.txt
+
+ Basicaly, you just need to put your language code [1] and optionnaly country
+ code [2] separated by a '-'. As instance for french canadian, it is: fr-CA
+ [1]: http://www.w3.org/WAI/ER/IG/ert/iso639.htm
+ [2]: http://www.iso.org/iso/country_codes/iso_3166_code_lists/country_names_and_code_elements.htm
4. Go through as much of the rest of the file as you wish, replacing the
English strings with strings in your native language.
@@ -41,42 +37,19 @@ At this point, you can send the yourlanguage.php file to us and we will take
care of testing and recoding the translation. Please only do that if you
find the rest of these steps too difficult.
-5. Recode your translation by running './lang2xml yourlanguage' from the lang/
- directory. A recoded language file will appear in the lang/recoded/
- directory. If the recoding fails, then fix the error in your language file
- and try again or report any bug with the "lang2xml" script.
-
- The HTML encoded language file is what phpPgAdmin actually uses to display
- localised strings. Have a look at the recoded file to see how the HTML
- encoding works. By encoding your language like this, we can display your
- language's characters as well as the characters of the language in your
- database.
-
-6. To add your language to phpPgAdmin, edit the lang/translations.php file
+5. To add your language to phpPgAdmin, edit the lang/translations.php file
and add your language to the $appLangFiles array.
- You must include the HTML encoded version of your language's name. You can
- get this from the recoded version of your translated strings file.
Also, add your language to the $availableLanguages array for
browser auto detection.
-7. Send your contribution to us. We need the lang/translations.php entry as
- well as the lang/yourlanguage.php file. We don't need the recoded file as
- we can recode it ourselves before committing it. Email to the developers
- list: phppgadmin-devel@lists.sourceforge.net
+6. Send your contribution to us. We need the lang/translations.php entry as
+ well as the lang/yourlanguage.php file. Email to the developers list:
+ phppgadmin-devel@lists.sourceforge.net
-8. There exists a tool named 'langcheck' in the lang/ directory. To run it,
+7. There exists a tool named 'langcheck' in the lang/ directory. To run it,
just type 'php langcheck <language>'. It will give you a report about
which strings are missing from your language file and which need to be
deleted.
Thank you for your contribution! You have just made phpPgAdmin accessible
to thousands more users!
-
-Appendix A: Ways to Get Recode
-------------------------------
-
-* FreeBSD: cd /usr/ports/converters/recode; make install clean
-* BSD: ftp.gnu.org/gnu/recode/
-* Red Hat: rpm -Uvh recode-3.6-6.i386.rpm
-* Debian: Available via apt-get
-* Win32: http://unxutils.sourceforge.net
View
@@ -56,9 +56,9 @@ function doCluster($type, $confirm=false) {
foreach($_REQUEST['table'] as $o) {
$status = $data->clusterIndex($o);
if ($status == 0)
- $msg.= sprintf('%s: %s<br />', htmlentities($o), $lang['strclusteredgood']);
+ $msg.= sprintf('%s: %s<br />', htmlentities($o, ENT_QUOTES, 'UTF-8'), $lang['strclusteredgood']);
else {
- doDefault($type, sprintf('%s%s: %s<br />', $msg, htmlentities($o), $lang['strclusteredbad']));
+ doDefault($type, sprintf('%s%s: %s<br />', $msg, htmlentities($o, ENT_QUOTES, 'UTF-8'), $lang['strclusteredbad']));
return;
}
}
@@ -141,9 +141,9 @@ function doReindex($type, $confirm=false) {
foreach($_REQUEST['table'] as $o) {
$status = $data->reindex(strtoupper($type), $o, isset($_REQUEST['reindex_force']));
if ($status == 0)
- $msg.= sprintf('%s: %s<br />', htmlentities($o), $lang['strreindexgood']);
+ $msg.= sprintf('%s: %s<br />', htmlentities($o, ENT_QUOTES, 'UTF-8'), $lang['strreindexgood']);
else {
- doDefault($type, sprintf('%s%s: %s<br />', $msg, htmlentities($o), $lang['strreindexbad']));
+ doDefault($type, sprintf('%s%s: %s<br />', $msg, htmlentities($o, ENT_QUOTES, 'UTF-8'), $lang['strreindexbad']));
return;
}
}
@@ -215,9 +215,9 @@ function doAnalyze($type, $confirm=false) {
foreach($_REQUEST['table'] as $o) {
$status = $data->analyzeDB($o);
if ($status == 0)
- $msg.= sprintf('%s: %s<br />', htmlentities($o), $lang['stranalyzegood']);
+ $msg.= sprintf('%s: %s<br />', htmlentities($o, ENT_QUOTES, 'UTF-8'), $lang['stranalyzegood']);
else {
- doDefault($type, sprintf('%s%s: %s<br />', $msg, htmlentities($o), $lang['stranalyzebad']));
+ doDefault($type, sprintf('%s%s: %s<br />', $msg, htmlentities($o, ENT_QUOTES, 'UTF-8'), $lang['stranalyzebad']));
return;
}
}
@@ -292,9 +292,9 @@ function doVacuum($type, $confirm = false) {
foreach($_REQUEST['table'] as $t) {
$status = $data->vacuumDB($t, isset($_REQUEST['vacuum_analyze']), isset($_REQUEST['vacuum_full']), isset($_REQUEST['vacuum_freeze']));
if ($status == 0)
- $msg.= sprintf('%s: %s<br />', htmlentities($t), $lang['strvacuumgood']);
+ $msg.= sprintf('%s: %s<br />', htmlentities($t, ENT_QUOTES, 'UTF-8'), $lang['strvacuumgood']);
else {
- doDefault($type, sprintf('%s%s: %s<br />', $msg, htmlentities($t), $lang['strvacuumbad']));
+ doDefault($type, sprintf('%s%s: %s<br />', $msg, htmlentities($t, ENT_QUOTES, 'UTF-8'), $lang['strvacuumbad']));
return;
}
}
View
@@ -38,7 +38,7 @@
if (in_array($h, $fkeynames))
echo '<img src="'. $misc->icon('ForeignKey') .'" alt="[referenced key]" />';
- echo htmlentities($h), '</th>';
+ echo htmlentities($h, ENT_QUOTES, 'UTF-8'), '</th>';
}
echo "</tr>\n";
View
@@ -121,9 +121,9 @@ function doDrop($confirm) {
foreach($_REQUEST['dropdatabase'] as $d) {
$status = $data->dropDatabase($d);
if ($status == 0)
- $msg.= sprintf('%s: %s<br />', htmlentities($d), $lang['strdatabasedropped']);
+ $msg.= sprintf('%s: %s<br />', htmlentities($d, ENT_QUOTES, 'UTF-8'), $lang['strdatabasedropped']);
else {
- doDefault(sprintf('%s%s: %s<br />', $msg, htmlentities($d), $lang['strdatabasedroppedbad']));
+ doDefault(sprintf('%s%s: %s<br />', $msg, htmlentities($d, ENT_QUOTES, 'UTF-8'), $lang['strdatabasedroppedbad']));
return;
}
}// Everything went fine, back to Default page...
@@ -156,10 +156,7 @@ function doCreate($msg = '') {
if (!isset($_POST['formName'])) $_POST['formName'] = '';
// Default encoding is that in language file
if (!isset($_POST['formEncoding'])) {
- if (isset($lang['appdbencoding']))
- $_POST['formEncoding'] = $lang['appdbencoding'];
- else
- $_POST['formEncoding'] = '';
+ $_POST['formEncoding'] = '';
}
if (!isset($_POST['formTemplate'])) $_POST['formTemplate'] = 'template1';
if (!isset($_POST['formSpc'])) $_POST['formSpc'] = '';
View
@@ -363,6 +363,9 @@ function getDatabaseAccessor($database, $server_id = null) {
$data = new $_type($_connection->conn);
$data->platform = $_connection->platform;
+ /* we work on UTF-8 only encoding */
+ $data->execute("SET client_encoding TO 'UTF-8'");
+
return $data;
}
@@ -377,9 +380,9 @@ function printHeader($title = '', $script = null, $frameset = false) {
global $appName, $lang, $_no_output, $conf;
if (!isset($_no_output)) {
- header("Content-Type: text/html; charset=" . $lang['appcharset']);
+ header("Content-Type: text/html; charset=utf-8");
// Send XHTML headers, or regular XHTML strict headers
- echo "<?xml version=\"1.0\" encoding=\"", htmlspecialchars($lang['appcharset']), "\"?>\n";
+ echo "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n";
if ($frameset == true) {
echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Frameset//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd\">\n";
} else if (isset($conf['use_xhtml_strict']) && $conf['use_xhtml_strict']) {
@@ -392,7 +395,7 @@ function printHeader($title = '', $script = null, $frameset = false) {
echo ">\n";
echo "<head>\n";
- echo "<meta http-equiv=\"Content-Type\" content=\"text/html; charset={$lang['appcharset']}\" />\n";
+ echo "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />\n";
// Theme
echo "<link rel=\"stylesheet\" href=\"themes/{$conf['theme']}/global.css\" type=\"text/css\" />\n";
echo "<link rel=\"shortcut icon\" href=\"images/themes/{$conf['theme']}/Favicon.ico\" type=\"image/vnd.microsoft.icon\" />\n";
@@ -1584,7 +1587,7 @@ function printActionUrl(&$action, &$fields, $attr = null) {
$sep = '&';
}
- $url = htmlentities($url);
+ $url = htmlentities($url, ENT_QUOTES, 'UTF-8');
if ($attr !== null && $url != '')
return ' '.$attr.'="'.$url.'"';
@@ -1718,7 +1721,7 @@ function printTable(&$tabledata, &$columns, &$actions, $nodata = null, $pre_fn =
foreach ($ma['keycols'] as $k => $v)
$a[$k] = $tabledata->fields[$v];
echo "<td>";
- echo "<input type=\"checkbox\" name=\"ma[]\" value=\"". htmlentities(serialize($a)) ."\" />";
+ echo "<input type=\"checkbox\" name=\"ma[]\" value=\"". htmlentities(serialize($a), ENT_COMPAT, 'UTF-8') ."\" />";
echo "</td>\n";
}
@@ -1828,10 +1831,10 @@ function printTreeXML(&$treedata, &$attrs) {
global $conf, $lang;
if (!isset($attrs['nohead']) || $attrs['nohead'] === false) {
- header("Content-Type: text/xml");
+ header("Content-Type: text/xml; charset=UTF-8");
header("Cache-Control: no-cache");
- echo "<?xml version=\"1.0\" encoding=\"", htmlspecialchars($lang['appcharset']), "\"?>\n";
+ echo "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n";
echo "<tree>\n";
}
@@ -2216,17 +2219,17 @@ function getAutocompleteFKProperties($table) {
foreach ($fksprops['byconstr'] as $conid => $props) {
$fksprops['code'] .= "constrs.constr_{$conid} = {\n";
$fksprops['code'] .= 'pattnums: ['. implode(',',$props['pattnums']) ."],\n";
- $fksprops['code'] .= "f_table:'". addslashes(htmlentities($props['f_table'], ENT_QUOTES)) ."',\n";
- $fksprops['code'] .= "f_schema:'". addslashes(htmlentities($props['f_schema'], ENT_QUOTES)) ."',\n";
+ $fksprops['code'] .= "f_table:'". addslashes(htmlentities($props['f_table'], ENT_QUOTES, 'UTF-8')) ."',\n";
+ $fksprops['code'] .= "f_schema:'". addslashes(htmlentities($props['f_schema'], ENT_QUOTES, 'UTF-8')) ."',\n";
$_ = '';
foreach ($props['pattnames'] as $n) {
- $_ .= ",'". htmlentities($n, ENT_QUOTES) ."'";
+ $_ .= ",'". htmlentities($n, ENT_QUOTES, 'UTF-8') ."'";
}
$fksprops['code'] .= 'pattnames: ['. substr($_, 1) ."],\n";
$_ = '';
foreach ($props['fattnames'] as $n) {
- $_ .= ",'". htmlentities($n, ENT_QUOTES) ."'";
+ $_ .= ",'". htmlentities($n, ENT_QUOTES, 'UTF-8') ."'";
}
$fksprops['code'] .= 'fattnames: ['. substr($_, 1) ."]\n";
@@ -2238,9 +2241,9 @@ function getAutocompleteFKProperties($table) {
$fksprops['code'] .= "attrs.attr_{$attnum} = [". implode(',', $fksprops['byfield'][$attnum]) ."];\n";
}
- $fksprops['code'] .= "var table='". addslashes(htmlentities($table, ENT_QUOTES)) ."';";
- $fksprops['code'] .= "var server='". htmlentities($_REQUEST['server']) ."';";
- $fksprops['code'] .= "var database='". addslashes(htmlentities($_REQUEST['database'], ENT_QUOTES)) ."';";
+ $fksprops['code'] .= "var table='". addslashes(htmlentities($table, ENT_QUOTES, 'UTF-8')) ."';";
+ $fksprops['code'] .= "var server='". htmlentities($_REQUEST['server'], ENT_QUOTES, 'UTF-8') ."';";
+ $fksprops['code'] .= "var database='". addslashes(htmlentities($_REQUEST['database'], ENT_QUOTES, 'UTF-8')) ."';";
$fksprops['code'] .= "</script>\n";
$fksprops['code'] .= '<div id="fkbg"></div>';
@@ -7331,19 +7331,6 @@ function setComment($obj_type, $obj_name, $table, $comment, $basetype = NULL) {
}
- /**
- * Sets the client encoding
- * @param $encoding The encoding to for the client
- * @return 0 success
- */
- function setClientEncoding($encoding) {
- $this->clean($encoding);
-
- $sql = "SET CLIENT_ENCODING TO '{$encoding}'";
-
- return $this->execute($sql);
- }
-
/**
* A private helper method for executeScript that advances the
* character by 1. In psql this is careful to take into account
View
@@ -146,7 +146,7 @@
echo "<html xmlns=\"http://www.w3.org/1999/xhtml\">\r\n";
echo "<head>\r\n";
echo "\t<title></title>\r\n";
- echo "\t<meta http-equiv=\"Content-Type\" content=\"text/html; charset={$data->codemap[$dbEncoding]}\" />\r\n";
+ echo "\t<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />\r\n";
echo "</head>\r\n";
echo "<body>\r\n";
echo "<table class=\"phppgadmin\">\r\n";
@@ -177,10 +177,7 @@
echo "</html>\r\n";
}
elseif ($format == 'xml') {
- echo "<?xml version=\"1.0\"";
- if (isset($data->codemap[$dbEncoding]))
- echo " encoding=\"{$data->codemap[$dbEncoding]}\"";
- echo " ?>\n";
+ echo "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n";
echo "<data>\n";
if (!$rs->EOF) {
// Output header row
View
@@ -341,9 +341,9 @@ function printTableRowCells(&$rs, &$fkey_information, $withOid) {
/* $fkey_information['common_url'] is already urlencoded */
$query_params .= '&amp;'. $fkey_information['common_url'];
echo "<div style=\"display:inline-block;\">";
- echo "<a class=\"fk fk_". htmlentities($conid) ."\" href=\"display.php?{$query_params}\">";
+ echo "<a class=\"fk fk_". htmlentities($conid, ENT_QUOTES, 'UTF-8') ."\" href=\"display.php?{$query_params}\">";
echo "<img src=\"".$misc->icon('ForeignKey')."\" style=\"vertical-align:middle;\" alt=\"[fk]\" title=\""
- . htmlentities($fkey_information['byconstr'][$conid]['consrc'])
+ . htmlentities($fkey_information['byconstr'][$conid]['consrc'], ENT_QUOTES, 'UTF-8')
."\" />";
echo "</a>";
echo "</div>";
View
@@ -381,10 +381,10 @@ function doDrop($confirm) {
foreach($_POST['function_oid'] as $k => $s) {
$status = $data->dropFunction($s, isset($_POST['cascade']));
if ($status == 0)
- $msg.= sprintf('%s: %s<br />', htmlentities($_POST['function'][$k]), $lang['strfunctiondropped']);
+ $msg.= sprintf('%s: %s<br />', htmlentities($_POST['function'][$k], ENT_QUOTES, 'UTF-8'), $lang['strfunctiondropped']);
else {
$data->endTransaction();
- doDefault(sprintf('%s%s: %s<br />', $msg, htmlentities($_POST['function'][$k]), $lang['strfunctiondroppedbad']));
+ doDefault(sprintf('%s%s: %s<br />', $msg, htmlentities($_POST['function'][$k], ENT_QUOTES, 'UTF-8'), $lang['strfunctiondroppedbad']));
return;
}
}
View
@@ -88,7 +88,7 @@ function doDelHistory($qid, $confirm) {
echo "<h3>{$lang['strdelhistory']}</h3>\n";
echo "<p>{$lang['strconfdelhistory']}</p>\n";
- echo "<pre>", htmlentities($_SESSION['history'][$_REQUEST['server']][$_REQUEST['database']][$qid]['query']), "</pre>";
+ echo "<pre>", htmlentities($_SESSION['history'][$_REQUEST['server']][$_REQUEST['database']][$qid]['query'], ENT_QUOTES, 'UTF-8'), "</pre>";
echo "<form action=\"history.php\" method=\"post\">\n";
echo "<input type=\"hidden\" name=\"action\" value=\"delhistory\" />\n";
echo "<input type=\"hidden\" name=\"queryid\" value=\"$qid\" />\n";
View
@@ -3,20 +3,6 @@ Translators
Please read the TRANSLATORS file in the top directory.
-"recoded" directory contains the HTML Unicode recodings of the source
-language files. These are the actual files used by phpPgAdmin
-when displaying strings.
-
-Instructions on recoding:
-
-cd lang
-./lang2xml <language_file> (eg. 'french.php')
-
-Running lang2xml with no arguments will recode all language files:
-
-cd lang
-lang2xml
-
To check your translation:
cd lang
@@ -26,4 +12,3 @@ To synchronize your translation with english.php:
cd lang
./synch <language> (eg. 'polish');
-
Oops, something went wrong.

0 comments on commit 6ca9379

Please sign in to comment.