diff --git a/package.json b/package.json index 8ff63f7da..6a3b330a6 100644 --- a/package.json +++ b/package.json @@ -83,7 +83,6 @@ "leaflet.gridlayer.googlemutant": "0.13.4", "preact": "10.5.7", "preact-cli": "3.0.0", - "preact-i18nline": "2.0.0", "preact-router": "3.2.1", "react-hook-form": "6.9.2", "react-query": "2.23.1", diff --git a/plugins/lime-plugin-delete-nodes/src/deleteNodesMenu.js b/plugins/lime-plugin-delete-nodes/src/deleteNodesMenu.js index 091be2c84..5f7be2277 100644 --- a/plugins/lime-plugin-delete-nodes/src/deleteNodesMenu.js +++ b/plugins/lime-plugin-delete-nodes/src/deleteNodesMenu.js @@ -1,8 +1,8 @@ import { h } from 'preact'; -import I18n from 'i18n-js'; +import { Trans } from '@lingui/macro'; const Menu = () => ( - {I18n.t('Delete Nodes')} + Delete Nodes ); export default Menu; diff --git a/plugins/lime-plugin-delete-nodes/src/deleteNodesPage.js b/plugins/lime-plugin-delete-nodes/src/deleteNodesPage.js index 418a762ff..b33a0311b 100644 --- a/plugins/lime-plugin-delete-nodes/src/deleteNodesPage.js +++ b/plugins/lime-plugin-delete-nodes/src/deleteNodesPage.js @@ -6,7 +6,7 @@ import { useEffect, useState } from 'preact/hooks'; import { useSet } from 'react-use'; import { useMarkNodesAsGone, useNetworkNodes } from 'plugins/lime-plugin-network-nodes/src/networkNodesQueries' import style from './deleteNodesStyle.less'; -import I18n from 'i18n-js'; +import { Trans } from '@lingui/macro'; export const DeleteNodesPage_ = ({ nodes, onDelete, isSubmitting, isSuccess }) => { const [selectedNodes, { toggle, has, reset }] = useSet(new Set([])); @@ -26,13 +26,17 @@ export const DeleteNodesPage_ = ({ nodes, onDelete, isSubmitting, isSuccess }) = return (
-

{I18n.t("Delete Nodes")}

+

Delete Nodes

{unreachableNodes.length > 0 && -

{I18n.t("Select the nodes which no longer belong to the network and " - + "delete them from the list of unreachable nodes")}

+

+ + Select the nodes which no longer belong to the network and + delete them from the list of unreachable nodes + +

} {unreachableNodes.length === 0 && -

{I18n.t("There are no left unreachable nodes")}

+

There are no left unreachable nodes

} {unreachableNodes.map(node => @@ -48,15 +52,16 @@ export const DeleteNodesPage_ = ({ nodes, onDelete, isSubmitting, isSuccess }) =
- {[selectedNodes.size, - I18n.t('selected-nodes', { count: selectedNodes.size }) - ].join(' ')} + {!isSubmitting && } {isSubmitting && @@ -66,7 +71,7 @@ export const DeleteNodesPage_ = ({ nodes, onDelete, isSubmitting, isSuccess }) = }
{showSuccess && - + Successfully deleted} /> }
) diff --git a/plugins/lime-plugin-network-nodes/src/components/expandableNode/index.js b/plugins/lime-plugin-network-nodes/src/components/expandableNode/index.js index e3ebeaf4a..05186ad9d 100644 --- a/plugins/lime-plugin-network-nodes/src/components/expandableNode/index.js +++ b/plugins/lime-plugin-network-nodes/src/components/expandableNode/index.js @@ -1,5 +1,5 @@ import { h } from 'preact'; -import I18n from 'i18n-js'; +import { Trans } from '@lingui/macro'; import { ListItem } from 'components/list'; import style from './style.less'; @@ -15,8 +15,8 @@ export const ExpandableNode = ({ node, showMore, onClick }) => {
e.stopPropagation()}> {ipv4 &&
IPv4: {ipv4}
} {ipv6 &&
IPv6: {ipv6}
} - {board &&
{I18n.t('Device')}: {board}
} - {fw_version &&
{I18n.t('Firmware')}: {fw_version}
} + {board &&
Device: {board}
} + {fw_version &&
Firmware: {fw_version}
}
} diff --git a/plugins/lime-plugin-network-nodes/src/networkNodesMenu.js b/plugins/lime-plugin-network-nodes/src/networkNodesMenu.js index 0303aa3c6..9f2019d78 100644 --- a/plugins/lime-plugin-network-nodes/src/networkNodesMenu.js +++ b/plugins/lime-plugin-network-nodes/src/networkNodesMenu.js @@ -1,8 +1,8 @@ import { h } from 'preact'; -import I18n from 'i18n-js'; +import { Trans } from '@lingui/macro'; const Menu = () => ( - {I18n.t('Network Nodes')} + Network Nodes ); export default Menu; diff --git a/plugins/lime-plugin-network-nodes/src/networkNodesPage.js b/plugins/lime-plugin-network-nodes/src/networkNodesPage.js index 539c126f5..f256d8b09 100644 --- a/plugins/lime-plugin-network-nodes/src/networkNodesPage.js +++ b/plugins/lime-plugin-network-nodes/src/networkNodesPage.js @@ -5,7 +5,7 @@ import { Loading } from 'components/loading'; import { ExpandableNode } from './components/expandableNode'; import style from './networkNodesStyle.less'; import { useState } from 'preact/hooks'; -import I18n from 'i18n-js'; +import { Trans } from '@lingui/macro'; export const _NetworkNodes = ({ nodes, isLoading, unfoldedNode, onUnfold }) => { if (isLoading) { @@ -13,7 +13,7 @@ export const _NetworkNodes = ({ nodes, isLoading, unfoldedNode, onUnfold }) => { } return (
-
{I18n.t("Network Nodes")}
+
Network Nodes
{nodes.map((node) => ( - {I18n.t('Reachable Nodes')} -); \ No newline at end of file + Reachable Nodes +); diff --git a/plugins/lime-plugin-reachable-nodes/src/reachableNodesPage.js b/plugins/lime-plugin-reachable-nodes/src/reachableNodesPage.js index bc02bd4fe..798a80b96 100644 --- a/plugins/lime-plugin-reachable-nodes/src/reachableNodesPage.js +++ b/plugins/lime-plugin-reachable-nodes/src/reachableNodesPage.js @@ -6,22 +6,28 @@ import { List } from "components/list"; import { ExpandableNode } from "plugins/lime-plugin-network-nodes/src/components/expandableNode"; import { useNetworkNodes } from "plugins/lime-plugin-network-nodes/src/networkNodesQueries"; import Help from "components/help"; -import I18n from 'i18n-js'; +import { Trans } from '@lingui/macro'; const PageHelp = () => (

-

{I18n.t("Reachable Nodes")}
- {I18n.t("These are the nodes that can be reached from your node, " + - "i.e. there is a working path from your node to each of them.")} +
Reachable Nodes
+ + These are the nodes that can be reached from your node, + i.e. there is a working path from your node to each of them. +
- {I18n.t("This information is synced periodically " + - "and can be outdated by some minutes")} + + This information is synced periodically + and can be outdated by some minutes. +

-

{I18n.t("Unreachable Nodes")}
- {I18n.t("These are the nodes that can't be reached from your node, " + - "it is possible that they are not turned on or a link to reach them is down.")} +
Unreachable Nodes
+ + These are the nodes that can't be reached from your node, + it is possible that they are not turned on or a link to reach them is down. +

); @@ -30,8 +36,8 @@ const PageTabs = ({ nodes, ...props }) => { const nReachable = Object.values(nodes).filter(n => n.status === "recently_reachable").length; const nUnreachable = Object.values(nodes).filter(n => n.status === "unreachable").length; const tabs = [ - { key: 'recently_reachable', repr: I18n.t('Reachable (%{howMany})', { howMany: nReachable }) }, - { key: 'unreachable', repr: I18n.t('Unreachable (%{howMany})', { howMany: nUnreachable }) }, + { key: 'recently_reachable', repr: Reachable ({nReachable}) }, + { key: 'unreachable', repr: Unreachable ({nUnreachable}) }, ]; return } diff --git a/plugins/lime-plugin-upgraded-nodes/src/upgradedNodesMenu.js b/plugins/lime-plugin-upgraded-nodes/src/upgradedNodesMenu.js index e9a01c90f..38dcd2f4a 100644 --- a/plugins/lime-plugin-upgraded-nodes/src/upgradedNodesMenu.js +++ b/plugins/lime-plugin-upgraded-nodes/src/upgradedNodesMenu.js @@ -1,8 +1,8 @@ import { h } from 'preact'; -import I18n from 'i18n-js'; +import { Trans } from '@lingui/macro'; const Menu = () => ( - {I18n.t('Upgraded Nodes')} + Upgraded Nodes ); export default Menu; diff --git a/plugins/lime-plugin-upgraded-nodes/src/upgradedNodesPage.js b/plugins/lime-plugin-upgraded-nodes/src/upgradedNodesPage.js index 99b5c2031..b14e582e6 100644 --- a/plugins/lime-plugin-upgraded-nodes/src/upgradedNodesPage.js +++ b/plugins/lime-plugin-upgraded-nodes/src/upgradedNodesPage.js @@ -8,7 +8,7 @@ import { ExpandableNode } from "plugins/lime-plugin-network-nodes/src/components import { useNetworkNodes } from "plugins/lime-plugin-network-nodes/src/networkNodesQueries"; import { useNewVersion } from "plugins/lime-plugin-firmware/src/firmwareQueries"; import Help from "components/help"; -import I18n from 'i18n-js'; +import { Trans } from '@lingui/macro'; function groupBy(xs, key) { return xs.reduce(function (rv, x) { @@ -26,12 +26,12 @@ function groupBy(xs, key) { const PageHelp = () => (

-

{I18n.t("Upgraded Nodes")}
- {I18n.t("These are the nodes running the last version of the Firmware")} +
Upgraded Nodes
+ These are the nodes running the last version of the Firmware

-

{I18n.t("Not Upgraded Nodes")}
- {I18n.t("These are the nodes that need to be upgraded to the last version of the Firmware")} +
Not Upgraded Nodes
+ These are the nodes that need to be upgraded to the last version of the Firmware

); @@ -40,8 +40,8 @@ const PageTabs = ({ nodes, ...props }) => { const nUpgraded = nodes.filter(n => n.group === "upgraded").length; const nNotUpgraded = nodes.filter(n => n.group === "not_upgraded").length; const tabs = [ - { key: 'upgraded', repr: I18n.t('Upgraded (%{howMany})', { howMany: nUpgraded }) }, - { key: 'not_upgraded', repr: I18n.t('Not Upgraded (%{howMany})', { howMany: nNotUpgraded }) }, + { key: 'upgraded', repr: Upgraded ({nUpgraded})}, + { key: 'not_upgraded', repr: Not Upgraded ({nNotUpgraded})}, ]; return }