Skip to content

Commit e7e181d

Browse files
author
Егор Сухоруков
committed
add localization in web app
1 parent e3c63c7 commit e7e181d

File tree

3 files changed

+9
-10
lines changed

3 files changed

+9
-10
lines changed

src/endpoint/Timesheet.Create/Flow/FlowStep/Step.ExpectConfirmation.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,8 @@ internal static ChatFlow<TimesheetCreateFlowState> ExpectConfirmationOrSkip(
8080
[
8181
new("data", HttpUtility.UrlEncode(data)),
8282
new("date", context.FlowState.Date.GetValueOrDefault().ToString("yyyy-MM-dd", CultureInfo.InvariantCulture)),
83-
new("days", context.FlowState.LimitationDayOfMonth.ToString(CultureInfo.InvariantCulture))
83+
new("days", context.FlowState.LimitationDayOfMonth.ToString(CultureInfo.InvariantCulture)),
84+
new("language", context.User.Culture.TwoLetterISOLanguageName)
8485
]);
8586

8687
context.Logger.LogInformation("WebAppUrl: {webAppUrl}", webAppUrl);

src/endpoint/Timesheet.Show/Flow/FlowStep/Step.ShowTimesheetSet.cs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,11 +114,14 @@ static decimal GetDuration(TimesheetJson timesheet)
114114
date: date.ToString("yyyy-MM-dd", CultureInfo.InvariantCulture),
115115
dateText: date.ToString(DateFormat, context.User.Culture),
116116
timesheets: state.Timesheets,
117-
allowedDays: state.LimitationDayOfMonth,
118-
language: context.User.Culture.TwoLetterISOLanguageName);
117+
allowedDays: state.LimitationDayOfMonth);
119118

120119
var data = webAppData.CompressDataJson();
121-
return context.WebApp.BuildUrl("selectUpdateTimesheet", [new("data", HttpUtility.UrlEncode(data))]);
120+
return context.WebApp.BuildUrl("selectUpdateTimesheet",
121+
[
122+
new("data", HttpUtility.UrlEncode(data)),
123+
new("language", context.User.Culture.TwoLetterISOLanguageName)
124+
]);
122125
}
123126

124127
private static string CompressDataJson(this WebAppTimesheetsDataJson data)

src/endpoint/Timesheet.Show/Flow/Internal.WebApp/WebAppTimesheetsDataJson.cs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,12 @@ public WebAppTimesheetsDataJson(
1010
[AllowNull] string date,
1111
[AllowNull] string dateText,
1212
[AllowNull] FlatArray<TimesheetJson> timesheets,
13-
int allowedDays,
14-
[AllowNull] string language)
13+
int allowedDays)
1514
{
1615
Date = date.OrEmpty();
1716
DateText = dateText.OrEmpty();
1817
Timesheets = timesheets;
1918
AllowedDays = allowedDays;
20-
Language = language.OrEmpty();
2119
}
2220

2321
[JsonPropertyName("d")]
@@ -31,7 +29,4 @@ public WebAppTimesheetsDataJson(
3129

3230
[JsonPropertyName("ad")]
3331
public int AllowedDays { get; }
34-
35-
[JsonPropertyName("l")]
36-
public string Language { get; }
3732
}

0 commit comments

Comments
 (0)