update most no-arg TR references in *.svelte

This commit is contained in:
Damien Elmes 2021-03-26 19:13:20 +10:00
parent cd4572c3dd
commit 1ca25c563f
14 changed files with 36 additions and 39 deletions

View File

@ -9,13 +9,13 @@ from re import Match
import stringcase 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: def repl(m: Match) -> str:
name = stringcase.camelcase(m.group(1).lower()) name = stringcase.camelcase(m.group(1).lower())
args = m.group(2) # args = m.group(2)
return f"i18n.{name}({args})" return f"i18n.{name}()"
def update_py(path: str) -> None: def update_py(path: str) -> None:

View File

@ -9,17 +9,14 @@
export let info: pb.BackendProto.CongratsInfoOut; export let info: pb.BackendProto.CongratsInfoOut;
export let i18n: I18n; export let i18n: I18n;
const congrats = i18n.tr(i18n.TR.SCHEDULING_CONGRATULATIONS_FINISHED); const congrats = i18n.schedulingCongratulationsFinished();
const nextLearnMsg = buildNextLearnMsg(info, i18n); const nextLearnMsg = buildNextLearnMsg(info, i18n);
const today_reviews = i18n.tr(i18n.TR.SCHEDULING_TODAY_REVIEW_LIMIT_REACHED); const today_reviews = i18n.schedulingTodayReviewLimitReached();
const today_new = i18n.tr(i18n.TR.SCHEDULING_TODAY_NEW_LIMIT_REACHED); 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 buriedMsg = i18n.schedulingBuriedCardsFound({ unburyThem });
const customStudy = bridgeLink( const customStudy = bridgeLink("customStudy", i18n.schedulingCustomStudy());
"customStudy",
i18n.tr(i18n.TR.SCHEDULING_CUSTOM_STUDY)
);
const customStudyMsg = i18n.schedulingHowToCustomStudy({ const customStudyMsg = i18n.schedulingHowToCustomStudy({
customStudy, customStudy,
}); });

View File

@ -42,8 +42,8 @@
); );
} }
const title = i18n.tr(i18n.TR.STATISTICS_ADDED_TITLE); const title = i18n.statisticsAddedTitle();
const subtitle = i18n.tr(i18n.TR.STATISTICS_ADDED_SUBTITLE); const subtitle = i18n.statisticsAddedSubtitle();
</script> </script>
<Graph {title} {subtitle}> <Graph {title} {subtitle}>

View File

@ -25,8 +25,8 @@
renderButtons(svg as SVGElement, bounds, sourceData, i18n, graphRange); renderButtons(svg as SVGElement, bounds, sourceData, i18n, graphRange);
} }
const title = i18n.tr(i18n.TR.STATISTICS_ANSWER_BUTTONS_TITLE); const title = i18n.statisticsAnswerButtonsTitle();
const subtitle = i18n.tr(i18n.TR.STATISTICS_ANSWER_BUTTONS_SUBTITLE); const subtitle = i18n.statisticsAnswerButtonsSubtitle();
</script> </script>
<Graph {title} {subtitle}> <Graph {title} {subtitle}>

View File

@ -66,7 +66,7 @@
); );
} }
const title = i18n.tr(i18n.TR.STATISTICS_CALENDAR_TITLE); const title = i18n.statisticsCalendarTitle();
</script> </script>
<Graph {title}> <Graph {title}>

View File

@ -33,8 +33,8 @@
tableData = renderCards(svg as any, bounds, graphData); tableData = renderCards(svg as any, bounds, graphData);
} }
const label = i18n.tr(i18n.TR.STATISTICS_COUNTS_SEPARATE_SUSPENDED_BURIED_CARDS); const label = i18n.statisticsCountsSeparateSuspendedBuriedCards();
const total = i18n.tr(i18n.TR.STATISTICS_COUNTS_TOTAL_CARDS); const total = i18n.statisticsCountsTotalCards();
</script> </script>
<style lang="scss"> <style lang="scss">

View File

@ -31,8 +31,8 @@
); );
} }
const title = i18n.tr(i18n.TR.STATISTICS_CARD_EASE_TITLE); const title = i18n.statisticsCardEaseTitle();
const subtitle = i18n.tr(i18n.TR.STATISTICS_CARD_EASE_SUBTITLE); const subtitle = i18n.statisticsCardEaseSubtitle();
</script> </script>
<Graph {title} {subtitle}> <Graph {title} {subtitle}>

View File

@ -43,9 +43,9 @@
)); ));
} }
const title = i18n.tr(i18n.TR.STATISTICS_FUTURE_DUE_TITLE); const title = i18n.statisticsFutureDueTitle();
const subtitle = i18n.tr(i18n.TR.STATISTICS_FUTURE_DUE_SUBTITLE); const subtitle = i18n.statisticsFutureDueSubtitle();
const backlogLabel = i18n.tr(i18n.TR.STATISTICS_BACKLOG_CHECKBOX); const backlogLabel = i18n.statisticsBacklogCheckbox();
</script> </script>
<Graph {title} {subtitle}> <Graph {title} {subtitle}>

View File

@ -25,7 +25,7 @@
const month = timeSpan(i18n, 1 * MONTH); const month = timeSpan(i18n, 1 * MONTH);
const month3 = timeSpan(i18n, 3 * MONTH); const month3 = timeSpan(i18n, 3 * MONTH);
const year = timeSpan(i18n, 1 * YEAR); const year = timeSpan(i18n, 1 * YEAR);
const all = i18n.tr(i18n.TR.STATISTICS_RANGE_ALL_TIME); const all = i18n.statisticsRangeAllTime();
</script> </script>
<label> <label>

View File

@ -25,8 +25,8 @@
renderHours(svg as SVGElement, bounds, sourceData, i18n, graphRange); renderHours(svg as SVGElement, bounds, sourceData, i18n, graphRange);
} }
const title = i18n.tr(i18n.TR.STATISTICS_HOURS_TITLE); const title = i18n.statisticsHoursTitle();
const subtitle = i18n.tr(i18n.TR.STATISTICS_HOURS_SUBTITLE); const subtitle = i18n.statisticsHoursSubtitle();
</script> </script>
<Graph {title} {subtitle}> <Graph {title} {subtitle}>

View File

@ -45,10 +45,10 @@
); );
} }
const title = i18n.tr(i18n.TR.STATISTICS_INTERVALS_TITLE); const title = i18n.statisticsIntervalsTitle();
const subtitle = i18n.tr(i18n.TR.STATISTICS_INTERVALS_SUBTITLE); const subtitle = i18n.statisticsIntervalsSubtitle();
const month = timeSpan(i18n, 1 * MONTH); const month = timeSpan(i18n, 1 * MONTH);
const all = i18n.tr(i18n.TR.STATISTICS_RANGE_ALL_TIME); const all = i18n.statisticsRangeAllTime();
</script> </script>
<Graph {title} {subtitle}> <Graph {title} {subtitle}>

View File

@ -3,7 +3,7 @@
import type { GraphBounds } from "./graph-helpers"; import type { GraphBounds } from "./graph-helpers";
export let bounds: GraphBounds; export let bounds: GraphBounds;
export let i18n: I18n; export let i18n: I18n;
const noData = i18n.tr(i18n.TR.STATISTICS_NO_DATA); const noData = i18n.statisticsNoData();
</script> </script>
<style lang="scss"> <style lang="scss">

View File

@ -57,11 +57,11 @@
} }
} }
const year = i18n.tr(i18n.TR.STATISTICS_RANGE_1_YEAR_HISTORY); const year = i18n.statisticsRange_1YearHistory();
const deck = i18n.tr(i18n.TR.STATISTICS_RANGE_DECK); const deck = i18n.statisticsRangeDeck();
const collection = i18n.tr(i18n.TR.STATISTICS_RANGE_COLLECTION); const collection = i18n.statisticsRangeCollection();
const searchLabel = i18n.tr(i18n.TR.STATISTICS_RANGE_SEARCH); const searchLabel = i18n.statisticsRangeSearch();
const all = i18n.tr(i18n.TR.STATISTICS_RANGE_ALL_HISTORY); const all = i18n.statisticsRangeAllHistory();
</script> </script>
<style lang="scss"> <style lang="scss">

View File

@ -43,14 +43,14 @@
); );
} }
const title = i18n.tr(i18n.TR.STATISTICS_REVIEWS_TITLE); const title = i18n.statisticsReviewsTitle();
const time = i18n.tr(i18n.TR.STATISTICS_REVIEWS_TIME_CHECKBOX); const time = i18n.statisticsReviewsTimeCheckbox();
let subtitle = ""; let subtitle = "";
$: if (showTime) { $: if (showTime) {
subtitle = i18n.tr(i18n.TR.STATISTICS_REVIEWS_TIME_SUBTITLE); subtitle = i18n.statisticsReviewsTimeSubtitle();
} else { } else {
subtitle = i18n.tr(i18n.TR.STATISTICS_REVIEWS_COUNT_SUBTITLE); subtitle = i18n.statisticsReviewsCountSubtitle();
} }
</script> </script>