diff --git a/ng-app/package.json b/ng-app/package.json index 20b53f6..af43b6d 100644 --- a/ng-app/package.json +++ b/ng-app/package.json @@ -24,6 +24,7 @@ "flowbite": "^1.6.5", "flowbite-svelte": "^0.43.3", "ng-sdk-js": "workspace:^0.1.0-preview.1", + "svelte-i18n": "^4.0.0", "svelte-spa-router": "^3.3.0", "vite-plugin-top-level-await": "^1.3.1" }, diff --git a/ng-app/src/App.svelte b/ng-app/src/App.svelte index babb772..258fde6 100644 --- a/ng-app/src/App.svelte +++ b/ng-app/src/App.svelte @@ -11,12 +11,14 @@ @@ -26,11 +27,10 @@
-

Welcome to NextGraph

+

{$t("pages.no_wallet.welcome")}

- We could not find a wallet saved on this device.
If you already have - a wallet, select "Log in", otherwise, select "Create Wallet" here below + {$t("pages.no_wallet.description")}

@@ -53,7 +53,7 @@ d="M19 7.5v3m0 0v3m0-3h3m-3 0h-3m-2.25-4.125a3.375 3.375 0 11-6.75 0 3.375 3.375 0 016.75 0zM4 19.235v-.11a6.375 6.375 0 0112.75 0v.109A12.318 12.318 0 0110.374 21c-2.331 0-4.512-.645-6.374-1.766z" /> - Create wallet + {$t("pages.no_wallet.create_wallet")}
@@ -78,7 +78,7 @@ d="M15.75 6a3.75 3.75 0 11-7.5 0 3.75 3.75 0 017.5 0zM4.501 20.118a7.5 7.5 0 0114.998 0A17.933 17.933 0 0112 21.75c-2.676 0-5.216-.584-7.499-1.632z" /> - Log in + {$t("common.login")} diff --git a/ng-app/src/lib/Test.svelte b/ng-app/src/lib/Test.svelte index 08e915a..88780c0 100644 --- a/ng-app/src/lib/Test.svelte +++ b/ng-app/src/lib/Test.svelte @@ -26,7 +26,7 @@ import { onMount, onDestroy, tick } from "svelte"; import { Button } from "flowbite-svelte"; import DataClassIcon from "./DataClassIcon.svelte"; - + import { t } from "svelte-i18n"; let is_tauri = import.meta.env.TAURI_PLATFORM; let files = $active_session && branch_subs($active_session.private_store_id); @@ -696,16 +696,8 @@ {#if $cannot_load_offline}

- You are offline and using the web app. You need to connect to the broker - at least once before you can start using the app locally because the web - app does not keep a local copy of your documents.

- Once connected, if you lose connectivity again, you will be able to have - limited access to some functionalities. Sending binary files won't be possible, - because the limit of local storage in your browser is around 5MB.

- All those limitations will be lifted once the "UserStorage for Web" feature - will be released. Stay tuned!

- Check your connection status in the User panel. + {$t("pages.text.cannot_load_offline")} + {$t("pages.user_panel.title")}.

{:else} @@ -745,7 +737,7 @@ d="M2.25 15.75l5.159-5.159a2.25 2.25 0 013.182 0l5.159 5.159m-1.5-1.5l1.409-1.409a2.25 2.25 0 013.182 0l2.909 2.909m-18 3.75h16.5a1.5 1.5 0 001.5-1.5V6a1.5 1.5 0 00-1.5-1.5H3.75A1.5 1.5 0 002.25 6v12a1.5 1.5 0 001.5 1.5zm10.5-11.25h.008v.008h-.008V8.25zm.375 0a.375.375 0 11-.75 0 .375.375 0 01.75 0z" /> - Add image + {$t("pages.test.add_image")} {#if files} {#await files.load()} -

Currently loading...

+

{$t("connectivity.loading")}...

{:then} {#each $files as file}

diff --git a/ng-app/src/locales/en.json b/ng-app/src/locales/en.json new file mode 100644 index 0000000..5891211 --- /dev/null +++ b/ng-app/src/locales/en.json @@ -0,0 +1,377 @@ +{ + "pages": { + "not_found": { + "title": "Page Not Found", + "message": "The page you are looking for does not exist." + }, + "nextgraph_uri": { + "message": "Nextgraph URI {uri}" + }, + "user_panel": { + "title": "User Panel", + "personal": "Personal", + "already_registered": "The user is already registered with the selected broker.
Try logging in instead.", + "error": "An error occured:
{error}" + }, + "user_registered": { + "already_exists": "The user is already registered with the selected broker.
Try logging in instead.", + "error": "An error occured:
{error}", + "back_to_homepage": "Go Back to Homepage", + "success": "You have been successfully registered{invitation_name, select, null {} other { to {invitationName}}}." + }, + "wallet": { + "title": "Wallet", + "download": "Download Wallet File", + "download_failed": "Download Failed:
{error}", + "download_in_progress": "Download in progress...", + "download_successful": "You will find the file named \"{wallet_file}\" in your Downloads folder", + "download_file": "Click here to download the wallet file" + }, + "settings": { + "title": "Settings" + }, + "admin": { + "title": "Admin" + }, + "accounts": { + "title": "Accounts" + }, + "full_layout": { + "home": "Home", + "stream": "Stream", + "search": "Search", + "create": "Create", + "shared": "Shared", + "site": "Site", + "messages": "Messages", + "notifications": "Notifications" + }, + "install": { + "app_availability": "NextGraph App is available for download as a native app for your mobile, tablet, laptop and desktop.
The app supports iOS, Android, Linux, macOS, Windows, or any other platform with a modern browser.", + "has_wallet_warning": "A wallet is saved in this browser. If it is yours,
once the installation of the app will be finished,
choose the option \"Login\" on the app.
(do not create another wallet from the app).", + "android_play_store": "Android Play Store", + "download_apk": "Download APK", + "ios_app_store": "iOS App Store", + "download_mac_os": "Download for MacOS", + "download_linux": "Download Linux Package", + "download_windows": "Download for Windows", + "other_platforms": "Other platforms" + }, + "no_wallet": { + "welcome": "Welcome to NextGraph", + "description": "We could not find a wallet saved on this device.
If you already have a wallet, select \"Log in\", otherwise, select \"Create Wallet\" here below.", + "create_wallet": "Create Wallet" + }, + "test": { + "cannot_load_offline": "You are offline and using the web app. You need to connect to the broker at least once before you can start using the app locally because the web app does not keep a local copy of your documents.

Once connected, if you lose connectivity again, you will be able to have limited access to some functionalities. Sending binary files won't be possible, because the limit of local storage in your browser is around 5MB.

All those limitations will be lifted once the \"UserStorage for Web\" feature will be released. Stay tuned!

Check your connection status in the ", + "add_image": "Add Image" + }, + "login": { + "heading": "How to open your wallet? You have 2 options:", + "with_pazzle": "With your Pazzle", + "pazzle_steps": { + "1": "For each one of the 9 categories of images, you will be presented with the 15 possible image choices. The categories are shuffled at every login. They will not always appear in the same order.", + "2": "At each category, only one of the 15 displayed choices is the correct image that belongs to your pazzle. Find it and tap or click on that one. The 15 images are shuffled too, they will not appear at the same position at each login. On a computer, you can also use the tab key on your keyboard to move to the desired item on the screen, then press the space bar to select each one.", + "3": "Once you completed the last category, you will be presented with all the images you have previously selected. Their order is displayed as it was when you picked them. But this is not the correct order of the images in your pazzle. You now have to order them correctly.", + "4": "You must remember which image should be the first one in your pazzle. Find it on the screen and click or tap on it. It will be greyed out and the number 1 will appear on top of it.", + "5": "Move on to the second image of your pazzle (that you memorized). Find it on the screen and tap on it. Repeat this step until you reached the last image.", + "6": "Finally, your PIN code will be asked. enter it by clicking or tapping on the digits." + }, + "with_menmonic": "With your 12 words Mnemonic (passphrase)", + "mnemonic_steps": { + "1": "Enter your twelve words mnemonic in the input field. The words must be separated by spaces.", + "2": "Enter the PIN code that you chose when you created your wallet." + }, + "trust_device": "Do you trust this device?", + "trust_device_description": "If you do, if this device is yours or is used by few trusted persons of your family or workplace, and you would like to login again from this device in the future, then you can save your wallet on this device. To the contrary, if this device is public and shared by strangers, do not save your wallet here.", + "trust_device_allow_cookies": "By selecting this option, you agree to saving some cookies on your browser.", + "trust_device_yes": "Yes, save my wallet on this device", + "loading_pazzle": "Loading Pazzle", + "open_with_pazzle": "Open With Pazzle", + "login_cancel": "Cancel Login", + "open_with_mnemonic": "Open with Mnemonic instead", + "enter_mnemonic": "Enter your 12 words mnemonic.", + "select_emoji": "Select your emoji of category:
{category}", + "order_emojis": "Select each image in the correct order", + "enter_pin": "Enter your PIN code", + "go_back": "Go Back", + "correct": "Correct", + "opening_wallet": "Opening your wallet...
Please wait", + "error_occured": "An error occured!", + "try_again": "Try Again", + "wallet_opened": "Your wallet is opened!
Please wait while the app is loading..." + }, + "wallet_create": {} + }, + "buttons": { + "back": "Back", + "confirm": "Confirm" + }, + "connectivity": { + "stopped": "Stopped", + "personal": "Personal", + "connecting": "Connecting", + "connected": "Connected", + "loading": "Loading", + "connection_error_short": "{error}", + "online": "Online", + "offline": "Offline" + }, + "common": { + "version": "Version: {version}", + "logo": "NextGraph Logo", + "support_nextgraph": "Support NextGraph", + "about_nextgraph": "About NextGraph", + "back_to_homepage": "Go Back to Homepage", + "donate_nextgraph": "Donate to NextGraph", + "logout": "Logout", + "login": "Login" + }, + "emojis": { + "category": { + "face": "Face", + "face_unwell": "Bad Face", + "face_costume": "Costumed", + "emotion": "Emotion", + "body": "Body", + "sport": "Sport", + "bigger_animal": "Big Animal", + "smaller_animal": "Small Animal", + "plants": "Plants and Instects", + "fruits": "Fruites and Veggies", + "food": "Food and Drinks", + "travel": "Travel", + "sky": "Sky and Weather", + "play": "Leasure", + "house": "Household" + }, + "codes": { + "COMMENT": "YOU CAN FIND I18N UNICODE DESCRIPTIONS AT https://github.com/unicode-org/cldr-json", + "happy": "grinning face", + "happy_tears": "face with tears of joy", + "halo": "smiling face with halo", + "three_hearts": "smiling face with hearts", + "with_two_hearts": "smiling face with heart-eyes", + "one_heart": "face blowing a kiss", + "with_tongue": "squinting face with tongue", + "with_two_hands": "smiling face with open hands", + "one_hand": "face with hand over mouth", + "silenced": "zipper-mouth face", + "celebrating": "partying face", + "sunglasses": "smiling face with sunglasses", + "eyes_up": "face with rolling eyes", + "monocole": "face with monocle", + "sleeping": "sleeping face", + "mask": "face with medical mask", + "fever": "face with thermometer", + "bandage": "face with head-bandage", + "vomit": "face vomiting", + "tissue": "sneezing face", + "hot": "face with head-bandage", + "cold": "cold face", + "crossed_eyes": "face with crossed-out eyes", + "exploding": "exploding head", + "sad": "frowning face", + "long_nose": "lying face", + "many_tears": "loudly crying face", + "fear": "face screaming in fear", + "tired": "yawning face", + "annoyed": "face with steam from nose", + "clown": "clown face", + "ghost": "ghost", + "dog": "dog face", + "happy_cat": "grinning cat with smiling eyes", + "scared_cat": "weary cat", + "sad_cat": "crying cat", + "monkey_no_see": "see-no-evil monkey", + "monkey_no_hear": "hear-no-evil monkey", + "monkey_no_talk": "speak-no-evil monkey", + "builder": "construction worker", + "princess": "princess", + "firefighter": "person", + "mage": "mage", + "mermaid": "merperson", + "fairy": "fairy", + "letter_heart": "love letter", + "red_heart": "red heart", + "two_hearts": "two hearts", + "kiss": "kiss mark", + "hundred": "hundred points", + "explosion": "collision", + "drops": "sweat droplets", + "handshake": "handshake", + "hand_five_fingers": "hand with fingers splayed", + "hand_two_fingers": "victory hand", + "thumbs_up": "thumbs up", + "fist": "raised fist", + "two_hands": "open hands", + "writing": "writing hand", + "praying": "folded hands", + "arm": "flexed biceps", + "leg": "leg", + "foot": "foot", + "ear": "ear", + "nose": "nose", + "brain": "brain", + "tooth": "tooth", + "bone": "bone", + "eye": "eye", + "tongue": "tongue", + "mouth": "mouth", + "shirt": "t-shirt", + "pants": "jeans", + "dress": "dress", + "shoe": "running shoe", + "fencing": "person fencing", + "horse_riding": "horse racing", + "ski": "skier", + "rowing_boat": "person rowing boat", + "swim": "person swimming", + "surf": "person surfing", + "gym": "person lifting weights", + "wrestling": "people wrestling", + "bike": "person biking", + "parachute": "parachute", + "football": "soccer ball", + "basketball": "basketball", + "tennis": "tennis", + "ping_pong": "ping pong", + "martial": "martial arts uniform", + "lion": "lion", + "leopard": "leopard", + "horse": "horse face", + "zebra": "zebra", + "pig": "pig", + "goat": "goat", + "sheep": "ewe", + "camel": "camel", + "giraffe": "giraffe", + "elephant": "elephant", + "rhinoceros": "rhinoceros", + "flamingo": "flamingo", + "whale": "spouting whale", + "dolphin": "dolphin", + "bear": "bear", + "rooster": "rooster", + "chick": "hatching chick", + "eagle": "eagle", + "duck": "duck", + "owl": "owl", + "rabbit": "rabbit", + "penguin": "penguin", + "lizard": "lizard", + "turtle": "turtle", + "snake": "snake", + "hedgehog": "hedgehog", + "bat": "bat", + "fish": "fish", + "shell": "spiral shell", + "octopus": "octopus", + "snail": "snail", + "butterfly": "butterfly", + "ant": "ant", + "bee": "honeybee", + "beetle": "lady beetle", + "rose": "rose", + "sunflower": "sunflower", + "fir": "evergreen tree", + "palm_tree": "palm tree", + "cactus": "cactus", + "clover": "four leaf clover", + "potted_plant": "potted plant", + "bouquet": "bouquet", + "three_leaves": "fallen leaf", + "mushroom": "mushroom", + "grapes": "grapes", + "watermelon": "watermelon", + "lemon": "lemon", + "banana": "banana", + "pineapple": "pineapple", + "apple": "red apple", + "cherries": "cherries", + "strawberry": "strawberry", + "three_blueberries": "blueberries", + "kiwi": "kiwi fruit", + "avocado": "avocado", + "eggplant": "eggplant", + "carrot": "carrot", + "corn": "ear of corn", + "pepper": "hot pepper", + "croissant": "croissant", + "bread": "baguette bread", + "pretzel": "pretzel", + "cheese": "cheese wedge", + "pizza": "pizza", + "egg": "cooking", + "ice_cream": "soft ice cream", + "cookie": "cookie", + "cake": "shortcake", + "chocolate": "chocolate bar", + "sweet": "candy", + "coffee": "hot beverage", + "champagne_bottle": "bottle with popping cork", + "glass_wine": "wine glass", + "two_glasses": "clinking glasses", + "mountain": "snow-capped mountain", + "camping": "camping", + "beach": "beach with umbrella", + "compass": "compass", + "museum": "classical building", + "house": "house with garden", + "fountain": "fountain", + "circus": "circus tent", + "train": "locomotive", + "taxi": "taxi", + "motorcycle": "motorcycle", + "sailboat": "sailboat", + "airplane": "airplane", + "helicopter": "helicopter", + "rocket": "rocket", + "sun": "sun", + "moon": "crescent moon", + "planet": "ringed planet", + "star": "star", + "night_sky": "milky way", + "cloud": "cloud with rain", + "umbrella": "umbrella with rain drops", + "lightning": "high voltage", + "snowflake": "snowflake", + "snowman": "snowman without snow", + "thermometer": "thermometer", + "fire": "fire", + "balloon": "balloon", + "kite": "kite", + "rainbow": "rainbow", + "guitar": "guitar", + "saxophone": "saxophone", + "music": "musical note", + "painting": "artist palette", + "chess": "chess pawn", + "gift": "wrapped gift", + "die": "game die", + "puzzle": "puzzle piece", + "teddy_bear": "teddy bear", + "firecracker": "firecracker", + "bullseye": "bullseye", + "roller_skate": "roller skate", + "kick_scooter": "kick scooter", + "anchor": "anchor", + "scuba_diving": "diving mask", + "broom": "broom", + "magnifying_glass": "magnifying glass tilted left", + "bulb": "light bulb", + "three_books": "books", + "package": "package", + "pencil": "pencil", + "pin": "pushpin", + "paperclip": "paperclip", + "scissors": "scissors", + "key": "key", + "lock": "unlocked", + "chair": "chair", + "bathtub": "bathtub", + "sponge": "sponge", + "shopping_cart": "shopping cart" + } + } +} diff --git a/ng-app/src/locales/i18n-init.ts b/ng-app/src/locales/i18n-init.ts new file mode 100644 index 0000000..a7fe459 --- /dev/null +++ b/ng-app/src/locales/i18n-init.ts @@ -0,0 +1,10 @@ +import { register, init, getLocaleFromNavigator } from "svelte-i18n"; + +register("en", () => import("./en.json")); +// register('de', () => import('./de.json')); +// register('fr', () => import('./fr.json')); + +init({ + fallbackLocale: "en", + initialLocale: getLocaleFromNavigator(), +}); diff --git a/ng-app/src/routes/Install.svelte b/ng-app/src/routes/Install.svelte index a63edfe..5e15148 100644 --- a/ng-app/src/routes/Install.svelte +++ b/ng-app/src/routes/Install.svelte @@ -10,16 +10,12 @@ -->

- 404 Page not found. + 404{$t("pages.not_found.title")} +
+ {$t("pages.not_found.message")}
diff --git a/ng-app/src/routes/User.svelte b/ng-app/src/routes/User.svelte index db70455..45608f1 100644 --- a/ng-app/src/routes/User.svelte +++ b/ng-app/src/routes/User.svelte @@ -23,6 +23,7 @@ import CenteredLayout from "../lib/CenteredLayout.svelte"; import { version } from "../../package.json"; import Time from "svelte-time"; + import { t } from "svelte-i18n"; // @ts-ignore import Logo from "../assets/nextgraph.svg?component"; import { @@ -109,10 +110,13 @@ } }; const donate = async () => { - await displayPopup("https://nextgraph.org/donate", "Support NextGraph"); + await displayPopup( + "https://nextgraph.org/donate", + $t("common.support_nextgraph") + ); }; const about = async () => { - await displayPopup("https://nextgraph.org", "About NextGraph"); + await displayPopup("https://nextgraph.org", $t("common.about_nextgraph")); }; @@ -125,7 +129,7 @@ >
  • -

    User panel

    +

    {$t("pages.user_panel.title")}

  • - Back + {$t("buttons.back")}
  • Online{$t("pages.user_panel.online")} {:else} - Offline + {$t("pages.user_panel.offline")} {/if}
  • @@ -172,7 +178,7 @@ tabindex="-1" class="w-7 h-7 text-black transition duration-75 focus:outline-none dark:text-white group-hover:text-gray-900 dark:group-hover:text-white" /> - Logout + {$t("common.logout")}