Skip to content

Commit

Permalink
Migrate date time strings to localization
Browse files Browse the repository at this point in the history
Add day, month, birth sign, season names to localization tables.
Add date time string formatting text containing words to localization tables.
  • Loading branch information
Interkarma committed Feb 19, 2023
1 parent 8b5e3b0 commit e5088be
Show file tree
Hide file tree
Showing 3 changed files with 133 additions and 31 deletions.
Expand Up @@ -3711,6 +3711,34 @@ MonoBehaviour:
m_Key: locationInRegionProvince
m_Metadata:
m_Items: []
- m_Id: 318179644662083584
m_Key: dayNames
m_Metadata:
m_Items: []
- m_Id: 318180613974126592
m_Key: monthNames
m_Metadata:
m_Items: []
- m_Id: 318180665765392384
m_Key: birthSignNames
m_Metadata:
m_Items: []
- m_Id: 318180720735940608
m_Key: seasonNames
m_Metadata:
m_Items: []
- m_Id: 318183911657566208
m_Key: longDateTimeFormatString
m_Metadata:
m_Items: []
- m_Id: 318184342387421184
m_Key: dateTimeFormatString
m_Metadata:
m_Items: []
- m_Id: 318184563599208448
m_Key: dateFormatString
m_Metadata:
m_Items: []
m_Metadata:
m_Items: []
m_KeyGenerator:
Expand Down
94 changes: 94 additions & 0 deletions Assets/Localization/StringTables/Internal_Strings_en.asset
Expand Up @@ -4625,5 +4625,99 @@ MonoBehaviour:
m_Localized: '{0} in {1} province'
m_Metadata:
m_Items: []
- m_Id: 318179644662083584
m_Localized: 'Sundas
Morndas
Tirdas
Middas
Turdas
Fredas
Loredas'
m_Metadata:
m_Items: []
- m_Id: 318180613974126592
m_Localized: 'Morning Star
Sun''s Dawn
First Seed
Rain''s
Hand
Second Seed
Midyear
Sun''s Height
Last Seed
Hearthfire
Frostfall
Sun''s
Dusk
Evening Star'
m_Metadata:
m_Items: []
- m_Id: 318180665765392384
m_Localized: 'The Ritual
The Lover
The Lord
The Mage
The
Shadow
The Steed
The Apprentice
The Warrior
The
Lady
The Tower
The Atronach
The Thief'
m_Metadata:
m_Items: []
- m_Id: 318180720735940608
m_Localized: 'Fall
Spring
Summer
Winter'
m_Metadata:
m_Items: []
- m_Id: 318183911657566208
m_Localized: '{0:00}:{1:00}:{2:00} on {3}, {4}{5} of {6:00}, 3E{7}'
m_Metadata:
m_Items: []
- m_Id: 318184342387421184
m_Localized: '{0:00}:{1:00}:{2:00} on {3}{4} of {5:00}, 3E{6}'
m_Metadata:
m_Items: []
- m_Id: 318184563599208448
m_Localized: '{0} the {1}{2} of {3:00}'
m_Metadata:
m_Items: []
references:
version: 1
42 changes: 11 additions & 31 deletions Assets/Scripts/Utility/DaggerfallDateTime.cs
Expand Up @@ -12,6 +12,7 @@
using UnityEngine;
using System;
using System.Collections;
using DaggerfallWorkshop.Game;

namespace DaggerfallWorkshop.Utility
{
Expand Down Expand Up @@ -281,30 +282,6 @@ public enum Seasons

#endregion

#region Strings

static string[] dayNames = new string[] {
"Sundas", "Morndas", "Tirdas", "Middas", "Turdas", "Fredas", "Loredas",
};

static string[] monthNames = new string[] {
"Morning Star", "Sun's Dawn", "First Seed", "Rain's Hand", "Second Seed",
"Midyear", "Sun's Height", "Last Seed", "Hearthfire", "Frostfall", "Sun's Dusk",
"Evening Star",
};

static string[] birthSignNames = new string[] {
"The Ritual", "The Lover", "The Lord", "The Mage", "The Shadow", "The Steed",
"The Apprentice", "The Warrior", "The Lady", "The Tower", "The Atronach",
"The Thief",
};

static string[] seasonNames = new string[] {
"Fall", "Spring", "Summer", "Winter",
};

#endregion

#region Constructors

/// <summary>
Expand Down Expand Up @@ -421,7 +398,8 @@ public string MidDateTimeString()
public string LongDateTimeString()
{
string suffix = GetSuffix(Day + 1);
return string.Format("{0:00}:{1:00}:{2:00} on {3}, {4}{5} of {6:00}, 3E{7}", Hour, Minute, Second, DayName, Day + 1, suffix, MonthName, Year);
string longDateTimeFormatString = TextManager.Instance.GetLocalizedText("longDateTimeFormatString");
return string.Format(longDateTimeFormatString, Hour, Minute, Second, DayName, Day + 1, suffix, MonthName, Year);
}

/// <summary>
Expand All @@ -430,7 +408,8 @@ public string LongDateTimeString()
public string DateTimeString()
{
string suffix = GetSuffix(Day + 1);
return string.Format("{0:00}:{1:00}:{2:00} on {3}{4} of {5:00}, 3E{6}", Hour, Minute, Second, Day + 1, suffix, MonthName, Year);
string dateTimeFormatString = TextManager.Instance.GetLocalizedText("dateTimeFormatString");
return string.Format(dateTimeFormatString, Hour, Minute, Second, Day + 1, suffix, MonthName, Year);
}

/// <summary>
Expand All @@ -439,7 +418,8 @@ public string DateTimeString()
public string DateString()
{
string suffix = GetSuffix(Day+1);
return string.Format("{0} the {1}{2} of {3:00}", DayName, Day + 1, suffix, MonthName);
string dateFormatString = TextManager.Instance.GetLocalizedText("dateFormatString");
return string.Format(dateFormatString, DayName, Day + 1, suffix, MonthName);
}


Expand Down Expand Up @@ -574,23 +554,23 @@ private string GetDayName()
int week = (int)(Day / DaysPerWeek);
int day = (int)(Day - (week * DaysPerWeek));

return dayNames[day];
return TextManager.Instance.GetLocalizedTextList("dayNames")[day];
}

private string GetMonthName()
{
if (Month < 0 || Month >= MonthsPerYear)
RaiseTime(0);

return monthNames[(int)Month];
return TextManager.Instance.GetLocalizedTextList("monthNames")[Month];
}

private string GetBirthSignName()
{
if (Month < 0 || Month >= MonthsPerYear)
RaiseTime(0);

return birthSignNames[(int)Month];
return TextManager.Instance.GetLocalizedTextList("birthSignNames")[Month];
}

private Seasons GetSeasonValue()
Expand Down Expand Up @@ -630,7 +610,7 @@ private string GetSeasonName()
if (Month < 0 || Month >= MonthsPerYear)
RaiseTime(0);

return seasonNames[(int)GetSeasonValue()];
return TextManager.Instance.GetLocalizedTextList("seasonNames")[(int)GetSeasonValue()];
}

private int GetMinuteOfDay()
Expand Down

0 comments on commit e5088be

Please sign in to comment.