diff --git a/LangCodes.php b/LangCodes.php
new file mode 100644
index 0000000..2d58bc7
--- /dev/null
+++ b/LangCodes.php
@@ -0,0 +1,23 @@
+'fr_FR',
+ 'en'=>'en_US'
+ );
+ return $all_lang[$code];
+ }
+ public function getNameLang($code_lang){
+ $name_lang=array(
+ 'fr'=>_('French'),
+ 'en'=>_('English')
+ );
+ return $name_lang[$code_lang];
+ }
+}
+?>
\ No newline at end of file
diff --git a/admin/classes/common/DBService.php b/admin/classes/common/DBService.php
index b45e8c3..f6e58cb 100644
--- a/admin/classes/common/DBService.php
+++ b/admin/classes/common/DBService.php
@@ -21,22 +21,22 @@ class DBService {
public function __construct($dbname = null){
Config::init();
if (!($this->db = new mysqli(Config::$database->host, Config::$database->username, Config::$database->password))){
- throw new Exception("There was a problem with the database: " . $this->db->error);
+ throw new Exception(_("There was a problem with the database: ") . $this->db->error);
}else if ($dbname){
if (!$this->db->select_db($dbname)){
- throw new Exception("There was a problem with the database: " . $this->db->error);
+ throw new Exception(_("There was a problem with the database: ") . $this->db->error);
}
}else if (!($this->db->select_db(Config::$database->name))){
- throw new Exception("There was a problem with the database: " . $this->db->error);
+ throw new Exception(_("There was a problem with the database: ") . $this->db->error);
}
if ($dbname)
$this->changeDB($dbname);
}
- public function changeDB($databaseName){
- // $databaseName='coral_reporting_pprd';
+ public function changeDB($databaseName) {
+ //$databaseName='coral_reporting_pprd';
if (!$this->db->select_db($databaseName)){
- throw new Exception("There was a problem with the database: " . $this->db->error);
+ throw new Exception(_("There was a problem with the database: ") . $this->db->error);
}
return $this;
}
@@ -45,7 +45,7 @@ public function getSQLdb(){
}
public function query($sql){
if (!($result = $this->db->query($sql)))
- throw new Exception("There was a problem with the database: " . $this->db->error);
+ throw new Exception(_("There was a problem with the database: ") . $this->db->error);
else if ($result instanceof mysqli_result){
return new DBResult($result);
}else if ($result){
diff --git a/admin/classes/domain/Report.php b/admin/classes/domain/Report.php
index 164a53f..99ab6a1 100644
--- a/admin/classes/domain/Report.php
+++ b/admin/classes/domain/Report.php
@@ -136,18 +136,18 @@ public function printPlatformInfo(&$platforms){
foreach ( $platforms as $platform ){
echo "
"._("This Interface ");
if ($platform['counterCompliantInd'] == '1'){
- echo 'provides COUNTER compliant stats. ';
+ echo _("provides COUNTER compliant stats.").' ';
}else{
- echo 'does not provide COUNTER compliant stats. ';
+ echo _("does not provide COUNTER compliant stats.").' ';
}
if ($platform['noteText']){
- echo " Interface Notes: {$platform['noteText']} ";
+ echo " "._("Interface Notes").": {$platform['noteText']} ";
}
echo '
';
}
@@ -155,11 +155,11 @@ public function printPlatformInfo(&$platforms){
public function printPublisherInfo(&$publishers){
foreach ( $publishers as $publisher ){
- echo "
';
}
@@ -218,7 +218,7 @@ public function process(DBResult &$reportArray, ReportNotes &$notes){
if ($this->report->hasGroupTotalInd() && $hold_rprt_grpng_data){
// one last grouping summary
if ($countForGrouping > 1){
- $grp .= "
+
+
+ "._("Invalid translation route!");
+ }
+ // Get language of navigator
+ $defLang = substr($_SERVER["HTTP_ACCEPT_LANGUAGE"],0,2);
+ // Show an ordered list
+ sort($lang);
+ for($i=0; $i".$lang_name->getNameLang(substr($lang[$i],0,2))."";
+ }else{
+ echo "";
+ }
+ }else{
+ if($defLang==substr($lang[$i],0,2)){
+ echo "";
+ }else{
+ echo "";
+ }
+ }
+ }
+ ?>
+
+
+
diff --git a/install/create_tables_data.sql b/install/create_tables_data.sql
index 1d86036..f1eea66 100644
--- a/install/create_tables_data.sql
+++ b/install/create_tables_data.sql
@@ -11,7 +11,7 @@ CREATE TABLE IF NOT EXISTS `_DATABASE_NAME_`.`Report` (
`excelOnlyInd` tinyint(1) default NULL,
`reportDatabaseName` varchar(45) NOT NULL,
PRIMARY KEY (`reportID`)
-) ENGINE=MyISAM AUTO_INCREMENT=0 DEFAULT CHARSET=latin1;
+) ENGINE=MyISAM AUTO_INCREMENT=0 DEFAULT CHARSET=utf8;
@@ -20,7 +20,7 @@ CREATE TABLE IF NOT EXISTS `_DATABASE_NAME_`.`ReportGroupingColumn` (
`reportGroupingColumnName` varchar(45) NOT NULL,
`reportGroupingColumnID` int(10) unsigned NOT NULL auto_increment,
PRIMARY KEY USING BTREE (`reportGroupingColumnID`)
-) ENGINE=MyISAM AUTO_INCREMENT=0 DEFAULT CHARSET=latin1;
+) ENGINE=MyISAM AUTO_INCREMENT=0 DEFAULT CHARSET=utf8;
@@ -37,7 +37,7 @@ CREATE TABLE IF NOT EXISTS `_DATABASE_NAME_`.`ReportParameter` (
`parentReportParameterID` int(11) default NULL,
`parameterSQLRestriction` text,
PRIMARY KEY (`reportParameterID`)
-) ENGINE=MyISAM AUTO_INCREMENT=0 DEFAULT CHARSET=latin1;
+) ENGINE=MyISAM AUTO_INCREMENT=0 DEFAULT CHARSET=utf8;
@@ -48,7 +48,7 @@ CREATE TABLE IF NOT EXISTS `_DATABASE_NAME_`.`ReportSum` (
`reportGroupingColumnName` varchar(45) default NULL,
`reportAction` varchar(45) default NULL,
PRIMARY KEY (`reportSumID`)
-) ENGINE=MyISAM AUTO_INCREMENT=0 DEFAULT CHARSET=latin1;
+) ENGINE=MyISAM AUTO_INCREMENT=0 DEFAULT CHARSET=utf8;
DELETE FROM `_DATABASE_NAME_`.Report;
diff --git a/install/manual_upgrade_charset_utf8.txt b/install/manual_upgrade_charset_utf8.txt
new file mode 100644
index 0000000..a9d0f4e
--- /dev/null
+++ b/install/manual_upgrade_charset_utf8.txt
@@ -0,0 +1,6 @@
+How to change the charset in the database to utf8
+
+ -Open SQL file in /coral/reports/install/update_latin1-to-utf8.sql and replace _DATABASE_NAME_ with your database schema name
+ -Run SQL file
+
+This script will change the charset in the database and convert all tables to utf8.
\ No newline at end of file
diff --git a/install/update_latin1-to-utf8.sql b/install/update_latin1-to-utf8.sql
new file mode 100644
index 0000000..e231252
--- /dev/null
+++ b/install/update_latin1-to-utf8.sql
@@ -0,0 +1,5 @@
+ALTER DATABASE `_DATABASE_NAME_` CHARACTER SET utf8 COLLATE utf8_general_ci;
+ALTER TABLE `_DATABASE_NAME_`.`Report` CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;
+ALTER TABLE `_DATABASE_NAME_`.`ReportGroupingColumn` CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;
+ALTER TABLE `_DATABASE_NAME_`.`ReportParameter` CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;
+ALTER TABLE `_DATABASE_NAME_`.`ReportSum` CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;
\ No newline at end of file
diff --git a/js/common.js b/js/common.js
index ec002ab..fad33d3 100644
--- a/js/common.js
+++ b/js/common.js
@@ -15,6 +15,15 @@
**************************************************************************************************************************
*/
+/*
+ * gt : Object to translate JavaScript strings
+ * function _() : Syntax of gettext
+ */
+var gt = new Gettext({ 'domain' : 'messages' });
+function _(msgid) {
+ return gt.gettext(msgid);
+}
+
//image preloader
(function($) {
var cache = [];
diff --git a/js/index.js b/js/index.js
index cb9457e..559ac9a 100644
--- a/js/index.js
+++ b/js/index.js
@@ -1,147 +1,147 @@
-/*
- **************************************************************************************************************************
- ** CORAL Usage Statistics Reporting Module v. 1.0
- **
- ** Copyright (c) 2010 University of Notre Dame
- **
- ** This file is part of CORAL.
- **
- ** CORAL is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- **
- ** CORAL is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
- **
- ** You should have received a copy of the GNU General Public License along with CORAL. If not, see .
- **
- **************************************************************************************************************************
- */
-
-$("#reportID").change(function(){
- //updateParms;
- if ($("#reportID").val() != "") {
- $("#div_parm").html(" Refreshing Contents...");
- $.ajax({
- type: "GET",
- url: "ajax_htmldata.php",
- cache: false,
- data: "action=getReportParameters&reportID=" + $("#reportID").val(),
- success: function(html) {
- $("#div_parm").html(html);
- }
-
-
- });
- }else{
- $("#div_parm").html("");
- }
-
-
-});
-
-
-
-function clearParms() {
-
- $("#reportID").val("");
- $("#div_parm").html("");
-
-
-}
-
-
-function updateChildren(parmID){
-
- //first get a list of this parm's children
- $.ajax({
- type: "GET",
- url: "ajax_htmldata.php",
- cache: false,
- data: "action=getChildParameters&parentReportParameterID=" + parmID,
- success: function(childParms) {
- var childParmArray = childParms.split("|");
-
- for (var i=0; i=0; i--)
- {
- if(theSelFrom.options[i].selected)
- {
- selectedText[selectedCount] = theSelFrom.options[i].text;
- selectedValues[selectedCount] = theSelFrom.options[i].value;
- if (theSelFrom.length > 0){
- theSelFrom.options[i] = null;
- }
- selectedCount++;
- }
- }
-
- // Add the selected text/values in reverse order.
- // This will add the Options to the 'to' Select
- // This will add the Options to the 'to' Select
- // in the same order as they were in the 'from' Select.
- for(i=selectedCount-1; i>=0; i--)
- {
- theSelTo.options[theSelTo.length] = new Option(selectedText[i], selectedValues[i]);
- }
-
-}
-
-function placeInHidden(delim, selStr, hidStr)
-{
- var selObj = document.getElementById(selStr);
- var hideObj = document.getElementById(hidStr);
- hideObj.value = '';
- for (var i=0; i.
+ **
+ **************************************************************************************************************************
+ */
+
+$("#reportID").change(function(){
+ //updateParms;
+ if ($("#reportID").val() != "") {
+ $("#div_parm").html(" "+_("Refreshing Contents..."));
+ $.ajax({
+ type: "GET",
+ url: "ajax_htmldata.php",
+ cache: false,
+ data: "action=getReportParameters&reportID=" + $("#reportID").val(),
+ success: function(html) {
+ $("#div_parm").html(html);
+ }
+
+
+ });
+ }else{
+ $("#div_parm").html("");
+ }
+
+
+});
+
+
+
+function clearParms() {
+
+ $("#reportID").val("");
+ $("#div_parm").html("");
+
+
+}
+
+
+function updateChildren(parmID){
+
+ //first get a list of this parm's children
+ $.ajax({
+ type: "GET",
+ url: "ajax_htmldata.php",
+ cache: false,
+ data: "action=getChildParameters&parentReportParameterID=" + parmID,
+ success: function(childParms) {
+ var childParmArray = childParms.split("|");
+
+ for (var i=0; i=0; i--)
+ {
+ if(theSelFrom.options[i].selected)
+ {
+ selectedText[selectedCount] = theSelFrom.options[i].text;
+ selectedValues[selectedCount] = theSelFrom.options[i].value;
+ if (theSelFrom.length > 0){
+ theSelFrom.options[i] = null;
+ }
+ selectedCount++;
+ }
+ }
+
+ // Add the selected text/values in reverse order.
+ // This will add the Options to the 'to' Select
+ // This will add the Options to the 'to' Select
+ // in the same order as they were in the 'from' Select.
+ for(i=selectedCount-1; i>=0; i--)
+ {
+ theSelTo.options[theSelTo.length] = new Option(selectedText[i], selectedValues[i]);
+ }
+
+}
+
+function placeInHidden(delim, selStr, hidStr)
+{
+ var selObj = document.getElementById(selStr);
+ var hideObj = document.getElementById(hidStr);
+ hideObj.value = '';
+ for (var i=0; i, all rights reserved
+
+This program is free software; you can redistribute it and/or modify it
+under the terms of the GNU Library General Public License as published
+by the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+USA.
+
+=head1 NAME
+
+Javascript Gettext - Javascript implemenation of GNU Gettext API.
+
+=head1 SYNOPSIS
+
+ // //////////////////////////////////////////////////////////
+ // Optimum caching way
+
+
+
+
+ // in domain.json
+ json_locale_data = {
+ "mydomain" : {
+ // po header fields
+ "" : {
+ "plural-forms" : "...",
+ "lang" : "en",
+ },
+ // all the msgid strings and translations
+ "msgid" : [ "msgid_plural", "translation", "plural_translation" ],
+ },
+ };
+ // please see the included bin/po2json script for the details on this format
+
+This method also allows you to use unsupported file formats, so long as you can parse them into the above format.
+
+=item 2. Use AJAX to load language file.
+
+Use XMLHttpRequest (actually, SJAX - syncronous) to load an external resource.
+
+Supported external formats are:
+
+=over
+
+=item * Javascript Object Notation (.json)
+
+(see bin/po2json)
+
+ type=application/json
+
+=item * Uniforum Portable Object (.po)
+
+(see GNU Gettext's xgettext)
+
+ type=application/x-po
+
+=item * Machine Object (compiled .po) (.mo)
+
+NOTE: .mo format isn't actually supported just yet, but support is planned.
+
+(see GNU Gettext's msgfmt)
+
+ type=application/x-mo
+
+=back
+
+=back
+
+=head1 METHODS
+
+The following methods are implemented:
+
+ new Gettext(args)
+ textdomain (domain)
+ gettext (msgid)
+ dgettext (domainname, msgid)
+ dcgettext (domainname, msgid, LC_MESSAGES)
+ ngettext (msgid, msgid_plural, count)
+ dngettext (domainname, msgid, msgid_plural, count)
+ dcngettext (domainname, msgid, msgid_plural, count, LC_MESSAGES)
+ pgettext (msgctxt, msgid)
+ dpgettext (domainname, msgctxt, msgid)
+ dcpgettext (domainname, msgctxt, msgid, LC_MESSAGES)
+ npgettext (msgctxt, msgid, msgid_plural, count)
+ dnpgettext (domainname, msgctxt, msgid, msgid_plural, count)
+ dcnpgettext (domainname, msgctxt, msgid, msgid_plural, count, LC_MESSAGES)
+ strargs (string, args_array)
+
+
+=head2 new Gettext (args)
+
+Several methods of loading locale data are included. You may specify a plugin or alternative method of loading data by passing the data in as the "locale_data" option. For example:
+
+ var get_locale_data = function () {
+ // plugin does whatever to populate locale_data
+ return locale_data;
+ };
+ var gt = new Gettext( 'domain' : 'messages',
+ 'locale_data' : get_locale_data() );
+
+The above can also be used if locale data is specified in a statically included
+
@@ -71,7 +72,7 @@
@@ -79,8 +80,3 @@