From 1ca25c563f810bbf1cd681dc7c7ca173041cd1e7 Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Fri, 26 Mar 2021 19:13:20 +1000 Subject: [PATCH] update most no-arg TR references in *.svelte --- pylib/tools/rewrite_tr.py | 6 +++--- ts/congrats/CongratsPage.svelte | 13 +++++-------- ts/graphs/AddedGraph.svelte | 4 ++-- ts/graphs/ButtonsGraph.svelte | 4 ++-- ts/graphs/CalendarGraph.svelte | 2 +- ts/graphs/CardCounts.svelte | 4 ++-- ts/graphs/EaseGraph.svelte | 4 ++-- ts/graphs/FutureDue.svelte | 6 +++--- ts/graphs/GraphRangeRadios.svelte | 2 +- ts/graphs/HourGraph.svelte | 4 ++-- ts/graphs/IntervalsGraph.svelte | 6 +++--- ts/graphs/NoDataOverlay.svelte | 2 +- ts/graphs/RangeBox.svelte | 10 +++++----- ts/graphs/ReviewsGraph.svelte | 8 ++++---- 14 files changed, 36 insertions(+), 39 deletions(-) diff --git a/pylib/tools/rewrite_tr.py b/pylib/tools/rewrite_tr.py index a1adc105b..732318d81 100644 --- a/pylib/tools/rewrite_tr.py +++ b/pylib/tools/rewrite_tr.py @@ -9,13 +9,13 @@ from re import Match import stringcase -TR_REF = re.compile(r"i18n.tr\(\s*i18n.TR.([^,) ]+),\s*([^)]+)\)") +TR_REF = re.compile(r"i18n\.tr\(i18n\.TR\.([^,) ]+)\)") def repl(m: Match) -> str: name = stringcase.camelcase(m.group(1).lower()) - args = m.group(2) - return f"i18n.{name}({args})" + # args = m.group(2) + return f"i18n.{name}()" def update_py(path: str) -> None: diff --git a/ts/congrats/CongratsPage.svelte b/ts/congrats/CongratsPage.svelte index 47f224da4..908339fef 100644 --- a/ts/congrats/CongratsPage.svelte +++ b/ts/congrats/CongratsPage.svelte @@ -9,17 +9,14 @@ export let info: pb.BackendProto.CongratsInfoOut; export let i18n: I18n; - const congrats = i18n.tr(i18n.TR.SCHEDULING_CONGRATULATIONS_FINISHED); + const congrats = i18n.schedulingCongratulationsFinished(); const nextLearnMsg = buildNextLearnMsg(info, i18n); - const today_reviews = i18n.tr(i18n.TR.SCHEDULING_TODAY_REVIEW_LIMIT_REACHED); - const today_new = i18n.tr(i18n.TR.SCHEDULING_TODAY_NEW_LIMIT_REACHED); + const today_reviews = i18n.schedulingTodayReviewLimitReached(); + const today_new = i18n.schedulingTodayNewLimitReached(); - const unburyThem = bridgeLink("unbury", i18n.tr(i18n.TR.SCHEDULING_UNBURY_THEM)); + const unburyThem = bridgeLink("unbury", i18n.schedulingUnburyThem()); const buriedMsg = i18n.schedulingBuriedCardsFound({ unburyThem }); - const customStudy = bridgeLink( - "customStudy", - i18n.tr(i18n.TR.SCHEDULING_CUSTOM_STUDY) - ); + const customStudy = bridgeLink("customStudy", i18n.schedulingCustomStudy()); const customStudyMsg = i18n.schedulingHowToCustomStudy({ customStudy, }); diff --git a/ts/graphs/AddedGraph.svelte b/ts/graphs/AddedGraph.svelte index c9e50a48f..3d7e9208a 100644 --- a/ts/graphs/AddedGraph.svelte +++ b/ts/graphs/AddedGraph.svelte @@ -42,8 +42,8 @@ ); } - const title = i18n.tr(i18n.TR.STATISTICS_ADDED_TITLE); - const subtitle = i18n.tr(i18n.TR.STATISTICS_ADDED_SUBTITLE); + const title = i18n.statisticsAddedTitle(); + const subtitle = i18n.statisticsAddedSubtitle(); diff --git a/ts/graphs/ButtonsGraph.svelte b/ts/graphs/ButtonsGraph.svelte index bbe2b2874..d6c6147d5 100644 --- a/ts/graphs/ButtonsGraph.svelte +++ b/ts/graphs/ButtonsGraph.svelte @@ -25,8 +25,8 @@ renderButtons(svg as SVGElement, bounds, sourceData, i18n, graphRange); } - const title = i18n.tr(i18n.TR.STATISTICS_ANSWER_BUTTONS_TITLE); - const subtitle = i18n.tr(i18n.TR.STATISTICS_ANSWER_BUTTONS_SUBTITLE); + const title = i18n.statisticsAnswerButtonsTitle(); + const subtitle = i18n.statisticsAnswerButtonsSubtitle(); diff --git a/ts/graphs/CalendarGraph.svelte b/ts/graphs/CalendarGraph.svelte index 7d72dd307..3865745ed 100644 --- a/ts/graphs/CalendarGraph.svelte +++ b/ts/graphs/CalendarGraph.svelte @@ -66,7 +66,7 @@ ); } - const title = i18n.tr(i18n.TR.STATISTICS_CALENDAR_TITLE); + const title = i18n.statisticsCalendarTitle(); diff --git a/ts/graphs/CardCounts.svelte b/ts/graphs/CardCounts.svelte index 384002e7f..4e4f8100e 100644 --- a/ts/graphs/CardCounts.svelte +++ b/ts/graphs/CardCounts.svelte @@ -33,8 +33,8 @@ tableData = renderCards(svg as any, bounds, graphData); } - const label = i18n.tr(i18n.TR.STATISTICS_COUNTS_SEPARATE_SUSPENDED_BURIED_CARDS); - const total = i18n.tr(i18n.TR.STATISTICS_COUNTS_TOTAL_CARDS); + const label = i18n.statisticsCountsSeparateSuspendedBuriedCards(); + const total = i18n.statisticsCountsTotalCards();