Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

mobile: fix localization

Ammar Ahmed3f54eee11d90
diff --git a/apps/mobile/app/components/list-items/headers/section-header.tsx b/apps/mobile/app/components/list-items/headers/section-header.tsx
index a0dd773ed..e7070c5a9 100644
--- a/apps/mobile/app/components/list-items/headers/section-header.tsx
+++ b/apps/mobile/app/components/list-items/headers/section-header.tsx
@@ -18,6 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import { GroupHeader, GroupOptions, ItemType } from "@notesnook/core";
+import { strings } from "@notesnook/intl";
import { useThemeColors } from "@notesnook/theme";
import React from "react";
import { TouchableOpacity, View, useWindowDimensions } from "react-native";
@@ -26,13 +27,11 @@ import { presentSheet } from "../../../services/event-manager";
import SettingsService from "../../../services/settings";
import { RouteName } from "../../../stores/use-navigation-store";
import { getContainerBorder } from "../../../utils/colors";
-import { GROUP } from "../../../utils/constants";
import { SIZE } from "../../../utils/size";
import Sort from "../../sheets/sort";
import { Button } from "../../ui/button";
import { IconButton } from "../../ui/icon-button";
import Heading from "../../ui/typography/heading";
-import { strings } from "@notesnook/intl";
type SectionHeaderProps = {
item: GroupHeader;
@@ -58,17 +57,14 @@ export const SectionHeader = React.memo<
}: SectionHeaderProps) {
const { colors } = useThemeColors();
const { fontScale } = useWindowDimensions();
- let groupBy = Object.keys(GROUP).find(
- (key) => GROUP[key as keyof typeof GROUP] === groupOptions.groupBy
- );
+ const groupBy =
+ strings.groupByStrings[
+ groupOptions.groupBy as keyof typeof strings.groupByStrings
+ ]?.();
const isCompactModeEnabled = useIsCompactModeEnabled(
dataType as "note" | "notebook"
);
- groupBy = !groupBy
- ? "Default"
- : groupBy.slice(0, 1).toUpperCase() + groupBy.slice(1, groupBy.length);
-
return (
<View
style={{
@@ -118,12 +114,10 @@ export const SectionHeader = React.memo<
<>
<Button
onPress={() => {
- console.log("Opening Sort sheet", screen, dataType);
presentSheet({
component: <Sort screen={screen} type={dataType} />
});
}}
- tooltipText="Change sorting of items in list"
title={groupBy}
icon={
groupOptions.sortDirection === "asc"
@@ -157,11 +151,6 @@ export const SectionHeader = React.memo<
screen !== "Notes"
}
testID="icon-compact-mode"
- tooltipText={
- isCompactModeEnabled
- ? "Switch to normal mode"
- : "Switch to compact mode"
- }
color={colors.secondary.icon}
name={isCompactModeEnabled ? "view-list" : "view-list-outline"}
onPress={() => {
diff --git a/apps/mobile/app/hooks/use-actions.tsx b/apps/mobile/app/hooks/use-actions.tsx
index 7fa127b53..aa11ce5a8 100644
--- a/apps/mobile/app/hooks/use-actions.tsx
+++ b/apps/mobile/app/hooks/use-actions.tsx
@@ -775,7 +775,7 @@ export const useActions = ({
actions.push(
{
id: "favorite",
- title: item.favorite ? "Unfav" : "Fav",
+ title: item.favorite ? strings.favorite() : strings.unfavorite(),
icon: item.favorite ? "star-off" : "star-outline",
func: addToFavorites,
close: false,
@@ -955,8 +955,8 @@ export const useActions = ({
id: "trash",
title:
item.type !== "notebook" && item.type !== "note"
- ? "Delete " + item.type
- : "Move to trash",
+ ? strings.doAction(item.type, 1, "delete")
+ : strings.moveToTrash(),
icon: "delete-outline",
type: "error",
func: deleteItem
diff --git a/apps/mobile/native/globals.js b/apps/mobile/native/globals.js
index a0d81930d..ab4c08a79 100644
--- a/apps/mobile/native/globals.js
+++ b/apps/mobile/native/globals.js
@@ -16,15 +16,18 @@ global.DOMParser = DOMParser;
import {setI18nGlobal } from "@notesnook/intl";
import { i18n } from "@lingui/core";
import { ScriptManager, Script } from '@callstack/repack/client';
+import {
+ messages as $en
+} from "@notesnook/intl/locales/$en.json";
import {
messages as $pseudo
} from "@notesnook/intl/locales/$pseudo-LOCALE.json";
i18n.load({
- "pseudo-LOCALE": $pseudo
+ en: __DEV__ ? $pseudo : $en
});
setI18nGlobal(i18n);
-i18n.activate("pseudo-LOCALE");
+i18n.activate("en");
setI18nGlobal(i18n);