last commit before migration from GitHub
This commit is contained in:
@@ -1,21 +1,160 @@
|
||||
{
|
||||
"setup": {
|
||||
"activity": {
|
||||
"wrong_apk_title": "Wrong APK installed",
|
||||
"wrong_apk_message": "Your device is armv8, please download the armv8 apk, not armv7.",
|
||||
"close_button": "Close",
|
||||
"important_confirm_timeout": "I understand ({seconds}s)",
|
||||
"important_confirm": "I understand",
|
||||
"important_title": "Important!",
|
||||
"important_message": "If you have used SnapEnhance or any other mod besides PurrfectSnap, we recommend uninstalling everything and staying on stock Snapchat for one week. Then switch to PurrfectSnap after next Friday.",
|
||||
"language_subtitle": "Tune PurrfectSnap to speak your voice before anything else.",
|
||||
"install_mode_title": "Choose your device",
|
||||
"install_mode_subtitle": "Pick the path that matches how you'll install PurrfectSnap.",
|
||||
"permissions_subtitle": "Grant the essentials so overlays, downloads, and alerts stay reliable.",
|
||||
"patch_title": "Auto Patcher",
|
||||
"patch_subtitle": "Streamlined download, patch, and install with a single flow.",
|
||||
"root_install_title": "Snapchat Installer",
|
||||
"root_install_subtitle": "Download and install the recommended Snapchat build.",
|
||||
"save_folder_subtitle": "Pick your personal vault so snaps land exactly where you expect.",
|
||||
"mappings_subtitle": "We calibrate everything to your install so the magic works flawlessly.",
|
||||
"step_counter": "Step {current} of {total}",
|
||||
"step_complete": "Checked off",
|
||||
"step_active": "In progress",
|
||||
"step_upcoming": "Ready next",
|
||||
"finish_button": "Finish setup",
|
||||
"continue_button": "Continue"
|
||||
},
|
||||
"dialogs": {
|
||||
"select_language": "Select Language",
|
||||
"save_folder": "Choose where to save downloads",
|
||||
"select_save_folder_button": "Select Folder"
|
||||
},
|
||||
"install_mode": {
|
||||
"confirm_timeout": "I understand ({seconds}s)",
|
||||
"confirm": "I understand",
|
||||
"notice_title": "Please note!",
|
||||
"notice_intro": "Select the type of device you have: rooted or non-rooted. If you are unsure, choose Non-root and continue.",
|
||||
"notice_non_root_title": "Non-rooted devices",
|
||||
"notice_non_root_body": "Select Non-root and the app will handle everything. Tap Install Patched Snapchat when it appears. After it installs, do not open Snapchat yet. Continue the PurrfectSnap setup; once it finishes, you can open Snapchat and enjoy.",
|
||||
"notice_root_title": "Rooted devices",
|
||||
"notice_root_body": "Make sure you have flashed LSPosed first. We recommend JingMatrix LSPosed or LSPosed Irena. After you select Root, the app will install the recommended Snapchat version. Do not open it yet; continue the PurrfectSnap setup. When setup finishes, enable PurrfectSnap in LSPosed and reboot your phone. Then start using Snapchat. We highly recommend detaching Snapchat from the Play Store with the Zygisk Detach module to prevent auto-updates.",
|
||||
"notice_issues_hint": "If you run into any installation issues, the solution will appear here. Please read it carefully.",
|
||||
"notice_note_prefix": "Note: ",
|
||||
"notice_note_body": "New Accounts easily get locked! It is recommended to use an older account with PurrfectSnap.",
|
||||
"step_title": "Choose your device",
|
||||
"step_subtitle": "If you don't know, select Non-rooted device and proceed.",
|
||||
"root_option_title": "Rooted device",
|
||||
"root_option_subtitle": "Use Lsposed and skip auto patching.",
|
||||
"non_root_option_title": "Non-rooted device",
|
||||
"non_root_option_subtitle": "Use included auto patcher to install patched Snapchat.",
|
||||
"skip_auto_setup": "Skip Auto Setup"
|
||||
},
|
||||
"mappings": {
|
||||
"dialog": "Generating Mappings...",
|
||||
"generate_failure_no_snapchat": "PurrfectSnap was unable to detect Snapchat, please try reinstalling Snapchat.",
|
||||
"generate_failure": "An error occurred while trying to generate mappings, please try again."
|
||||
"generate_failure": "An error occurred while trying to generate mappings, please try again.",
|
||||
"confirm_understand_timeout": "I understand ({seconds}s)",
|
||||
"confirm_understand": "I understand",
|
||||
"notice_title": "Please note!",
|
||||
"notice_intro": "If you see the \"Account temporarily disabled\" error while logging in, do not worry. Follow these steps in order:",
|
||||
"notice_step_1": "1. Reopen Snapchat and log in. This fixes it most of the time.",
|
||||
"notice_step_2": "2. If it still fails, tap the login button repeatedly. This usually covers the next chunk.",
|
||||
"notice_step_3": "3. If it still fails, clear Snapchat's data, disable any VPN, and log in again.",
|
||||
"notice_rooted_title": "For rooted users:",
|
||||
"notice_rooted_body": "Reopen Snapchat and log in. If it still fails, disable PurrfectSnap in LSPosed, log in, then re-enable PurrfectSnap.",
|
||||
"warnings_info": "{count} warning(s) occurred while generating mappings:\n\n{warnings}",
|
||||
"progress_hint": "This only takes a moment. Keep the app open while magic happens!"
|
||||
},
|
||||
"patch": {
|
||||
"title": "Auto Patcher",
|
||||
"ready_log": "Auto Patcher is ready.",
|
||||
"install_confirmed_log": "Snapchat install confirmed. You're cleared to continue.",
|
||||
"download_recommended_status": "Downloading recommended Snapchat version ({version})...",
|
||||
"starting_log": "Starting Auto Patcher for recommended Snapchat version.",
|
||||
"uninstall_prompt_status": "Snapchat is installed. Please uninstall it first (don't keep data), then start Auto Patcher again.",
|
||||
"uninstall_prompt_error": "Snapchat still installed. Uninstall it first, to continue.",
|
||||
"module_apk_not_found_error": "Module apk not found",
|
||||
"fetching_apk_status": "Fetching recommended Snapchat APK...",
|
||||
"download_failed_error": "Download failed",
|
||||
"download_completed_status": "Download completed: {fileName}",
|
||||
"starting_patch_status": "Starting patch powered by Jingmatrix Lspatch",
|
||||
"patched_not_produced_error": "Patched apk not produced",
|
||||
"patched_ready_status": "Patched build ready. Install to finish.",
|
||||
"failed_status": "Failed: {message}",
|
||||
"mark_installed_log": "Marked as installed manually. You're cleared to continue.",
|
||||
"issues_title": "Facing issues?",
|
||||
"issues_confirm": "Got it",
|
||||
"issues_heading": "How to fix installation errors",
|
||||
"issues_conflict_issue": "Issue: App cannot be installed because it conflicts with an existing package.",
|
||||
"issues_conflict_fix": "Fix: Download Snapchat from the Play Store and uninstall it without keeping data. Run Auto Patcher again. If it still does not work, run:",
|
||||
"issues_adb_command": "adb uninstall com.snapchat.android",
|
||||
"issues_invalid_issue": "Issue: App not installed because the package appears to be invalid.",
|
||||
"issues_invalid_fix": "Fix: Download and install JingMatrix LSPatch, then patch a Snapchat version (any one) from this range, i.e. between 13.65.1.0 and 13.71.0.51, in Integrated mode. Select Embed Modules and embed the PurrfectSnap APK. Then choose Skip auto setup during PurrfectSnap setup to skip Auto Patcher.",
|
||||
"status_downloading": "Downloading Snapchat {percent}%",
|
||||
"status_patching": "Patching...",
|
||||
"status_initializing": "Initializing...",
|
||||
"logs_copied": "Logs copied to clipboard.",
|
||||
"install_success": "Patched APK installed",
|
||||
"start_button": "Start auto patch",
|
||||
"install_button": "Install patched Snapchat",
|
||||
"already_installed_button": "Already Installed?",
|
||||
"powered_by_label": "Powered by Jingmatrix Lspatch",
|
||||
"logs_title": "Logs",
|
||||
"copy_button": "Copy",
|
||||
"log_line_prefix": "- {line}"
|
||||
},
|
||||
"permissions": {
|
||||
"dialog": "Complete these essentials to continue:",
|
||||
"notification_access": "Notification Access",
|
||||
"battery_optimization": "Battery Optimization",
|
||||
"display_over_other_apps": "Display Over Other Apps",
|
||||
"request_button": "Request"
|
||||
"request_button": "Request",
|
||||
"notification_access_description": "Alerts you the second downloads finish.",
|
||||
"battery_optimization_description": "Keeps background tasks alive without being killed.",
|
||||
"display_over_other_apps_description": "Enables floating overlays while you are in Snapchat.",
|
||||
"granted_label": "Granted"
|
||||
},
|
||||
"pick_language": {
|
||||
"current_selection": "Current selection",
|
||||
"browse_languages": "Browse languages",
|
||||
"change_anytime_hint": "You can change this anytime from PurrfectSnap settings.",
|
||||
"available_languages": "Available Languages"
|
||||
},
|
||||
"root_install": {
|
||||
"title": "Snapchat Installer",
|
||||
"ready_log": "Snapchat installer is ready.",
|
||||
"install_confirmed_log": "Snapchat install confirmed. You're cleared to continue.",
|
||||
"download_recommended_status": "Downloading recommended Snapchat version ({version})...",
|
||||
"mark_installed_log": "Marked as installed manually. You're cleared to continue.",
|
||||
"start_download_log": "Starting Snapchat download for rooted install.",
|
||||
"uninstall_prompt_status": "Snapchat is installed. Please uninstall it first (don't keep data), then try again.",
|
||||
"uninstall_prompt_error": "Snapchat still installed. Uninstall it first, to continue.",
|
||||
"fetching_apk_status": "Fetching recommended Snapchat APK...",
|
||||
"download_failed_error": "Download failed",
|
||||
"download_completed_status": "Download completed: {fileName}",
|
||||
"launching_installer_status": "Launching installer...",
|
||||
"failed_status": "Failed: {message}",
|
||||
"status_downloading": "Downloading Snapchat {percent}%",
|
||||
"status_preparing": "Preparing installer...",
|
||||
"logs_copied": "Logs copied to clipboard.",
|
||||
"install_success": "Snapchat installed",
|
||||
"download_button": "Download Snapchat",
|
||||
"install_button": "Install Snapchat",
|
||||
"already_installed_button": "Already Installed?",
|
||||
"logs_title": "Logs",
|
||||
"copy_button": "Copy",
|
||||
"log_line_prefix": "- {line}"
|
||||
},
|
||||
"save_folder": {
|
||||
"description": "Please choose the location where media should be downloaded to.",
|
||||
"destination_label": "Destination",
|
||||
"system_default_label": "System default",
|
||||
"use_default_location_button": "Use default location",
|
||||
"no_picker_title": "Folder picker unavailable",
|
||||
"no_picker_message": "Some cloned/dual-app environments block the system folder picker. You can continue using the system default save location, or open the app outside clone mode to select a custom folder.",
|
||||
"use_default_button": "Use default",
|
||||
"permission_hint": "PurrfectSnap requires Storage permissions to download and Save Media from Snapchat."
|
||||
}
|
||||
},
|
||||
"scopes": {
|
||||
@@ -61,10 +200,44 @@
|
||||
"update_title": "PurrfectSnap Update",
|
||||
"update_content": "Version {version} is available!",
|
||||
"update_button": "Download",
|
||||
"hero_tagline": "An Xposed Module meant to enhance your Snapchat experience",
|
||||
"hero_version_label": "Version: {version} - {channel}",
|
||||
"hero_build_label": "Build: {build}",
|
||||
"update_ready_label": "Ready to install",
|
||||
"purr_aura_active_label": "PurrAura Active!",
|
||||
"purr_aura_inactive_label": "PurrAura Inactive",
|
||||
"open_settings_button": "Open Settings",
|
||||
"wiki_button": "Wiki",
|
||||
"github_button": "GitHub",
|
||||
"telegram_button": "Telegram",
|
||||
"channel_label_stable": "Stable",
|
||||
"channel_label_prerelease": "Pre-release",
|
||||
"announcements_button_description": "Announcements",
|
||||
"update_arch_not_supported_toast": "Your device architecture is not supported for automatic updates.",
|
||||
"update_download_started_toast": "Download started",
|
||||
"update_download_completed_toast": "Download completed",
|
||||
"update_install_failed_toast": "Failed to install update. Check logs for more details.",
|
||||
"update_download_failed_toast": "Download failed: {error}",
|
||||
"debug_build_summary_title": "You are running a debug build of PurrfectSnap",
|
||||
"debug_build_summary_content": "Version {versionName} ({versionCode})",
|
||||
"debug_build_summary_date": "Build date: {date} ({days} days ago)",
|
||||
"quick_actions_title": "Quick Actions"
|
||||
"quick_actions_title": "Quick Actions",
|
||||
"quick_actions_empty_title": "No quick tiles yet",
|
||||
"quick_actions_empty_subtitle": "Design your dream grid with the actions you use the most.",
|
||||
"quick_actions_add_tile_button": "Add tile",
|
||||
"quick_actions_manage_button": "Manage",
|
||||
"quick_actions_count_label": "{count} curated shortcuts"
|
||||
},
|
||||
"home_about": {
|
||||
"about_title": "PurrfectSnap",
|
||||
"about_tagline": "An Xposed Module meant to enhance your Snapchat experience!",
|
||||
"about_lead_developers_title": "Lead Developers",
|
||||
"about_story_title": "Our Story",
|
||||
"about_story": "PurrfectSnap was founded on 2nd of October, 2025, as a fork of SnapEnhance by IzTIzRNAL with a vision to provide users the quality Snapchat experience they deserve. This app was just meant to be a minor update in the SnapEnhance repository, but it soon became a separate app wherein the contributors kept adding features. Then the developer <RSR/> joined the team, and this app soon became a huge success. We received much love and support and gained 1K+ downloads in just two days! We thank all users and contributors; without your support, we wouldn't have reached this place. We would also like to convey our huge thanks to rhunk, the lead developer of SnapEnhance, as without him, this app wouldn't even exist. We are immensely grateful to him. Lastly, we would like to thank all our admins, notably: CLASSIC GENIUS, Harry, SUJI>L, Zain & scrodingerspet, who were right there with us from the very beginning. We would also like to thank all testers, notably Leo & Toxic, who tested and reported bugs continuously. We are immensely grateful for your contribution.",
|
||||
"about_thanks_title": "With love, PurrfectSnap Team",
|
||||
"about_magic_toast": "Tap 5 times in this screen to see some magic 😉!",
|
||||
"github_button": "GitHub",
|
||||
"telegram_button": "Telegram"
|
||||
},
|
||||
"home_logs": {
|
||||
"no_logs_hint": "No logs available",
|
||||
@@ -72,7 +245,8 @@
|
||||
"export_logs_button": "Export Logs",
|
||||
"saving_logs_toast": "Saving logs, this may take a while ...",
|
||||
"saved_logs_success_toast": "Logs saved successfully",
|
||||
"saved_logs_failure_toast": "Failed to save logs"
|
||||
"saved_logs_failure_toast": "Failed to save logs",
|
||||
"read_logs_failed_toast": "Failed to read logs!"
|
||||
},
|
||||
"home_settings": {
|
||||
"actions_title": "Actions",
|
||||
@@ -119,11 +293,17 @@
|
||||
"test_mode_label": "Enable PurrAura",
|
||||
"disable_feature_loading_label": "Disable Feature Loading",
|
||||
"disable_auto_mapper_label": "Disable Auto Mapper",
|
||||
"disable_bypass_indicator_label": "Disable Bypass Indicator"
|
||||
"disable_bypass_indicator_label": "Disable Bypass Indicator",
|
||||
"open_file_failed_toast": "Failed to open file! {message}",
|
||||
"import_failed_toast": "Import failed: {message}"
|
||||
},
|
||||
"tasks": {
|
||||
"no_tasks": "No tasks",
|
||||
"merge_button": "Merge",
|
||||
"summary_active": "{active} active \u00b7 {recent} recent",
|
||||
"summary_idle": "Idle \u00b7 {recent} recent",
|
||||
"running_count": "{count} running",
|
||||
"clear_button_description": "Clear tasks",
|
||||
"failed_to_open_file": "Failed to open file",
|
||||
"merge_files_toast": "Merging {count} files",
|
||||
"remove_selected_tasks_title": "Are you sure you want to remove selected tasks?",
|
||||
@@ -167,6 +347,9 @@
|
||||
"social": {
|
||||
"friends_tab": "Friends",
|
||||
"groups_tab": "Groups",
|
||||
"search_button_description": "Search",
|
||||
"close_search_button_description": "Close search",
|
||||
"clear_search_button_description": "Clear search",
|
||||
"empty_hint": "Your list is empty for now",
|
||||
"friends_empty_title": "No friends added yet",
|
||||
"groups_empty_title": "No groups synced yet",
|
||||
@@ -317,6 +500,7 @@
|
||||
"import_button": "Import",
|
||||
"import_from_url_button": "Import from URL",
|
||||
"import_script_from_url_title": "Import Script from URL",
|
||||
"import_failed": "Import failed: {message}",
|
||||
"import_script_warning": "Only install scripts from sources you trust.",
|
||||
"installed_scripts_tab": "Installed",
|
||||
"manage_repos_button": "Manage repos",
|
||||
@@ -420,6 +604,7 @@
|
||||
"delete_rule_dialog_text": "Are you sure you want to delete this rule?",
|
||||
"no_repos_added": "No repositories added",
|
||||
"import_dialog_title": "Import Rules",
|
||||
"read_file_failed_toast": "Failed to read file: {message}",
|
||||
"bulk_import_button": "Bulk import",
|
||||
"individual_import_button": "Single import",
|
||||
"invalid_import_type_dialog_title": "Invalid import",
|
||||
@@ -753,6 +938,10 @@
|
||||
"name": "Allow Duplicate",
|
||||
"description": "Allows the same media to be downloaded multiple times"
|
||||
},
|
||||
"file_hash_check": {
|
||||
"name": "File Hash Check",
|
||||
"description": "Verify downloaded media with file hashes"
|
||||
},
|
||||
"merge_overlays": {
|
||||
"name": "Merge Overlays",
|
||||
"description": "Combines the Text and the media of a Snap into a single file"
|
||||
@@ -2834,6 +3023,8 @@
|
||||
"native_hooks_send_failure_toast": "Failed to send! Please enable Native Hooks in the settings.",
|
||||
"no_participants_to_encrypt_toast": "You don't have any friends in this conversation to encrypt messages with!",
|
||||
"encryption_failed_toast": "Failed to encrypt message! Check logcat for more details.",
|
||||
"missing_friend_id_toast": "Can't find friendId for conversationId {conversationId}",
|
||||
"key_exchange_failed_toast": "Can't create key exchange for friendId {friendId}",
|
||||
"accept_public_key_success_toast": "Public key successfully accepted!",
|
||||
"accept_secret_key_success_toast": "Done! You can now send and receive encrypted messages with this friend.",
|
||||
"accept_public_key_failure_toast": "Failed to accept public key",
|
||||
@@ -2845,6 +3036,21 @@
|
||||
"incoming_pk_message": "You just received a public key request. Click below to accept it.",
|
||||
"incoming_secret_message": "Your friend just accepted your public key. Click below to accept the secret."
|
||||
},
|
||||
"account_switcher_ui": {
|
||||
"already_logged_in": "Already logged in as {username}",
|
||||
"login_failed_toast": "Failed to login. Check logs for more info.",
|
||||
"logged_out_toast": "Logged out",
|
||||
"data_not_found_toast": "Account data not found",
|
||||
"restore_failed_toast": "Failed to restore account data",
|
||||
"logged_in_as_toast": "Logged in as {username}",
|
||||
"backup_success_toast": "Account backed up!",
|
||||
"backup_failure_toast": "Failed to backup account. Check logs for more info.",
|
||||
"import_success_toast": "Imported {username}!",
|
||||
"import_failure_toast": "Failed to import account: {message}",
|
||||
"export_success_toast": "Account exported!",
|
||||
"export_failed_toast": "Failed to export account. Check logs for more info.",
|
||||
"forced_logout_toast": "Removed account due to forced logout"
|
||||
},
|
||||
"auto_open_snaps": {
|
||||
"title": "Auto Open Snaps",
|
||||
"priority_title": "Auto Open Snaps (Priority)",
|
||||
@@ -3004,7 +3210,8 @@
|
||||
"auto_delete_sent_messages": {
|
||||
"countdown_toast": "Message will be deleted in {time}",
|
||||
"delete_success_toast": "Message deleted successfully",
|
||||
"delete_failed_toast": "Failed to delete message"
|
||||
"delete_failed_toast": "Failed to delete message",
|
||||
"queue_cleared_toast": "Auto delete queue cleared"
|
||||
},
|
||||
"translation_position": {
|
||||
"above": "Above",
|
||||
@@ -3243,6 +3450,9 @@
|
||||
"cancel": "Cancel",
|
||||
"documentation": "Documentation"
|
||||
},
|
||||
"button": {
|
||||
"cancel": "Cancel"
|
||||
},
|
||||
"common": {
|
||||
"cancel": "Cancel",
|
||||
"add": "Add",
|
||||
@@ -3309,6 +3519,32 @@
|
||||
"failed_to_fetch_message": "Failed to fetch message: {error}",
|
||||
"failed_to_edit_message": "Failed to edit message: {error}"
|
||||
},
|
||||
"toast_snapchat_not_installed": "Can't execute action: Snapchat is not installed",
|
||||
"invalid_input_toast": "Invalid input! Make sure you entered a valid value.",
|
||||
"toast_async_task_failed": "Async task failed: {message}",
|
||||
"toast_snapchat_crashed": "Snapchat has crashed! Please check logs for more details.",
|
||||
"toast_init_features_failed": "Failed to initialize features! Some functionality may not work properly.",
|
||||
"toast_init_script_runtime_failed": "Failed to initialize script runtime!",
|
||||
"toast_database_corrupted": "Database {path} is corrupted! Restarting ...",
|
||||
"toast_feature_init_failed": "Failed to init feature {feature}! Check logcat for more details.",
|
||||
"toast_updating_purrfectsnap": "Updating PurrfectSnap. Please wait...",
|
||||
"toast_update_purrfectsnap_failed": "Failed to update PurrfectSnap. Please check logcat for more details.",
|
||||
"toast_purrfectsnap_updated": "PurrfectSnap updated!",
|
||||
"toast_export_memories_failed": "Failed to export memories",
|
||||
"toast_exported_to_path": "Exported to {path}",
|
||||
"toast_open_memories_db_failed": "Failed to open memories database",
|
||||
"toast_friend_add_unavailable": "Failed to add friend: FriendRelationshipChanger instance not available",
|
||||
"toast_friend_add_failed": "Failed to add friend: {message}",
|
||||
"toast_friends_exported": "Exported {count} friends!",
|
||||
"toast_friends_import_failed": "Failed to import friends: {message}",
|
||||
"toast_translation_service_unavailable": "Translation service temporarily unavailable",
|
||||
"toast_send_message_failed": "Failed to send message: {error}",
|
||||
"toast_mark_conversation_read_failed": "Failed to mark conversation as read",
|
||||
"toast_fetch_conversation_failed": "Failed to fetch conversation",
|
||||
"toast_open_snap_failed": "Failed to open snap",
|
||||
"toast_mark_message_read_failed": "Failed to mark message as read. Check logs for more details",
|
||||
"toast_open_conversation_first": "You must open a conversation first",
|
||||
"toast_open_link_failed": "Failed to open link",
|
||||
"ai_response_style": {
|
||||
"casual": "Casual",
|
||||
"formal": "Formal",
|
||||
@@ -3347,7 +3583,3 @@
|
||||
"openrouter": "OpenRouter"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -33,11 +33,26 @@ class LocaleWrapper(
|
||||
lateinit var loadedLocale: Locale
|
||||
|
||||
private fun load(locale: String, pfd: ParcelFileDescriptor) {
|
||||
loadedLocale = if (locale.contains("_")) {
|
||||
val split = locale.split("_")
|
||||
Locale.Builder().setLanguage(split[0]).setRegion(split[1]).build()
|
||||
} else {
|
||||
Locale.Builder().setLanguage(locale).build()
|
||||
loadedLocale = when (locale) {
|
||||
"zh_SIMPLIFIED" -> Locale.SIMPLIFIED_CHINESE
|
||||
else -> {
|
||||
if (locale.contains("_")) {
|
||||
val split = locale.split("_", limit = 2)
|
||||
val language = split[0]
|
||||
val region = split.getOrNull(1)
|
||||
runCatching {
|
||||
val builder = Locale.Builder().setLanguage(language)
|
||||
if (!region.isNullOrBlank() && region.length in 2..3) {
|
||||
builder.setRegion(region)
|
||||
}
|
||||
builder.build()
|
||||
}.getOrElse {
|
||||
Locale.forLanguageTag(locale.replace('_', '-'))
|
||||
}
|
||||
} else {
|
||||
Locale.forLanguageTag(locale)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
val translations = AutoCloseInputStream(pfd).use {
|
||||
|
||||
@@ -42,7 +42,7 @@ fun Context.getUrlFromClipboard(): String? {
|
||||
return getTextFromClipboard()?.takeIf { it.startsWith("http") }
|
||||
}
|
||||
|
||||
fun Context.openLink(url: String, shouldThrow: Boolean = false) {
|
||||
fun Context.openLink(url: String, failureMessage: String, shouldThrow: Boolean = false) {
|
||||
runCatching {
|
||||
startActivity(Intent(Intent.ACTION_VIEW).apply {
|
||||
data = url.toUri()
|
||||
@@ -50,7 +50,7 @@ fun Context.openLink(url: String, shouldThrow: Boolean = false) {
|
||||
})
|
||||
}.onFailure {
|
||||
if (shouldThrow) throw it
|
||||
Toast.makeText(this, "Failed to open link", Toast.LENGTH_SHORT).show()
|
||||
Toast.makeText(this, failureMessage, Toast.LENGTH_SHORT).show()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user