17 $monLibrary= dirname(__FILE__) .
"/../library";
18 $sharedLibrary= dirname(__FILE__) .
"/../../shared/library";
19 $bankingDir = dirname(__FILE__) .
"/../../banking";
20 require_once(
"$monLibrary/cu_top.i");
21 require_once(
"$monLibrary/ck_hticket.i");
22 require_once(
"$monLibrary/monitorView.i");
23 require_once(
"$sharedLibrary/hcuTranslate.i");
24 require_once(
"$sharedLibrary/cu_func.i");
26 if (!CheckPerm($link, $Hu, basename($_SERVER[
'SCRIPT_NAME']), $_SERVER[
'REMOTE_ADDR'])) {
29 header(
"Location: /hcuadm/hcu_noperm.prg");
35 function TransTableSort( $a, $b ) {
36 $result = strcasecmp( $a, $b );
39 $result = strcmp( $a, $b );
51 $languageAry = array(
"en_US"=>
"English",
"es_US"=>
"Spanish",
"pl_US"=>
"Polish");
52 $languageKeys = array_keys($languageAry);
55 $ignoreList[
"es_US"] = array(
"Total",
"Quicken WebConnect",
"PIN",
"No",
"Error" );
56 $ignoreList[
"pl_US"] = array();
60 $dms_ok=array(
"action"=>
"string",
"key"=>
"string",
"screen" =>
"string",
61 "delimiter"=>
"string" );
62 dms_import_v2( $HB_ENV,
"MY_POST", $dms_ok);
64 $self = $_SERVER[
'SCRIPT_NAME'];
65 $baseURL = $_SERVER[
"SCRIPT_NAME"];
67 $action = $HB_ENV[
"MY_POST"][
"action"];
68 $screen = $HB_ENV[
"MY_POST"][
"screen"];
70 if ( $action ==
"import" &&
71 $screen ==
"import" ) {
75 $delimiter = $HB_ENV[
"MY_POST"][
"delimiter"];
76 $delimiterChoices = array(
",",
"|",
";",
"^" );
77 if ( !in_array( $delimiter, $delimiterChoices ) && $delimiter !=
"tab" ) {
78 throw new ErrorException(
"Error - Invalid Delimiter");
81 if ( $delimiter ==
"tab" ) {
85 $uploadFile =
"/tmp/hcuTransUpload.txt";
88 $importLines = file( $uploadFile, FILE_IGNORE_NEW_LINES );
90 $importInfo = array();
92 for ( $i = 0; $i < count( $importLines ); $i++ ) {
93 $line = trim( $importLines[$i] );
94 if ( substr( $line, 0, 1) ==
"#" )
continue;
96 $lineParts = explode( $delimiter, $line );
99 if ( !in_array($lineParts[1], $keyList) ) {
100 $keyList[] = $lineParts[1];
104 $importInfo[$lineParts[1]][$lineParts[0]] = ConvertFromUTF8( $lineParts[2] );
108 $importEntries = array();
109 for ( $k = 0; $k < count( $keyList ); $k++ ) {
111 $entry[
"key"] = $keyList[$k];
115 for ( $l = 0; $l < count( $languageKeys ); $l++ ) {
117 if ( $l == $englishEntry ) {
118 $englishPhrase = $importInfo[$keyList[$k]][$languageKeys[$l]];
121 $phrase = $importInfo[$keyList[$k]][$languageKeys[$l]];
122 if ( !strlen( trim( $phrase ) ) ) {
123 $phrase = $englishPhrase;
126 $entry[$languageKeys[$l]] = $phrase;
129 $importEntries[] = $entry;
133 for ( $l = 0; $l < count( $languageKeys ); $l++ ) {
137 for ( $k = 0; $k < count( $keyList ); $k++ ) {
141 for ( $p = 0; $p < count( $importEntries ); $p++ ) {
142 if ( $importEntries[$p][
"key"] == $key ) {
143 $phrase = trim( $importEntries[$p][$languageKeys[$l]] );
151 $transTable->messages[$key] = addslashes( $phrase );
156 uksort( $transTable->messages,
"TransTableSort" );
159 WriteTranslationTableFile($languageKeys[$l], $transTable);
166 if ( $action ==
"sort" ) {
167 for ( $i = 0; $i < count( $languageKeys ); $i++ ) {
171 uksort( $transTable->messages,
"TransTableSort" );
173 WriteTranslationTableFile( $languageKeys[$i], $transTable );
178 }
else if ( $action ==
"removeEntry") {
179 $key = $HB_ENV[
"MY_POST"][
"key"];
182 for ( $i = 0; $i < count( $languageKeys ); $i++ ) {
186 unset( $transTable->messages[$key] );
189 uksort( $transTable->messages,
"TransTableSort" );
191 WriteTranslationTableFile( $languageKeys[$i], $transTable );
195 header(
'Content-Type: application/json');
196 print json_encode(
"");
200 }
else if ( $action ==
"updateEntry") {
202 $key = $HB_ENV[
"MY_POST"][
"key"];
205 for ( $i = 0; $i < count( $languageKeys ); $i++ ) {
209 $key = str_replace(
"'",
"", $key );
210 $transTable->messages[$key] = $_REQUEST[$languageKeys[$i]] ;
213 uksort( $transTable->messages,
"TransTableSort" );
215 WriteTranslationTableFile( $languageKeys[$i], $transTable );
219 header(
'Content-Type: application/json');
220 print json_encode(
"");
231 if ( $action ==
"edit" )
232 $actionName =
"(Edit)";
233 else if ( $action ==
"check" )
234 $actionName =
"(Check)";
235 else if ( $action ==
"import" )
236 $actionName =
"(Import)";
239 $callbackHost = trim( $_REQUEST[
"callback"] );
240 if ( $callbackHost ==
"" ) $callbackHost =
"www.homecu.net";
243 header(
'content-type: text/html; charset: utf-8');
245 $title=
"Credit Union Home Banking Settings $actionName";
246 printMonitorPageTop($title, $homecuKendoVersion, $cloudfrontDomainName);
250 font-family: Arial, Helvetica, sans-serif;
251 background-color: #EFEFEF;
255 background-color: #666;
257 border-bottom: 5px solid #cc0000;
259 header .header-title {
260 padding: 12px 0 5px 56px;
268 padding: 0 10px 10px 10px;
269 -moz-box-shadow: 0 1px 2px rgba(0,0,0,0.5);
270 -webkit-box-shadow: 0 1px 2px rgba(0,0,0,0.5);
271 box-shadow: 0 1px 2px rgba(0,0,0,0.5);
272 border: 1px solid rgba(255,255,255,0.2);
273 -moz-border-radius: 3px;
274 -webkit-border-radius: 3px;
276 background: -moz-linear-gradient(top, rgba(0,0,0,0.01) 0%, rgba(0,0,0,0.07) 100%);
277 background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(0,0,0,0.01)), color-stop(100%,rgba(0,0,0,0.07)));
278 background: -webkit-linear-gradient(top, rgba(0,0,0,0.01) 0%,rgba(0,0,0,0.07) 100%);
279 background: -o-linear-gradient(top, rgba(0,0,0,0.01) 0%,rgba(0,0,0,0.07) 100%);
280 background: -ms-linear-gradient(top, rgba(0,0,0,0.01) 0%,rgba(0,0,0,0.07) 100%);
281 background: linear-gradient(to bottom, rgba(0,0,0,0.01) 0%,rgba(0,0,0,0.07) 100%);
285 .configuration .options {
290 .configuration .options li {
297 .configuration .options li:after {
303 .configuration .configHead {
310 border-bottom: 1px solid #999;
312 .configuration .configHead label{
316 #detailConfiguration fieldset legend { 322 #detailConfiguration label { 328 #detailConfiguration fieldset.language div { 332 .configuration-language {
335 .configuration-language .lang-select {
338 vertical-align: middle;
339 border-right: 1px solid #AAA;
340 padding: 10px 10px 10px 0px;
343 .configuration-language .lang-title {
346 vertical-align: middle;
353 #editMenu .menuTree { 360 #editMenu .menuDetails { 363 .configuration-language ul {
366 .configuration-language li {
370 border-top:1px solid #DFDFDF;
375 font-family: Arial, Helvetica, sans-serif;
386 .sectionTitle strong {
392 padding: 20px 0 20px 20px;
393 background-color: #fcfcfc;
394 background: -webkit-gradient(linear, left top, left bottom, from(#ffffff), to(#efefef));
396 background: -webkit-linear-gradient(top, #ffffff, #efefef);
397 background: -moz-linear-gradient(top, #ffffff, #efefef);
398 background: -o-linear-gradient(top, #ffffff, #efefef);
399 background: -ms-linear-gradient(top, #ffffff, #efefef);
400 background: linear-gradient(top, #ffffff, #efefef);
401 -webkit-box-shadow: 0px 1px 2px #8e8e8e;
402 -moz-box-shadow: 0px 1px 2px #8e8e8e;
403 -o-box-shadow: 0px 1px 2px #8e8e8e;
404 box-shadow: 0px 1px 2px #8e8e8e;
416 #themeWrap .get-kendoui 420 -moz-border-radius:3px;
421 -webkit-border-radius:3px;
431 text-decoration: none;
432 display:
inline-block;
439 vertical-align: middle;
444 .k-theme-chooser .tc-link
446 vertical-align: middle;
448 padding: 0 4px 0 8px;
449 -moz-border-radius: 3px;
450 -webkit-border-radius: 3px;
456 vertical-align: middle;
464 list-style-type: none;
466 padding: 0 0 18px 10px;
467 border-bottom: 1px solid #dfdfdf;
468 font:75% Arial,Helvetica,sans-serif;
477 border-color: rgba(0,0,0,.1) rgba(0,0,0,.1) rgba(0,0,0,.1) rgba(255,255,255,.1);
478 display: inline-block;
492 border: 1px solid #fff;
495 .tc-theme .tc-link:hover
497 border-color: #d6d6d6;
498 -moz-box-shadow: 0 0 7px rgba(0,0,0,.15);
499 -webkit-box-shadow: 0 0 7px rgba(0,0,0,.15);
500 box-shadow: 0 0 7px rgba(0,0,0,.15);
503 .tc-theme .tc-link.active
505 border-color: #d6d6d6;
506 -moz-box-shadow: inset 0 0 7px rgba(0,0,0,.15);
507 -webkit-box-shadow: inset 0 0 7px rgba(0,0,0,.15);
508 box-shadow: inset 0 0 7px rgba(0,0,0,.15);
511 .tc-theme .tc-theme-name
518 #themeChooser .skin-black .k-state-selected{background-color:#0070e4;color:#fff;} 519 #themeChooser .skin-blueopal .k-state-selected{background-color:#005c83;color:#fff;} 520 #themeChooser .skin-bootstrap .k-state-selected{background-color:#0044cc;color:#fff;} 521 #themeChooser .skin-default .k-state-selected{background-color:#f0713a;color:#fff;} 522 #themeChooser .skin-highcontrast .k-state-selected{background-color:#a7008f;color:#fff;} 523 #themeChooser .skin-metro .k-state-selected{background-color:#8ebc00;color:#fff;} 524 #themeChooser .skin-metroblack .k-state-selected{background-color:#00aba9;color:#fff;} 525 #themeChooser .skin-silver .k-state-selected{background-color:#0879C0;color:#fff;} 526 #themeChooser .skin-uniform .k-state-selected{background-color:#ccc;color:#666;} 532 .k-tooltip-content { text-align: left;
538 printMonitorPageMiddle($title, array(
"REDIRECT" => array(
"list" => array(
"Monitor" => array(
"url" =>
"https://$callbackHost/monitor/mindex.html",
"target" =>
"_top"))),
539 "Check" => array(
"url" =>
"$self?action=check&callback=$callbackHost"),
"Edit" => array(
"url" =>
"$self?action=edit&callback=$callbackHost"),
"Re-Sort" => array(
"url" =>
"$self?action=sort&callback=$callbackHost"),
540 "Import" => array(
"url" =>
"$self?action=import&callback=$callbackHost")));
541 if ( $action ==
"edit" || $action ==
"" ) {
543 $languageKeysInfo = array();
545 for ( $i = 0; $i < count( $languageKeys ); $i++ ) {
546 $languageKeysInfo[$i][
"language"] = $languageKeys[$i];
547 $languageKeysInfo[$i][
"mc"] =
new hcu_talk_base( $languageKeys[$i] );
548 if ( $languageKeys[$i] ==
"en_US" ) {
554 $baseKeys = array_keys( $languageKeysInfo[$englishEntry][
"mc"]->messages );
557 $languageLists = array();
558 for ( $k = 0; $k < count( $baseKeys ); $k++ ) {
560 $entry[
"key"] = $baseKeys[$k];
562 for ( $i = 0; $i < count( $languageKeys ); $i++ ) {
563 $entry[$languageKeys[$i]] = $languageKeysInfo[$i][
"mc"]->msg($baseKeys[$k], HCU_DISPLAY_AS_JS);
566 $languageLists[] = $entry;
571 <div
id=
"editList"></div>
572 <div
id=
"helpInfo"></div>
574 <div
id=
"progressShow" style=
"z-index:20000;"></div>
575 <script
id=
"popup-editor" type=
"text/x-kendo-template">
576 <h3 style=
'text-align:center; width:100%;'>Edit Translation Entry</h3>
578 <label
for=
"key" style=
'font-weight:bold;'>Key:</label>
580 style=
"float:right; width:90%;" 581 data-bind=
"value:key" 582 data-value-field=
"key" 583 data-text-field=
"key" 588 <div style=
"clear:both"></div>
591 for ( $i = 0; $i < count( $languageKeys ); $i++ ) {
592 $lang = $languageKeys[$i];
595 <label
for=
"<?php echo $lang ?>" style=
'font-weight:bold;'><?php echo $lang ?>:</label>
596 <textarea name=
"<?php echo $lang ?>" 597 id=
"<?php echo $lang ?>" 598 style=
"float:right; width:90%;" 599 data-bind=
"value:<?php echo $lang ?>" 600 data-value-field=
"<?php echo $lang ?>" 601 data-text-field=
"<?php echo $lang ?>" 604 <div style=
"clear:both"></div>
610 <script
id=
"cmdTemplate" type=
"text/x-kendo-template">
611 <a
class=
"k-button" href=
"\#" onclick=
"return showHelp()">Help</a>
614 .k-edit-form-container { width:
auto; }
615 .edit_label { text-align: left; font-weight: bold; font-size: larger; }
616 .edit_entry { text-align: left; }
617 .odd-row { background-color:lightcyan; }
618 .header-row { background-color: lightsteelblue; font-weight: bold; }
619 .td-detail { text-align: center; width: 33%; }
621 <script type=
"text/javascript">
622 $(document).ready(
function() {
623 $(
"#tabstrip").kendoTabStrip({
624 animation: { open: { effects:
"fadeIn"} }
630 operators : { string : { contains :
"Contains"}},
631 ui :
function( element )
633 var parent = element.parent();
634 while( parent.children().length > 1 )
635 $(parent.children()[0]).
remove( );
637 parent.prepend(
"<input data-bind=\"value:filters[0].value\" class=\"k-textbox\" type=\"text\">" );
641 var phraseList = <?php echo str_replace(
'\\\u',
'\u', json_encode( $languageLists )); ?>;
642 $(
'#editList').kendoGrid({
643 dataSource: phraseList,
648 filterable: { contains:
true },
651 confirmation:
"Are you sure you want to delete this record?",
652 template: kendo.template($(
"#popup-editor").html())
655 if (confirm(
"Are you sure you want to save this change?")) {
657 var postData = JSON.parse(JSON.stringify(e.model));
658 postData[
"action"] =
"updateEntry";
661 $.each(postData,
function( index,
object ) {
662 if ( parameters.length > 0 ) parameters +=
"&";
663 parameters += index +
"=" + encodeURIComponent(
object);
666 kendo.ui.progress($(
'#progressShow'),
true);
668 $.post(
'<?php echo $baseURL ?>', parameters,
669 function (data, status, xhr) {
671 $.each(phraseList,
function( index,
object ) {
672 if (
object[
"key"] == postData[
"key"] ) {
674 for ( $i = 0; $i < count( $languageKeys ); $i++ ) {
675 print
"object[\"{$languageKeys[$i]}\"] = postData[\"{$languageKeys[$i]}\"];\n";
686 .fail(
function (xhr, status, error) {
687 alert(
'Some error happened:' + error);
690 .always(
function( xhr, status ) {
691 kendo.ui.progress($(
'#progressShow'),
false);
698 toolbar: [{ name:
"create" }, {
template: kendo.template($(
"#cmdTemplate").html()) } ],
700 { command: [
"edit",
"destroy"], title:
" ", width:
"172px" },
701 { field:
"key", title:
"Key", filterable: containsFilter, width:
"200px" }
703 for ( $i = 0; $i < count( $languageKeys ); $i++ ) {
704 print
",\n{ field: \"{$languageKeys[$i]}\", title: \"{$languageKeys[$i]}\", filterable: containsFilter, encoded: false }\n";
715 title:
"Character Translation",
720 }).data(
"kendoWindow");
724 function showHelp(e) {
725 var dialog = $(
"#helpInfo").data(
"kendoWindow");
727 [
'<table style="width:100%">',
730 ' <th class="header-row" colspan="3">Spanish</th>',
733 $transString = array(
"Á"=>
"&\#194;",
"É"=>
"&\#201;",
"Í"=>
"&\#205;",
"Ó"=>
"&\#211;",
734 "Ú"=>
"&\#218;",
"Ñ"=>
"&\#209;",
"á"=>
"&\#225;",
"é"=>
"&\#233;",
735 "í"=>
"&\#237;",
"ó"=>
"&\#243;",
"ú"=>
"&\#250;",
"ñ"=>
"&\#241;",
736 "¡"=>
"&\#161;",
"¿"=>
"&\#191;");
737 $transKeys = array_keys($transString);
740 for ( $i = 0; $i < count( $transKeys ); $i++ ) {
741 $htmlEntity = htmlentities($transKeys[$i]);
742 $hashCode = $transString[$transKeys[$i]];
744 '<tr class="<?php echo $rowBackground; ?>">',
745 ' <td class="td-detail"><?php echo $transKeys[$i]; ?></td><td class="td-detail"><?php echo $hashCode; ?></td><td class="td-detail"><?php echo $htmlEntity; ?></td>',
748 $rowBackground = ( $rowBackground ==
"odd-row" ) ?
"" :
"odd-row";
752 ' <th class="header-row" colspan="3">Polish</th>',
755 $transString = array(
"Ą"=>
"&\#260;",
"ą"=>
"&\#261;",
"Ę"=>
"&\#280;",
"ę"=>
"&\#281;",
756 "Ó"=>
"&\#211;",
"ó"=>
"&\#243;",
"Ć"=>
"&\#262;",
"ć"=>
"&\#263;",
757 "Ł"=>
"&\#321;",
"ł"=>
"&\#322;",
"Ń"=>
"&\#323;",
"ń"=>
"&\#324;",
758 "Ś"=>
"&\#346;",
"ś"=>
"&\#347;",
"Ź"=>
"&\#377;",
"ź"=>
"&\#378;",
759 "Ż"=>
"&\#379;",
"ż"=>
"&\#380;" );
760 $transKeys = array_keys($transString);
763 for ( $i = 0; $i < count( $transKeys ); $i++ ) {
764 $htmlEntity =
" ";
765 $hashCode = $transString[$transKeys[$i]];
767 '<tr class="<?php echo $rowBackground; ?>">',
768 ' <td class="td-detail"><?php echo $transKeys[$i]; ?></td><td class="td-detail"><?php echo $hashCode; ?></td><td class="td-detail"><?php echo $htmlEntity; ?></td>',
771 $rowBackground = ( $rowBackground ==
"odd-row" ) ?
"" :
"odd-row";
775 '</table>'].join(
"\n");
777 dialog.content(windowContents).open().center();
780 function textareaEditor(container, options) {
781 $(
'<textarea data-bind="value: ' + options.field +
'" cols="80" rows="5"></textarea>')
782 .appendTo(container);
785 function removeEntry(e) {
788 var modelData = JSON.parse(JSON.stringify(e.model));
790 postData[
"action"] =
"removeEntry";
791 postData[
"key"] = modelData[
"key"];
794 $.each(postData,
function( index,
object ) {
795 if ( parameters.length > 0 ) parameters +=
"&";
796 parameters += index +
"=" + encodeURIComponent(
object);
799 kendo.ui.progress($(
'#progressShow'),
true);
801 $.post(
'<?php echo $baseURL ?>', parameters,
802 function (data, status, xhr) {
806 .fail(
function (xhr, status, error) {
807 alert(
'Some error happened:' + error);
810 .always(
function( xhr, status ) {
811 kendo.ui.progress($(
'#progressShow'),
false);
816 }
else if ( $action ==
"check" ) {
818 $languageKeysInfo = array();
820 for ( $i = 0; $i < count( $languageKeys ); $i++ ) {
821 $languageKeysInfo[$i][
"language"] = $languageKeys[$i];
822 $languageKeysInfo[$i][
"mc"] =
new hcu_talk_base( $languageKeys[$i] );
823 $languageKeysInfo[$i][
"keys"] = array_keys( $languageKeysInfo[$i][
"mc"]->messages );
825 if ( $languageKeys[$i] ==
"en_US" ) {
832 $controlList = $languageKeysInfo[$englishEntry][
"keys"];
833 $untransList = array();
834 for ( $i = 0; $i < count( $controlList ); $i++ ) {
836 $controlKey = $controlList[$i];
837 $controlPhrase = stripslashes( $languageKeysInfo[$englishEntry][
"mc"]->messages[$controlKey] );
839 $languagePresent = array();
840 for ( $t = 0; $t < count( $languageKeysInfo ); $t++ ) {
843 if ( $englishEntry == $t )
continue;
846 $compareList = $languageKeysInfo[$t][
"mc"];
847 $comparePhrase = stripslashes( HCU_array_key_value($controlKey, $languageKeysInfo[$t][
"mc"]->messages) );
849 if ( $comparePhrase == $controlPhrase ) {
851 if ( !in_array( $controlKey, $ignoreList[$languageKeysInfo[$t][
"language"]] ) ) {
852 $languagePresent[$languageKeysInfo[$t][
"language"]] =
true;
858 if ( count( $languagePresent ) ) {
860 $entry[
"key"] = $controlKey;
861 $entry[
"phrase"] = $controlPhrase;
862 $entry[
"selected"] =
"";
865 for ( $t = 0; $t < count( $languageKeysInfo ); $t++ ) {
867 if ( $t == $englishEntry )
continue;
869 $lang = $languageKeysInfo[$t][
"language"];
870 if ( HCU_array_key_value($lang, $languagePresent) ) {
877 $untransList[] = $entry;
882 $missingList = array();
883 for ( $i = 0; $i < count( $languageKeysInfo ); $i++ ) {
884 for ( $m = 0; $m < count( $languageKeysInfo ); $m++ ) {
886 if ( $m == $i )
continue;
889 $controlList = $languageKeysInfo[$i][
"keys"];
890 $compareList = $languageKeysInfo[$m][
"keys"];
892 for ( $c = 0; $c < count( $controlList ); $c++ ) {
893 $controlKey = $controlList[$c];
895 if ( !in_array( $controlKey, $compareList ) ) {
898 for ( $t = 0; $t < count( $missingList ); $t++ ) {
899 if ( $missingList[$t][
"key"] == $controlKey ) {
901 $missingList[$t][$languageKeysInfo[$m][
"language"]] =
"X";
909 $entry[
"key"] = $controlKey;
910 $entry[
"phrase"] = stripslashes( HCU_array_key_value($controlKey, $languageKeysInfo[$t][
"mc"]->messages) );
911 $entry[
"selected"] =
"";
914 for ( $t = 0; $t < count( $languageKeysInfo ); $t++ ) {
915 $lang = $languageKeysInfo[$t][
"language"];
917 if ( $lang == $languageKeysInfo[$m][
"language"] ) {
924 $missingList[] = $entry;
933 $controlList = $languageKeysInfo[$englishEntry][
"keys"];
934 $missingPhraseList = array();
935 for ( $i = 0; $i < count( $controlList ); $i++ ) {
937 $controlKey = $controlList[$i];
938 $controlPhrase = $languageKeysInfo[$englishEntry][
"mc"]->messages[$controlKey];
940 $missingPhrase = array();
941 for ( $t = 0; $t < count( $languageKeysInfo ); $t++ ) {
944 if ( $englishEntry == $t )
continue;
947 $comparePhrase = stripslashes( HCU_array_key_value($controlKey, $languageKeysInfo[$t][
"mc"]->messages) );
949 if ( trim( $comparePhrase ) ==
"" ) {
950 $missingPhrase[$languageKeysInfo[$t][
"language"]] =
true;
955 if ( count( $missingPhrase ) ) {
957 $entry[
"key"] = $controlKey;
958 $entry[
"phrase"] = $controlPhrase;
959 $entry[
"selected"] =
"";
962 for ( $t = 0; $t < count( $languageKeysInfo ); $t++ ) {
964 if ( $t == $englishEntry )
continue;
966 $lang = $languageKeysInfo[$t][
"language"];
967 if ( HCU_array_key_value($lang, $missingPhrase) ) {
974 $missingPhraseList[] = $entry;
981 $notUsedList = $languageKeysInfo[$englishEntry][
"keys"];
986 $searchFileList = array();
987 $searchFileList[] =
"$sharedLibrary/cu_data.i";
988 foreach (glob(
"$bankingDir/scripts/*.prg") as $fileName) {
989 $searchFileList[] = $fileName;
993 for ( $i = 0; $i < count( $searchFileList ); $i++ ) {
995 $fileTest = file_get_contents( $searchFileList[$i], FILE_USE_INCLUDE_PATH );
998 for ( $t = 0; $t < count( $notUsedList ); $t++ ) {
999 if ( strpos( $fileTest, HCU_array_key_value($t, $notUsedList) ) > 0 ) {
1001 unset( $notUsedList[$t] );
1008 $sql=
"SELECT docs.docsdisplaytext FROM cucmsdocs docs";
1010 $sth = db_query( $sql, $dbh );
1012 while ( $row = db_fetch_array( $sth, $trow++ ) ) {
1013 $phrase = $row[
"docsdisplaytext"];
1016 for ( $t = 0; $t < count( $notUsedList ); $t++ ) {
1017 if ( !strcmp( $phrase, HCU_array_key_value($t, $notUsedList) ) ) {
1019 unset( $notUsedList[$t] );
1024 db_free_result($sth);
1027 $notUsedListFinal = array();
1028 for ( $i = 0; $i < count( $notUsedList ); $i++ ) {
1029 if ( isset( $notUsedList[$i] ) ) {
1030 $notUsedListFinal[] = array(
"key" => $notUsedList[$i],
"phrase" => stripslashes( $languageKeysInfo[$englishEntry][
"mc"]->messages[$notUsedList[$i]] ),
"selected" =>
"" );
1036 $duplicateCase = array();
1037 $controlList = $languageKeysInfo[$englishEntry][
"keys"];
1038 for ( $i = 0; $i < count( $controlList ); $i++ ) {
1040 for ( $m = 0; $m < count( $controlList ); $m++ ) {
1042 if ( $m == $i )
continue;
1045 if ( !strcasecmp( $controlList[$i], $controlList[$m] ) ) {
1051 $duplicateCase[] = array(
"key" => $controlList[$i],
"phrase" => stripslashes( $languageKeysInfo[$englishEntry][
"mc"]->messages[$controlList[$i]] ),
"selected" =>
"" );
1056 $fullList = array();
1057 $controlList = $languageKeysInfo[$englishEntry][
"keys"];
1058 for ( $i = 0; $i < count( $controlList ); $i++ ) {
1059 $fullList[] = array(
"key" => $controlList[$i],
"phrase" => stripslashes( $languageKeysInfo[$englishEntry][
"mc"]->messages[$controlList[$i]] ),
"selected" =>
"" );
1064 $languageList = array_keys( $ignoreList );
1065 $ignoreExplainList = array();
1066 for ( $i = 0; $i < count( $languageList ); $i++ ) {
1068 $ignoreListForLanguage = $ignoreList[$languageList[$i]];
1071 for ( $k = 0; $k < count( $ignoreListForLanguage); $k++ ) {
1073 $controlKey = $ignoreListForLanguage[$k];
1076 $entryPresent =
false;
1077 for ( $t = 0; $t < count( $ignoreExplainList ); $t++ ) {
1078 if ( $ignoreExplainList[$t][
"key"] == $ignoreListForLanguage[$k] ) {
1079 $entryPresent =
true;
1084 if ( $entryPresent) {
1086 $ignoreExplainList[$t][$languageList[$i]] =
"X";
1090 $entry[
"key"] = $controlKey;
1091 $entry[
"phrase"] = stripslashes( $languageKeysInfo[$englishEntry][
"mc"]->messages[$controlKey] );
1092 $entry[
"selected"] =
"";
1095 for ( $l = 0; $l < count( $languageList ); $l++ ) {
1097 $entry[$languageList[$l]] = ($l == $i) ?
"X" :
"";
1101 $ignoreExplainList[] = $entry;
1110 <li
class=
"k-state-active"><span
id=
"tip_untranslated">Untranslated Keys</span></li>
1111 <li><span
id=
"tip_missing_keys">Missing Keys</span></li>
1112 <li><span
id=
"tip_missing_phrases">Missing Phrases</span></li>
1113 <li><span
id=
"tip_not_in_use">Keys Not In Use</span></li>
1114 <li><span
id=
"tip_duplicate_case">Duplicate Case</span></li>
1115 <li><span
id=
"tip_full_list">Full List</span></li>
1116 <li><span
id=
"tip_ignore_list">(Ignore List)</span></li>
1120 <div
id=
"untransList"></div>
1125 <div
id=
"missingList"></div>
1130 <div
id=
"missingPhraseList"></div>
1135 <div
id=
"notUsedList"></div>
1140 <div
id=
"duplicateCase"></div>
1145 <div
id=
"fullList"></div>
1150 <div
id=
"ignoreList"></div>
1155 <div
id=
'submitWait' style=
'display:none;'>
1156 <h2><img src=
"https://www4.homecu.net/dash/homecu/images/busy.gif" /> Submitting data...</h2>
1158 <script type=
"text/javascript">
1159 $(document).ready(
function() {
1161 $(
"#tabstrip").kendoTabStrip({
1162 animation: { open: { effects:
"fadeIn"} }
1165 homecuTooltip.bind({
1166 tip_untranslated:
"At least one language phrase is a duplicate of the English phrase.",
1167 tip_missing_keys:
"Keys are missing in at least one language file.",
1168 tip_missing_phrases:
"A language file is missing a key/phrase compared to the English keys.",
1169 tip_not_in_use:
"In searching script files, some keys are not found to be in use.",
1170 tip_duplicate_case:
"Identical keys found but with different case sensitivity.",
1171 tip_full_list:
"The full list of English Key/Phrase pairs.",
1172 tip_ignore_list:
"The list of keys that are ignored in the Untranslated List because they are the same in both languagues." 1175 var untransList = <?php echo json_encode( $untransList ); ?>;
1176 var missingList = <?php echo json_encode( $missingList ); ?>;
1177 var missingPhraseList = <?php echo json_encode( $missingPhraseList ); ?>;
1178 var notUsedList = <?php echo json_encode( $notUsedListFinal ); ?>;
1179 var duplicateCase = <?php echo json_encode( $duplicateCase ); ?>;
1180 var fullList = <?php echo json_encode( $fullList ); ?>;
1181 var ignoreList = <?php echo json_encode( $ignoreExplainList ); ?>;
1183 var containsFilter =
1186 operators : { string : { contains :
"Contains"}},
1187 ui :
function( element )
1189 var parent = element.parent();
1190 while( parent.children().length > 1 )
1191 $(parent.children()[0]).
remove( );
1193 parent.prepend(
"<input data-bind=\"value:filters[0].value\" class=\"k-textbox\" type=\"text\">" );
1197 $(
'#untransList').kendoGrid({
1198 dataSource: untransList,
1203 filterable: { contains:
true },
1205 { field:
"key", title:
"Key", filterable: containsFilter, width:
"200px" },
1208 for ( $i = 0; $i < count( $languageKeysInfo ); $i++ ) {
1210 if ( $i == $englishEntry )
continue;
1211 $fieldName = $languageKeysInfo[$i][
"language"];
1212 $title = $fieldName;
1214 { field:
"<?php echo $fieldName ?>", title:
"<?php echo $title ?>", width:
"45px", filterable:
false },
1218 { field:
"phrase", title:
"Phrase", filterable: containsFilter },
1219 { field:
"selected", title:
"Sel", filterable: containsFilter, width:
"45px" }
1222 change:
function(e) {
1223 var selectedRow = this.dataItem(this.select());
1224 var key = selectedRow.key;
1225 var selected = selectedRow.selected ==
"Y" ?
"" :
"Y";
1228 $.each(untransList,
function( index,
object ) {
1229 if (
object[
"key"] == key ) {
1230 object[
"selected"] = selected;
1236 var grid = $(
"#untransList").data(
"kendoGrid");
1237 grid.dataSource.data(untransList);
1240 dataBound:
function () {
1241 $(
"table tbody tr").hover(
1243 $(
this).toggleClass(
"k-state-hover");
1250 $(
'#missingList').kendoGrid({
1251 dataSource: missingList,
1256 filterable: { contains:
true },
1258 { field:
"key", title:
"Key", filterable: containsFilter, width:
"200px" },
1261 for ( $i = 0; $i < count( $languageKeysInfo ); $i++ ) {
1263 if ( $i == $englishEntry )
continue;
1265 $fieldName = $languageKeysInfo[$i][
"language"];
1266 $title = $fieldName;
1268 { field:
"<?php echo $fieldName ?>", title:
"<?php echo $title ?>", width:
"45px", filterable:
false },
1272 { field:
"phrase", title:
"Phrase", filterable: containsFilter },
1273 { field:
"selected", title:
"Sel", filterable: containsFilter, width:
"45px" }
1276 change:
function(e) {
1277 var selectedRow = this.dataItem(this.select());
1278 var key = selectedRow.key;
1279 var selected = selectedRow.selected ==
"Y" ?
"" :
"Y";
1282 $.each(missingList,
function( index,
object ) {
1283 if (
object[
"key"] == key ) {
1284 object[
"selected"] = selected;
1290 var grid = $(
"#missingList").data(
"kendoGrid");
1291 grid.dataSource.data(missingList);
1294 dataBound:
function () {
1295 $(
"table tbody tr").hover(
1297 $(
this).toggleClass(
"k-state-hover");
1304 $(
'#missingPhraseList').kendoGrid({
1305 dataSource: missingPhraseList,
1310 filterable: { contains:
true },
1312 { field:
"key", title:
"Key", filterable: containsFilter, width:
"200px" },
1315 for ( $i = 0; $i < count( $languageKeysInfo ); $i++ ) {
1317 if ( $i == $englishEntry )
continue;
1319 $fieldName = $languageKeysInfo[$i][
"language"];
1320 $title = $fieldName;
1322 { field:
"<?php echo $fieldName ?>", title:
"<?php echo $title ?>", width:
"45px", filterable:
false },
1326 { field:
"phrase", title:
"Phrase", filterable: containsFilter },
1327 { field:
"selected", title:
"Sel", filterable: containsFilter, width:
"45px" }
1330 change:
function(e) {
1331 var selectedRow = this.dataItem(this.select());
1332 var key = selectedRow.key;
1333 var selected = selectedRow.selected ==
"Y" ?
"" :
"Y";
1336 $.each(missingPhraseList,
function( index,
object ) {
1337 if (
object[
"key"] == key ) {
1338 object[
"selected"] = selected;
1344 var grid = $(
"#missingPhraseList").data(
"kendoGrid");
1345 grid.dataSource.data(missingPhraseList);
1348 dataBound:
function () {
1349 $(
"table tbody tr").hover(
1351 $(
this).toggleClass(
"k-state-hover");
1358 $(
'#notUsedList').kendoGrid({
1359 dataSource: notUsedList,
1364 filterable: { contains:
true },
1366 { field:
"key", title:
"Key", filterable: containsFilter, width:
"200px" },
1367 { field:
"phrase", title:
"Phrase", filterable: containsFilter },
1368 { field:
"selected", title:
"Sel", filterable: containsFilter, width:
"45px" }
1371 change:
function(e) {
1372 var selectedRow = this.dataItem(this.select());
1373 var key = selectedRow.key;
1374 var selected = selectedRow.selected ==
"Y" ?
"" :
"Y";
1377 $.each(notUsedList,
function( index,
object ) {
1378 if (
object[
"key"] == key ) {
1379 object[
"selected"] = selected;
1385 var grid = $(
"#notUsedList").data(
"kendoGrid");
1386 grid.dataSource.data(notUsedList);
1389 dataBound:
function () {
1390 $(
"table tbody tr").hover(
1392 $(
this).toggleClass(
"k-state-hover");
1399 $(
'#duplicateCase').kendoGrid({
1400 dataSource: duplicateCase,
1405 filterable: { contains:
true },
1407 { field:
"key", title:
"Key", filterable: containsFilter, width:
"200px" },
1408 { field:
"phrase", title:
"Phrase", filterable: containsFilter },
1409 { field:
"selected", title:
"Sel", filterable: containsFilter, width:
"45px" }
1412 change:
function(e) {
1413 var selectedRow = this.dataItem(this.select());
1414 var key = selectedRow.key;
1415 var selected = selectedRow.selected ==
"Y" ?
"" :
"Y";
1418 $.each(duplicateCase,
function( index,
object ) {
1419 if (
object[
"key"] == key ) {
1420 object[
"selected"] = selected;
1426 var grid = $(
"#duplicateCase").data(
"kendoGrid");
1427 grid.dataSource.data(duplicateCase);
1430 dataBound:
function () {
1431 $(
"table tbody tr").hover(
1433 $(
this).toggleClass(
"k-state-hover");
1440 $(
'#fullList').kendoGrid({
1441 dataSource: fullList,
1446 filterable: { contains:
true },
1448 { field:
"key", title:
"Key", filterable: containsFilter, width:
"200px" },
1449 { field:
"phrase", title:
"Phrase", filterable: containsFilter },
1450 { field:
"selected", title:
"Sel", filterable: containsFilter, width:
"45px" }
1453 change:
function(e) {
1454 var selectedRow = this.dataItem(this.select());
1455 var key = selectedRow.key;
1456 var selected = selectedRow.selected ==
"Y" ?
"" :
"Y";
1459 $.each(fullList,
function( index,
object ) {
1460 if (
object[
"key"] == key ) {
1461 object[
"selected"] = selected;
1467 var grid = $(
"#fullList").data(
"kendoGrid");
1468 grid.dataSource.data(fullList);
1471 dataBound:
function () {
1472 $(
"table tbody tr").hover(
1474 $(
this).toggleClass(
"k-state-hover");
1481 $(
'#ignoreList').kendoGrid({
1482 dataSource: ignoreList,
1487 filterable: { contains:
true },
1489 { field:
"key", title:
"Key", filterable: containsFilter, width:
"200px" },
1492 for ( $i = 0; $i < count( $languageKeysInfo ); $i++ ) {
1494 if ( $i == $englishEntry )
continue;
1496 $fieldName = $languageKeysInfo[$i][
"language"];
1497 $title = $fieldName;
1499 { field:
"<?php echo $fieldName ?>", title:
"<?php echo $title ?>", width:
"45px", filterable:
false },
1503 { field:
"phrase", title:
"Phrase", filterable: containsFilter },
1504 { field:
"selected", title:
"Sel", filterable: containsFilter, width:
"45px" }
1507 change:
function(e) {
1508 var selectedRow = this.dataItem(this.select());
1509 var key = selectedRow.key;
1510 var selected = selectedRow.selected ==
"Y" ?
"" :
"Y";
1513 $.each(ignoreList,
function( index,
object ) {
1514 if (
object[
"key"] == key ) {
1515 object[
"selected"] = selected;
1521 var grid = $(
"#ignoreList").data(
"kendoGrid");
1522 grid.dataSource.data(ignoreList);
1525 dataBound:
function () {
1526 $(
"table tbody tr").hover(
1528 $(
this).toggleClass(
"k-state-hover");
1540 padding: 5px 20px 5px 20px;
1556 margin-bottom: 10px;
1565 #panels .k-block .k-header { 1568 .homecu-formStatus {
1573 }
else if ( $action ==
"import" || $action ==
"" ) {
1575 if ( $screen ==
"upload" || $screen ==
"" ) {
1578 <h3>Pick a file to upload and specify the delimiter.</h3>
1579 <h5>Note: the
default delimiter is a comma (
',')</h5>
1580 <form method=
"post" style=
"width:45%">
1581 <input type=
"hidden" name=
"action" value=
"import">
1582 <input type=
"hidden" name=
"screen" value=
"confirm">
1583 <input name=
"upload_file" id=
"uploadFile" type=
"file" />
1584 <h3> Select Delimiter</h3>
1586 <select name=
"delimiter">
1587 <option value=
','>,</option>
1588 <option value=
'tab'>tab</option>
1589 <option value=
';'>;</option>
1590 <option value=
'|'>|</option>
1591 <option value=
'^'>^</option>
1597 <input type=
"submit" value=
"Review" id=
"submitButton" class=
"k-button" style=
"visibility: hidden;"/>
1603 <li>The file is in the format:<br>
1604 language<delim>key<delim>phrase</li>
1605 <li>If the key exists then the phrase will be used with that key.</li>
1606 <li>If a key/phrase already exists the imported phrase will overwrite the existing.</li>
1607 <li>If a
new key phrase
's supported language is missing the English will be used.</li> 1608 <li>If a new key phrase is missing English, any missing phrases will be left blank.</li> 1609 <li>Lines starting with a '#
' will be treated as comments.</li> 1610 <li>Any special characters need to use HTML Encoded entities.</li> 1616 $(document).ready(function() { 1617 $("#uploadFile").kendoUpload({ 1619 select: "Select File..." 1625 function onSelect(e) { 1626 $("#submitButton").css("visibility", "visible"); 1631 } else if ( $screen == "confirm" ) { 1632 // show the uploaded info as delimited by the user's choice
1637 if ( is_uploaded_file( $_FILES[
"upload_file"][
"tmp_name"] ) &&
1638 ( $_FILES[
"upload_file"][
"size"] > 0 ) &&
1639 ( $_FILES[
"upload_file"][
"error"] == 0) ) {
1640 $tmpName = $_FILES[
"upload_file"][
"tmp_name"];
1641 $saveName =
"/tmp/hcuTransUpload.txt";
1642 if ( move_uploaded_file($tmpName, $saveName) ) {
1644 $uploadFile = $saveName;
1649 $delimiterPassed = $HB_ENV[
"MY_POST"][
"delimiter"];
1650 $delimiterChoices = array(
",",
"|",
";",
"^" );
1651 if ( !in_array( $delimiterPassed, $delimiterChoices ) && $delimiterPassed !=
"tab" ) {
1652 throw new ErrorException(
"Error - Invalid Delimiter");
1655 if ( $delimiterPassed ==
"tab" ) {
1658 $delimiter = $delimiterPassed;
1661 if ( $uploadFile ==
"" ) {
1662 throw new ErrorException(
"Error Uploading Translation Import File");
1666 $importLines = file( $uploadFile, FILE_IGNORE_NEW_LINES );
1668 $importInfo = array();
1670 for ( $i = 0; $i < count( $importLines ); $i++ ) {
1671 $line = trim( $importLines[$i] );
1672 if ( substr( $line, 0, 1) ==
"#" )
continue;
1674 $lineParts = explode( $delimiter, $line );
1677 if ( !in_array($lineParts[1], $keyList) ) {
1678 $keyList[] = $lineParts[1];
1682 $importInfo[$lineParts[1]][$lineParts[0]] = $lineParts[2];
1686 $importEntries = array();
1687 for ( $k = 0; $k < count( $keyList ); $k++ ) {
1689 $entry[
"key"] = $keyList[$k];
1691 $englishPhrase =
"";
1693 for ( $l = 0; $l < count( $languageKeys ); $l++ ) {
1695 if ( $l == $englishEntry ) {
1696 $englishPhrase = $importInfo[$keyList[$k]][$languageKeys[$l]];
1699 $phrase = $importInfo[$keyList[$k]][$languageKeys[$l]];
1700 if ( !strlen( trim( $phrase ) ) ) {
1701 $phrase = $englishPhrase;
1704 $entry[$languageKeys[$l]] = ConvertFromUTF8( $phrase );
1707 $importEntries[] = $entry;
1710 <script type=
"text/x-kendo-template" id=
"actionTemplate">
1711 <div
class=
"toolbar">
1712 <form method=
'post'>
1713 <input type=
"hidden" name=
"action" value=
"import">
1714 <input type=
"hidden" name=
"screen" value=
"import">
1715 <input type=
"hidden" name=
"delimiter" value=
"<?php echo $delimiterPassed ?>">
1716 <button type=
'submit' id=
'upload' <?php echo (!count( $importLines ) ?
"disabled='DISABLED'" :
"") ?>
class=
'k-button'>Upload</button>
1718 <form method=
'post'>
1719 <input type=
"hidden" name=
"action" value=
"">
1720 <input type=
"hidden" name=
"screen" value=
"">
1721 <button type=
'submit' id=
'cancel' class=
'k-button'>Cancel</button>
1726 <div
id=
"confirmList"></div>
1728 <div
id=
"progressShow" style=
"z-index:20000;"></div>
1729 <script type=
"text/javascript">
1730 $(document).ready(
function() {
1732 var confirmList = <?php echo json_encode( $importEntries ); ?>;
1733 $(
'#confirmList').kendoGrid({
1734 dataSource: confirmList,
1735 toolbar: kendo.template($(
"#actionTemplate").html()),
1737 { field:
"key", title:
"Key" }
1739 for ( $i = 0; $i < count( $languageKeys ); $i++ ) {
1740 print
",\n{ field: \"{$languageKeys[$i]}\", title: \"{$languageKeys[$i]}\", encoded: false }\n";
1748 $(
"#upload").click(
function() {
1749 kendo.ui.progress($(
'#progressShow'),
true);
1752 $(
"#cancel").click(
function() {
1753 kendo.ui.progress($(
'#progressShow'),
true);
1764 }
else if ( $screen ==
"import" ) {
1768 throw new ErrorException(
"Unsupported Import Screen");
1771 throw new ErrorException(
"Unsupported Action");
1774 printMonitorPageBottom();
1775 }
catch (Exception $e) {
1780 $errorTitle=
"Credit Union Home Banking Translation Table Maintenance";
1781 printMonitorPageTop($errorTitle, $homecuKendoVersion, $cloudfrontDomainName);
1782 printMonitorPageMiddle($errorTitle);
1783 print
"<h3>{$e->getMessage()}</h3>";
1784 printMonitorPageBottom();
1790 function WriteTranslationTableFile( $language, $transTable ) {
1791 $fileWarning =
"// This file is created and maintained programatically. DO NOT EDIT THIS FILE DIRECTLY.\n";
1792 $fileWarning .=
"// The script file hcuadm/hcuTransAm is used to edit and maintain this file.\n\n";
1795 $fileName = dirname(__FILE__) .
"/../../shared/includes/hcuTranslate." . $language .
".i";
1798 $file = fopen($fileName,
"w",
true);
1800 fwrite( $file,
"<?php\n" );
1802 fwrite( $file, $fileWarning );
1805 $jsArrayStr =
"\$html_decode = {$transTable->html_decode};\n";
1806 fwrite($file, $jsArrayStr );
1808 $jsFind = $transTable->js_find;
1809 $arrayContents =
"";
1810 for ( $j = 0; $j < count( $jsFind ); $j++ ) {
1811 if ( strlen( $arrayContents ) > 0 ) $arrayContents .=
",";
1812 $arrayContents .=
"\"" . $jsFind[$j] .
"\"";
1815 $jsArrayStr =
"\$js_find = array($arrayContents);\n";
1816 fwrite($file, $jsArrayStr );
1818 $jsReplace = $transTable->js_replace;
1819 $arrayContents =
"";
1820 for ( $j = 0; $j < count( $jsFind ); $j++ ) {
1821 if ( strlen( $arrayContents ) > 0 ) $arrayContents .=
",";
1822 $arrayContents .=
"\"" . $jsReplace[$j] .
"\"";
1825 $jsArrayStr =
"\$js_replace = array($arrayContents);\n";
1826 fwrite($file, $jsArrayStr );
1829 $lowerCharArray = $transTable->lowerChar;
1830 $arrayContents =
"";
1831 for ( $j = 0; $j < count( $lowerCharArray ); $j++ ) {
1832 if ( strlen( $arrayContents ) > 0 ) $arrayContents .=
",";
1833 $arrayContents .=
"\"" . $lowerCharArray[$j] .
"\"";
1836 $jsArrayStr =
"\$lowerChar = array($arrayContents);\n";
1837 fwrite($file, $jsArrayStr );
1840 $upperCharArray = $transTable->upperChar;
1841 $arrayContents =
"";
1842 for ( $j = 0; $j < count( $lowerCharArray ); $j++ ) {
1843 if ( strlen( $arrayContents ) > 0 ) $arrayContents .=
",";
1844 $arrayContents .=
"\"" . $upperCharArray[$j] .
"\"";
1847 $jsArrayStr =
"\$upperChar = array($arrayContents);\n";
1848 fwrite($file, $jsArrayStr );
1851 $langStr =
"\$lang = '{$language}';\n";
1852 fwrite($file, $langStr );
1855 $langNameStr =
"\$langName = '{$transTable->langName}';\n";
1856 fwrite($file, $langNameStr );
1859 fwrite( $file,
"\$messages = array(\n" );
1861 $transKeys = array_keys( $transTable->messages );
1864 for ( $k = 0; $k < count( $transKeys ); $k++ ) {
1865 if ( $k > 0 ) $transString .=
",\n";
1867 $findKey = $transKeys[$k];
1868 $newPhrase = str_replace(
"'",
"\'", ConvertFromUTF8( $transTable->messages[$findKey]));
1869 $transString .=
" '{$findKey}' => '{$newPhrase}'";
1872 $transString .=
"\n);\n";
1874 fwrite( $file, $transString );
1881 function TranslateLetters( $string ) {
1900 $strLen = strlen( $string );
1902 print
"<br> New String to translate: $string<br>";
1903 $chrArray = preg_split(
'//u',$string, -1, PREG_SPLIT_NO_EMPTY);
1904 print_r( $chrArray );
1905 for ( $s = 0; $s < count( $chrArray ); $s++ ) {
1906 $oldChar = substr( $chrArray, $s, 1 );
1907 $ord = ord( $oldChar );
1908 print
"<br>found: $oldChar ($ord)";
1910 $newChar = $transList[$ord];
1912 if ( strlen( $newChar ) ) {
1913 print
"<br>$ord, $oldChar --) $newChar";
1914 $transChar = $newChar;
1916 $transChar = $oldChar;
1919 $newString .= $transChar;
1922 if ( strcmp( $newString, $string ) ) {
1923 print
"<br>Changed: $string --) $newString";