#TV.RecordedTv.Time (1 Viewer)

gpnash

Portal Pro
March 2, 2015
70
16
65
Linden, Michigan
Home Country
United States of America United States of America
in the titan skin myrecordedtv.xml #TV.RecordedTv.Time is used in several places to display the date and time of a recorded file.
The value display is not formatted correctly according to culture. Util.GetShortDayString has hardcoded the date portion of the string to always display day then month normal for your side of the pond but in the states we're used to month then day so Fri 11-3 for me is the 3rd day of November, not the 11th day of March.
Code:
  public static string GetShortDayString(DateTime dt)
    {
      try
      {
        string day;
        switch (dt.DayOfWeek)
        {
          case DayOfWeek.Monday:
            day = GUILocalizeStrings.Get(657);
            break;
          case DayOfWeek.Tuesday:
            day = GUILocalizeStrings.Get(658);
            break;
          case DayOfWeek.Wednesday:
            day = GUILocalizeStrings.Get(659);
            break;
          case DayOfWeek.Thursday:
            day = GUILocalizeStrings.Get(660);
            break;
          case DayOfWeek.Friday:
            day = GUILocalizeStrings.Get(661);
            break;
          case DayOfWeek.Saturday:
            day = GUILocalizeStrings.Get(662);
            break;
          default:
            day = GUILocalizeStrings.Get(663);
            break;
        }
        return String.Format("{0} {1}-{2}", day, dt.Day, dt.Month);
      }

Code:
return dt.tostring("ddd MM-dd") 
or
return dt.tostring("ddd dd-MM")
Code:
in strings-en-us.xml added....
<String id="20000">ddd MM-dd</String>
<String id="20001">MM-dd<string>

is various locations updated formatted date settings to be

program.StartTime.ToString(GuiLocalizeStrings.get(20000))  // to replace getshortdaystring
and
program.StartTime.Tostring(GuiLocalizeStrings.get(20001)) // to replace .tostring("dd-MM")

I'm just not sure how to tell which countries use which format. maybe using dt.toString(GUILocatizeStrings.get(xxx)) would solve it where GUILocatizeStrings.get(xxx) returns ddd MM-dd for some of us and ddd dd-MM for the rest. in any case it almost does away with the need for getshortdaystring. is there a base Strings file that all Strings files inherit?
it would be nice to have Strings.xml that contained strings common to all languages that are overridden by the individual Strings-en-US.xml files.
Code:
<String id="20000">ddd dd-MM</String>
<String id="20001">dd-MM</String>
could then be included in the base strings file and only the us file would need to be changed to the MM-dd format.
 
Last edited:

gpnash

Portal Pro
March 2, 2015
70
16
65
Linden, Michigan
Home Country
United States of America United States of America
Well I've been running my patch for three days without any issue, however I can't test it for national languages so I'm posting it here if you want it.
I've added String id="20000" thru "20004" which are various display dates that I needed to replace and actually one or two more for another project.
the string-en-us strings have the month before the day, all other string files have the day before the month. in setuptv I change the schedule display to show the date in iso formart yyyy-MM-dd hh:mm:ss. in most cases the original code was left, just commented out. util.GetShortDayString was commented out to facility Feel free to use/change/ignore as you see fit.
 

Attachments

  • NashlocalizeDate.patch
    93 KB

Users who are viewing this thread

Top Bottom