Skip to content

Commit

Permalink
bugfix(Experimentalfeatures): Added translation for Settings and expe…
Browse files Browse the repository at this point in the history
…rimental features
  • Loading branch information
mcayuelas-ledger committed Sep 13, 2022
1 parent d4fe263 commit 134ec2a
Show file tree
Hide file tree
Showing 4 changed files with 77 additions and 22 deletions.
5 changes: 5 additions & 0 deletions .changeset/late-spies-knock.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"live-mobile": patch
---

Added translation for Settings and experimental features
45 changes: 26 additions & 19 deletions apps/ledger-live-mobile/src/experimental.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ import { setEnvUnsafe, isEnvDefault, changes } from "@ledgerhq/live-common/env";
import type { EnvName } from "@ledgerhq/live-common/env";

import { FeatureId } from "@ledgerhq/types-live";

import logger from "./logger";
import { i18n } from "./context/Locale";

export type FeatureCommon = {
name: EnvName;
Expand Down Expand Up @@ -34,14 +36,22 @@ export type Feature = FeatureCommon & (FeatureToggle | FeatureInteger);
// const experimentalCurrencies = "solana,cardano";
const experimentalCurrencies = "";

const i18nKey = (key: string, prop: string) =>
`settings.experimental.experimentalFeatures.${key}.${prop}`;

const i18nKeyDeveloper = (key: string, prop: string) =>
`settings.experimental.developerFeatures.${key}.${prop}`;

export const experimentalFeatures: Feature[] = [
...(experimentalCurrencies.length
? [
{
type: "toggle",
name: "EXPERIMENTAL_CURRENCIES",
title: "Experimental integrations",
description: "Use available experimental crypto assets integrations.",
title: i18n.t(i18nKey("experimentalIntegrations", "title")),
description: i18n.t(
i18nKey("experimentalIntegrations", "description"),
),
valueOn: experimentalCurrencies,
valueOff: "",
},
Expand All @@ -50,30 +60,27 @@ export const experimentalFeatures: Feature[] = [
{
type: "toggle",
name: "MANAGER_DEV_MODE",
title: "Developer mode",
description: "Show developer and testnet apps in the Manager.",
title: i18n.t(i18nKey("developerMode", "title")),
description: i18n.t(i18nKey("developerMode", "description")),
},
{
type: "integer",
name: "FORCE_PROVIDER",
title: "Manager provider",
description:
"Changing the app provider in the Manager may make it impossible to install or uninstall apps on your Ledger device.",
title: i18n.t(i18nKey("managerProvider", "title")),
description: i18n.t(i18nKey("managerProvider", "description")),
minValue: 1,
},
{
type: "toggle",
name: "EXPERIMENTAL_EXPLORERS",
title: "Experimental Explorers API",
description:
"Try an upcoming version of Ledger's blockchain explorers. Changing this setting may affect the account balance and synchronization as well as the send feature.",
title: i18n.t(i18nKey("experimentalExplorers", "title")),
description: i18n.t(i18nKey("experimentalExplorers", "description")),
},
{
type: "toggle",
name: "LEDGER_COUNTERVALUES_API",
title: "Experimental countervalues API",
description:
"This may cause the countervalues displayed for your accounts to become incorrect.",
title: i18n.t(i18nKey("experimentalCountervalues", "title")),
description: i18n.t(i18nKey("experimentalCountervalues", "description")),
valueOn: "https://countervalues-experimental.live.ledger.com",
valueOff: "https://countervalues.live.ledger.com",
},
Expand All @@ -82,8 +89,8 @@ export const experimentalFeatures: Feature[] = [
{
type: "toggle",
name: "EXPERIMENTAL_SWAP",
title: "New SWAP interface ",
description: "Use the new experimental swap interface",
title: i18n.t(i18nKey("experimentalSwap", "title")),
description: i18n.t(i18nKey("experimentalSwap", "description")),
},
]
: []),
Expand All @@ -93,14 +100,14 @@ export const developerFeatures: Feature[] = [
{
type: "toggle",
name: "PLATFORM_EXPERIMENTAL_APPS",
title: "Allow experimental apps",
description: "Display and allow opening experimental tagged platform apps.",
title: i18n.t(i18nKeyDeveloper("experimentalApps", "title")),
description: i18n.t(i18nKeyDeveloper("experimentalApps", "description")),
},
{
type: "toggle",
name: "USE_LEARN_STAGING_URL",
title: "Learn staging URL",
description: "Use the staging URL for the Learn page.",
title: i18n.t(i18nKeyDeveloper("staggingUrl", "title")),
description: i18n.t(i18nKeyDeveloper("staggingUrl", "description")),
},
];

Expand Down
43 changes: 41 additions & 2 deletions apps/ledger-live-mobile/src/locales/en/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -2261,7 +2261,46 @@
"experimental": {
"title": "Experimental features",
"desc": "Try out the Experimental features and let us know what you think.",
"disclaimer": "These are Experimental features provided on an \"as is\" basis for our community of tech enthusiasts. They may change, break or be removed at any time. By enabling them, you agree to use them at your own risk."
"disclaimer": "These are Experimental features provided on an \"as is\" basis for our community of tech enthusiasts. They may change, break or be removed at any time. By enabling them, you agree to use them at your own risk.",
"experimentalFeatures": {
"experimentalIntegrations": {
"title": "Experimental integrations",
"description": "Use available experimental crypto assets integrations."
},
"developerMode": {
"title": "Developer mode",
"description": "Show developer and testnet apps in the Manager."
},
"managerProvider": {
"title": "Manager provider",
"description": "Changing the app provider in the Manager may make it impossible to install or uninstall apps on your Ledger device."
},
"experimentalExplorers": {
"title": "Experimental Explorers API",
"description": "Try an upcoming version of Ledger's blockchain explorers. Changing this setting may affect the account balance and synchronization as well as the send feature."
},
"experimentalCountervalues": {
"title": "Experimental countervalues API",
"description": "This may cause the countervalues displayed for your accounts to become incorrect."
},
"experimentalSwap": {
"title": "New SWAP interface",
"description": "Use the new experimental swap interface"
}
},
"developerFeatures": {
"experimentalApps": {
"title": "Allow experimental apps",
"description": "Display and allow opening experimental tagged platform apps."
},
"staggingUrl": {
"title": "Learn staging URL",
"description": "Use the staging URL for the Learn page."
},
"platformManifest": {
"title": "Load Platform Manifest"
}
}
},
"developer": {
"title": "Developer",
Expand Down Expand Up @@ -4775,4 +4814,4 @@
"description": "Click here to finish setting up your {{productName}} with Ledger Live"
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { NavigationProp } from "@react-navigation/native";
import { isEnvDefault } from "@ledgerhq/live-common/env";
import React from "react";
import { ScrollView } from "react-native";
import { useTranslation } from "react-i18next";
import SettingsRow from "../../../components/SettingsRow";
import { ScreenName } from "../../../const";
import { developerFeatures } from "../../../experimental";
Expand All @@ -14,6 +15,7 @@ export default function DeveloperSettings({
}: {
navigation: NavigationProp;
}) {
const { t } = useTranslation();
return (
<ScrollView>
<TrackScreen category="Settings" name="Developer" />
Expand All @@ -26,7 +28,9 @@ export default function DeveloperSettings({
)}

<SettingsRow
title="Load Platform Manifest"
title={t(
"settings.experimental.developerFeatures.platformManifest.title",
)}
onPress={() => navigation.navigate(ScreenName.DeveloperCustomManifest)}
/>
</ScrollView>
Expand Down

0 comments on commit 134ec2a

Please sign in to comment.