Change language automatically

pull/498/head
Alinson S. Xavier 7 years ago
parent c380abad5a
commit 6af576c09c

@ -21,14 +21,15 @@ package org.isoron.uhabits.backend
import org.isoron.platform.concurrency.*
import org.isoron.platform.io.*
import org.isoron.platform.time.*
import org.isoron.uhabits.*
import org.isoron.uhabits.components.*
import org.isoron.uhabits.i18n.*
import org.isoron.uhabits.models.*
class Backend(databaseName: String,
databaseOpener: DatabaseOpener,
fileOpener: FileOpener,
localeHelper: LocaleHelper,
val log: Log,
val taskRunner: TaskRunner) {
@ -44,6 +45,8 @@ class Backend(databaseName: String,
val mainScreenDataSource: MainScreenDataSource
val strings = localeHelper.getStringsForCurrentLocale()
var theme: Theme = LightTheme()
init {

@ -0,0 +1,24 @@
/*
* Copyright (C) 2016-2019 Álinson Santos Xavier <isoron@gmail.com>
*
* This file is part of Loop Habit Tracker.
*
* Loop Habit Tracker is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by the
* Free Software Foundation, either version 3 of the License, or (at your
* option) any later version.
*
* Loop Habit Tracker is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.isoron.uhabits.i18n
interface LocaleHelper {
fun getStringsForCurrentLocale(): Strings
}

@ -1,192 +1,189 @@
// --------------------------------------------------------------------------
// THIS FILE WAS AUTOMATICALLY GENERATED
//
// Please do not submit pull request to modify it. Corrections to translations
// may be submitted at https://translate.loophabits.org/
// --------------------------------------------------------------------------
package org.isoron.uhabits.i18n
@Suppress("PropertyName", "unused")
open class Strings() {
open val app_name = "Loop Habit Tracker"
open val main_activity_title = "Habits"
open val about = "About"
open val action = "Action"
open val action_settings = "Settings"
open val edit = "Edit"
open val delete = "Delete"
open val archive = "Archive"
open val unarchive = "Unarchive"
open val add_habit = "Add habit"
open val color_picker_default_title = "Change color"
open val toast_habit_created = "Habit created"
open val toast_habit_deleted = "Habits deleted"
open val toast_habit_restored = "Habits restored"
open val toast_nothing_to_undo = "Nothing to undo"
open val toast_nothing_to_redo = "Nothing to redo"
open val toast_habit_changed = "Habit changed"
open val toast_habit_changed_back = "Habit changed back"
open val toast_habit_archived = "Habits archived"
open val toast_habit_unarchived = "Habits unarchived"
open val overview = "Overview"
open val habit_strength = "Habit strength"
open val history = "History"
open val all_time = "All time"
open val any_day = "Any day of the week"
open val any_weekday = "Monday to Friday"
open val app_name = "Loop Habit Tracker"
open val archive = "Archive"
open val behavior = "Behavior"
open val best_streaks = "Best streaks"
open val bug_report_failed = "Failed to generate bug report."
open val by_color = "By color"
open val by_name = "By name"
open val by_score = "By score"
open val calendar = "Calendar"
open val cancel = "Cancel"
open val change_value = "Change value"
open val check = "Check"
open val checkmark = "Checkmark"
open val checkmark_stack_widget = "Checkmark Stack Widget"
open val clear = "Clear"
open val description_hint = "Question (Did you … today?)"
open val repeat = "Repeat"
open val times_every = "times in"
open val clear_label = "Clear"
open val color_picker_default_title = "Change color"
open val could_not_export = "Failed to export data."
open val could_not_import = "Failed to import data."
open val count = "Count"
open val create_habit = "Create habit"
open val create_stackview_widget_button = "StackView Widget For All Habits"
open val current_streaks = "Current streak"
open val custom_frequency = "Custom …"
open val customize_notification = "Customize notifications"
open val customize_notification_summary = "Change sound, vibration, light and other notification settings"
open val database_repaired = "Database repaired."
open val day = "Day"
open val days = "days"
open val reminder = "Reminder"
open val delete = "Delete"
open val delete_habits = "Delete Habits"
open val delete_habits_message = "The habits will be permanently deleted. This action cannot be undone."
open val description_hint = "Question (Did you … today?)"
open val developers = "Developers"
open val discard = "Discard"
open val save = "Save"
open val streaks = "Streaks"
open val no_habits_found = "You have no active habits"
open val long_press_to_toggle = "Press-and-hold to check or uncheck"
open val reminder_off = "Off"
open val validation_name_should_not_be_blank = "Name cannot be blank."
open val validation_number_should_be_positive = "Number must be positive."
open val validation_at_most_one_rep_per_day = "You can have at most one repetition per day"
open val create_habit = "Create habit"
open val done_label = "Done"
open val download = "Download"
open val edit = "Edit"
open val edit_habit = "Edit habit"
open val check = "Check"
open val snooze = "Later"
open val intro_title_1 = "Welcome"
open val intro_description_1 = "Loop Habit Tracker helps you create and maintain good habits."
open val intro_title_2 = "Create some new habits"
open val intro_description_2 = "Every day, after performing your habit, put a checkmark on the app."
open val intro_title_3 = "Keep doing it"
open val intro_description_3 = "Habits performed consistently for a long time will earn a full star."
open val intro_title_4 = "Track your progress"
open val intro_description_4 = "Detailed graphs show you how your habits improved over time."
open val every_day = "Every day"
open val every_week = "Every week"
open val every_x_days = "Every %d days"
open val every_x_months = "Every %d months"
open val every_x_weeks = "Every %d weeks"
open val example_question_boolean = "e.g. Did you exercise today?"
open val example_question_numerical = "e.g. How many steps did you walk today?"
open val example_units = "e.g. steps"
open val export = "Export"
open val export_as_csv_summary = "Generates files that can be opened by spreadsheet software such as Microsoft Excel or OpenOffice Calc. This file cannot be imported back."
open val export_full_backup = "Export full backup"
open val export_full_backup_summary = "Generates a file that contains all your data. This file can be imported back."
open val export_to_csv = "Export as CSV"
open val file_not_recognized = "File not recognized."
open val filter = "Filter"
open val five_times_per_week = "5 times per week"
open val frequency = "Frequency"
open val frequency_stack_widget = "Frequency Stack Widget"
open val full_backup_success = "Full backup successfully exported."
open val generate_bug_report = "Generate bug report"
open val habit = "Habit"
open val habit_not_found = "Habit deleted / not found"
open val habit_strength = "Habit strength"
open val habits_imported = "Habits imported successfully."
open val help = "Help & FAQ"
open val help_translate = "Help translate this app"
open val hide_archived = "Hide archived"
open val hide_completed = "Hide completed"
open val hint_drag = "To rearrange the entries, press-and-hold on the name of the habit, then drag it to the correct place."
open val hint_landscape = "You can see more days by putting your phone in landscape mode."
open val hint_title = "Did you know?"
open val history = "History"
open val history_stack_widget = "History Stack Widget"
open val import_data = "Import data"
open val import_data_summary = "Supports full backups exported by this app, as well as files generated by Tickmate, HabitBull or Rewire. See FAQ for more information."
open val interface_preferences = "Interface"
open val interval_15_minutes = "15 minutes"
open val interval_30_minutes = "30 minutes"
open val interval_1_hour = "1 hour"
open val interval_24_hour = "24 hours"
open val interval_2_hour = "2 hours"
open val interval_30_minutes = "30 minutes"
open val interval_4_hour = "4 hours"
open val interval_8_hour = "8 hours"
open val interval_24_hour = "24 hours"
open val interval_always_ask = "Always ask"
open val interval_custom = "Custom..."
open val pref_toggle_title = "Toggle with short press"
open val pref_toggle_description = "Put checkmarks with a single tap instead of press-and-hold. More convenient, but might cause accidental toggles."
open val pref_snooze_interval_title = "Snooze interval on reminders"
open val pref_rate_this_app = "Rate this app on Google Play"
open val pref_send_feedback = "Send feedback to developer"
open val pref_view_source_code = "View source code at GitHub"
open val pref_view_app_introduction = "View app introduction"
open val links = "Links"
open val behavior = "Behavior"
open val name = "Name"
open val settings = "Settings"
open val snooze_interval = "Snooze interval"
open val select_snooze_delay = "Select snooze delay"
open val hint_title = "Did you know?"
open val hint_drag = "To rearrange the entries, press-and-hold on the name of the habit, then drag it to the correct place."
open val hint_landscape = "You can see more days by putting your phone in landscape mode."
open val delete_habits = "Delete Habits"
open val delete_habits_message = "The habits will be permanently deleted. This action cannot be undone."
open val habit_not_found = "Habit deleted / not found"
open val weekends = "Weekends"
open val any_weekday = "Monday to Friday"
open val any_day = "Any day of the week"
open val select_weekdays = "Select days"
open val export_to_csv = "Export as CSV"
open val done_label = "Done"
open val clear_label = "Clear"
open val select_hours = "Select hours"
open val select_minutes = "Select minutes"
open val select_habit_requirement_prompt = "Please select at least one habit"
open val about = "About"
open val translators = "Translators"
open val developers = "Developers"
open val version_n = "Version %s"
open val frequency = "Frequency"
open val checkmark = "Checkmark"
open val create_stackview_widget_button = "StackView Widget For All Habits"
open val checkmark_stack_widget = "Checkmark Stack Widget"
open val frequency_stack_widget = "Frequency Stack Widget"
open val score_stack_widget = "Score Stack Widget"
open val history_stack_widget = "History Stack Widget"
open val streaks_stack_widget = "Streaks Stack Widget"
open val strength = "Strength"
open val best_streaks = "Best streaks"
open val current_streaks = "Current streak"
open val number_of_repetitions = "Number of repetitions"
open val intro_description_1 = "Loop Habit Tracker helps you create and maintain good habits."
open val intro_description_2 = "Every day, after performing your habit, put a checkmark on the app."
open val intro_description_3 = "Habits performed consistently for a long time will earn a full star."
open val intro_description_4 = "Detailed graphs show you how your habits improved over time."
open val intro_title_1 = "Welcome"
open val intro_title_2 = "Create some new habits"
open val intro_title_3 = "Keep doing it"
open val intro_title_4 = "Track your progress"
open val last_x_days = "Last %d days"
open val last_x_weeks = "Last %d weeks"
open val last_x_months = "Last %d months"
open val last_x_weeks = "Last %d weeks"
open val last_x_years = "Last %d years"
open val all_time = "All time"
open val every_day = "Every day"
open val every_week = "Every week"
open val two_times_per_week = "2 times per week"
open val five_times_per_week = "5 times per week"
open val custom_frequency = "Custom …"
open val help = "Help &amp; FAQ"
open val could_not_export = "Failed to export data."
open val could_not_import = "Failed to import data."
open val file_not_recognized = "File not recognized."
open val habits_imported = "Habits imported successfully."
open val full_backup_success = "Full backup successfully exported."
open val import_data = "Import data"
open val export_full_backup = "Export full backup"
open val import_data_summary = "Supports full backups exported by this app, as well as files generated by Tickmate, HabitBull or Rewire. See FAQ for more information."
open val export_as_csv_summary = "Generates files that can be opened by spreadsheet software such as Microsoft Excel or OpenOffice Calc. This file cannot be imported back."
open val export_full_backup_summary = "Generates a file that contains all your data. This file can be imported back."
open val bug_report_failed = "Failed to generate bug report."
open val generate_bug_report = "Generate bug report"
open val troubleshooting = "Troubleshooting"
open val help_translate = "Help translate this app"
open val led_notifications = "Notification light"
open val led_notifications_description = "Shows a blinking light for reminders. Only available in phones with LED notification lights."
open val links = "Links"
open val long_press_to_edit = "Press-and-hold to change the value"
open val long_press_to_toggle = "Press-and-hold to check or uncheck"
open val main_activity_title = "Habits"
open val manually = "Manually"
open val month = "Month"
open val name = "Name"
open val night_mode = "Night mode"
open val use_pure_black = "Use pure black in night mode"
open val no = "No"
open val no_habits_found = "You have no active habits"
open val none = "None"
open val number_of_repetitions = "Number of repetitions"
open val overview = "Overview"
open val pref_rate_this_app = "Rate this app on Google Play"
open val pref_send_feedback = "Send feedback to developer"
open val pref_snooze_interval_title = "Snooze interval on reminders"
open val pref_toggle_description = "Put checkmarks with a single tap instead of press-and-hold. More convenient, but might cause accidental toggles."
open val pref_toggle_title = "Toggle with short press"
open val pref_view_app_introduction = "View app introduction"
open val pref_view_source_code = "View source code at GitHub"
open val pure_black_description = "Replaces gray backgrounds with pure black in night mode. Reduces battery usage in phones with AMOLED display."
open val interface_preferences = "Interface"
open val quarter = "Quarter"
open val question = "Question"
open val reminder = "Reminder"
open val reminder_off = "Off"
open val reminder_sound = "Reminder sound"
open val repair_database = "Repair database"
open val repeat = "Repeat"
open val reverse_days = "Reverse order of days"
open val reverse_days_description = "Show days in reverse order on the main screen."
open val day = "Day"
open val week = "Week"
open val month = "Month"
open val quarter = "Quarter"
open val year = "Year"
open val total = "Total"
open val time_every = "time in"
open val every_x_days = "Every %d days"
open val every_x_weeks = "Every %d weeks"
open val every_x_months = "Every %d months"
open val save = "Save"
open val score = "Score"
open val reminder_sound = "Reminder sound"
open val none = "None"
open val filter = "Filter"
open val hide_completed = "Hide completed"
open val hide_archived = "Hide archived"
open val score_stack_widget = "Score Stack Widget"
open val select_habit_requirement_prompt = "Please select at least one habit"
open val select_hours = "Select hours"
open val select_minutes = "Select minutes"
open val select_snooze_delay = "Select snooze delay"
open val select_weekdays = "Select days"
open val settings = "Settings"
open val show_archived = "Show archived"
open val show_completed = "Show completed"
open val snooze = "Later"
open val snooze_interval = "Snooze interval"
open val sort = "Sort"
open val sticky_notifications = "Make notifications sticky"
open val sticky_notifications_description = "Prevents notifications from being swiped away."
open val led_notifications = "Notification light"
open val led_notifications_description = "Shows a blinking light for reminders. Only available in phones with LED notification lights."
open val repair_database = "Repair database"
open val database_repaired = "Database repaired."
open val uncheck = "Uncheck"
open val streaks = "Streaks"
open val streaks_stack_widget = "Streaks Stack Widget"
open val strength = "Strength"
open val target = "Target"
open val time_every = "time in"
open val times_every = "times in"
open val toast_habit_archived = "Habits archived"
open val toast_habit_changed = "Habit changed"
open val toast_habit_changed_back = "Habit changed back"
open val toast_habit_created = "Habit created"
open val toast_habit_deleted = "Habits deleted"
open val toast_habit_restored = "Habits restored"
open val toast_habit_unarchived = "Habits unarchived"
open val toast_nothing_to_redo = "Nothing to redo"
open val toast_nothing_to_undo = "Nothing to undo"
open val toggle = "Toggle"
open val action = "Action"
open val habit = "Habit"
open val sort = "Sort"
open val manually = "Manually"
open val by_name = "By name"
open val by_color = "By color"
open val by_score = "By score"
open val download = "Download"
open val export = "Export"
open val long_press_to_edit = "Press-and-hold to change the value"
open val change_value = "Change value"
open val calendar = "Calendar"
open val total = "Total"
open val translators = "Translators"
open val troubleshooting = "Troubleshooting"
open val two_times_per_week = "2 times per week"
open val unarchive = "Unarchive"
open val uncheck = "Uncheck"
open val unit = "Unit"
open val count = "Count"
open val use_pure_black = "Use pure black in night mode"
open val validation_at_most_one_rep_per_day = "You can have at most one repetition per day"
open val validation_name_should_not_be_blank = "Name cannot be blank."
open val validation_number_should_be_positive = "Number must be positive."
open val validation_show_not_be_blank = "This field should not be blank"
open val example_question_numerical = "e.g. How many steps did you walk today?"
open val example_units = "e.g. steps"
open val example_question_boolean = "e.g. Did you exercise today?"
open val question = "Question"
open val target = "Target"
open val version_n = "Version %s"
open val week = "Week"
open val weekends = "Weekends"
open val year = "Year"
open val yes = "Yes"
open val no = "No"
open val customize_notification_summary = "Change sound, vibration, light and other notification settings"
open val customize_notification = "Customize notifications"
}

@ -1,21 +1,9 @@
/*
* Copyright (C) 2016-2019 Alinson Santos Xavier <isoron@gmail.com>
*
* This file is part of Loop Habit Tracker.
*
* Loop Habit Tracker is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by the
* Free Software Foundation, either version 3 of the License, or (at your
* option) any later version.
*
* Loop Habit Tracker is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
// --------------------------------------------------------------------------
// THIS FILE WAS AUTOMATICALLY GENERATED
//
// Please do not submit pull request to modify it. Corrections to translations
// may be submitted at https://translate.loophabits.org/
// --------------------------------------------------------------------------
package org.isoron.uhabits.i18n

@ -1,165 +0,0 @@
// --------------------------------------------------------------------------
// THIS FILE WAS AUTOMATICALLY GENERATED
//
// Please do not submit pull request to modify it. Corrections to translations
// may be submitted at https://translate.loophabits.org/
// --------------------------------------------------------------------------
package org.isoron.uhabits.i18n
class StringsArabig : Strings() {
override val app_name = "متعقب العادة لووب"
override val main_activity_title = "عادات"
override val action_settings = "إعدادات"
override val edit = "تعديل"
override val delete = "حذف"
override val archive = "أرشفة"
override val unarchive = "إزالة من الأرشيف"
override val add_habit = "إضافة عادة"
override val color_picker_default_title = "تغيير اللون"
override val toast_habit_created = "تم إنشاء عادة"
override val toast_habit_deleted = "تم حذف العادات"
override val toast_habit_restored = "تم إستعادة العادات"
override val toast_nothing_to_undo = "لا شيء للألغاء"
override val toast_nothing_to_redo = "لا شيء للإعادة"
override val toast_habit_changed = "تم تغيير عادة"
override val toast_habit_changed_back = "تم أرجاع العادة إلى أصلها"
override val toast_habit_archived = "تم أرشفه العادات"
override val toast_habit_unarchived = "تم الغاء ارشفه العادات"
override val overview = "نظرة عامة"
override val habit_strength = "قوة العادة"
override val history = "السجل"
override val clear = "إزالة"
override val description_hint = "السؤال (هل ... اليوم؟)"
override val repeat = "كرره"
override val times_every = "مرات كل"
override val days = "أيام"
override val reminder = "التذكرة"
override val discard = "تجاهل"
override val save = "حفظ"
override val streaks = "الانجازات"
override val no_habits_found = "لا يوجد لديك عادات مفعلة"
override val long_press_to_toggle = "أضغط و إستمر لتحقق أو ازل"
override val reminder_off = "إيقاف"
override val validation_name_should_not_be_blank = "لا يمكن أن يكون الإسم فارغ"
override val validation_number_should_be_positive = "يجب أن يكون الرقم موجب."
override val validation_at_most_one_rep_per_day = "يجب أن يكون التكرار مرة واحدة فقط كل يوم"
override val create_habit = "انشاء العادة"
override val edit_habit = "تعديل العادة"
override val check = "حقق"
override val snooze = "لاحقاً"
override val intro_title_1 = "أهلا بك"
override val intro_description_1 = "لوب يساعدك في بدأ عادات جيدة والحفاظ عليها."
override val intro_title_2 = "إنشاء عادات جديدة"
override val intro_description_2 = "كل يوم، بعد أداء عادتك، ضع علامة عليها في التطبيق."
override val intro_title_3 = "حافظ على القيام بذلك"
override val intro_description_3 = "العادة المستمرة لفترة طويلة تكسب نجمة كامله."
override val intro_title_4 = "تتبع اداءك"
override val intro_description_4 = "رسوم بيانية مفصلة تُريك كيف تحسنت عاداتك مع مرور الوقت."
override val interval_15_minutes = "15 دقيقة"
override val interval_30_minutes = "30 دقيقة"
override val interval_1_hour = "ساعة واحدة"
override val interval_2_hour = "ساعتان"
override val interval_4_hour = "٤ ساعات"
override val interval_8_hour = "8 ساعات"
override val interval_24_hour = "٢٤ ساعة"
override val pref_toggle_title = "تبديل وضعية العادة بضغطة قصيرة"
override val pref_toggle_description = "أكثر سهولة، لكنه ممكن يسبب كبسات غير مقصوده"
override val pref_snooze_interval_title = "فترتي الغفوى على التذكير"
override val pref_rate_this_app = "تقييم هذا التطبيق على جوجل بلاي"
override val pref_send_feedback = "أرسل الملاحظات إلى المطور"
override val pref_view_source_code = "إفحص التعليمات البرمجية على GitHub"
override val pref_view_app_introduction = "عرض المقدمه"
override val links = "روابط"
override val behavior = "سلوك"
override val name = "اسم"
override val settings = "إعدادات"
override val snooze_interval = "فترتي الغفوه"
override val hint_title = "هل كنت تعلم؟"
override val hint_drag = "لإعادة ترتيب القوائم، أضغط اسم من هذه العادة، ثم اسحبه إلى المكان الصحيح."
override val hint_landscape = "يمكنك ان ترى المزيد أيام عن طريق وضع الهاتف في وضع أفقي."
override val delete_habits = "حذف عادات"
override val delete_habits_message = "سيتم حذف عادات بشكل دائم. هذا العمل لا يمكن التراجع عنه."
override val habit_not_found = "العادة حذفت/لم يتم العثور عليها"
override val weekends = "عطلة نهاية الأسبوع"
override val any_weekday = "أيام الأسبوع"
override val any_day = "أي يوم"
override val select_weekdays = "إختار أيام "
override val export_to_csv = "تصدير البيانات (CSV)"
override val done_label = "منجز"
override val clear_label = "نظف"
override val select_hours = "تحديد ساعات"
override val select_minutes = "تحديد دقائق "
override val about = "معلومات حول"
override val translators = "المترجمين"
override val developers = "المطورين"
override val version_n = "الإصدار %s"
override val frequency = "تردد"
override val checkmark = "علامة الاختيار"
override val strength = "القوة"
override val best_streaks = "أكثر تقدم"
override val current_streaks = "تقدم الحالي"
override val number_of_repetitions = "عدد من حالات التكرار"
override val last_x_days = "آخر %d أيام"
override val last_x_weeks = "آخر %d أسابيع"
override val last_x_months = "آخر %d أشهر"
override val last_x_years = "آخر %d سنين"
override val all_time = "كل الوقت"
override val every_day = "كل يوم"
override val every_week = "كل اسبوع"
override val two_times_per_week = "مرتين في الأسبوع"
override val five_times_per_week = "خمس مرات في الأسبوع"
override val custom_frequency = "مخصص..."
override val help = "مساعدة والأسئلة المتداولة"
override val could_not_export = "فشل في تصدير البيانات."
override val could_not_import = "فشل في استيراد البيانات."
override val file_not_recognized = "الملف غير المعترف."
override val habits_imported = "نجح إستيراد العادات."
override val full_backup_success = "نجح تصدير النسخ الاحتياطي الكامل."
override val import_data = "استيراد بيانات."
override val export_full_backup = "صدر نسخة احتياطية كاملة."
override val import_data_summary = "تدعم النسخ الاحتياطي الكامل المصدرة من هذا التطبيق، فضلا عن الملفات التي تم إنشاؤها من Tickmate, HabitBull و Rewire. انظر التعليمات لمزيد من المعلومات."
override val export_as_csv_summary = "صدر ملف التي يمكن فتحها ببرنامج جداول البيانات مثل إكسل أو وبينوفيس. لا يمكن إستيراد هذا الملف."
override val export_full_backup_summary = "إنشاء ملف يحتوي على كافة البيانات. يمكن استيراد هذا الملف نفسه."
override val bug_report_failed = "فشل في توليد تقرير الاعطال"
override val generate_bug_report = "توليد تقرير الاعطال"
override val troubleshooting = "استكشاف الأخطاء وإصلاحها"
override val help_translate = "المساعدة في ترجمة هذا البرنامج"
override val night_mode = "الوضع الليلي"
override val use_pure_black = "استخدام أسود نقي في الوضع الليلي"
override val pure_black_description = "يستبدل خلفيات رمادية مع أسود نقي في الوضع الليلي. يقلل من استهلاك البطارية في الهواتف مع شاشة AMOLED."
override val interface_preferences = "السطح البيني"
override val reverse_days = "ترتيب عكسي أيام"
override val reverse_days_description = "عرض أيام في ترتيب عكسي على الشاشة الرئيسية"
override val day = "يوم"
override val week = "أسبوع"
override val month = "شهر"
override val quarter = "ربع سنه"
override val year = "عام"
override val total = "المجموع"
override val time_every = "مرات في"
override val every_x_days = "كل %d أيام"
override val every_x_weeks = "كل %d أسابيع"
override val every_x_months = "كل %d أشهر"
override val score = "النقاط"
override val reminder_sound = "صوت تذكير"
override val none = "صامت"
override val filter = "تصنيف"
override val hide_completed = "إخفاء المكتملة"
override val hide_archived = "إخفاء المؤرشفة"
override val sticky_notifications = "جعل الإشعارات ثابتة"
override val sticky_notifications_description = "منع الإشعارات من تمريرها بعيداً."
override val repair_database = "إصلاح قاعدة البيانات"
override val database_repaired = "تم إصلاح قاعدة البيانات."
override val uncheck = "إلغاء تحديد"
override val toggle = "تبديل"
override val action = "عمل"
override val habit = "عادة"
override val sort = "فرز"
override val manually = "يدوياً"
override val by_name = "حسب الإسم"
override val by_color = "حسب اللون"
override val by_score = "حسب النقاط"
override val download = "تحميل"
override val export = "استخراج"
}

@ -110,7 +110,7 @@ class StringsBulgarian : Strings() {
override val two_times_per_week = "2 пъти седмично"
override val five_times_per_week = "5 пъти седмично"
override val custom_frequency = "Друго ..."
override val help = "Помощ &amp; ЧЗВ"
override val help = "Помощ & ЧЗВ"
override val could_not_export = "Неуспешно експортиране на данни."
override val could_not_import = "Неуспешно импортиране на данни."
override val file_not_recognized = "Файлът не е разпознат."

@ -110,7 +110,7 @@ class StringsChineseCN : Strings() {
override val two_times_per_week = "每周两次"
override val five_times_per_week = "每周5次"
override val custom_frequency = "自定义"
override val help = "帮助 &amp; 常见问题"
override val help = "帮助 & 常见问题"
override val could_not_export = "导出数据失败"
override val could_not_import = "导入数据失败"
override val file_not_recognized = "无法识别文件"

@ -110,7 +110,7 @@ class StringsChineseTW : Strings() {
override val two_times_per_week = "每週兩次"
override val five_times_per_week = "每週五次"
override val custom_frequency = "自訂週期"
override val help = "幫助&amp; 常見問題"
override val help = "幫助& 常見問題"
override val could_not_export = "輸出資料失敗"
override val could_not_import = "輸入資料失敗"
override val file_not_recognized = "無法辨識"

@ -105,7 +105,7 @@ class StringsDanish : Strings() {
override val two_times_per_week = "2 gange om ugen"
override val five_times_per_week = "5 gange om ugen"
override val custom_frequency = "Brugerdefinerede"
override val help = "Hjælp &amp; FAQ"
override val help = "Hjælp & FAQ"
override val could_not_export = "Kunne ikke eksportere data"
override val could_not_import = "Kunne ikke importere data"
override val file_not_recognized = "Fil ikke genkendt."

@ -110,7 +110,7 @@ class StringsFrench : Strings() {
override val two_times_per_week = "2 fois par semaine"
override val five_times_per_week = "5 fois par semaine"
override val custom_frequency = "Personnalisée ..."
override val help = "Aide &amp; FAQ"
override val help = "Aide & FAQ"
override val could_not_export = "Export des données échoué."
override val could_not_import = "Import des données échoué."
override val file_not_recognized = "Fichier non reconnu"

@ -110,7 +110,7 @@ class StringsGerman : Strings() {
override val two_times_per_week = "2 Mal pro Woche"
override val five_times_per_week = "5 Mal pro Woche"
override val custom_frequency = "Benutzerdefiniert"
override val help = "Hilfe &amp; FAQ"
override val help = "Hilfe & FAQ"
override val could_not_export = "Fehler beim Exportieren der Daten."
override val could_not_import = "Fehler beim Importieren der Daten."
override val file_not_recognized = "Datei nicht erkannt."

@ -108,7 +108,7 @@ class StringsGreek : Strings() {
override val two_times_per_week = "2 φορές την εβδομάδα"
override val five_times_per_week = "5 φορές την εβδομάδα"
override val custom_frequency = "Προσαρμογή"
override val help = "Βοήθεια &amp; FAQ"
override val help = "Βοήθεια & FAQ"
override val could_not_export = "Αποτυχία εξαγωγής."
override val could_not_import = "Αποτυχία εισαγωγής."
override val file_not_recognized = "Άγνωστο αρχείο."

@ -110,7 +110,7 @@ class StringsIndonesian : Strings() {
override val two_times_per_week = "2 kali per minggu"
override val five_times_per_week = "5 kali per minggu"
override val custom_frequency = "Sesuaikan &#8230;"
override val help = "Bantuan &amp; FAQ"
override val help = "Bantuan & FAQ"
override val could_not_export = "Gagal mengekspor data."
override val could_not_import = "Gagal mengimpor data."
override val file_not_recognized = "File tidak dikenali."

@ -110,7 +110,7 @@ class StringsItalian : Strings() {
override val two_times_per_week = "2 volte a settimana"
override val five_times_per_week = "5 volte a settimana"
override val custom_frequency = "Personalizzato ..."
override val help = "Aiuto &amp; FAQ"
override val help = "Aiuto & FAQ"
override val could_not_export = "Esportazione non riuscita."
override val could_not_import = "Importazione non riuscita."
override val file_not_recognized = "File non riconosciuto."

@ -109,7 +109,7 @@ class StringsJapanese : Strings() {
override val two_times_per_week = "1 週間に 2 回"
override val five_times_per_week = "1 週間に 5 回"
override val custom_frequency = "カスタム &#8230;"
override val help = "ヘルプ &amp; FAQ"
override val help = "ヘルプ & FAQ"
override val could_not_export = "データのエクスポートに失敗しました。"
override val could_not_import = "データのインポートに失敗しました。"
override val file_not_recognized = "ファイルを認識できません。"

@ -110,7 +110,7 @@ class StringsKorean : Strings() {
override val two_times_per_week = "일주일에 2번"
override val five_times_per_week = "일주일에 5번"
override val custom_frequency = "직접 정하기"
override val help = "도움 &amp; FAQ"
override val help = "도움 & FAQ"
override val could_not_export = "데이터 내보내기에 실패했습니다."
override val could_not_import = "데이터 가져오기에 실패했습니다."
override val file_not_recognized = "파일을 인식할 수 없습니다."

@ -55,7 +55,7 @@ class StringsNorwegian : Strings() {
override val every_week = "Ĉiu semajno"
override val two_times_per_week = "Dufoje en semajno"
override val five_times_per_week = "Kvinfoje en semajno"
override val help = "Helpo &amp; Ofte Demandite"
override val help = "Helpo & Ofte Demandite"
override val file_not_recognized = "Dosiero ne rekonita."
override val full_backup_success = "Plena savkopio sukcese eksportita."
override val troubleshooting = "Problemserĉado"

@ -110,7 +110,7 @@ class StringsPolish : Strings() {
override val two_times_per_week = "2 razy na tydzień"
override val five_times_per_week = "5 razy na tydzień"
override val custom_frequency = "Niestandardowo..."
override val help = "Pomoc &amp; FAQ"
override val help = "Pomoc & FAQ"
override val could_not_export = "Eksportowanie danych nie powiodło się."
override val could_not_import = "Importowanie danych nie powiodło się."
override val file_not_recognized = "Plik nierozpoznany."

@ -110,7 +110,7 @@ class StringsPortugueseBR : Strings() {
override val two_times_per_week = "2 vezes por semana"
override val five_times_per_week = "5 vezes por semana"
override val custom_frequency = "Personalizar ..."
override val help = "Ajuda &amp; FAQ"
override val help = "Ajuda & FAQ"
override val could_not_export = "Erro ao exportar dados."
override val could_not_import = "Erro ao importar dados."
override val file_not_recognized = "Arquivo não reconhecido."

@ -106,7 +106,7 @@ class StringsPortuguesePT : Strings() {
override val two_times_per_week = "2 vezes por semana"
override val five_times_per_week = "5 vezes por semana"
override val custom_frequency = "Personalizar..."
override val help = "Ajuda &amp; FAQ"
override val help = "Ajuda & FAQ"
override val could_not_export = "Falha ao exportar dados."
override val could_not_import = "Falha ao importar dados."
override val file_not_recognized = "Ficheiro não reconhecido."

@ -108,7 +108,7 @@ class StringsRomanian : Strings() {
override val two_times_per_week = "De 2 ori pe săptămână"
override val five_times_per_week = "De 5 ori pe săptămână"
override val custom_frequency = "Personalizare ..."
override val help = "Ajutor &amp; Întrebări frecvente"
override val help = "Ajutor & Întrebări frecvente"
override val could_not_export = "Exportare nereușită."
override val could_not_import = "Importare nereușită."
override val file_not_recognized = "Fișier nerecunoscut."

@ -110,7 +110,7 @@ class StringsSlovak : Strings() {
override val two_times_per_week = "2 krat na teden"
override val five_times_per_week = "5 krat na teden"
override val custom_frequency = "Po meri ..."
override val help = "Pomoč &amp; Pogosta vprašanja"
override val help = "Pomoč & Pogosta vprašanja"
override val could_not_export = "Neuspešen izvoz podatkov."
override val could_not_import = "Neuspešen uvoz podatkov."
override val file_not_recognized = "Datoteka ni bila prepoznana."

@ -110,7 +110,7 @@ class StringsSpanish : Strings() {
override val two_times_per_week = "2 veces por semana"
override val five_times_per_week = "5 veces por semana"
override val custom_frequency = "Personalizado..."
override val help = "Ayuda &amp; FAQ"
override val help = "Ayuda & FAQ"
override val could_not_export = "Error al exportar datos."
override val could_not_import = "Error al importar datos."
override val file_not_recognized = "Archivo no reconocido."

@ -110,7 +110,7 @@ class StringsTurkish : Strings() {
override val two_times_per_week = "Haftada 2 kez"
override val five_times_per_week = "Haftada 5 kez"
override val custom_frequency = "Özel ..."
override val help = "Yardım &amp; SSS"
override val help = "Yardım & SSS"
override val could_not_export = "Dışarı veri aktarımı başarısız."
override val could_not_import = "İçeri veri aktarımı başarısız."
override val file_not_recognized = "Dosya tanınamadı."

@ -110,7 +110,7 @@ class StringsUkrainian : Strings() {
override val two_times_per_week = "Двічі на тиждень"
override val five_times_per_week = "5 разів на тиждень"
override val custom_frequency = "Инше&#8230;"
override val help = "Допомога &amp; ЧаПи"
override val help = "Допомога & ЧаПи"
override val could_not_export = "Помилка експортування даних."
override val could_not_import = "Помилка імпортування даних."
override val file_not_recognized = "Неможливо визначити тип файлу."

@ -25,6 +25,7 @@ import UIKit
var backend = Backend(databaseName: "dev.db",
databaseOpener: IosDatabaseOpener(withLog: StandardLog()),
fileOpener: IosFileOpener(),
localeHelper: IosLocaleHelper(NSLocale.preferredLanguages),
log: StandardLog(),
taskRunner: SequentialTaskRunner())

@ -86,11 +86,13 @@ class MainScreenCell : UITableViewCell {
}
class MainScreenController: UITableViewController, MainScreenDataSourceListener {
var backend: Backend
var dataSource: MainScreenDataSource
var data: MainScreenDataSource.Data?
var theme: Theme
var nButtons = 3
var strings: Strings
required init?(coder aDecoder: NSCoder) {
fatalError()
@ -98,6 +100,7 @@ class MainScreenController: UITableViewController, MainScreenDataSourceListener
init(withBackend backend:Backend) {
self.backend = backend
self.strings = backend.strings
self.dataSource = backend.mainScreenDataSource
self.theme = backend.theme
super.init(nibName: nil, bundle: nil)
@ -110,7 +113,7 @@ class MainScreenController: UITableViewController, MainScreenDataSourceListener
}
override func viewDidLoad() {
self.title = "Habits"
self.title = strings.main_activity_title
self.navigationItem.rightBarButtonItems = [
UIBarButtonItem(image: UIImage(named: "ic_more"),
@ -176,27 +179,27 @@ class MainScreenController: UITableViewController, MainScreenDataSourceListener
@objc func onMoreActionsClicked() {
let alert = UIAlertController(title: nil, message: nil, preferredStyle: .actionSheet)
alert.addAction(UIAlertAction(title: "Show archived", style: .default) {
alert.addAction(UIAlertAction(title: strings.show_archived, style: .default) {
(action: UIAlertAction) -> Void in
// TODO
})
alert.addAction(UIAlertAction(title: "Hide completed", style: .default) {
alert.addAction(UIAlertAction(title: strings.hide_completed, style: .default) {
(action: UIAlertAction) -> Void in
// TODO
})
alert.addAction(UIAlertAction(title: "Night mode", style: .default) {
alert.addAction(UIAlertAction(title: strings.night_mode, style: .default) {
(action: UIAlertAction) -> Void in
// TODO
})
alert.addAction(UIAlertAction(title: "Help & FAQ", style: .default) {
alert.addAction(UIAlertAction(title: strings.help, style: .default) {
(action: UIAlertAction) -> Void in
// TODO
})
alert.addAction(UIAlertAction(title: "About", style: .default) {
alert.addAction(UIAlertAction(title: strings.about, style: .default) {
(action: UIAlertAction) -> Void in
// TODO
})
alert.addAction(UIAlertAction(title: "Cancel", style: .cancel) {
alert.addAction(UIAlertAction(title: strings.cancel, style: .cancel) {
(action: UIAlertAction) -> Void in
// Do nothing
})

@ -44,6 +44,10 @@ extension Date {
class IosLocalDateFormatter : NSObject, LocalDateFormatter {
let fmt = DateFormatter()
override init() {
fmt.locale = Locale(identifier: NSLocale.preferredLanguages.first!)
}
func shortMonthName(date: LocalDate) -> String {
fmt.dateFormat = "MMM"
return fmt.string(from: date.iosDate)

@ -0,0 +1,64 @@
/*
* Copyright (C) 2016-2019 Álinson Santos Xavier <isoron@gmail.com>
*
* This file is part of Loop Habit Tracker.
*
* Loop Habit Tracker is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by the
* Free Software Foundation, either version 3 of the License, or (at your
* option) any later version.
*
* Loop Habit Tracker is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import Foundation
class IosLocaleHelper : NSObject, LocaleHelper {
var preferredLanguages: [String]
init(_ preferredLanguages: [String]) {
self.preferredLanguages = preferredLanguages
}
func getStringsForCurrentLocale() -> Strings {
let lang = preferredLanguages.first ?? "en-US"
StandardLog().debug(tag: "IosLocale", msg: lang)
if lang.hasPrefix("ar") { return StringsArabic() }
if lang.hasPrefix("fr") { return StringsFrench() }
if lang.hasPrefix("es") { return StringsSpanish() }
if lang.hasPrefix("pt-BR") { return StringsPortugueseBR() }
if lang.hasPrefix("pt") { return StringsPortuguesePT() }
if lang.hasPrefix("it") { return StringsItalian() }
if lang.hasPrefix("de") { return StringsGerman() }
if lang.hasPrefix("zh-Hans") { return StringsChineseCN() }
if lang.hasPrefix("zh-Hant") { return StringsChineseTW() }
if lang.hasPrefix("nl") { return StringsDutch() }
if lang.hasPrefix("ja") { return StringsJapanese() }
if lang.hasPrefix("ko") { return StringsKorean() }
if lang.hasPrefix("vi") { return StringsVietnamese() }
if lang.hasPrefix("ru") { return StringsRussian() }
if lang.hasPrefix("sv") { return StringsSwedish() }
if lang.hasPrefix("da") { return StringsDanish() }
if lang.hasPrefix("fi") { return StringsFinnish() }
if lang.hasPrefix("nb") { return StringsNorwegian() }
if lang.hasPrefix("tr") { return StringsTurkish() }
if lang.hasPrefix("el") { return StringsGreek() }
if lang.hasPrefix("id") { return StringsIndonesian() }
if lang.hasPrefix("hi") { return StringsHindi() }
if lang.hasPrefix("hu") { return StringsHungarian() }
if lang.hasPrefix("pl") { return StringsPolish() }
if lang.hasPrefix("cs") { return StringsCzech() }
if lang.hasPrefix("sk") { return StringsSlovak() }
if lang.hasPrefix("ca") { return StringsCatalan() }
if lang.hasPrefix("ro") { return StringsRomanian() }
if lang.hasPrefix("hr") { return StringsCroatian() }
if lang.hasPrefix("he") { return StringsHebrew() }
return Strings()
}
}

@ -0,0 +1,27 @@
/*
* Copyright (C) 2016-2019 Álinson Santos Xavier <isoron@gmail.com>
*
* This file is part of Loop Habit Tracker.
*
* Loop Habit Tracker is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by the
* Free Software Foundation, either version 3 of the License, or (at your
* option) any later version.
*
* Loop Habit Tracker is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import XCTest
@testable import uhabits
class IosLocaleTest: XCTestCase {
func testGetStringForLocale() {
//let helper = IosLocaleHelper()
}
}

@ -8,6 +8,8 @@
/* Begin PBXBuildFile section */
0057EC2B224C4CDB00C49288 /* icons in Resources */ = {isa = PBXBuildFile; fileRef = 0057EC2A224C4CDB00C49288 /* icons */; };
006EFE4C2252E9F3008464E0 /* IosLocaleTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 006EFE4A2252E9D3008464E0 /* IosLocaleTest.swift */; };
006EFE4E2252EA2B008464E0 /* IosLocale.swift in Sources */ = {isa = PBXBuildFile; fileRef = 006EFE4D2252EA2B008464E0 /* IosLocale.swift */; };
00A5B42822009F590024E00C /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 00A5B42722009F590024E00C /* AppDelegate.swift */; };
00A5B42A22009F590024E00C /* MainScreenController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 00A5B42922009F590024E00C /* MainScreenController.swift */; };
00A5B42F22009F5A0024E00C /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 00A5B42E22009F5A0024E00C /* Assets.xcassets */; };
@ -57,6 +59,8 @@
/* Begin PBXFileReference section */
0057EC2A224C4CDB00C49288 /* icons */ = {isa = PBXFileReference; lastKnownFileType = folder; path = icons; sourceTree = "<group>"; };
006EFE4A2252E9D3008464E0 /* IosLocaleTest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = IosLocaleTest.swift; sourceTree = "<group>"; };
006EFE4D2252EA2B008464E0 /* IosLocale.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = IosLocale.swift; sourceTree = "<group>"; };
00A5B42422009F590024E00C /* uhabits.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = uhabits.app; sourceTree = BUILT_PRODUCTS_DIR; };
00A5B42722009F590024E00C /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
00A5B42922009F590024E00C /* MainScreenController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainScreenController.swift; sourceTree = "<group>"; };
@ -184,6 +188,7 @@
00C0C6DA2247E6B0003D8AF0 /* IosDates.swift */,
00C0C6CD2246EFB3003D8AF0 /* IosExtensions.swift */,
00C0C6A9224654F4003D8AF0 /* IosFiles.swift */,
006EFE4D2252EA2B008464E0 /* IosLocale.swift */,
);
path = Platform;
sourceTree = "<group>";
@ -195,6 +200,7 @@
00C0C6A222465365003D8AF0 /* IosDatabaseTest.swift */,
00C0C6DC2247E6C4003D8AF0 /* IosDatesTest.swift */,
00C0C6A122465365003D8AF0 /* IosFilesTest.swift */,
006EFE4A2252E9D3008464E0 /* IosLocaleTest.swift */,
);
path = Platform;
sourceTree = "<group>";
@ -331,6 +337,7 @@
00C0C6CE2246EFB3003D8AF0 /* IosExtensions.swift in Sources */,
00C0C6E0224A3602003D8AF0 /* DetailScreenController.swift in Sources */,
00C0C6A8224654A2003D8AF0 /* IosDatabase.swift in Sources */,
006EFE4E2252EA2B008464E0 /* IosLocale.swift in Sources */,
00C0C6DB2247E6B0003D8AF0 /* IosDates.swift in Sources */,
00A5B42A22009F590024E00C /* MainScreenController.swift in Sources */,
00A5B42822009F590024E00C /* AppDelegate.swift in Sources */,
@ -344,6 +351,7 @@
files = (
00C0C6DD2247E6C4003D8AF0 /* IosDatesTest.swift in Sources */,
00C0C6A52246537A003D8AF0 /* IosFilesTest.swift in Sources */,
006EFE4C2252E9F3008464E0 /* IosLocaleTest.swift in Sources */,
00C0C6D92247DC13003D8AF0 /* IosCanvasTest.swift in Sources */,
00C0C6A62246537E003D8AF0 /* IosDatabaseTest.swift in Sources */,
);

@ -24,6 +24,7 @@ fi
grep "<string name" "$1" | \
grep -v translatable | \
sed 's/&amp;/\&/g' | \
sed 's/^.*name="\([^"]*\)">\([^<]*\)<.*/ '"$prefix"'val \1 = "\2"/'
echo "}"

@ -7,8 +7,8 @@ convert() {
./androidStringsToKt.sh $INPUT_DIR/$1/strings.xml "$2" > $OUTPUT_DIR/Strings$2.kt
}
convert values ""
convert values-ar Arabig
#convert values ""
convert values-ar Arabic
convert values-bg Bulgarian
convert values-ca Catalan
convert values-cs Czech

Loading…
Cancel
Save