Add translations for French and Japanese
[frank.git] / prod / net / jaekl / frank / Schedule.java
index edd1b398a602afff7e23aa734d892ee5de6c8a1f..8cc4f846124a5a1b628c0d011e3f6069d80ff5d2 100644 (file)
@@ -13,13 +13,15 @@ import net.jaekl.frank.octranspo.StopInfo;
 import net.jaekl.frank.octranspo.Trip;
 
 public class Schedule {
-       Locale m_locale;
-       FrankBundle m_bundle;
        DateFormat m_hourMinFmt;
        DateFormat m_hourMinSecFmt;
+       FrankBundle m_bundle;
+       Locale m_locale;
+       Style m_style;
        
        public Schedule(Locale locale) {
                m_locale = locale;
+               m_style = new Style();
                m_bundle = FrankBundle.getInst(locale);
                m_hourMinFmt = new SimpleDateFormat("hh:mma", locale);
                m_hourMinSecFmt = new SimpleDateFormat("hh:mm:ssa", locale);
@@ -40,17 +42,7 @@ public class Schedule {
        String mapUrl(double latitude, double longitude) {
                return "http://www.openstreetmap.org/?mlat=" + latitude + "&mlon=" + longitude + "&zoom=15";
        }
-       
-       void writeStyle(PrintWriter pw) {
-               pw.println("<STYLE>");
-               pw.println("  body {background-color: #F0F0C0; font-size: 1.5em; }");
-               pw.println("  #trips {border-collapse: collapse; font-size: 1.5em; }");
-               pw.println("  #trips td, #trips th {border: 1px solid #600000; padding: 3px 3px 3px 3px; text-align: center;}");
-               pw.println("  #trips th {background-color: #800000; color: #FFFFFF; }");
-               pw.println("  #trips tr.ghost td {background-color: #C0C0C0;}");
-               pw.println("</STYLE>");
-       }
-       
+
        // Countdown timer that updates time remaining until each bus is expected.
        void writeScript(PrintWriter pw, String remainArray, int remainCount) {
                String min = trans(FrankBundle.MINUTES);
@@ -70,7 +62,7 @@ public class Schedule {
            pw.println("    if (remain_delta <= 0) {");
            pw.println("      element.innerHTML = \"----\";");
            pw.println("    } else {");
-           pw.println("      element.innerHTML = (Math.floor(remain_delta / 60)) + \"" + trans(min) + "\";");
+           pw.println("      element.innerHTML = (Math.floor(remain_delta / 60)) + \"" + min + "\";");
            pw.println("    }");
            pw.println("  }");
            pw.println("}");
@@ -82,7 +74,7 @@ public class Schedule {
                pw.println("<HTML>");
                pw.println("<HEAD>");
                pw.println("<TITLE>" + title + "</TITLE>");
-               writeStyle(pw);
+               new Style().writeStyle(pw);
                pw.println("</HEAD>");
        }