From 4c83ed3cc4b63fef821549cd0f0efc5bf0c3a8dd Mon Sep 17 00:00:00 2001 From: Amaury Martiny Date: Sat, 10 Aug 2019 11:59:05 +0200 Subject: [PATCH] fix: Use en-US for US locales, en otherwise (#166) --- App/localization/index.ts | 19 +++---- App/localization/languages/en-us.json | 79 +++++++++++++++++++++++++++ App/localization/languages/en.json | 4 +- 3 files changed, 90 insertions(+), 12 deletions(-) create mode 100644 App/localization/languages/en-us.json diff --git a/App/localization/index.ts b/App/localization/index.ts index d3b8f6ec..476c3357 100644 --- a/App/localization/index.ts +++ b/App/localization/index.ts @@ -19,20 +19,19 @@ import i18n from 'i18n-js'; // languages const en = require('./languages/en'); -const es = require('./languages/es'); -const fr = require('./languages/fr'); +const enUS = require('./languages/en-us'); i18n.fallbacks = true; i18n.translations = { en, - es, - fr + 'en-US': enUS }; -// `Localization.locale` can come in the form of `en-US` sometimes, so we just -// take the 1st part. -i18n.locale = (Localization.locale || 'en').split('-')[0]; +// If the locale is en-US, then we use the `en-US` file. For any other locale, +// we use the `en` file +i18n.locale = + Localization.locale && Localization.locale.toLowerCase() === 'en-us' + ? 'en-US' + : 'en'; -export { - i18n -}; +export { i18n }; diff --git a/App/localization/languages/en-us.json b/App/localization/languages/en-us.json new file mode 100644 index 00000000..6956c9ee --- /dev/null +++ b/App/localization/languages/en-us.json @@ -0,0 +1,79 @@ +{ + "error_screen_common_sorry": "Sorry!\n", + "error_screen_error_cannot_load_cigarettes": "We cannot load your cigarettes.", + "error_screen_choose_other_location": "Choose other location", + "error_screen_error_description": "There's either a problem with our databases, or you don't have any Air Monitoring Stations near you. Try again later!", + "error_screen_error_message": "Error: {{errorText}}", + "home_station_too_far_message": "We couldn’t find a closer station to you.\nResults may be inaccurate at this distance.", + "home_share_title": "Did you know that you may be smoking up to 20 cigarettes per day, just for living in a big city?", + "home_share_message": "Shoot! I 'smoked' {{cigarettes}} cigarettes today by breathing urban air. And you? Find out here: https://shootismoke.github.io", + "home_header_air_quality_station_distance": "Air Quality Station: {{distanceToStation}}{{distanceUnit}} away", + "home_header_from_search": "from search", + "home_btn_why_is_station_so_far": "Why is the station so far?", + "home_btn_see_detailed_info": "See detailed info", + "home_btn_see_how_it_works": "See how it works", + "home_btn_more_details": "More details", + "home_btn_faq_about": "Faq/About", + "home_btn_share": "Share", + "home_common_you_smoke": "You smoke", + "home_common_you_d_smoke": "You'd smoke", + "home_common_you_ll_smoke": "You'll smoke", + "home_common_you_smoked": "You smoked", + "home_common_oh": "Oh", + "home_common_cigarette": "Cigarette", + "home_common_cigarettes": "Cigarettes", + "home_smoked_cigarette_title": "{{swearWord}}! {{presentPast}}\n<{{cigarettes}} {{singularPlural}}>", + "home_smoked_there": "there today", + "home_wait_more_days": "{{days}} more days", + "home_wait_until_results": "to \nshow your results", + "home_swear_word_dang": "Dang", + "home_swear_word_shoot": "Shoot", + "home_swear_word_darn": "Darn", + "home_swear_word_geez": "Geez", + "home_swear_word_omg": "OMG", + "home_swear_word_crap": "Crap", + "home_swear_word_arrgh": "Arrgh", + "loading_title_cough": "Cough", + "loading_title_loading": "Loading", + "search_header_input_placeholder": "Search for a city or address", + "search_current_location": "Your current location", + "nav_btn_back": "Back", + "details_air_quality_station_marker": "Air Quality Station", + "details_your_position_marker": "Your position", + "details_header_latest_update_label": "Latest Update:", + "details_header_latest_update_ago": "ago", + "details_header_primary_pollutant_label": "Primary Pollutant:", + "details_distance_label": "AQI Station: {{distanceToStation}}{{distanceUnit}} away", + "distance_unit": "mi", + "haversine_distance_unit": "mile", + "past_stations_loading": "Loading", + "past_stations_date_from_to": "{{startDate}} to {{endDate}}", + "past_stations_monitored_weekly": "Stations monitored from you during the week", + "past_stations_monitored_monthly": "Stations monitored from you during the month", + "past_stations_unknown_station": "Unknown AQI station", + "past_stations_unknown_city": "Unknown city", + "about_how_do_you_calculate_the_number_of_cigarettes_title": "How do you calculate the number of cigarettes?", + "about_how_do_you_calculate_the_number_of_cigarettes_message_1": "This app was inspired by Berkeley Earth’s findings about the", + "about_how_do_you_calculate_the_number_of_cigarettes_link_1": "equivalence between air pollution and cigarette smoking", + "about_how_do_you_calculate_the_number_of_cigarettes_message_2": ". The rule of thumb is simple: one cigarette per day is the rough equivalent of a PM2.5 level of 22", + "about_box_per_day": "per day", + "about_box_footnote": "*Atmospheric particulate matter (PM) that have a diameter of less than 2.5 micrometers, with increased chances of inhalation by living beings.", + "about_where_does_data_come_from_title": "Where does the data come from?", + "about_where_does_data_come_from_message_1": "Air quality data comes from", + "about_where_does_data_come_from_link_1": "WAQI", + "about_were_does_data_come_from_message_2": "in the form of PM2.5 AQI levels which are usually updated every one hour and converted to direct PM2.5 levels by the app.", + "about_why_is_the_station_so_far_title": "Why is the station so far away from my current location?", + "about_why_is_the_station_so_far_message": "Since stations that measure and communicate Air Quality results every hour are expensive, the data is still limited to well-developed regions and larger cities around the globe. If you are far from a more prominent urban center, results will probably not be so accurate. Chances are that your air is better in that case at least!", + "about_weird_results_title": "The results are weird or inconsistent with other sources!", + "about_weird_results_message_1": "We have also encountered a few surprising results: large cities with better air than small villages; sudden huge increases in the number of cigarettes; stations of the same town showing significantly different numbers... The fact is air quality depends on several factors such as temperature, pressure, humidity and even wind direction and intensity. If the result seems weird for you, check", + "about_weird_results_link_1": "WAQI", + "about_weird_results_message_2": "for more information and history on your station.", + "about_credits_title": "Credits", + "about_credits_concept_and_development": "Concept & Development by", + "about_credits_design_and_copywriting": "Design & Copywriting by", + "about_credits_data_from": "Air quality data from", + "about_credits_source_code": "Source code", + "about_credits_available_github": "available on Github", + "about_language": "Language", + "current_location_unknown_station": "Unknown AQI station" +} diff --git a/App/localization/languages/en.json b/App/localization/languages/en.json index 6956c9ee..9de45eee 100644 --- a/App/localization/languages/en.json +++ b/App/localization/languages/en.json @@ -44,8 +44,8 @@ "details_header_latest_update_ago": "ago", "details_header_primary_pollutant_label": "Primary Pollutant:", "details_distance_label": "AQI Station: {{distanceToStation}}{{distanceUnit}} away", - "distance_unit": "mi", - "haversine_distance_unit": "mile", + "distance_unit": "km", + "haversine_distance_unit": "km", "past_stations_loading": "Loading", "past_stations_date_from_to": "{{startDate}} to {{endDate}}", "past_stations_monitored_weekly": "Stations monitored from you during the week",