From 5bfd354f90f5507257a7a718efaeaecbbd7e106a Mon Sep 17 00:00:00 2001 From: io53 Date: Wed, 4 Sep 2024 23:39:26 +0300 Subject: [PATCH] added translation to myaccount page #438 --- src/TextHelper.js | 15 +++-- src/components/MyAccountModal.js | 54 +--------------- src/localization_i18n.json | 102 +++++++++++++++++-------------- 3 files changed, 70 insertions(+), 101 deletions(-) diff --git a/src/TextHelper.js b/src/TextHelper.js index c35d880..c16e6e0 100644 --- a/src/TextHelper.js +++ b/src/TextHelper.js @@ -3,16 +3,23 @@ export function uppercaseFirst(string) { return string.charAt(0).toUpperCase() + string.slice(1); } -export function addNewlines(str, newlineChar) { +function addHighlight(str, highlightedText) { + return str.split(highlightedText).map((x, i, all) => { + return <>{x}{i === all.length - 1 ? null : {highlightedText}} + }) +} + +export function addNewlines(str, newlineChar, highlightedText) { return str.split(newlineChar || "\n").map((x, i, all) => { - if (i === all.length-1) return <>{x} + x = addHighlight(x, highlightedText) return

0 ? 10 : undefined }} key={Math.random()}>{x}

}) } -export function addLink(str, key, link) { +export function addLink(str, key, link, andNewLines, highlightedText) { return str.split(key).map((x, i, all) => { - return <>{x}{i === all.length-1 ? null : {key}} + if (andNewLines) x = addNewlines(x, undefined, highlightedText) + return <>{x}{i === all.length - 1 ? null : {key} ⇗} }) } diff --git a/src/components/MyAccountModal.js b/src/components/MyAccountModal.js index 68157f6..8f88fdb 100644 --- a/src/components/MyAccountModal.js +++ b/src/components/MyAccountModal.js @@ -110,57 +110,9 @@ function MyAccountModal(props) { {t("no_expiry_date")} )} {t("information")} - {lng === "en" && - - - To purchase Ruuvi Cloud package activation codes, please visit {cloudLink()} - - - Once you have received your code(s) by email, enter them below to activate them. - - - Important! Entering a code for a different type of Ruuvi Cloud plan than the one currently active overrides the currently active plan. For example, if you currently have a Ruuvi Cloud Pro plan in your account, entering the Ruuvi Cloud Basic activation code will replace the Pro plan and your new Basic plan will be activated immediately, losing the remaining part of the old Pro plan. But if you enter the same type of activation code (in this case Pro), the current Pro plan's expiration date will be automatically extended. - - - Most frequently asked questions and more information about available packages and their features can be found at {cloudLink()} - - - } - {lng === "fi" && - - - Osta Ruuvi Cloud -paketin aktivointikoodi kotisivuiltamme osoitteesta {cloudLink()} - - - Tarkasta aktivointikoodi(t) saamastasi sähköpostista ja syötä tiedot alla olevaan kenttään. - - - Tärkeää! Eri tyyppisen Ruuvi Cloud -tilauskoodin syöttäminen korvaa ja päättää nykyisen tyyppisen aktiivisen tilauksen. Esimerkiksi Ruuvi Cloud Basic -tilauskoodin syöttäminen tilille jolla on jo aktiivinen Ruuvi Cloud Pro -tilaus päättää Pro-tilauksen välittömästi ja se korvataan Ruuvi Cloud Basic tilauksella, jolloin Pro-tilauksessa jäljellä oleva käyttöaika päättyy heti. - - - Nykyisen Pro-tilauksen päättymispäivää siirretään aktivointikoodin mukaisesti eteenpäin, mikäli syötät kenttään saman tyyppisen tilauksen aktivointikoodin (tässä tapauksessa Pro). - - - Lisätietoja saatavilla olevista tilauspaketeista ja vastauksia usein kysyttyihin kysymyksiin löydät osoitteesta {cloudLink()} - - - } - {lng === "sv" && - - - För att köpa aktiveringskoder för Ruuvi Cloud-paket, besök {cloudLink()} - - - När du har fått din/dina kod(er) via e-post, ange dem nedan för att aktivera dem. - - - Viktigt! Genom att ange en kod för en annan typ av Ruuvi Cloud-plan än den som är aktiv just nu ersätts den aktuella planen. Till exempel, om du just nu har en Ruuvi Cloud Pro-plan i ditt konto, genom att ange en Ruuvi Cloud Basic-aktiveringskod, kommer Pro-planen att ersättas och din nya Basic-plan kommer att aktiveras omedelbart, vilket leder till förlusten av resten av den gamla Pro-planen. Men om du anger samma typ av aktiveringskod (i det här fallet Pro), kommer den aktuella Pro-planens utgångsdatum att automatiskt förlängas. - - - De flesta vanligt förekommande frågorna och mer information om tillgängliga paket och deras funktioner finns på {cloudLink()} - - - } + + {addLink(t('my_account_information'), t("cloud_ruuvi_link"), t("cloud_ruuvi_link_url"), true, t('my_account_information_hightlighted_text'))} + {t("enter_activation_code")} updateValidationCode(code)}> diff --git a/src/localization_i18n.json b/src/localization_i18n.json index 24bbf95..6261690 100644 --- a/src/localization_i18n.json +++ b/src/localization_i18n.json @@ -13,10 +13,10 @@ "language_german": "Deutsch", "language": "Language", "sensor_name": "Name", - "data_format": "Data Format", - "tx_power": "Tx Power", - "movement_counter": "Movement Counter", - "measurement_sequence_number": "Measurement Sequence Number", + "data_format": "Data format", + "tx_power": "Tx power", + "movement_counter": "Movement counter", + "measurement_sequence_number": "Measurement sequence number", "alarm_custom_title_hint": "Set custom description...", "acceleration_x": "Acceleration X", "acceleration_y": "Acceleration Y", @@ -25,7 +25,7 @@ "movement": "Movement", "alert_movement_description": "Movement alert is triggered if the value of the sensor's internal motion counter changes. This alert can be used, for example, to detect door movement or vibration in the vicinity of the sensor.", "alert_description": "Alert when less than {%@^%1$s} or more than {%@^%2$s}", - "battery_voltage": "Battery Voltage", + "battery_voltage": "Battery voltage", "calibrate": "Calibrate", "cancel": "Cancel", "clear": "Clear", @@ -37,9 +37,9 @@ "humidity_absolute_name": "Absolute (g/m³)", "humidity_dew_point_name": "Dew point (°)", "humidity_relative_name": "Relative (%)", - "mac_address": "MAC Address", - "add_new_sensor": "Add a New Sensor", - "my_ruuvi_account": "My Ruuvi Account", + "mac_address": "MAC address", + "add_new_sensor": "Add a new sensor", + "my_ruuvi_account": "My Ruuvi account", "min": "min", "more_info": "More info", "no": "No", @@ -48,13 +48,13 @@ "pressure_inhg_name": "Inch of mercury (inHg)", "pressure_mmhg_name": "Millimetre of mercury (mmHg)", "pressure_pa_name": "Pascal (Pa)", - "signal_strength": "Signal Strength (RSSI)", + "signal_strength": "Signal strength (RSSI)", "s": "s", "settings": "Settings", "settings_chart_draw_dots": "Show datapoints", - "settings_humidity_unit": "Humidity Unit", - "settings_pressure_unit": "Pressure Unit", - "settings_temperature_unit": "Temperature Unit", + "settings_humidity_unit": "Humidity unit", + "settings_pressure_unit": "Pressure unit", + "settings_temperature_unit": "Temperature unit", "something_went_wrong": "Something went wrong", "remove_sensor": "Remove sensor", "temperature_celsius_name": "Celsius (℃)", @@ -93,7 +93,7 @@ "UserApiError.ER_INVALID_SORT_MODE": "Invalid sort mode", "UserApiError.ER_INVALID_TIME_RANGE": "Invalid time range", "UserApiError.ER_INVALID_EMAIL_ADDRESS": "Invalid email address", - "UserApiError.ER_INVALID_MAC_ADDRESS": "Invalid MAC-address", + "UserApiError.ER_INVALID_MAC_ADDRESS": "Invalid MAC address", "UserApiError.ER_SUB_DATA_STORAGE_ERROR": "Data storage error", "UserApiError.ER_SUB_NO_USER": "No user", "calibration_description": "In normal use, it's not necessary to adjust the offset.\\n\\nIf you're an advanced user and you'd like to manually configure the factory calibrated sensors, it's possible to do so.\\n\\nCalibration tips are available on ruuvi.com/support", @@ -169,10 +169,10 @@ "replace_battery": "Low battery", "battery_ok": "Battery OK", "voltage": "Voltage", - "temperature_resolution": "Temperature Resolution", - "humidity_resolution": "Humidity Resolution", - "pressure_resolution": "Pressure Resolution", - "delete_account": "Delete Account", + "temperature_resolution": "Temperature resolution", + "humidity_resolution": "Humidity resolution", + "pressure_resolution": "Pressure resolution", + "delete_account": "Delete account", "account_delete_confirmation_description": "A confirmation has been sent to your email. To proceed with the deletion, please check your inbox and follow the instructions.", "alert_dialog_title_temperature": "Set temperature alert", "alert_dialog_title_humidity": "Set humidity alert", @@ -198,7 +198,7 @@ "plan_expiry_date": "Ruuvi plan's expiry date", "current_plan": "Current Ruuvi plan", "user": "User", - "graph_view": "History View", + "graph_view": "History view", "subscription_activated": "subscription activated", "signed_in_user": "Signed in user", "information": "Information", @@ -211,7 +211,7 @@ "graph_stats_info": "A minimum, maximum and average values in the visible timeframe are shown. You can change the visible timeframe from the dropdown menu or by using the zoom tool.", "no_expiry_date": "No expiry date", "shared_to_x": "Shared to {%d^%1$,d}/{%d^%2$,d}", - "settings_email_alerts": "Email Alerts", + "settings_email_alerts": "Email alerts", "settings_mobile_push_alerts": "Mobile Push Alerts", "sensor_alert_free_info": "This sensor is in Free mode. You will be able to receive local alerts via Bluetooth when using Ruuvi Station mobile and your sensor is within Bluetooth signal range. Email and push notifications are available in paid subscriptions. View subscription packages at cloud.ruuvi.com.", "cloud_ruuvi_link": "cloud.ruuvi.com", @@ -221,8 +221,8 @@ "add": "Add", "sensor_added_successfully": "Sensor added successfully!", "no_data_free_mode": "No history data. This sensor is in Free mode.", - "owners_plan": "Owner's Ruuvi Plan", - "alert_offline_title": "Cloud Connection", + "owners_plan": "Owner's Ruuvi plan", + "alert_offline_title": "Cloud connection", "alert_offline_description": "Alert if sensor data hasn't been updated to the cloud for longer than {%d^%1$,d} minutes.", "alert_offline_dialog_description": "Enter the desired delay to be used in minutes before alert is triggered. Minimum value is 2 minutes.", "alert_offline_dialog_title": "Set cloud connection alert", @@ -244,7 +244,7 @@ "reset_order": "Reset to alphabetical sorting", "reset_order_confirmation": "Are you certain you wish to revert the sensor card ordering to alphabetical sorting?", "account_delete_description": "All account settings, sensor-related data, sensor shares, and sensor ownerships associated with this account will be permanently deleted. A confirmation email will be sent to your registered email address.", - "ruuvi_measurements_report": "Ruuvi Measurements Report", + "ruuvi_measurements_report": "Ruuvi measurements report", "dates": "Dates", "limits_hit": "Limits hit", "no_limits_hit": "No limits hit", @@ -254,12 +254,12 @@ "set": "Set", "upgrade_plan": "Upgrade plan", "active_shares": "Active shares", - "remove_share_title": "Remove Share", - "share_center": "Share Sensors", + "remove_share_title": "Remove share", + "share_center": "Share sensors", "share_center_subtitle": "Share your sensors with other Ruuvi users and manage the sensor sharing settings", "share_center_description": "Select one or more sensors from the list, enter the email addresses to share with, and tap Add. You can add multiple email addresses at once. To share, tap the Share button.", - "shared_by_me": "Sensors Shared by Me", - "shared_to_me": "Sensors Shared to Me", + "shared_by_me": "Sensors shared by me", + "shared_to_me": "Sensors shared to me", "sharing_progress": "Sharing {}/{}...", "sensor_shared_to_email": "Sensor {} has been shared to {}", "sensor_not_shared_to_email": "Sensor {} was not shared to {}", @@ -267,20 +267,20 @@ "sensor_removed": "Sensor removed", "sensor_shared_by_me_description": "Below is a list of sensors you have shared with others. To remove a share, choose X. After removing the share, the respective sensor will be removed from the recipient's app and it will become instantly unaccessible for the user.", "sensor_shared_with_me_description": "Below is a list of sensors shared with you, along with the owner's email addresses and subscription levels. To remove a share, choose X. The respective sensor will be removed from the app.", - "remove_sensor_confirmation_title": "Remove Sensor", + "remove_sensor_confirmation_title": "Remove sensor", "my_sensors": "Sensors", "home": "Home", "help": "Help", - "contact_support": "Contact Support", - "what_to_measure": "What to Measure?", - "switch_to_dark_mode": "Switch to Dark Mode", - "switch_to_light_mode": "Switch to Light Mode", - "all_my_sensors": "All Sensors", - "buy_sensors": "Buy Sensors", - "share_sensors": "Share Sensors", + "contact_support": "Contact support", + "what_to_measure": "What to measure?", + "switch_to_dark_mode": "Switch to dark mode", + "switch_to_light_mode": "Switch to light mode", + "all_my_sensors": "All sensors", + "buy_sensors": "Buy sensors", + "share_sensors": "Share sensors", "app_settings": "Settings", - "my_profile": "My Profile", - "compare_sensors": "Compare Sensors", + "my_profile": "My profile", + "compare_sensors": "Compare sensors", "compare_subtitle": "Compare history data from multiple sensors on a unified chart", "unit": "Unit", "compare": "Compare", @@ -292,7 +292,9 @@ "try_refreshing_page": "Try refreshing the page", "my_account_change_email": "Contact support@ruuvi.com if you wish to change the email address associated with this user account.", "my_account_change_email_link_markup": "support@ruuvi.com", - "my_account_change_email_link": "mailto:support@ruuvi.com" + "my_account_change_email_link": "mailto:support@ruuvi.com", + "my_account_information": "To purchase Ruuvi Cloud package activation codes, please visit cloud.ruuvi.com\nOnce you have received your code(s) by email, enter them below to activate them.\nImportant! Entering a code for a different type of Ruuvi Cloud plan than the one currently active overrides the currently active plan. For example, if you currently have a Ruuvi Cloud Pro plan in your account, entering the Ruuvi Cloud Basic activation code will replace the Pro plan and your new Basic plan will be activated immediately, losing the remaining part of the old Pro plan. But if you enter the same type of activation code (in this case Pro), the current Pro plan's expiration date will be automatically extended.\nMost frequently asked questions and more information about available packages and their features can be found at cloud.ruuvi.com", + "my_account_information_hightlighted_text": "Important!" } }, "fi": { @@ -540,7 +542,7 @@ "reset_order": "Palauta aakkosjärjestys", "reset_order_confirmation": "Oletko varma, että haluat palauttaa anturikortin järjestyksen aakkosjärjestykseen?", "account_delete_description": "Kaikki tähän tiliin liittyvät asetukset, antureihin liittyvät tiedot, anturien jaot ja anturin omistajuudet poistetaan pysyvästi. Vahvistusviesti lähetetään sähköpostitse.", - "ruuvi_measurements_report": "Ruuvi Mittausraportti", + "ruuvi_measurements_report": "Ruuvi-mittausraportti", "dates": "Päivämäärät", "limits_hit": "Rajat ylitetty", "no_limits_hit": "Ei ylitettyjä rajoja", @@ -588,7 +590,9 @@ "try_refreshing_page": "Kokeile päivittää sivu uudelleen", "my_account_change_email": "Ota yhteyttä support@ruuvi.com, jos haluat vaihtaa tämän käyttäjätilin sähköpostiosoitteen.", "my_account_change_email_link_markup": "support@ruuvi.com", - "my_account_change_email_link": "mailto:support@ruuvi.com" + "my_account_change_email_link": "mailto:support@ruuvi.com", + "my_account_information": "Osta Ruuvi Cloud -paketin aktivointikoodi kotisivuiltamme osoitteesta cloud.ruuvi.com\nTarkasta aktivointikoodi(t) saamastasi sähköpostista ja syötä tiedot alla olevaan kenttään.\nTärkeää! Eri tyyppisen Ruuvi Cloud -tilauskoodin syöttäminen korvaa ja päättää nykyisen tyyppisen aktiivisen tilauksen. Esimerkiksi Ruuvi Cloud Basic -tilauskoodin syöttäminen tilille jolla on jo aktiivinen Ruuvi Cloud Pro -tilaus päättää Pro-tilauksen välittömästi ja se korvataan Ruuvi Cloud Basic tilauksella, jolloin Pro-tilauksessa jäljellä oleva käyttöaika päättyy heti.\nNykyisen Pro-tilauksen päättymispäivää siirretään aktivointikoodin mukaisesti eteenpäin, mikäli syötät kenttään saman tyyppisen tilauksen aktivointikoodin (tässä tapauksessa Pro).\nLisätietoja saatavilla olevista tilauspaketeista ja vastauksia usein kysyttyihin kysymyksiin löydät osoitteesta cloud.ruuvi.com", + "my_account_information_hightlighted_text": "Tärkeää!" } }, "sv": { @@ -836,7 +840,7 @@ "reset_order": "Återställ till alfabetisk sortering", "reset_order_confirmation": "Är du säker på att du vill återställa sensorkortsordningen till alfabetisk sortering?", "account_delete_description": "Alla kontoinställningar, sensorrelaterade data, sensorandelar och sensorägande som är kopplade till detta konto kommer att raderas permanent. Ett bekräftelsemail kommer att skickas till din registrerade e-postadress.", - "ruuvi_measurements_report": "Ruuvi Mätning Rapport", + "ruuvi_measurements_report": "Ruuvi mätning rapport", "dates": "Datum", "limits_hit": "Gränser nådda", "no_limits_hit": "Inga gränser nådda", @@ -884,7 +888,9 @@ "try_refreshing_page": "Försök att ladda om sidan", "my_account_change_email": "Kontakta support@ruuvi.com om du vill ändra e-postadressen som är kopplad till detta användarkonto.", "my_account_change_email_link_markup": "support@ruuvi.com", - "my_account_change_email_link": "mailto:support@ruuvi.com" + "my_account_change_email_link": "mailto:support@ruuvi.com", + "my_account_information": "För att köpa aktiveringskoder för Ruuvi Cloud-paket, besök cloud.ruuvi.com\nNär du har fått din/dina kod(er) via e-post, ange dem nedan för att aktivera dem.\nViktigt! Genom att ange en kod för en annan typ av Ruuvi Cloud-plan än den som är aktiv just nu ersätts den aktuella planen. Till exempel, om du just nu har en Ruuvi Cloud Pro-plan i ditt konto, genom att ange en Ruuvi Cloud Basic-aktiveringskod, kommer Pro-planen att ersättas och din nya Basic-plan kommer att aktiveras omedelbart, vilket leder till förlusten av resten av den gamla Pro-planen. Men om du anger samma typ av aktiveringskod (i det här fallet Pro), kommer den aktuella Pro-planens utgångsdatum att automatiskt förlängas.\nDe flesta vanligt förekommande frågorna och mer information om tillgängliga paket och deras funktioner finns på cloud.ruuvi.com", + "my_account_information_hightlighted_text": "Viktigt!" } }, "fr": { @@ -1180,7 +1186,9 @@ "try_refreshing_page": "Essayez de rafraîchir la page", "my_account_change_email": "Contactez support@ruuvi.com si vous souhaitez modifier l'adresse e-mail associée à ce compte utilisateur.", "my_account_change_email_link_markup": "support@ruuvi.com", - "my_account_change_email_link": "mailto:support@ruuvi.com" + "my_account_change_email_link": "mailto:support@ruuvi.com", + "my_account_information": "Pour acheter des codes d'activation de forfait Ruuvi Cloud, veuillez visiter cloud.ruuvi.com\nUne fois que vous avez reçu votre/vos code(s) par e-mail, entrez-les ci-dessous pour les activer.\nImportant ! Entrer un code pour un type de plan Ruuvi Cloud différent de celui actuellement actif remplace le plan actuellement actif. Par exemple, si vous avez actuellement un plan Ruuvi Cloud Pro dans votre compte, en entrant le code d'activation Ruuvi Cloud Basic, le plan Pro sera remplacé et votre nouveau plan Basic sera activé immédiatement, perdant la partie restante de l'ancien plan Pro. Mais si vous entrez le même type de code d'activation (dans ce cas Pro), la date d'expiration du plan Pro actuel sera automatiquement prolongée.\nLa plupart des questions les plus fréquemment posées et plus d'informations sur les forfaits disponibles et leurs fonctionnalités se trouvent sur cloud.ruuvi.com", + "my_account_information_hightlighted_text": "Important !" } }, "de": { @@ -1223,7 +1231,7 @@ "humidity_relative_name": "Relative (%)", "mac_address": "MAC-Adresse", "add_new_sensor": "Neuen Sensor hinzufügen", - "my_ruuvi_account": "Mein Ruuvi Konto", + "my_ruuvi_account": "Mein Ruuvi konto", "min": "min", "more_info": "Mehr info", "no": "Nein", @@ -1369,7 +1377,7 @@ "history_view": "Ansicht Verlauf", "settings_and_alerts": "Einstellungen & Benachrichtigungen", "change_background": "Einstellungen und Warnungen", - "view": "Siehe", + "view": "Ansicht", "card_type": "Speicherkarten-Typ", "image_cards": "Bildkarten", "simple_cards": "Einfache Karten", @@ -1428,7 +1436,7 @@ "reset_order": "Zur alphabetischen Sortierung zurücksetzen", "reset_order_confirmation": "Sind Sie sicher, dass Sie die Reihenfolge der Sensorkarten auf die alphabetische Sortierung zurücksetzen möchten?", "account_delete_description": "Alle mit diesem Konto verknüpften Kontoeinstellungen, sensorbezogenen Daten, Sensorfreigaben und Sensorbesitzverhältnisse werden dauerhaft gelöscht. Eine Bestätigungs-E-Mail wird an Ihre registrierte E-Mail-Adresse gesendet.", - "ruuvi_measurements_report": "Ruuvi Messbericht", + "ruuvi_measurements_report": "Ruuvi messbericht", "dates": "Termine", "limits_hit": "Grenzen erreicht", "no_limits_hit": "Keine Grenzen erreicht", @@ -1476,7 +1484,9 @@ "try_refreshing_page": "Versuchen Sie, die Seite neu zu laden", "my_account_change_email": "Kontaktieren Sie support@ruuvi.com, wenn Sie die mit diesem Benutzerkonto verknüpfte E-Mail-Adresse ändern möchten.", "my_account_change_email_link_markup": "support@ruuvi.com", - "my_account_change_email_link": "mailto:support@ruuvi.com" + "my_account_change_email_link": "mailto:support@ruuvi.com", + "my_account_information": "Um Ruuvi Cloud-Paketaktivierungscodes zu kaufen, besuchen Sie bitte cloud.ruuvi.com\nSobald Sie Ihren/die Codes per E-Mail erhalten haben, geben Sie sie unten ein, um sie zu aktivieren.\nWichtig! Das Eingeben eines Codes für einen anderen Ruuvi Cloud-Plan als den derzeit aktiven ersetzt den derzeit aktiven Plan. Wenn Sie beispielsweise derzeit einen Ruuvi Cloud Pro-Plan in Ihrem Konto haben und den Ruuvi Cloud Basic-Aktivierungscode eingeben, wird der Pro-Plan ersetzt und Ihr neuer Basic-Plan wird sofort aktiviert, wobei der verbleibende Teil des alten Pro-Plans verloren geht. Wenn Sie jedoch denselben Typ von Aktivierungscode eingeben (in diesem Fall Pro), wird das Ablaufdatum des aktuellen Pro-Plans automatisch verlängert.\nDie häufigsten Fragen und weitere Informationen zu verfügbaren Paketen und deren Funktionen finden Sie unter cloud.ruuvi.com", + "my_account_information_hightlighted_text": "Wichtig!" } } } \ No newline at end of file