chore(lang): section translation

- profile picture downloader config
This commit is contained in:
rhunk
2023-09-03 00:11:11 +02:00
parent e587f4700a
commit 77584d67e2
12 changed files with 150 additions and 68 deletions

View File

@ -12,6 +12,12 @@
"generate_failure_no_snapchat": "SnapEnhance was unable to detect Snapchat, please try reinstalling Snapchat.",
"generate_failure": "An error occurred while trying to generate mappings, please try again.",
"generate_success": "Mappings generated successfully."
},
"permissions": {
"dialog": "To continue you need to fit the following requirements:",
"notification_access": "Notification Access",
"battery_optimization": "Battery Optimization",
"request_button": "Request"
}
},
@ -25,8 +31,38 @@
"social": "Social",
"plugins": "Plugins"
},
"features": {
"disabled": "Disabled"
"sections": {
"home": {
"logs": {
"clear_logs_button": "Clear Logs",
"export_logs_button": "Export Logs"
}
},
"downloads": {
"empty_download_list": "(empty)"
},
"features": {
"disabled": "Disabled"
},
"social": {
"rules_title": "Rules",
"participants_text": "{count} participants",
"not_found": "Not found",
"streaks_title": "Streaks",
"streaks_length_text": "Length: {length}",
"streaks_expiration_short": "{hours}h",
"streaks_expiration_text": "Expires in {eta}",
"reminder_button": "Set Reminder"
}
},
"dialogs": {
"add_friend": {
"title": "Add Friend or Group",
"search_hint": "Search",
"fetch_error": "Failed to fetch data",
"category_groups": "Groups",
"category_friends": "Friends"
}
}
},
@ -118,6 +154,10 @@
"name": "Force Voice Note Format",
"description": "Forces Voice Notes to be saved in a specified Format"
},
"download_profile_pictures": {
"name": "Download Profile Pictures",
"description": "Allows you to download Profile Pictures from the profile page"
},
"chat_download_context_menu": {
"name": "Chat Download Context Menu",
"description": "Allows you to download media from a conversation by long-pressing them"
@ -577,16 +617,6 @@
"birthday": "Birthday : {month} {day}"
},
"auto_updater": {
"no_update_available": "No Update available!",
"dialog_title": "New Update available!",
"dialog_message": "There is a new Update for SnapEnhance available! ({version})\n\n{body}",
"dialog_positive_button": "Download and Install",
"dialog_negative_button": "Cancel",
"downloading_toast": "Downloading Update...",
"download_manager_notification_title": "Downloading SnapEnhance APK..."
},
"chat_export": {
"select_export_format": "Select the Export Format",
"select_media_type": "Select Media Types to export",
@ -610,7 +640,15 @@
"positive": "Yes",
"negative": "No",
"cancel": "Cancel",
"open": "Open"
"open": "Open",
"download": "Download"
},
"profile_picture_downloader": {
"button": "Download Profile Picture",
"title": "Profile Picture Downloader",
"avatar_option": "Avatar",
"background_option": "Background"
},
"download_manager_activity": {

View File

@ -41,6 +41,7 @@ class DownloaderConfig : ConfigContainer() {
val forceVoiceNoteFormat = unique("force_voice_note_format", "aac", "mp3", "opus") {
addFlags(ConfigFlag.NO_TRANSLATE)
}
val downloadProfilePictures = boolean("download_profile_pictures")
val chatDownloadContextMenu = boolean("chat_download_context_menu")
val ffmpegOptions = container("ffmpeg_options", FFMpegOptions()) { addNotices(FeatureNotice.UNSTABLE) }
val logging = multiple("logging", "started", "success", "progress", "failure").apply {

View File

@ -11,6 +11,7 @@ class RootConfig : ConfigContainer() {
val rules = container("rules", Rules()) { icon = "Rule" }
val camera = container("camera", Camera()) { icon = "Camera"}
val streaksReminder = container("streaks_reminder", StreaksReminderConfig()) { icon = "Alarm" }
val experimental = container("experimental", Experimental()) { icon = "Science"; addNotices(FeatureNotice.UNSTABLE)
val experimental = container("experimental", Experimental()) {
icon = "Science"; addNotices(FeatureNotice.UNSTABLE)
}
}

View File

@ -16,6 +16,8 @@ import java.nio.ByteBuffer
class ProfilePictureDownloader : Feature("ProfilePictureDownloader", loadParams = FeatureLoadParams.ACTIVITY_CREATE_ASYNC) {
@SuppressLint("SetTextI18n")
override fun asyncOnActivityCreate() {
if (!context.config.downloader.downloadProfilePictures.get()) return
var friendUsername: String? = null
var backgroundUrl: String? = null
var avatarUrl: String? = null
@ -24,7 +26,7 @@ class ProfilePictureDownloader : Feature("ProfilePictureDownloader", loadParams
if (event.view::class.java.name != "com.snap.unifiedpublicprofile.UnifiedPublicProfileView") return@subscribe
event.parent.addView(Button(event.parent.context).apply {
text = "Download"
text = this@ProfilePictureDownloader.context.translation["profile_picture_downloader.button"]
layoutParams = RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT).apply {
setMargins(0, 200, 0, 0)
}
@ -32,12 +34,14 @@ class ProfilePictureDownloader : Feature("ProfilePictureDownloader", loadParams
ViewAppearanceHelper.newAlertDialogBuilder(
this@ProfilePictureDownloader.context.mainActivity!!
).apply {
setTitle("Download profile picture")
setTitle(this@ProfilePictureDownloader.context.translation["profile_picture_downloader.title"])
val choices = mutableMapOf<String, String>()
backgroundUrl?.let { choices["Background"] = it }
avatarUrl?.let { choices["Avatar"] = it }
backgroundUrl?.let { choices["avatar_option"] = it }
avatarUrl?.let { choices["background_option"] = it }
setItems(choices.keys.toTypedArray()) { _, which ->
setItems(choices.keys.map {
this@ProfilePictureDownloader.context.translation["profile_picture_downloader.$it"]
}.toTypedArray()) { _, which ->
runCatching {
this@ProfilePictureDownloader.context.feature(MediaDownloader::class).downloadProfilePicture(
choices.values.elementAt(which),