improve music patch

This commit is contained in:
inotia00
2023-01-05 12:05:03 +09:00
parent 73449598c2
commit 33dd92ec93
92 changed files with 872 additions and 1412 deletions

View File

@ -4,16 +4,14 @@ import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.ResourceContext
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.ResourcePatch
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
import app.revanced.shared.annotation.YouTubeCompatibility
import app.revanced.shared.util.resources.ResourceHelper
import java.nio.file.Files
import java.nio.file.StandardCopyOption
@Patch
@Name("translations")
@ -24,18 +22,7 @@ import java.nio.file.StandardCopyOption
class TranslationsPatch : ResourcePatch {
override fun execute(context: ResourceContext): PatchResult {
LANGUAGE_LIST.forEach { language ->
val directory = "values-" + language + "-v21"
val relativePath = "$language/strings.xml"
context["res/$directory"].mkdir()
Files.copy(
this.javaClass.classLoader.getResourceAsStream("youtube/translations/$relativePath")!!,
context["res"].resolve("$directory/strings.xml").toPath(),
StandardCopyOption.REPLACE_EXISTING
)
}
ResourceHelper.addTranslations(context, "youtube", LANGUAGE_LIST)
ResourceHelper.patchSuccess(
context,