comparison index.php @ 184:04490fe590ec

Cleanup translation code and translations.
author Matti Hamalainen <ccr@tnsp.org>
date Wed, 30 Sep 2015 09:39:32 +0300
parents dda30eff3266
children 111b062d3988
comparison
equal deleted inserted replaced
183:dda30eff3266 184:04490fe590ec
30 "fi" => array("Maanantai", "Tiistai", "Keskiviikko", "Torstai", "Perjantai", "Lauantai", "Sunnuntai"), 30 "fi" => array("Maanantai", "Tiistai", "Keskiviikko", "Torstai", "Perjantai", "Lauantai", "Sunnuntai"),
31 "en" => array("Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"), 31 "en" => array("Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"),
32 ); 32 );
33 33
34 $pageTranslations = array( 34 $pageTranslations = array(
35 "Original" => array("fi" => "Alkuperäinen"), 35 "change" => array(
36 36 "fi" => "Vaihda",
37 "Shown" => array("fi" => "Näkyvillä"), 37 "en" => "Change",
38 "Next period" => array("fi" => "Seuraava periodi"), 38 ),
39 "Current period" => array("fi" => "Nykyinen periodi"), 39
40 "Switch" => array("fi" => "Vaihda"), 40 "period_shown" => array(
41 41 "fi" => "Näkyvillä",
42 "contact" => array( 42 "en" => "Shown",
43 "en" => "Contact <b>%1</b> or <b>%2</b>. ". 43 ),
44 "The author can't be held responsible for any errors or inaccuracies in the data!", 44 "next_period" => array(
45 45 "fi" => "Seuraava periodi",
46 "fi" => "Yhteydenotot <b>%1</b> tai <b>%2</b>. ". 46 "en" => "Next period",
47 "En vastaa mahdollisista virheistä tai epätarkkuuksista tiedoissa!", 47 ),
48 ), 48 "current_period" => array(
49 49 "fi" => "Nykyinen periodi",
50 "updated" => array( 50 "en" => "Current period",
51 "en" => "Last updated: <b>%1</b>.", 51 ),
52 "fi" => "Päivitetty: <b>%1</b>.", 52 "expl_toggle_period" => array(
53 ), 53 "fi" => "Vaihda nykyisen ja seuraavan periodin (jos saatavilla) lukujärjestyksen välillä.",
54 54 "en" => "Switch view between current and next period (if available) timetable.",
55 "beta" => array(
56 "en" => " NOTICE! %2 v%1 is still under development. There may be bugs.",
57 "fi" => " HUOM! %2 v%1 on vielä kehityksen alla. Bugeja voi löytyä.",
58 ), 55 ),
59 56
60 "viikossa" => array( 57 "viikossa" => array(
58 "fi" => "Viikossa yhteensä <b>%1</b> tuntia.",
61 "en" => "Total of <b>%1</b> hours in the week.", 59 "en" => "Total of <b>%1</b> hours in the week.",
62 "fi" => "Viikossa yhteensä <b>%1</b> tuntia.",
63 ), 60 ),
64 61
65 "vuoroviikoin" => array( 62 "vuoroviikoin" => array(
63 "fi" => "Vuoroviikoin",
66 "en" => "Every other week", 64 "en" => "Every other week",
67 "fi" => "Vuoroviikoin", 65 ),
68 ), 66
69 67 "class_not_set" => array(
70 "classNotSet" => array( 68 "fi" => "Luokkaa ei asetettu, käytetään vakioarvoa <b>%1</b>.",
71 "en" => "Class not set, using default <b>%1</b>.", 69 "en" => "Class not set, using default <b>%1</b>.",
72 "fi" => "Luokkaa ei asetettu, käytetään vakioarvoa <b>%1</b>.", 70 ),
73 ), 71
74 72 "class_data_not_found" => array(
75 "classDataNotFound" => array(
76 "fi" => "Luokan %1 tietoja ei löytynyt! Jos luokkakoodi on uusi, ". 73 "fi" => "Luokan %1 tietoja ei löytynyt! Jos luokkakoodi on uusi, ".
77 "ilmestyy se järjestelmään seuraavan päivityksen aikana. Luokkatiedot ". 74 "ilmestyy se järjestelmään seuraavan päivityksen aikana. Luokkatiedot ".
78 "päivitetään noin kerran viikossa. <b>On myös mahdollista, että luokkakoodi ". 75 "päivitetään noin kerran viikossa. <b>On myös mahdollista, että luokkakoodi ".
79 "on olemassa vain seuraavan periodin tiedoissa.</b>", 76 "on olemassa vain seuraavan periodin tiedoissa.</b>",
80 77
82 "should appear in this system during the next update. The data is updated ". 79 "should appear in this system during the next update. The data is updated ".
83 "approximately once per week. <b>It is also possible that the code only ". 80 "approximately once per week. <b>It is also possible that the code only ".
84 "exists for next period's data.</b>", 81 "exists for next period's data.</b>",
85 ), 82 ),
86 83
87 "classListNotFound" => array( 84 "class_list_not_found" => array(
88 "fi" => "Luokkien listaa ei löytynyt. Kokeile ladata sivu uudelleen hetken kuluttua.", 85 "fi" => "Luokkien listaa ei löytynyt. Kokeile ladata sivu uudelleen hetken kuluttua.",
89 "en" => "Class list not found. An update may be in progress, try reloading in a minute.", 86 "en" => "Class list not found. An update may be in progress, try reloading in a minute.",
90 ), 87 ),
91 88
92 "classFormatError" => array( 89 "class_format_error" => array(
93 "fi" => "Virhe! Luokan täytyy olla muotoa <b>XXXnXXX</b>, käytetään vakioarvoa <b>%1</b>.", 90 "fi" => "Virhe! Luokan täytyy olla muotoa <b>XXXnXXX</b>, käytetään vakioarvoa <b>%1</b>.",
94 "en" => "Error! Class code must be of format <b>XXXnXXX</b>, using default value of <b>%1</b>.", 91 "en" => "Error! Class code must be of format <b>XXXnXXX</b>, using default value of <b>%1</b>.",
95 ), 92 ),
96 93
97 "Style" => array( 94 "change_style" => array(
98 "fi" => "Tyyli", 95 "fi" => "Tyyli",
99 ), 96 "en" => "Style",
100 97 ),
101 "linkToggle" => array( 98
102 "fi" => "Vaihda nykyisen ja seuraavan periodin (jos saatavilla) lukujärjestyksen välillä.", 99 "link_original_data" => array(
103 "en" => "Switch view between current and next period (if available) timetable.", 100 "fi" => "Alkuperäinen",
104 ), 101 "en" => "Original",
105 102 ),
106 "linkOrig" => array( 103
104 "expl_link_original_data" => array(
107 "fi" => "Linkki alkuperäiseen lukujärjestysdataan.", 105 "fi" => "Linkki alkuperäiseen lukujärjestysdataan.",
108 "en" => "Link to the original time table data.", 106 "en" => "Link to the original time table data.",
109 ), 107 ),
110 108
111 "linkMobile" => array( 109 "link_mobile_version" => array(
110 "en" => "Mobile",
111 "fi" => "Mobile",
112 ),
113
114 "expl_link_mobile_version" => array(
112 "fi" => "Yksinkertaisempi mobiililaiteversio lukujärjestyksestä.", 115 "fi" => "Yksinkertaisempi mobiililaiteversio lukujärjestyksestä.",
113 "en" => "Simpler mobile device version of the timetable.", 116 "en" => "Simpler mobile device version of the timetable.",
114 ), 117 ),
115 118
116 "linkCurrLuk" => array( 119 "link_current_settings" => array(
120 "fi" => "Linkki",
121 "en" => "Link",
122 ),
123
124 "expl_link_current_settings" => array(
117 "fi" => "Linkki tähän lukujärjestykseen nykyisillä asetuksilla (kieli, jne.)", 125 "fi" => "Linkki tähän lukujärjestykseen nykyisillä asetuksilla (kieli, jne.)",
118 "en" => "Link to the this timetable with current settings (language, etc.)", 126 "en" => "Link to the this timetable with current settings (language, etc.)",
119 ), 127 ),
128
129 "contact" => array(
130 "fi" => "Yhteydenotot <b>%1</b> tai <b>%2</b>. ".
131 "En vastaa mahdollisista virheistä tai epätarkkuuksista tiedoissa!",
132
133 "en" => "Contact <b>%1</b> or <b>%2</b>. ".
134 "The author can't be held responsible for any errors or inaccuracies in the data!",
135 ),
136
137 "updated" => array(
138 "fi" => "Päivitetty: <b>%1</b>.",
139 "en" => "Last updated: <b>%1</b>.",
140 ),
141
142 "beta" => array(
143 "fi" => " HUOM! %2 v%1 on vielä kehityksen alla. Bugeja voi löytyä.",
144 "en" => " NOTICE! %2 v%1 is still under development. There may be bugs.",
145 ),
146
120 // "" => array("fi" => ), 147 // "" => array("fi" => ),
121 ); 148 );
122 149
123 150
124 function lukGetDayName($day) 151 function lukGetDayName($day)
138 if (preg_match("#^([A-Z]{3}\d[A-Za-z0-9_]{1,6}|ccr|Ryh_[A-Z]{3}\d[A-Za-z0-9_]{1,6})$#", $id, $m)) 165 if (preg_match("#^([A-Z]{3}\d[A-Za-z0-9_]{1,6}|ccr|Ryh_[A-Z]{3}\d[A-Za-z0-9_]{1,6})$#", $id, $m))
139 { 166 {
140 $id = $m[1]; 167 $id = $m[1];
141 return TRUE; 168 return TRUE;
142 } else { 169 } else {
143 stError(cmQM("classFormatError", $classDefaultID)); 170 stError(cmQM("class_format_error", $classDefaultID));
144 $id = $classDefaultID; 171 $id = $classDefaultID;
145 return FALSE; 172 return FALSE;
146 } 173 }
147 } 174 }
148 175
482 $classID = $_COOKIE["lukluokka"]; 509 $classID = $_COOKIE["lukluokka"];
483 lukCheckClassID($classID); 510 lukCheckClassID($classID);
484 } 511 }
485 else 512 else
486 { 513 {
487 stError(cmQM("classNotSet", $classDefaultID)); 514 stError(cmQM("class_not_set", $classDefaultID));
488 $classID = $classDefaultID; 515 $classID = $classDefaultID;
489 } 516 }
490 517
491 518
492 // Check next period flag 519 // Check next period flag
523 } 550 }
524 551
525 552
526 // Read classfile 553 // Read classfile
527 if (($classIDs = lukReadClassFile($classIDFile[$nextPeriod])) === false) 554 if (($classIDs = lukReadClassFile($classIDFile[$nextPeriod])) === false)
528 stError(cmQM("classListNotFound")); 555 stError(cmQM("class_list_not_found"));
529 556
530 557
531 // Read class data 558 // Read class data
532 $dataFile = $cachePath.$classID.".data"; 559 $dataFile = $cachePath.$classID.".data";
533 if (!file_exists($dataFile)) 560 if (!file_exists($dataFile))
534 { 561 {
535 stError(cmQM("classDataNotFound", chentities($classID))); 562 stError(cmQM("class_data_not_found", chentities($classID)));
536 $haveData = FALSE; 563 $haveData = FALSE;
537 $timestamp = time(); 564 $timestamp = time();
538 } 565 }
539 else 566 else
540 { 567 {
617 } 644 }
618 645
619 echo 646 echo
620 " </select>\n". 647 " </select>\n".
621 " </th>\n". 648 " </th>\n".
622 " <th><input class=\"submit\" type=\"submit\" value=\"".cmQM("Switch")."\" /></th>\n"; 649 " <th><input class=\"submit\" type=\"submit\" value=\"".cmQM("change")."\" /></th>\n";
623 650
624 if (!$mobileMode) 651 if (!$mobileMode)
625 { 652 {
626 echo 653 echo
627 " <th><a id=\"next\" class=\"textctrl\" href=\"". 654 " <th><a id=\"next\" class=\"textctrl\" href=\"".
628 $baseURI.($nextPeriod ? "" : "?next")."\" title=\"".cmQM("linkToggle")."\">". 655 $baseURI.($nextPeriod ? "" : "?next")."\" title=\"".cmQM("expl_toggle_period")."\">".
629 cmQM("Shown").": ".($nextPeriod ? cmQM("Next period") : cmQM("Current period")). 656 cmQM("period_shown").": ".($nextPeriod ? cmQM("next_period") : cmQM("current_period")).
630 "</a></th>\n"; 657 "</a></th>\n";
631 658
632 if ($haveData) 659 if ($haveData)
633 { 660 {
634 echo 661 echo
635 " <th><a id=\"orig\" class=\"textctrl\" href=\"".$origBaseURI.$classID.$origBaseExt."\" title=\"".cmQM("linkOrig")."\">".cmQM("Original")."</a></th>\n"; 662 " <th><a id=\"orig\" class=\"textctrl\" href=\"".$origBaseURI.$classID.$origBaseExt."\" title=\"".cmQM("expl_link_original_data")."\">".cmQM("link_original_data")."</a></th>\n";
636 //" <th><a id=\"xml\" class=\"textctrl\" href=\"".$baseURI.$cachePath."/".$luokka.".xml\">XML</a></th>\n"; 663 //" <th><a id=\"xml\" class=\"textctrl\" href=\"".$baseURI.$cachePath."/".$luokka.".xml\">XML</a></th>\n";
637 } 664 }
638 665
639 echo 666 echo
640 " <th><a class=\"textctrl mobile\" href=\"http://tnsp.org/mluk/\" title=\"".cmQM("linkMobile")."\">Mobile</a></th>\n"; 667 " <th><a class=\"textctrl mobile\" href=\"http://tnsp.org/mluk/\" title=\"".cmQM("expl_link_mobile_version")."\">".cmQM("link_mobile_version")."</a></th>\n";
641 } 668 }
642 669
643 $currURL = $baseURI."?luokka=".$classID."&amp;lang=".$pageLang. 670 $currURL = $baseURI."?luokka=".$classID."&amp;lang=".$pageLang.
644 (isset($pageCSSIndex) ? "&amp;css=".$pageCSSIndex : ""). 671 (isset($pageCSSIndex) ? "&amp;css=".$pageCSSIndex : "").
645 ($nextPeriod ? "&amp;next" : ""); 672 ($nextPeriod ? "&amp;next" : "");
646 673
647 echo 674 echo
648 " <th><a href=\"".$currURL."\" class=\"textctrl\" title=\"".cmQM("linkCurrLuk")."\">Link</a></th>\n". 675 " <th><a href=\"".$currURL."\" class=\"textctrl\" title=\"".cmQM("expl_link_current_settings")."\">".cmQM("link_current_settings")."</a></th>\n".
649 // " <th class=\"advert\"><a href=\"http://tnsp.org/u/G1X\"><img src=\"img/hdd_fi.gif\" alt=\"HDD.fi\" /></a></th>\n". 676 // " <th class=\"advert\"><a href=\"http://tnsp.org/u/G1X\"><img src=\"img/hdd_fi.gif\" alt=\"HDD.fi\" /></a></th>\n".
650 " <th class=\"advert\"><a href=\"http://tnsp.org/u/H9w\"><img src=\"img/batmud.png\" alt=\"BatMUD\" /></a></th>\n". 677 " <th class=\"advert\"><a href=\"http://tnsp.org/u/H9w\"><img src=\"img/batmud.png\" alt=\"BatMUD\" /></a></th>\n".
651 // " <th><a href=\"http://tnsp.org/testluk/\"><img src=\"img/test.png\" alt=\"Lukkari v3\" /></a></th>\n". 678 // " <th><a href=\"http://tnsp.org/testluk/\"><img src=\"img/test.png\" alt=\"Lukkari v3\" /></a></th>\n".
652 " </tr>\n". 679 " </tr>\n".
653 " </table>\n". 680 " </table>\n".