mirror of
https://github.com/blakeblackshear/frigate.git
synced 2025-12-06 05:24:11 +03:00
improve i18n for lists of text/labels (#20696)
Some checks are pending
CI / AMD64 Build (push) Waiting to run
CI / ARM Build (push) Waiting to run
CI / Jetson Jetpack 6 (push) Waiting to run
CI / AMD64 Extra Build (push) Blocked by required conditions
CI / ARM Extra Build (push) Blocked by required conditions
CI / Synaptics Build (push) Blocked by required conditions
CI / Assemble and push default build (push) Blocked by required conditions
Some checks are pending
CI / AMD64 Build (push) Waiting to run
CI / ARM Build (push) Waiting to run
CI / Jetson Jetpack 6 (push) Waiting to run
CI / AMD64 Extra Build (push) Blocked by required conditions
CI / ARM Extra Build (push) Blocked by required conditions
CI / Synaptics Build (push) Blocked by required conditions
CI / Assemble and push default build (push) Blocked by required conditions
This commit is contained in:
parent
640007e5d3
commit
c2cbb0fa87
@ -98,6 +98,10 @@
|
|||||||
"show": "Show {{item}}",
|
"show": "Show {{item}}",
|
||||||
"ID": "ID"
|
"ID": "ID"
|
||||||
},
|
},
|
||||||
|
"list": {
|
||||||
|
"two": "{{0}} and {{1}}",
|
||||||
|
"many": "{{items}}, and {{last}}"
|
||||||
|
},
|
||||||
"field": {
|
"field": {
|
||||||
"optional": "Optional",
|
"optional": "Optional",
|
||||||
"internalID": "The Internal ID Frigate uses in the configuration and database"
|
"internalID": "The Internal ID Frigate uses in the configuration and database"
|
||||||
|
|||||||
@ -3,6 +3,23 @@ import { t } from "i18next";
|
|||||||
import { getTranslatedLabel } from "./i18n";
|
import { getTranslatedLabel } from "./i18n";
|
||||||
import { capitalizeFirstLetter } from "./stringUtil";
|
import { capitalizeFirstLetter } from "./stringUtil";
|
||||||
|
|
||||||
|
function formatZonesList(zones: string[]): string {
|
||||||
|
if (zones.length === 0) return "";
|
||||||
|
if (zones.length === 1) return zones[0];
|
||||||
|
if (zones.length === 2) {
|
||||||
|
return t("list.two", {
|
||||||
|
0: zones[0],
|
||||||
|
1: zones[1],
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
const allButLast = zones.slice(0, -1).join(", ");
|
||||||
|
return t("list.many", {
|
||||||
|
items: allButLast,
|
||||||
|
last: zones[zones.length - 1],
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
export function getLifecycleItemDescription(
|
export function getLifecycleItemDescription(
|
||||||
lifecycleItem: TrackingDetailsSequence,
|
lifecycleItem: TrackingDetailsSequence,
|
||||||
) {
|
) {
|
||||||
@ -24,7 +41,7 @@ export function getLifecycleItemDescription(
|
|||||||
return t("trackingDetails.lifecycleItemDesc.entered_zone", {
|
return t("trackingDetails.lifecycleItemDesc.entered_zone", {
|
||||||
ns: "views/explore",
|
ns: "views/explore",
|
||||||
label,
|
label,
|
||||||
zones: lifecycleItem.data.zones.join(" and ").replaceAll("_", " "),
|
zones: formatZonesList(lifecycleItem.data.zones),
|
||||||
});
|
});
|
||||||
case "active":
|
case "active":
|
||||||
return t("trackingDetails.lifecycleItemDesc.active", {
|
return t("trackingDetails.lifecycleItemDesc.active", {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user