mirror of
https://github.com/inotia00/revanced-patches.git
synced 2025-06-12 05:07:41 +02:00
improve music patch
This commit is contained in:
@ -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,
|
||||
|
Reference in New Issue
Block a user