CircleToSearch with multi search engine support for all android
Kotlin
add OCR-translation module
AKS Labs26777d474f3b
diff --git a/.idea/gradle.xml b/.idea/gradle.xmlindex 02c4aa5..34cf41f 100644--- a/.idea/gradle.xml+++ b/.idea/gradle.xml@@ -9,6 +9,7 @@<option name="modules"><set><option value="$PROJECT_DIR$" />+ <option value="$PROJECT_DIR$/OCR-translation" /><option value="$PROJECT_DIR$/app" /></set></option>diff --git a/OCR-translation/.gitignore b/OCR-translation/.gitignorenew file mode 100644index 0000000..42afabf--- /dev/null+++ b/OCR-translation/.gitignore@@ -0,0 +1 @@+/build\ No newline at end of filediff --git a/OCR-translation/bindings-bindgen/.gitignore b/OCR-translation/bindings-bindgen/.gitignorenew file mode 100644index 0000000..2f7896d--- /dev/null+++ b/OCR-translation/bindings-bindgen/.gitignore@@ -0,0 +1 @@+target/diff --git a/OCR-translation/bindings-bindgen/Cargo.lock b/OCR-translation/bindings-bindgen/Cargo.locknew file mode 100644index 0000000..35fa50b--- /dev/null+++ b/OCR-translation/bindings-bindgen/Cargo.lock@@ -0,0 +1,919 @@+# This file is automatically @generated by Cargo.+# It is not intended for manual editing.+version = 4++[[package]]+name = "anstyle"+version = "1.0.14"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "940b3a0ca603d1eade50a4846a2afffd5ef57a9feac2c0e2ec2e14f9ead76000"++[[package]]+name = "anyhow"+version = "1.0.102"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "7f202df86484c868dbad7eaa557ef785d5c66295e41b460ef922eca0723b842c"++[[package]]+name = "askama"+version = "0.14.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "f75363874b771be265f4ffe307ca705ef6f3baa19011c149da8674a87f1b75c4"+dependencies = [+ "askama_derive",+ "itoa",+ "percent-encoding",+ "serde",+ "serde_json",+]++[[package]]+name = "askama_derive"+version = "0.14.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "129397200fe83088e8a68407a8e2b1f826cf0086b21ccdb866a722c8bcd3a94f"+dependencies = [+ "askama_parser",+ "basic-toml",+ "memchr",+ "proc-macro2",+ "quote",+ "rustc-hash",+ "serde",+ "serde_derive",+ "syn",+]++[[package]]+name = "askama_parser"+version = "0.14.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "d6ab5630b3d5eaf232620167977f95eb51f3432fc76852328774afbd242d4358"+dependencies = [+ "memchr",+ "serde",+ "serde_derive",+ "winnow 0.7.15",+]++[[package]]+name = "autocfg"+version = "1.5.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8"++[[package]]+name = "basic-toml"+version = "0.1.10"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "ba62675e8242a4c4e806d12f11d136e626e6c8361d6b829310732241652a178a"+dependencies = [+ "serde",+]++[[package]]+name = "bindings-bindgen"+version = "0.1.0"+dependencies = [+ "uniffi",+]++[[package]]+name = "bitflags"+version = "2.11.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "c4512299f36f043ab09a583e57bceb5a5aab7a73db1805848e8fef3c9e8c78b3"++[[package]]+name = "bytes"+version = "1.11.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "1e748733b7cbc798e1434b6ac524f0c1ff2ab456fe201501e6497c8417a4fc33"++[[package]]+name = "camino"+version = "1.2.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "e629a66d692cb9ff1a1c664e41771b3dcaf961985a9774c0eb0bd1b51cf60a48"+dependencies = [+ "serde_core",+]++[[package]]+name = "cargo-platform"+version = "0.1.9"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "e35af189006b9c0f00a064685c727031e3ed2d8020f7ba284d78cc2671bd36ea"+dependencies = [+ "serde",+]++[[package]]+name = "cargo_metadata"+version = "0.19.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "dd5eb614ed4c27c5d706420e4320fbe3216ab31fa1c33cd8246ac36dae4479ba"+dependencies = [+ "camino",+ "cargo-platform",+ "semver",+ "serde",+ "serde_json",+ "thiserror",+]++[[package]]+name = "cfg-if"+version = "1.0.4"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801"++[[package]]+name = "clap"+version = "4.6.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "1ddb117e43bbf7dacf0a4190fef4d345b9bad68dfc649cb349e7d17d28428e51"+dependencies = [+ "clap_builder",+ "clap_derive",+]++[[package]]+name = "clap_builder"+version = "4.6.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "714a53001bf66416adb0e2ef5ac857140e7dc3a0c48fb28b2f10762fc4b5069f"+dependencies = [+ "anstyle",+ "clap_lex",+ "strsim",+]++[[package]]+name = "clap_derive"+version = "4.6.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "f2ce8604710f6733aa641a2b3731eaa1e8b3d9973d5e3565da11800813f997a9"+dependencies = [+ "heck",+ "proc-macro2",+ "quote",+ "syn",+]++[[package]]+name = "clap_lex"+version = "1.1.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "c8d4a3bb8b1e0c1050499d1815f5ab16d04f0959b233085fb31653fbfc9d98f9"++[[package]]+name = "equivalent"+version = "1.0.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f"++[[package]]+name = "errno"+version = "0.3.14"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb"+dependencies = [+ "libc",+ "windows-sys",+]++[[package]]+name = "fastrand"+version = "2.4.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "9f1f227452a390804cdb637b74a86990f2a7d7ba4b7d5693aac9b4dd6defd8d6"++[[package]]+name = "foldhash"+version = "0.1.5"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2"++[[package]]+name = "fs-err"+version = "2.11.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "88a41f105fe1d5b6b34b2055e3dc59bb79b46b48b2040b9e6c7b4b5de097aa41"+dependencies = [+ "autocfg",+]++[[package]]+name = "getrandom"+version = "0.4.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "0de51e6874e94e7bf76d726fc5d13ba782deca734ff60d5bb2fb2607c7406555"+dependencies = [+ "cfg-if",+ "libc",+ "r-efi",+ "wasip2",+ "wasip3",+]++[[package]]+name = "glob"+version = "0.3.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "0cc23270f6e1808e30a928bdc84dea0b9b4136a8bc82338574f23baf47bbd280"++[[package]]+name = "goblin"+version = "0.8.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "1b363a30c165f666402fe6a3024d3bec7ebc898f96a4a23bd1c99f8dbf3f4f47"+dependencies = [+ "log",+ "plain",+ "scroll",+]++[[package]]+name = "hashbrown"+version = "0.15.5"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "9229cfe53dfd69f0609a49f65461bd93001ea1ef889cd5529dd176593f5338a1"+dependencies = [+ "foldhash",+]++[[package]]+name = "hashbrown"+version = "0.17.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "4f467dd6dccf739c208452f8014c75c18bb8301b050ad1cfb27153803edb0f51"++[[package]]+name = "heck"+version = "0.5.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"++[[package]]+name = "id-arena"+version = "2.3.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "3d3067d79b975e8844ca9eb072e16b31c3c1c36928edf9c6789548c524d0d954"++[[package]]+name = "indexmap"+version = "2.14.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "d466e9454f08e4a911e14806c24e16fba1b4c121d1ea474396f396069cf949d9"+dependencies = [+ "equivalent",+ "hashbrown 0.17.0",+ "serde",+ "serde_core",+]++[[package]]+name = "itoa"+version = "1.0.18"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "8f42a60cbdf9a97f5d2305f08a87dc4e09308d1276d28c869c684d7777685682"++[[package]]+name = "leb128fmt"+version = "0.1.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "09edd9e8b54e49e587e4f6295a7d29c3ea94d469cb40ab8ca70b288248a81db2"++[[package]]+name = "libc"+version = "0.2.185"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "52ff2c0fe9bc6cb6b14a0592c2ff4fa9ceb83eea9db979b0487cd054946a2b8f"++[[package]]+name = "linux-raw-sys"+version = "0.12.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "32a66949e030da00e8c7d4434b251670a91556f4144941d37452769c25d58a53"++[[package]]+name = "log"+version = "0.4.29"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "5e5032e24019045c762d3c0f28f5b6b8bbf38563a65908389bf7978758920897"++[[package]]+name = "memchr"+version = "2.8.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "f8ca58f447f06ed17d5fc4043ce1b10dd205e060fb3ce5b979b8ed8e59ff3f79"++[[package]]+name = "minimal-lexical"+version = "0.2.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a"++[[package]]+name = "nom"+version = "7.1.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a"+dependencies = [+ "memchr",+ "minimal-lexical",+]++[[package]]+name = "once_cell"+version = "1.21.4"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50"++[[package]]+name = "percent-encoding"+version = "2.3.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220"++[[package]]+name = "plain"+version = "0.2.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "b4596b6d070b27117e987119b4dac604f3c58cfb0b191112e24771b2faeac1a6"++[[package]]+name = "prettyplease"+version = "0.2.37"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "479ca8adacdd7ce8f1fb39ce9ecccbfe93a3f1344b3d0d97f20bc0196208f62b"+dependencies = [+ "proc-macro2",+ "syn",+]++[[package]]+name = "proc-macro2"+version = "1.0.106"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "8fd00f0bb2e90d81d1044c2b32617f68fcb9fa3bb7640c23e9c748e53fb30934"+dependencies = [+ "unicode-ident",+]++[[package]]+name = "quote"+version = "1.0.45"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "41f2619966050689382d2b44f664f4bc593e129785a36d6ee376ddf37259b924"+dependencies = [+ "proc-macro2",+]++[[package]]+name = "r-efi"+version = "6.0.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "f8dcc9c7d52a811697d2151c701e0d08956f92b0e24136cf4cf27b57a6a0d9bf"++[[package]]+name = "rustc-hash"+version = "2.1.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "94300abf3f1ae2e2b8ffb7b58043de3d399c73fa6f4b73826402a5c457614dbe"++[[package]]+name = "rustix"+version = "1.1.4"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "b6fe4565b9518b83ef4f91bb47ce29620ca828bd32cb7e408f0062e9930ba190"+dependencies = [+ "bitflags",+ "errno",+ "libc",+ "linux-raw-sys",+ "windows-sys",+]++[[package]]+name = "scroll"+version = "0.12.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "6ab8598aa408498679922eff7fa985c25d58a90771bd6be794434c5277eab1a6"+dependencies = [+ "scroll_derive",+]++[[package]]+name = "scroll_derive"+version = "0.12.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "1783eabc414609e28a5ba76aee5ddd52199f7107a0b24c2e9746a1ecc34a683d"+dependencies = [+ "proc-macro2",+ "quote",+ "syn",+]++[[package]]+name = "semver"+version = "1.0.28"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "8a7852d02fc848982e0c167ef163aaff9cd91dc640ba85e263cb1ce46fae51cd"+dependencies = [+ "serde",+ "serde_core",+]++[[package]]+name = "serde"+version = "1.0.228"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "9a8e94ea7f378bd32cbbd37198a4a91436180c5bb472411e48b5ec2e2124ae9e"+dependencies = [+ "serde_core",+ "serde_derive",+]++[[package]]+name = "serde_core"+version = "1.0.228"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "41d385c7d4ca58e59fc732af25c3983b67ac852c1a25000afe1175de458b67ad"+dependencies = [+ "serde_derive",+]++[[package]]+name = "serde_derive"+version = "1.0.228"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79"+dependencies = [+ "proc-macro2",+ "quote",+ "syn",+]++[[package]]+name = "serde_json"+version = "1.0.149"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "83fc039473c5595ace860d8c4fafa220ff474b3fc6bfdb4293327f1a37e94d86"+dependencies = [+ "itoa",+ "memchr",+ "serde",+ "serde_core",+ "zmij",+]++[[package]]+name = "serde_spanned"+version = "1.1.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "6662b5879511e06e8999a8a235d848113e942c9124f211511b16466ee2995f26"+dependencies = [+ "serde_core",+]++[[package]]+name = "siphasher"+version = "1.0.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "8ee5873ec9cce0195efcb7a4e9507a04cd49aec9c83d0389df45b1ef7ba2e649"++[[package]]+name = "smawk"+version = "0.3.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "b7c388c1b5e93756d0c740965c41e8822f866621d41acbdf6336a6a168f8840c"++[[package]]+name = "static_assertions"+version = "1.1.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f"++[[package]]+name = "strsim"+version = "0.11.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f"++[[package]]+name = "syn"+version = "2.0.117"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "e665b8803e7b1d2a727f4023456bbbbe74da67099c585258af0ad9c5013b9b99"+dependencies = [+ "proc-macro2",+ "quote",+ "unicode-ident",+]++[[package]]+name = "tempfile"+version = "3.27.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "32497e9a4c7b38532efcdebeef879707aa9f794296a4f0244f6f69e9bc8574bd"+dependencies = [+ "fastrand",+ "getrandom",+ "once_cell",+ "rustix",+ "windows-sys",+]++[[package]]+name = "textwrap"+version = "0.16.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "c13547615a44dc9c452a8a534638acdf07120d4b6847c8178705da06306a3057"+dependencies = [+ "smawk",+]++[[package]]+name = "thiserror"+version = "2.0.18"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "4288b5bcbc7920c07a1149a35cf9590a2aa808e0bc1eafaade0b80947865fbc4"+dependencies = [+ "thiserror-impl",+]++[[package]]+name = "thiserror-impl"+version = "2.0.18"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "ebc4ee7f67670e9b64d05fa4253e753e016c6c95ff35b89b7941d6b856dec1d5"+dependencies = [+ "proc-macro2",+ "quote",+ "syn",+]++[[package]]+name = "toml"+version = "0.9.12+spec-1.1.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "cf92845e79fc2e2def6a5d828f0801e29a2f8acc037becc5ab08595c7d5e9863"+dependencies = [+ "indexmap",+ "serde_core",+ "serde_spanned",+ "toml_datetime",+ "toml_parser",+ "toml_writer",+ "winnow 0.7.15",+]++[[package]]+name = "toml_datetime"+version = "0.7.5+spec-1.1.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "92e1cfed4a3038bc5a127e35a2d360f145e1f4b971b551a2ba5fd7aedf7e1347"+dependencies = [+ "serde_core",+]++[[package]]+name = "toml_parser"+version = "1.1.2+spec-1.1.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "a2abe9b86193656635d2411dc43050282ca48aa31c2451210f4202550afb7526"+dependencies = [+ "winnow 1.0.3",+]++[[package]]+name = "toml_writer"+version = "1.1.1+spec-1.1.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "756daf9b1013ebe47a8776667b466417e2d4c5679d441c26230efd9ef78692db"++[[package]]+name = "unicode-ident"+version = "1.0.24"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75"++[[package]]+name = "unicode-xid"+version = "0.2.6"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853"++[[package]]+name = "uniffi"+version = "0.31.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "46eefd5468602930da46b1f49d3448c6dfc2e81295f93120f23f8174fd70267f"+dependencies = [+ "anyhow",+ "camino",+ "cargo_metadata",+ "clap",+ "uniffi_bindgen",+ "uniffi_core",+ "uniffi_macros",+ "uniffi_pipeline",+]++[[package]]+name = "uniffi_bindgen"+version = "0.31.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "c4a0c9b375d32e1365cdb2bdd7cb495eecf6fac851ddbad077412b4ee1888514"+dependencies = [+ "anyhow",+ "askama",+ "camino",+ "cargo_metadata",+ "fs-err",+ "glob",+ "goblin",+ "heck",+ "indexmap",+ "once_cell",+ "serde",+ "tempfile",+ "textwrap",+ "toml",+ "uniffi_internal_macros",+ "uniffi_meta",+ "uniffi_pipeline",+ "uniffi_udl",+]++[[package]]+name = "uniffi_core"+version = "0.31.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "eec017b112701681f6fbbe5d92014b5c468eb0b177a94389de03ceec40665095"+dependencies = [+ "anyhow",+ "bytes",+ "once_cell",+ "static_assertions",+]++[[package]]+name = "uniffi_internal_macros"+version = "0.31.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "4641669b48fefbc5e80ff08c5004d9c7617fb91232131a6734ab6712779cb04c"+dependencies = [+ "anyhow",+ "indexmap",+ "proc-macro2",+ "quote",+ "syn",+]++[[package]]+name = "uniffi_macros"+version = "0.31.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "eeb8617ee814de22caf7417bf514715ba0b3f46bd9d5a5d794413fd8282cb737"+dependencies = [+ "camino",+ "fs-err",+ "once_cell",+ "proc-macro2",+ "quote",+ "serde",+ "syn",+ "toml",+ "uniffi_meta",+]++[[package]]+name = "uniffi_meta"+version = "0.31.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "58d5b94fc92803d21b2928bd15c6f06e57609b95caf98ea561c99cda1b6d2a25"+dependencies = [+ "anyhow",+ "siphasher",+ "uniffi_internal_macros",+ "uniffi_pipeline",+]++[[package]]+name = "uniffi_pipeline"+version = "0.31.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "032739b3ec725576914c15899dedaf080163ced86b6934566c20ec2b20ce90ca"+dependencies = [+ "anyhow",+ "heck",+ "indexmap",+ "tempfile",+ "uniffi_internal_macros",+]++[[package]]+name = "uniffi_udl"+version = "0.31.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "fc0a1d0a0252ce1af9e8ce78ba67ac0d8937fb2bedaf10cbddd43d3614d06ec6"+dependencies = [+ "anyhow",+ "textwrap",+ "uniffi_meta",+ "weedle2",+]++[[package]]+name = "wasip2"+version = "1.0.3+wasi-0.2.9"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "20064672db26d7cdc89c7798c48a0fdfac8213434a1186e5ef29fd560ae223d6"+dependencies = [+ "wit-bindgen 0.57.1",+]++[[package]]+name = "wasip3"+version = "0.4.0+wasi-0.3.0-rc-2026-01-06"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "5428f8bf88ea5ddc08faddef2ac4a67e390b88186c703ce6dbd955e1c145aca5"+dependencies = [+ "wit-bindgen 0.51.0",+]++[[package]]+name = "wasm-encoder"+version = "0.244.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "990065f2fe63003fe337b932cfb5e3b80e0b4d0f5ff650e6985b1048f62c8319"+dependencies = [+ "leb128fmt",+ "wasmparser",+]++[[package]]+name = "wasm-metadata"+version = "0.244.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "bb0e353e6a2fbdc176932bbaab493762eb1255a7900fe0fea1a2f96c296cc909"+dependencies = [+ "anyhow",+ "indexmap",+ "wasm-encoder",+ "wasmparser",+]++[[package]]+name = "wasmparser"+version = "0.244.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "47b807c72e1bac69382b3a6fb3dbe8ea4c0ed87ff5629b8685ae6b9a611028fe"+dependencies = [+ "bitflags",+ "hashbrown 0.15.5",+ "indexmap",+ "semver",+]++[[package]]+name = "weedle2"+version = "5.0.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "998d2c24ec099a87daf9467808859f9d82b61f1d9c9701251aea037f514eae0e"+dependencies = [+ "nom",+]++[[package]]+name = "windows-link"+version = "0.2.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5"++[[package]]+name = "windows-sys"+version = "0.61.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc"+dependencies = [+ "windows-link",+]++[[package]]+name = "winnow"+version = "0.7.15"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "df79d97927682d2fd8adb29682d1140b343be4ac0f08fd68b7765d9c059d3945"+dependencies = [+ "memchr",+]++[[package]]+name = "winnow"+version = "1.0.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "0592e1c9d151f854e6fd382574c3a0855250e1d9b2f99d9281c6e6391af352f1"++[[package]]+name = "wit-bindgen"+version = "0.51.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "d7249219f66ced02969388cf2bb044a09756a083d0fab1e566056b04d9fbcaa5"+dependencies = [+ "wit-bindgen-rust-macro",+]++[[package]]+name = "wit-bindgen"+version = "0.57.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "1ebf944e87a7c253233ad6766e082e3cd714b5d03812acc24c318f549614536e"++[[package]]+name = "wit-bindgen-core"+version = "0.51.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "ea61de684c3ea68cb082b7a88508a8b27fcc8b797d738bfc99a82facf1d752dc"+dependencies = [+ "anyhow",+ "heck",+ "wit-parser",+]++[[package]]+name = "wit-bindgen-rust"+version = "0.51.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "b7c566e0f4b284dd6561c786d9cb0142da491f46a9fbed79ea69cdad5db17f21"+dependencies = [+ "anyhow",+ "heck",+ "indexmap",+ "prettyplease",+ "syn",+ "wasm-metadata",+ "wit-bindgen-core",+ "wit-component",+]++[[package]]+name = "wit-bindgen-rust-macro"+version = "0.51.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "0c0f9bfd77e6a48eccf51359e3ae77140a7f50b1e2ebfe62422d8afdaffab17a"+dependencies = [+ "anyhow",+ "prettyplease",+ "proc-macro2",+ "quote",+ "syn",+ "wit-bindgen-core",+ "wit-bindgen-rust",+]++[[package]]+name = "wit-component"+version = "0.244.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "9d66ea20e9553b30172b5e831994e35fbde2d165325bec84fc43dbf6f4eb9cb2"+dependencies = [+ "anyhow",+ "bitflags",+ "indexmap",+ "log",+ "serde",+ "serde_derive",+ "serde_json",+ "wasm-encoder",+ "wasm-metadata",+ "wasmparser",+ "wit-parser",+]++[[package]]+name = "wit-parser"+version = "0.244.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "ecc8ac4bc1dc3381b7f59c34f00b67e18f910c2c0f50015669dde7def656a736"+dependencies = [+ "anyhow",+ "id-arena",+ "indexmap",+ "log",+ "semver",+ "serde",+ "serde_derive",+ "serde_json",+ "unicode-xid",+ "wasmparser",+]++[[package]]+name = "zmij"+version = "1.0.21"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "b8848ee67ecc8aedbaf3e4122217aff892639231befc6a1b58d29fff4c2cabaa"diff --git a/OCR-translation/bindings-bindgen/Cargo.toml b/OCR-translation/bindings-bindgen/Cargo.tomlnew file mode 100644index 0000000..68ddcb2--- /dev/null+++ b/OCR-translation/bindings-bindgen/Cargo.toml@@ -0,0 +1,11 @@+[package]+name = "bindings-bindgen"+version = "0.1.0"+edition = "2024"++[[bin]]+name = "uniffi-bindgen"+path = "src/main.rs"++[dependencies]+uniffi = { version = "0.31", features = ["cli"] }diff --git a/OCR-translation/bindings-bindgen/src/main.rs b/OCR-translation/bindings-bindgen/src/main.rsnew file mode 100644index 0000000..f6cff6c--- /dev/null+++ b/OCR-translation/bindings-bindgen/src/main.rs@@ -0,0 +1,3 @@+fn main() {+ uniffi::uniffi_bindgen_main()+}diff --git a/OCR-translation/build.gradle.kts b/OCR-translation/build.gradle.ktsnew file mode 100644index 0000000..86d0afc--- /dev/null+++ b/OCR-translation/build.gradle.kts@@ -0,0 +1,346 @@+plugins {+ alias(libs.plugins.android.library)+ alias(libs.plugins.kotlin.android)+ alias(libs.plugins.kotlin.compose)+ alias(libs.plugins.kotlin.serialization)+}++// Keep the original Kotlin package (dev.davidv.translator) untouched:+// the R class is generated under this namespace, so every bare `R`+// reference inside the pasted sources keeps resolving with zero renames.+android {+ namespace = "dev.davidv.translator"+ compileSdk {+ version = release(36)+ }+ ndkVersion = "27.0.12077973"++ sourceSets {+ getByName("main") {+ aidl.srcDir("src/main/aidl")+ java.srcDir(layout.buildDirectory.dir("generated/source/uniffi/kotlin"))+ }+ }++ defaultConfig {+ minSdk = 29++ testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"+ consumerProguardFiles("consumer-rules.pro")+ }++ compileOptions {+ sourceCompatibility = JavaVersion.VERSION_11+ targetCompatibility = JavaVersion.VERSION_11+ }+ kotlinOptions {+ jvmTarget = "11"+ }+ buildFeatures {+ aidl = true+ compose = true+ buildConfig = true+ }++ lint {+ disable += "MissingTranslation"+ }+}++val bindingsRootDir = file("src/main/bindings")+val bindingsBindgenRootDir = file("bindings-bindgen")+val jniLibsRootDir = file("src/main/jniLibs")+val llvmDllDir =+ File(+ System.getenv("LOCALAPPDATA")+ ?: (System.getenv("USERPROFILE") + "/AppData/Local"),+ "llvm-dll",+ ).absolutePath+val ndkDir =+ System.getenv("ANDROID_NDK_ROOT")+ ?: System.getenv("ANDROID_NDK_HOME")+ ?: System.getenv("ANDROID_HOME")?.let { "$it/ndk/27.0.12077973" }+ ?: System.getenv("ANDROID_SDK_ROOT")?.let { "$it/ndk/27.0.12077973" }+ ?: (try { android.sdkDirectory.resolve("ndk/27.0.12077973").absolutePath } catch (_: Exception) { null })+ ?: throw GradleException("NDK 27.0.12077973 not found: set ANDROID_HOME or install it via sdkmanager")+val sdkCmakeBinDir =+ listOfNotNull(+ System.getenv("ANDROID_HOME"),+ System.getenv("ANDROID_SDK_ROOT"),+ File(ndkDir).parentFile?.parentFile?.absolutePath,+ ).asSequence()+ .map { File(File(it, "cmake"), "").listFiles()?.maxByOrNull { f -> f.name } }+ .filterNotNull()+ .map { File(it, "bin").absolutePath }+ .firstOrNull { File(it).exists() }+val bindingsAndroidApi = 29++fun jniLibAbiDir(abi: String) = File(jniLibsRootDir, abi)++// Short, space-free cargo home + target dir: absolute host paths get baked+// into ninja object dirs (260-char Windows limit), so both must stay short.+val shortCargoHome = "C:/cgo"+val shortCargoTargetDir = "C:/ct"++val ndkLlvmPrebuiltFw = "$ndkDir/toolchains/llvm/prebuilt/windows-x86_64".replace('\\', '/')+val ndkClangIncludeFw =+ fileTree("$ndkDir/toolchains/llvm/prebuilt/windows-x86_64") {+ include("lib/clang/*/include/stddef.h")+ }.files.firstOrNull()?.parent?.replace('\\', '/')+ ?: error("clang include dir not found under $ndkDir")+// Read by espeak-rs-sys' build script (BINDGEN_EXTRA_CLANG_ARGS_<target>);+// plain CFLAGS must NOT be set: they leak into cmake configure checks.+val bindgenExtraArgs =+ listOf(+ "--target=aarch64-linux-android29",+ "--sysroot=$ndkLlvmPrebuiltFw/sysroot",+ "-isystem$ndkClangIncludeFw",+ "-isystem${ndkDir.replace('\\', '/')}/sources/cxx-stl/llvm-libc++/include",+ ).joinToString(" ")+val msysBinDir = "C:/msys64/usr/bin"++// NDK clang version differs per NDK release: discover the runtime-builtins+// archive instead of hardcoding the clang version directory.+fun clangRtLib(abi: String): String {+ val rtArch =+ when (abi) {+ "arm64-v8a" -> "aarch64-android"+ "armeabi-v7a" -> "arm-android"+ "x86" -> "i686-android"+ "x86_64" -> "x86_64-android"+ else -> error("Unknown abi $abi")+ }+ val hostOs =+ when {+ org.gradle.internal.os.OperatingSystem.current().isWindows -> "windows-x86_64"+ org.gradle.internal.os.OperatingSystem.current().isMacOsX -> "darwin-x86_64"+ else -> "linux-x86_64"+ }+ val hits =+ fileTree("$ndkDir/toolchains/llvm/prebuilt/$hostOs") {+ include("lib/clang/*/lib/$hostOs/libclang_rt.builtins-$rtArch.a")+ }.files ++ fileTree("$ndkDir/toolchains/llvm/prebuilt/$hostOs") {+ include("lib/clang/*/lib/linux/libclang_rt.builtins-$rtArch.a")+ }.files+ return (hits.firstOrNull()?.absolutePath+ ?: error("libclang_rt for $abi not found under $ndkDir"))+}++fun cmakePathRemapFlags(): String =+ listOf(+ "-ffile-prefix-map=${rootProject.projectDir.absolutePath}=.",+ "-fdebug-prefix-map=${rootProject.projectDir.absolutePath}=.",+ ).joinToString(" ")++fun cargoEncodedRustflags(abi: String? = null): String {+ val base =+ listOf(+ "--remap-path-prefix=${rootProject.projectDir.absolutePath}=.",+ )+ if (abi == null) return base.joinToString("\u001F")+ return (+ base ++ listOf(+ "-C",+ "link-arg=-Wl,--threads=1",+ "-C",+ "link-arg=-Wl,--sort-section=name",+ "-C",+ "link-arg=-Wl,--sort-common",+ "-C",+ "link-arg=-Wl,-z,max-page-size=16384",+ "-C",+ "link-arg=${clangRtLib(abi)}",+ )+ ).joinToString("\u001F")+}++val abiToTaskSuffix =+ mapOf(+ "arm64-v8a" to "Aarch64",+ "armeabi-v7a" to "ArmeabiV7a",+ "x86_64" to "X86_64",+ "x86" to "X86",+ )++val abiToCargoTarget =+ mapOf(+ "arm64-v8a" to "aarch64-linux-android",+ "armeabi-v7a" to "armv7-linux-androideabi",+ "x86_64" to "x86_64-linux-android",+ "x86" to "i686-linux-android",+ )++val cargoProfileArgs = listOf("--release")++val abiToBindingsTask =+ abiToCargoTarget.mapValues { (abi, cargoTarget) ->+ val taskSuffix = abiToTaskSuffix.getValue(abi)+ tasks.register("buildBindings$taskSuffix") {+ group = "build"+ description = "Build Rust bindings library for $abi"+ inputs.file(bindingsRootDir.resolve("Cargo.toml"))+ inputs.file(bindingsRootDir.resolve("Cargo.lock"))+ inputs.file(bindingsRootDir.resolve(".cargo/config.toml"))+ inputs.dir(bindingsRootDir.resolve("src"))+ inputs.property("cargoTarget", cargoTarget)+ inputs.property("androidApi", bindingsAndroidApi)+ inputs.property("androidNdkRoot", ndkDir)+ inputs.property("cargoEncodedRustflags", cargoEncodedRustflags(abi))+ inputs.property("cargoProfile", "release")+ outputs.file(File(jniLibAbiDir(abi), "libbindings.so"))+ outputs.file(File(jniLibAbiDir(abi), "libc++_shared.so"))++ doLast {+ exec {+ workingDir = bindingsRootDir+ environment("ANDROID_NDK_ROOT", ndkDir)+ environment("ANDROID_NDK_HOME", ndkDir)+ environment("LIBCLANG_PATH", llvmDllDir)+ environment("CARGO_HOME", shortCargoHome)+ environment("CARGO_TARGET_DIR", shortCargoTargetDir)+ environment("BINDGEN_EXTRA_CLANG_ARGS_aarch64-linux-android", bindgenExtraArgs)+ environment("BINDGEN_EXTRA_CLANG_ARGS_aarch64_linux_android", bindgenExtraArgs)+ val extraPath =+ listOfNotNull(+ sdkCmakeBinDir,+ msysBinDir.takeIf { File(it).exists() },+ ).joinToString(File.pathSeparator)+ if (extraPath.isNotEmpty()) {+ environment(+ "PATH",+ extraPath + File.pathSeparator + (System.getenv("PATH") ?: ""),+ )+ }+ environment("CARGO_ENCODED_RUSTFLAGS", cargoEncodedRustflags(abi))+ environment(+ "CMAKE_TOOLCHAIN_FILE",+ File(ndkDir, "build/cmake/android.toolchain.cmake").absolutePath,+ )+ environment("ANDROID_ABI", abi)+ environment("ANDROID_PLATFORM", "android-$bindingsAndroidApi")+ environment("CMAKE_GENERATOR", "Ninja")+ commandLine(+ "cargo",+ "ndk",+ "build",+ "--lib",+ "--target",+ cargoTarget,+ *cargoProfileArgs.toTypedArray(),+ "--platform",+ bindingsAndroidApi.toString(),+ "--link-libcxx-shared",+ "--output-dir",+ "../jniLibs",+ )+ }+ }+ }+ }++val targetAbi = project.findProperty("targetAbi")?.toString()+val selectedAbis =+ if (targetAbi != null) {+ listOf(targetAbi)+ } else {+ listOf("arm64-v8a")+ }+val bindingsTasks = selectedAbis.mapNotNull { abiToBindingsTask[it] }++val bindgenHostBinary =+ File(+ bindingsBindgenRootDir,+ if (org.gradle.internal.os.OperatingSystem.current().isWindows) {+ "target/release/uniffi-bindgen.exe"+ } else {+ "target/release/uniffi-bindgen"+ },+ )++val buildUniffiBindgen =+ tasks.register("buildUniffiBindgen", Exec::class) {+ group = "build"+ description = "Build the host uniffi-bindgen binary"+ workingDir = bindingsBindgenRootDir+ environment("CARGO_HOME", shortCargoHome)+ inputs.file(bindingsBindgenRootDir.resolve("Cargo.toml"))+ inputs.dir(bindingsBindgenRootDir.resolve("src"))+ outputs.file(bindgenHostBinary)+ commandLine("cargo", "build", "--release")+ }++val generatedBindingsDir = layout.buildDirectory.dir("generated/source/uniffi/kotlin")++val bindgenSourceAbi = selectedAbis.first()+val bindgenSourceLib = File(jniLibAbiDir(bindgenSourceAbi), "libbindings.so")++val generateUniffiBindings =+ tasks.register("generateUniffiBindings", Exec::class) {+ group = "build"+ description = "Generate Kotlin bindings from the compiled libbindings.so"+ dependsOn(buildUniffiBindgen)+ dependsOn(abiToBindingsTask.getValue(bindgenSourceAbi))+ workingDir = bindingsRootDir+ inputs.file(bindgenHostBinary)+ inputs.file(bindgenSourceLib)+ outputs.dir(generatedBindingsDir)+ doFirst {+ val outDir = generatedBindingsDir.get().asFile+ outDir.deleteRecursively()+ outDir.mkdirs()+ }+ commandLine(+ bindgenHostBinary.absolutePath,+ "generate",+ bindgenSourceLib.absolutePath,+ "--language",+ "kotlin",+ "--out-dir",+ generatedBindingsDir.get().asFile.absolutePath,+ "--no-format",+ "--metadata-no-deps",+ )+ }++tasks.named("preBuild") {+ dependsOn(bindingsTasks)+ dependsOn(generateUniffiBindings)+}++dependencies {+ implementation(libs.androidx.core.ktx)+ implementation(libs.androidx.appcompat)+ implementation(libs.androidx.lifecycle.runtime.ktx)+ implementation(libs.androidx.lifecycle.viewmodel.compose)+ implementation(libs.androidx.activity.compose)+ implementation(platform(libs.androidx.compose.bom))+ implementation(libs.androidx.compose.ui)+ implementation(libs.androidx.compose.ui.graphics)+ implementation(libs.androidx.compose.ui.tooling.preview)+ implementation(libs.androidx.compose.material3)+ implementation("androidx.compose.material:material-icons-extended")+ implementation(libs.material)+ implementation(libs.androidx.navigation.compose)+ implementation(libs.androidx.exifinterface)+ implementation(libs.androidx.uiautomator)+ testImplementation(libs.junit)+ androidTestImplementation(libs.androidx.junit)+ androidTestImplementation(libs.androidx.espresso.core)+ androidTestImplementation(platform(libs.androidx.compose.bom))+ androidTestImplementation(libs.androidx.compose.ui.test.junit4)+ debugImplementation(libs.androidx.compose.ui.tooling)+ debugImplementation(libs.androidx.compose.ui.test.manifest)+ implementation(libs.kotlinx.coroutines.android)+ implementation(libs.kotlinx.coroutines.core)+ implementation(libs.androidx.datastore.preferences)+ implementation(libs.androidx.graphics.path)+ implementation(libs.kotlinx.serialization.json)+ implementation("com.github.yalantis:ucrop:2.2.11")+ implementation("net.java.dev.jna:jna:5.14.0@aar")+ implementation(libs.androidx.camera.core)+ implementation(libs.androidx.camera.camera2)+ implementation(libs.androidx.camera.lifecycle)+ implementation(libs.androidx.camera.view)+}diff --git a/OCR-translation/consumer-rules.pro b/OCR-translation/consumer-rules.pronew file mode 100644index 0000000..e69de29diff --git a/OCR-translation/old-app-build.gradle.kts.txt b/OCR-translation/old-app-build.gradle.kts.txtnew file mode 100644index 0000000..1d17ea7--- /dev/null+++ b/OCR-translation/old-app-build.gradle.kts.txt@@ -0,0 +1,493 @@+plugins {+ alias(libs.plugins.android.application)+ alias(libs.plugins.kotlin.android)+ alias(libs.plugins.kotlin.compose)+ alias(libs.plugins.kotlin.serialization)+ alias(libs.plugins.ktlint)+ alias(libs.plugins.detekt)+}++val abiCodes = mapOf("armeabi-v7a" to 1, "arm64-v8a" to 2, "x86" to 3, "x86_64" to 4)+val defaultDevAbis = listOf("arm64-v8a", "x86_64")++android {+ namespace = "dev.davidv.translator"+ compileSdk = 34+ ndkVersion = "28.0.13004108"+ buildToolsVersion = "34.0.0"++ sourceSets {+ getByName("main") {+ aidl.srcDir("src/main/aidl")+ java.srcDir(layout.buildDirectory.dir("generated/source/uniffi/kotlin"))+ }+ getByName("androidTest") {+ assets {+ srcDirs("src/androidTest/assets")+ }+ }+ }+ defaultConfig {+ applicationId = "dev.davidv.translator"+ minSdk = 23+ targetSdk = 34+ versionCode = 30+ versionName = "0.8.5"++ testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"+ }++ splits {+ abi {+ isEnable = true+ reset()+ val targetAbi = project.findProperty("targetAbi")?.toString()+ if (targetAbi != null) {+ include(targetAbi)+ } else {+ include(*defaultDevAbis.toTypedArray())+ }+ isUniversalApk = false+ }+ }++ buildTypes {+ release {+ isMinifyEnabled = true+ isShrinkResources = true+ // when building in F-Droid CI, the `cargo` binary is not in path+ // so there's a prebuild step to modify this file and replace "cargo"+ // with the full path to cargo (/home/vagrant/.cargo/bin/..)+ // however, modifying this file leaves the repo in a dirty state+ // which means that the revision in `META-INF/version-control-info.textproto`+ // does not match with the _actual_ commit.+ // Disabling this until I figure out how to put `cargo` in PATH+ // in F-Droid CI+ vcsInfo {+ include = false+ }+ proguardFiles(+ getDefaultProguardFile("proguard-android-optimize.txt"),+ "proguard-rules.pro",+ )+ }+ }+ compileOptions {+ sourceCompatibility = JavaVersion.VERSION_11+ targetCompatibility = JavaVersion.VERSION_11+ }+ kotlinOptions {+ jvmTarget = "11"+ }+ buildFeatures {+ aidl = true+ compose = true+ buildConfig = true+ }++ androidResources {+ generateLocaleConfig = true+ }++ lint {+ // Translations are managed in Weblate and land incrementally, so partial+ // locales are expected; completeness is tracked there, not by the build.+ disable += "MissingTranslation"+ }++ applicationVariants.all {+ outputs.all {+ val output = this as com.android.build.gradle.internal.api.ApkVariantOutputImpl+ val abi = output.getFilter(com.android.build.OutputFile.ABI)+ if (abi != null) {+ output.versionCodeOverride = defaultConfig.versionCode!! * 10 + (abiCodes[abi] ?: 0)+ }+ }+ }+}++val bindingsRootDir = file("src/main/bindings")+val bindingsBindgenRootDir = file("bindings-bindgen")+val jniLibsRootDir = file("src/main/jniLibs")+val androidSdkRoot =+ System.getenv("ANDROID_SDK_ROOT")+ ?: System.getenv("ANDROID_HOME")+ ?: throw GradleException("ANDROID_SDK_ROOT or ANDROID_HOME must be set")+val ndk = "$androidSdkRoot/ndk/28.0.13004108"+val bindingsAndroidApi = 23++fun jniLibAbiDir(abi: String) = File(jniLibsRootDir, abi)++fun cmakePathRemapFlags(): String =+ listOf(+ "-ffile-prefix-map=${rootProject.projectDir.absolutePath}=.",+ "-fdebug-prefix-map=${rootProject.projectDir.absolutePath}=.",+ ).joinToString(" ")++fun cargoEncodedRustflags(abi: String? = null): String {+ val base =+ listOf(+ "--remap-path-prefix=${rootProject.projectDir.absolutePath}=.",+ "--remap-path-prefix=/home/vagrant/.cargo=/",+ "--remap-path-prefix=/usr/local/cargo=/",+ )+ if (abi == null) return base.joinToString("\u001f")+ val rtArch =+ when (abi) {+ "arm64-v8a" -> "aarch64-android"+ "armeabi-v7a" -> "arm-android"+ "x86" -> "i686-android"+ "x86_64" -> "x86_64-android"+ else -> error("Unknown abi $abi")+ }+ val rtLib = "$ndk/toolchains/llvm/prebuilt/linux-x86_64/lib/clang/19/lib/linux/libclang_rt.builtins-$rtArch.a"+ return (+ base ++ listOf(+ "-C",+ "link-arg=-Wl,--threads=1",+ "-C",+ "link-arg=-Wl,--sort-section=name",+ "-C",+ "link-arg=-Wl,--sort-common",+ "-C",+ "link-arg=$rtLib",+ )+ ).joinToString("\u001f")+}++val abiToTaskSuffix =+ mapOf(+ "arm64-v8a" to "Aarch64",+ "armeabi-v7a" to "ArmeabiV7a",+ "x86_64" to "X86_64",+ "x86" to "X86",+ )++val abiToCargoTarget =+ mapOf(+ "arm64-v8a" to "arm64-v8a",+ "armeabi-v7a" to "armeabi-v7a",+ "x86_64" to "x86_64",+ "x86" to "x86",+ )++val cargoProfileArgs = listOf("--release")++val abiToBindingsTask =+ abiToCargoTarget.mapValues { (abi, cargoTarget) ->+ val taskSuffix = abiToTaskSuffix.getValue(abi)+ tasks.register("buildBindings$taskSuffix") {+ group = "build"+ description = "Build Rust bindings library for $abi"+ inputs.file(bindingsRootDir.resolve("Cargo.toml"))+ inputs.file(bindingsRootDir.resolve("Cargo.lock"))+ inputs.file(bindingsRootDir.resolve(".cargo/config.toml"))+ inputs.dir(bindingsRootDir.resolve("src"))++ // Local-dev convenience: auto-discover any `path = "..."`+ // dependency in Cargo.toml and watch its `src/` so editing the+ // path-deped crate (typically translator-rs in a sibling+ // checkout) invalidates this task without a manual cache-bust.+ // CI uses git deps — the parsed paths don't exist there, so the+ // inputs.dir calls are skipped and behaviour is unchanged.+ val cargoTomlText = bindingsRootDir.resolve("Cargo.toml").readText()+ // Matches both `path = "..."` (own-line dep) and the inline+ // `name = { path = "..." }` form used by [patch] overrides; the+ // leading anchor still skips commented-out lines.+ val pathDepRegex = Regex("""(?m)^\s*(?:[A-Za-z0-9_-]+\s*=\s*\{\s*)?path\s*=\s*"([^"]+)"""")+ pathDepRegex.findAll(cargoTomlText).forEach { match ->+ val raw = match.groupValues[1]+ val resolved =+ if (File(raw).isAbsolute) File(raw) else bindingsRootDir.resolve(raw).normalize()+ val srcDir = resolved.resolve("src")+ if (srcDir.exists()) {+ inputs.dir(srcDir)+ val depCargo = resolved.resolve("Cargo.toml")+ if (depCargo.exists()) inputs.file(depCargo)+ }+ resolved.resolve("crates").listFiles()?.forEach { crate ->+ val crateSrc = crate.resolve("src")+ if (crateSrc.exists()) {+ inputs.dir(crateSrc)+ val crateCargo = crate.resolve("Cargo.toml")+ if (crateCargo.exists()) inputs.file(crateCargo)+ }+ }+ }+ inputs.property("cargoTarget", cargoTarget)+ inputs.property("androidApi", bindingsAndroidApi)+ inputs.property("androidNdkRoot", ndk)+ inputs.property("cargoEncodedRustflags", cargoEncodedRustflags(abi))+ inputs.property("cargoProfile", "release")+ outputs.file(File(jniLibAbiDir(abi), "libbindings.so"))+ outputs.file(File(jniLibAbiDir(abi), "libc++_shared.so"))++ doLast {+ exec {+ workingDir = bindingsRootDir+ environment("ANDROID_NDK_ROOT", ndk)+ environment("ANDROID_NDK_HOME", ndk)+ environment("CARGO_ENCODED_RUSTFLAGS", cargoEncodedRustflags(abi))+ // CMake cross-compile contract for slimt-sys: parent build owns+ // toolchain selection, the -sys crate just forwards these.+ environment(+ "CMAKE_TOOLCHAIN_FILE",+ File(ndk, "build/cmake/android.toolchain.cmake").absolutePath,+ )+ environment("ANDROID_ABI", abi)+ environment("ANDROID_PLATFORM", "android-$bindingsAndroidApi")+ environment("CMAKE_GENERATOR", "Ninja")+ commandLine(+ "cargo",+ "ndk",+ "build",+ "--lib",+ "--target",+ cargoTarget,+ *cargoProfileArgs.toTypedArray(),+ "--platform",+ bindingsAndroidApi.toString(),+ "--link-libcxx-shared",+ "--output-dir",+ "../jniLibs",+ )+ }+ }+ }+ }++tasks.register("buildBindingsAll") {+ group = "build"+ description = "Build Rust bindings library for all architectures"+ dependsOn(abiToBindingsTask.values.toList())+}++// Separate cdylib for the on-device ONNX->MNN migration converter. It links the+// MNN converter (full protobuf), which cannot share a binary with slimt's+// sentencepiece (protobuf-lite), so it must NOT be part of libbindings.so.+val converterRootDir = file("src/main/model-converter")++val abiToConverterTask =+ abiToCargoTarget.mapValues { (abi, cargoTarget) ->+ val taskSuffix = abiToTaskSuffix.getValue(abi)+ tasks.register("buildModelConverter$taskSuffix") {+ group = "build"+ description = "Build the ONNX->MNN converter library for $abi"+ inputs.file(converterRootDir.resolve("Cargo.toml"))+ inputs.file(converterRootDir.resolve(".cargo/config.toml"))+ inputs.dir(converterRootDir.resolve("src"))++ val cargoTomlText = converterRootDir.resolve("Cargo.toml").readText()+ val pathDepRegex = Regex("""(?m)^\s*(?:[A-Za-z0-9_-]+\s*=\s*\{\s*)?path\s*=\s*"([^"]+)"""")+ pathDepRegex.findAll(cargoTomlText).forEach { match ->+ val raw = match.groupValues[1]+ val resolved =+ if (File(raw).isAbsolute) File(raw) else converterRootDir.resolve(raw).normalize()+ val srcDir = resolved.resolve("src")+ if (srcDir.exists()) {+ inputs.dir(srcDir)+ val depCargo = resolved.resolve("Cargo.toml")+ if (depCargo.exists()) inputs.file(depCargo)+ }+ resolved.resolve("crates").listFiles()?.forEach { crate ->+ val crateSrc = crate.resolve("src")+ if (crateSrc.exists()) {+ inputs.dir(crateSrc)+ val crateCargo = crate.resolve("Cargo.toml")+ if (crateCargo.exists()) inputs.file(crateCargo)+ }+ }+ }+ inputs.property("cargoTarget", cargoTarget)+ inputs.property("androidApi", bindingsAndroidApi)+ inputs.property("androidNdkRoot", ndk)+ inputs.property("cargoEncodedRustflags", cargoEncodedRustflags(abi))+ inputs.property("cargoProfile", "release")+ // libc++_shared.so is produced/owned by the bindings task; this task only+ // owns its own .so to avoid overlapping gradle outputs.+ outputs.file(File(jniLibAbiDir(abi), "libmodel_converter.so"))++ doLast {+ exec {+ workingDir = converterRootDir+ environment("ANDROID_NDK_ROOT", ndk)+ environment("ANDROID_NDK_HOME", ndk)+ environment("CARGO_ENCODED_RUSTFLAGS", cargoEncodedRustflags(abi))+ environment(+ "CMAKE_TOOLCHAIN_FILE",+ File(ndk, "build/cmake/android.toolchain.cmake").absolutePath,+ )+ environment("ANDROID_ABI", abi)+ environment("ANDROID_PLATFORM", "android-$bindingsAndroidApi")+ environment("CMAKE_GENERATOR", "Ninja")+ commandLine(+ "cargo",+ "ndk",+ "build",+ "--lib",+ "--target",+ cargoTarget,+ *cargoProfileArgs.toTypedArray(),+ "--platform",+ bindingsAndroidApi.toString(),+ "--link-libcxx-shared",+ "--output-dir",+ "../jniLibs",+ )+ }+ }+ }+ }++tasks.register("buildModelConverterAll") {+ group = "build"+ description = "Build the ONNX->MNN converter library for all architectures"+ dependsOn(abiToConverterTask.values.toList())+}++val targetAbi = project.findProperty("targetAbi")?.toString()+val selectedAbis =+ if (targetAbi != null) {+ listOf(targetAbi)+ } else {+ defaultDevAbis+ }+val bindingsTasks = selectedAbis.mapNotNull { abiToBindingsTask[it] }+val converterTasks = selectedAbis.mapNotNull { abiToConverterTask[it] }++val bindgenHostBinary = File(bindingsBindgenRootDir, "target/release/uniffi-bindgen")++val buildUniffiBindgen =+ tasks.register("buildUniffiBindgen", Exec::class) {+ group = "build"+ description = "Build the host uniffi-bindgen binary"+ workingDir = bindingsBindgenRootDir+ inputs.file(bindingsBindgenRootDir.resolve("Cargo.toml"))+ inputs.dir(bindingsBindgenRootDir.resolve("src"))+ outputs.file(bindgenHostBinary)+ commandLine("cargo", "build", "--release")+ }++val generatedBindingsDir = layout.buildDirectory.dir("generated/source/uniffi/kotlin")++val bindgenSourceAbi = selectedAbis.first()+val bindgenSourceLib = File(jniLibAbiDir(bindgenSourceAbi), "libbindings.so")++val generateUniffiBindings =+ tasks.register("generateUniffiBindings", Exec::class) {+ group = "build"+ description = "Generate Kotlin bindings from the compiled libbindings.so"+ dependsOn(buildUniffiBindgen)+ dependsOn(abiToBindingsTask.getValue(bindgenSourceAbi))+ workingDir = bindingsRootDir+ inputs.file(bindgenHostBinary)+ inputs.file(bindgenSourceLib)+ outputs.dir(generatedBindingsDir)+ doFirst {+ val outDir = generatedBindingsDir.get().asFile+ outDir.deleteRecursively()+ outDir.mkdirs()+ }+ commandLine(+ bindgenHostBinary.absolutePath,+ "generate",+ bindgenSourceLib.absolutePath,+ "--language",+ "kotlin",+ "--out-dir",+ generatedBindingsDir.get().asFile.absolutePath,+ "--no-format",+ "--metadata-no-deps",+ )+ }++tasks.named("preBuild") {+ dependsOn(bindingsTasks)+ dependsOn(converterTasks)+ dependsOn(generateUniffiBindings)+}++dependencies {++ implementation(libs.androidx.core.ktx)+ implementation(libs.androidx.appcompat)+ implementation(libs.androidx.lifecycle.runtime.ktx)+ implementation(libs.androidx.lifecycle.viewmodel.compose)+ implementation(libs.androidx.activity.compose)+ implementation(platform(libs.androidx.compose.bom))+ implementation(libs.androidx.ui)+ implementation(libs.androidx.ui.graphics)+ implementation(libs.androidx.ui.tooling.preview)+ implementation(libs.androidx.material3)+ implementation(libs.material)+ implementation(libs.androidx.navigation.compose)+ implementation(libs.androidx.exifinterface)+ implementation(libs.androidx.uiautomator)+ testImplementation(libs.junit)+ androidTestImplementation(libs.androidx.junit)+ androidTestImplementation(libs.androidx.espresso.core)+ androidTestImplementation(platform(libs.androidx.compose.bom))+ androidTestImplementation(libs.androidx.ui.test.junit4)+ debugImplementation(libs.androidx.ui.tooling)+ debugImplementation(libs.androidx.ui.test.manifest)+ implementation(libs.kotlinx.coroutines.android)+ implementation(libs.kotlinx.coroutines.core)+ implementation(libs.androidx.datastore.preferences)+ implementation(libs.kotlinx.serialization.json)+ implementation(libs.kotlinx.serialization.json.v162)+ implementation("com.github.yalantis:ucrop:2.2.11")+ implementation("net.java.dev.jna:jna:5.14.0@aar")+ implementation(libs.androidx.camera.core)+ implementation(libs.androidx.camera.camera2)+ implementation(libs.androidx.camera.lifecycle)+ implementation(libs.androidx.camera.view)+ detektPlugins(project(":detekt-rules"))+}++ktlint {+ android.set(true)+ ignoreFailures.set(false)+ reporters {+ reporter(org.jlleitschuh.gradle.ktlint.reporter.ReporterType.PLAIN)+ reporter(org.jlleitschuh.gradle.ktlint.reporter.ReporterType.CHECKSTYLE)+ }+ filter {+ exclude { it.file.path.contains("generated/") }+ }+}++detekt {+ toolVersion = "1.23.4"+ config.setFrom(file("$projectDir/detekt-config.yml"))+ buildUponDefaultConfig = true+ allRules = false+}++tasks.register<io.gitlab.arturbosch.detekt.Detekt>("detektHardcodedStrings") {+ description = "Fails the build on any hardcoded user-facing string (NoHardcodedUiString)."+ group = "verification"+ buildUponDefaultConfig = false+ config.setFrom(file("$projectDir/detekt-hardcoded-strings.yml"))+ setSource(files("src/main/java"))+ include("**/*.kt")+ reports {+ html.required.set(false)+ xml.required.set(false)+ txt.required.set(false)+ sarif.required.set(false)+ md.required.set(false)+ }+}++tasks.register("lintAll") {+ dependsOn("ktlintCheck", "detekt", "detektHardcodedStrings")+ description = "Run all lint checks (ktlint and detekt)"+ group = "verification"+}++tasks.register("formatAll") {+ dependsOn("ktlintFormat")+ description = "Format all code using ktlint"+ group = "formatting"+}diff --git a/OCR-translation/old-app-proguard-rules.pro.txt b/OCR-translation/old-app-proguard-rules.pro.txtnew file mode 100644index 0000000..ad85082--- /dev/null+++ b/OCR-translation/old-app-proguard-rules.pro.txt@@ -0,0 +1,37 @@+# Preserve file names and line numbers for readable stack traces+-keepattributes SourceFile,LineNumberTable++# Replace source file paths with just "SourceFile" to avoid leaking build paths+-renamesourcefileattribute SourceFile++# Disable obfuscation entirely+-dontobfuscate++-keepclasseswithmembernames class * {+ native <methods>;+}++# JNA: native code looks up methods/fields reflectively via initIDs+-dontwarn java.awt.*+-dontwarn com.sun.jna.**+-keep class com.sun.jna.** { *; }+-keepclassmembers class * extends com.sun.jna.** { *; }+-keep class * implements com.sun.jna.** { *; }++# uniffi-generated bindings: Structure subclasses, Callback interfaces, and+# enum/data classes crossing the FFI boundary must retain their fields.+-keep class uniffi.bindings.** { *; }+-keep class uniffi.translator.** { *; }++# uCrop contains an optional HTTP(S) download path that depends on OkHttp, but+# this app only sends local content/file URIs to the cropper.+-dontwarn okhttp3.Call+-dontwarn okhttp3.Dispatcher+-dontwarn okhttp3.OkHttpClient+-dontwarn okhttp3.Request$Builder+-dontwarn okhttp3.Request+-dontwarn okhttp3.Response+-dontwarn okhttp3.ResponseBody+-dontwarn okio.BufferedSource+-dontwarn okio.Okio+-dontwarn okio.Sinkdiff --git a/OCR-translation/proguard-rules.pro b/OCR-translation/proguard-rules.pronew file mode 100644index 0000000..481bb43--- /dev/null+++ b/OCR-translation/proguard-rules.pro@@ -0,0 +1,21 @@+# Add project specific ProGuard rules here.+# You can control the set of applied configuration files using the+# proguardFiles setting in build.gradle.+#+# For more details, see+# http://developer.android.com/guide/developing/tools/proguard.html++# If your project uses WebView with JS, uncomment the following+# and specify the fully qualified class name to the JavaScript interface+# class:+#-keepclassmembers class fqcn.of.javascript.interface.for.webview {+# public *;+#}++# Uncomment this to preserve the line number information for+# debugging stack traces.+#-keepattributes SourceFile,LineNumberTable++# If you keep the line number information, uncomment this to+# hide the original source file name.+#-renamesourcefileattribute SourceFile\ No newline at end of filediff --git a/OCR-translation/src/androidTest/java/com/akslabs/ocr_translation/ExampleInstrumentedTest.kt b/OCR-translation/src/androidTest/java/com/akslabs/ocr_translation/ExampleInstrumentedTest.ktnew file mode 100644index 0000000..ea91017--- /dev/null+++ b/OCR-translation/src/androidTest/java/com/akslabs/ocr_translation/ExampleInstrumentedTest.kt@@ -0,0 +1,24 @@+package com.akslabs.ocr_translation++import androidx.test.platform.app.InstrumentationRegistry+import androidx.test.ext.junit.runners.AndroidJUnit4++import org.junit.Test+import org.junit.runner.RunWith++import org.junit.Assert.*++/**+ * Instrumented test, which will execute on an Android device.+ *+ * See [testing documentation](http://d.android.com/tools/testing).+ */+@RunWith(AndroidJUnit4::class)+class ExampleInstrumentedTest {+ @Test+ fun useAppContext() {+ // Context of the app under test.+ val appContext = InstrumentationRegistry.getInstrumentation().targetContext+ assertEquals("com.akslabs.ocr_translation.test", appContext.packageName)+ }+}\ No newline at end of filediff --git a/OCR-translation/src/main/AndroidManifest.xml b/OCR-translation/src/main/AndroidManifest.xmlnew file mode 100644index 0000000..a5ba1be--- /dev/null+++ b/OCR-translation/src/main/AndroidManifest.xml@@ -0,0 +1,303 @@+<?xml version="1.0" encoding="utf-8"?>+<manifest xmlns:android="http://schemas.android.com/apk/res/android"+ xmlns:tools="http://schemas.android.com/tools">++ <uses-feature+ android:name="android.hardware.camera"+ android:required="false" />++ <queries>+ <intent>+ <action android:name="android.media.action.IMAGE_CAPTURE" />+ </intent>+ <intent>+ <action android:name="android.speech.action.RECOGNIZE_SPEECH" />+ </intent>+ </queries>++ <uses-permission android:name="android.permission.INTERNET" />+ <uses-permission android:name="android.permission.FOREGROUND_SERVICE" />+ <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"+ android:maxSdkVersion="28" />+ <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"+ android:maxSdkVersion="32" />+ <uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE" />+ <uses-permission android:name="android.permission.FOREGROUND_SERVICE_SPECIAL_USE" />+ <uses-permission android:name="android.permission.FOREGROUND_SERVICE_MEDIA_PROJECTION" />+ <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />+ <uses-permission android:name="android.permission.POST_NOTIFICATIONS" />+ <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />+ <uses-permission android:name="android.permission.CAMERA" />+ <uses-permission android:name="android.permission.FLASHLIGHT" />++ <application+ android:name=".TranslatorApplication"+ android:allowBackup="true"+ android:dataExtractionRules="@xml/data_extraction_rules"+ android:fullBackupContent="@xml/backup_rules"+ android:icon="@mipmap/ic_launcher"+ android:label="@string/app_name"+ android:requestLegacyExternalStorage="true"+ android:roundIcon="@mipmap/ic_launcher_round"+ android:supportsRtl="true"+ android:theme="@style/Theme.Translator"+ tools:targetApi="31">++ <provider+ android:name="androidx.core.content.FileProvider"+ android:authorities="${applicationId}.fileprovider"+ android:exported="false"+ android:grantUriPermissions="true">+ <meta-data+ android:name="android.support.FILE_PROVIDER_PATHS"+ android:resource="@xml/file_paths" />+ </provider>+ <!-- android:theme="@style/WideDialogTheme"-->++ <activity+ android:name=".ProcessTextActivity"+ android:exported="true"+ android:windowSoftInputMode="adjustResize"+ android:excludeFromRecents="true"+ android:theme="@style/WideDialogTheme">+ <!-- via popup 'translate' button -->+ <intent-filter+ android:icon="@mipmap/ic_launcher"+ android:label="@string/translate_text">+ <action android:name="android.intent.action.PROCESS_TEXT" />+ <action android:name="android.intent.action.PROCESS_TEXT_READONLY" />++ <category android:name="android.intent.category.DEFAULT" />+ <data android:mimeType="text/plain" />+ </intent-filter>++ <intent-filter>+ <category android:name="android.intent.category.DEFAULT" />+ <action android:name="android.intent.action.TRANSLATE" />+ </intent-filter>++ <intent-filter>+ <action android:name="dev.davidv.translator.OPEN_POPUP" />+ <category android:name="android.intent.category.DEFAULT" />+ </intent-filter>+ </activity>++ <activity+ android:name=".MainActivity"+ android:exported="true"+ android:windowSoftInputMode="adjustResize">++ <!-- via 'share' text -->+ <intent-filter>+ <action android:name="android.intent.action.SEND" />+ <category android:name="android.intent.category.DEFAULT" />+ <data android:mimeType="text/plain" />+ </intent-filter>++ <!-- via 'share' image -->+ <intent-filter>+ <action android:name="android.intent.action.SEND" />+ <category android:name="android.intent.category.DEFAULT" />+ <data android:mimeType="image/*" />+ </intent-filter>++ <!-- via 'share' document: pdf/odt/epub (txt is covered by the text filter above) -->+ <intent-filter>+ <action android:name="android.intent.action.SEND" />+ <category android:name="android.intent.category.DEFAULT" />+ <data android:mimeType="application/pdf" />+ <data android:mimeType="application/vnd.oasis.opendocument.text" />+ <data android:mimeType="application/epub+zip" />+ </intent-filter>++ </activity>++ <activity-alias+ android:name=".MainActivityBrowser"+ android:targetActivity=".MainActivity"+ android:exported="true"+ android:enabled="true"+ android:label="@string/translate_link">+ <!-- via 'open link' from browsers, URLCheck, and other URL handlers -->+ <intent-filter android:label="@string/translate_link">+ <action android:name="android.intent.action.VIEW" />+ <category android:name="android.intent.category.DEFAULT" />+ <category android:name="android.intent.category.BROWSABLE" />+ <data android:scheme="http" />+ <data android:scheme="https" />+ </intent-filter>+ </activity-alias>++ <activity+ android:name=".browser.BrowserActivity"+ android:exported="false"+ android:label="@string/app_name" />++ <activity+ android:name=".ui.components.AppCropActivity"+ android:screenOrientation="portrait"+ android:theme="@style/Theme.Translator.CropImage" />++ <activity+ android:name=".ui.components.DocAlignActivity"+ android:screenOrientation="portrait"+ android:theme="@style/Theme.Translator.CropImage" />++ <activity+ android:name=".TranslatorTtsDataActivity"+ android:exported="true"+ android:theme="@android:style/Theme.NoDisplay">+ <intent-filter>+ <action android:name="android.speech.tts.engine.CHECK_TTS_DATA" />+ <category android:name="android.intent.category.DEFAULT" />+ </intent-filter>+ <intent-filter>+ <action android:name="android.speech.tts.engine.GET_SAMPLE_TEXT" />+ <category android:name="android.intent.category.DEFAULT" />+ </intent-filter>+ <intent-filter>+ <action android:name="android.speech.tts.engine.INSTALL_TTS_DATA" />+ <category android:name="android.intent.category.DEFAULT" />+ </intent-filter>+ </activity>++ <activity+ android:name=".TranslatorTtsSettingsRelayActivity"+ android:exported="true"+ android:theme="@android:style/Theme.NoDisplay" />++ <activity+ android:name=".screenTranslate.ScreenCaptureRequestActivity"+ android:exported="false"+ android:excludeFromRecents="true"+ android:taskAffinity=""+ android:noHistory="true"+ android:theme="@android:style/Theme.Translucent.NoTitleBar" />++ <service+ android:name=".screenTranslate.ScreenTranslateService"+ android:enabled="true"+ android:exported="false"+ android:foregroundServiceType="mediaProjection" />++ <service+ android:name=".DownloadService"+ android:enabled="true"+ android:exported="false" />++ <service+ android:name=".DocumentTranslationService"+ android:enabled="true"+ android:exported="false"+ android:foregroundServiceType="specialUse">+ <property+ android:name="android.app.PROPERTY_SPECIAL_USE_FGS_SUBTYPE"+ android:value="document_translation" />+ </service>++ <service+ android:name=".TranslationApiService"+ android:enabled="true"+ android:exported="false"+ android:foregroundServiceType="specialUse">+ <property+ android:name="android.app.PROPERTY_SPECIAL_USE_FGS_SUBTYPE"+ android:value="translation_api_server" />+ </service>++ <receiver+ android:name=".TapToTranslateDismissReceiver"+ android:exported="false" />++ <receiver+ android:name=".TapToTranslateBootReceiver"+ android:exported="true">+ <intent-filter>+ <action android:name="android.intent.action.BOOT_COMPLETED" />+ </intent-filter>+ </receiver>++ <service+ android:name=".QuickTranslateTileService"+ android:exported="true"+ android:icon="@drawable/ic_translate_button"+ android:label="@string/quick_tile_label"+ android:permission="android.permission.BIND_QUICK_SETTINGS_TILE">+ <intent-filter>+ <action android:name="android.service.quicksettings.action.QS_TILE" />+ </intent-filter>+ </service>++ <service+ android:name=".screenTranslate.LiveScreenTileService"+ android:exported="true"+ android:icon="@drawable/videocam"+ android:label="@string/live_tile_label"+ android:permission="android.permission.BIND_QUICK_SETTINGS_TILE">+ <intent-filter>+ <action android:name="android.service.quicksettings.action.QS_TILE" />+ </intent-filter>+ </service>++ <service+ android:name=".AidlTranslationService"+ android:exported="true">+ <intent-filter>+ <action android:name="dev.davidv.translator.ITranslationService" />+ </intent-filter>+ </service>++ <service+ android:name=".TranslatorTtsService"+ android:enabled="true"+ android:exported="true"+ android:label="@string/app_name">+ <intent-filter>+ <action android:name="android.intent.action.TTS_SERVICE" />+ <category android:name="android.intent.category.DEFAULT" />+ </intent-filter>+ <meta-data+ android:name="android.speech.tts"+ android:resource="@xml/tts_engine" />+ </service>++ <service+ android:name=".accessibilityOverlay.TranslatorAccessibilityService"+ android:enabled="@bool/accessibility_service_enabled"+ android:exported="true"+ android:permission="android.permission.BIND_ACCESSIBILITY_SERVICE">+ <intent-filter>+ <action android:name="android.accessibilityservice.AccessibilityService" />+ </intent-filter>+ <meta-data+ android:name="android.accessibilityservice"+ android:resource="@xml/accessibility_service_config" />+ </service>++ <service+ android:name=".assistantOverlay.TranslatorVoiceInteractionService"+ android:exported="true"+ android:directBootAware="true"+ android:permission="android.permission.BIND_VOICE_INTERACTION">+ <intent-filter>+ <action android:name="android.service.voice.VoiceInteractionService" />+ </intent-filter>+ <meta-data+ android:name="android.voice_interaction"+ android:resource="@xml/voice_interaction_service" />+ </service>++ <service+ android:name=".assistantOverlay.TranslatorVoiceInteractionSessionService"+ android:exported="true"+ android:directBootAware="true" />++ <service+ android:name=".assistantOverlay.TranslatorRecognitionService"+ android:exported="true"+ android:directBootAware="true"+ android:permission="android.permission.BIND_SPEECH_RECOGNITION_SERVICE" />++ </application>++</manifest>diff --git a/OCR-translation/src/main/aidl/dev/davidv/translator/ErrorType.aidl b/OCR-translation/src/main/aidl/dev/davidv/translator/ErrorType.aidlnew file mode 100644index 0000000..8e21191--- /dev/null+++ b/OCR-translation/src/main/aidl/dev/davidv/translator/ErrorType.aidl@@ -0,0 +1,8 @@+package dev.davidv.translator;++enum ErrorType {+ COULD_NOT_DETECT_LANGUAGE,+ DETECTED_BUT_UNAVAILABLE,+ UNEXPECTED,+}+diff --git a/OCR-translation/src/main/aidl/dev/davidv/translator/ITranslationCallback.aidl b/OCR-translation/src/main/aidl/dev/davidv/translator/ITranslationCallback.aidlnew file mode 100644index 0000000..659b8d9--- /dev/null+++ b/OCR-translation/src/main/aidl/dev/davidv/translator/ITranslationCallback.aidl@@ -0,0 +1,8 @@+package dev.davidv.translator;++import dev.davidv.translator.TranslationError;++oneway interface ITranslationCallback {+ void onTranslationResult(String translatedText);+ void onTranslationError(in TranslationError error);+}diff --git a/OCR-translation/src/main/aidl/dev/davidv/translator/ITranslationService.aidl b/OCR-translation/src/main/aidl/dev/davidv/translator/ITranslationService.aidlnew file mode 100644index 0000000..5692099--- /dev/null+++ b/OCR-translation/src/main/aidl/dev/davidv/translator/ITranslationService.aidl@@ -0,0 +1,7 @@+package dev.davidv.translator;++import dev.davidv.translator.ITranslationCallback;++interface ITranslationService {+ void translate(String textToTranslate, String fromLanguage, String toLanguage, ITranslationCallback callback);+}diff --git a/OCR-translation/src/main/aidl/dev/davidv/translator/TranslationError.aidl b/OCR-translation/src/main/aidl/dev/davidv/translator/TranslationError.aidlnew file mode 100644index 0000000..cee284b--- /dev/null+++ b/OCR-translation/src/main/aidl/dev/davidv/translator/TranslationError.aidl@@ -0,0 +1,9 @@+package dev.davidv.translator;++import dev.davidv.translator.ErrorType;++parcelable TranslationError {+ ErrorType type;+ @nullable String language;+ @nullable String message;+}diff --git a/OCR-translation/src/main/assets/Readability.js b/OCR-translation/src/main/assets/Readability.jsnew file mode 100644index 0000000..5cff454--- /dev/null+++ b/OCR-translation/src/main/assets/Readability.js@@ -0,0 +1,2812 @@+/*+ * Copyright (c) 2010 Arc90 Inc+ *+ * Licensed under the Apache License, Version 2.0 (the "License");+ * you may not use this file except in compliance with the License.+ * You may obtain a copy of the License at+ *+ * http://www.apache.org/licenses/LICENSE-2.0+ *+ * Unless required by applicable law or agreed to in writing, software+ * distributed under the License is distributed on an "AS IS" BASIS,+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */++/*+ * This code is heavily based on Arc90's readability.js (1.7.1) script+ * available at: http://code.google.com/p/arc90labs-readability+ */++/**+ * Public constructor.+ * @param {HTMLDocument} doc The document to parse.+ * @param {Object} options The options object.+ */+function Readability(doc, options) {+ // In some older versions, people passed a URI as the first argument. Cope:+ if (options && options.documentElement) {+ doc = options;+ options = arguments[2];+ } else if (!doc || !doc.documentElement) {+ throw new Error(+ "First argument to Readability constructor should be a document object."+ );+ }+ options = options || {};++ this._doc = doc;+ this._docJSDOMParser = this._doc.firstChild.__JSDOMParser__;+ this._articleTitle = null;+ this._articleByline = null;+ this._articleDir = null;+ this._articleSiteName = null;+ this._attempts = [];+ this._metadata = {};++ // Configurable options+ this._debug = !!options.debug;+ this._maxElemsToParse =+ options.maxElemsToParse || this.DEFAULT_MAX_ELEMS_TO_PARSE;+ this._nbTopCandidates =+ options.nbTopCandidates || this.DEFAULT_N_TOP_CANDIDATES;+ this._charThreshold = options.charThreshold || this.DEFAULT_CHAR_THRESHOLD;+ this._classesToPreserve = this.CLASSES_TO_PRESERVE.concat(+ options.classesToPreserve || []+ );+ this._keepClasses = !!options.keepClasses;+ this._serializer =+ options.serializer ||+ function (el) {+ return el.innerHTML;+ };+ this._disableJSONLD = !!options.disableJSONLD;+ this._allowedVideoRegex = options.allowedVideoRegex || this.REGEXPS.videos;+ this._linkDensityModifier = options.linkDensityModifier || 0;++ // Start with all flags set+ this._flags =+ this.FLAG_STRIP_UNLIKELYS |+ this.FLAG_WEIGHT_CLASSES |+ this.FLAG_CLEAN_CONDITIONALLY;++ // Control whether log messages are sent to the console+ if (this._debug) {+ let logNode = function (node) {+ if (node.nodeType == node.TEXT_NODE) {+ return `${node.nodeName} ("${node.textContent}")`;+ }+ let attrPairs = Array.from(node.attributes || [], function (attr) {+ return `${attr.name}="${attr.value}"`;+ }).join(" ");+ return `<${node.localName} ${attrPairs}>`;+ };+ this.log = function () {+ if (typeof console !== "undefined") {+ let args = Array.from(arguments, arg => {+ if (arg && arg.nodeType == this.ELEMENT_NODE) {+ return logNode(arg);+ }+ return arg;+ });+ args.unshift("Reader: (Readability)");+ // eslint-disable-next-line no-console+ console.log(...args);+ } else if (typeof dump !== "undefined") {+ /* global dump */+ var msg = Array.prototype.map+ .call(arguments, function (x) {+ return x && x.nodeName ? logNode(x) : x;+ })+ .join(" ");+ dump("Reader: (Readability) " + msg + "\n");+ }+ };+ } else {+ this.log = function () {};+ }+}++Readability.prototype = {+ FLAG_STRIP_UNLIKELYS: 0x1,+ FLAG_WEIGHT_CLASSES: 0x2,+ FLAG_CLEAN_CONDITIONALLY: 0x4,++ // https://developer.mozilla.org/en-US/docs/Web/API/Node/nodeType+ ELEMENT_NODE: 1,+ TEXT_NODE: 3,++ // Max number of nodes supported by this parser. Default: 0 (no limit)+ DEFAULT_MAX_ELEMS_TO_PARSE: 0,++ // The number of top candidates to consider when analysing how+ // tight the competition is among candidates.+ DEFAULT_N_TOP_CANDIDATES: 5,++ // Element tags to score by default.+ DEFAULT_TAGS_TO_SCORE: "section,h2,h3,h4,h5,h6,p,td,pre"+ .toUpperCase()+ .split(","),++ // The default number of chars an article must have in order to return a result+ DEFAULT_CHAR_THRESHOLD: 500,++ // All of the regular expressions in use within readability.+ // Defined up here so we don't instantiate them repeatedly in loops.+ REGEXPS: {+ // NOTE: These two regular expressions are duplicated in+ // Readability-readerable.js. Please keep both copies in sync.+ unlikelyCandidates:+ /-ad-|ai2html|banner|breadcrumbs|combx|comment|community|cover-wrap|disqus|extra|footer|gdpr|header|legends|menu|related|remark|replies|rss|shoutbox|sidebar|skyscraper|social|sponsor|supplemental|ad-break|agegate|pagination|pager|popup|yom-remote/i,+ okMaybeItsACandidate:+ /and|article|body|column|content|main|mathjax|shadow/i,++ positive:+ /article|body|content|entry|hentry|h-entry|main|page|pagination|post|text|blog|story/i,+ negative:+ /-ad-|hidden|^hid$| hid$| hid |^hid |banner|combx|comment|com-|contact|footer|gdpr|masthead|media|meta|outbrain|promo|related|scroll|share|shoutbox|sidebar|skyscraper|sponsor|shopping|tags|widget/i,+ extraneous:+ /print|archive|comment|discuss|e[\-]?mail|share|reply|all|login|sign|single|utility/i,+ byline: /byline|author|dateline|writtenby|p-author/i,+ replaceFonts: /<(\/?)font[^>]*>/gi,+ normalize: /\s{2,}/g,+ videos:+ /\/\/(www\.)?((dailymotion|youtube|youtube-nocookie|player\.vimeo|v\.qq|bilibili|live.bilibili)\.com|(archive|upload\.wikimedia)\.org|player\.twitch\.tv)/i,+ shareElements: /(\b|_)(share|sharedaddy)(\b|_)/i,+ nextLink: /(next|weiter|continue|>([^\|]|$)|»([^\|]|$))/i,+ prevLink: /(prev|earl|old|new|<|«)/i,+ tokenize: /\W+/g,+ whitespace: /^\s*$/,+ hasContent: /\S$/,+ hashUrl: /^#.+/,+ srcsetUrl: /(\S+)(\s+[\d.]+[xw])?(\s*(?:,|$))/g,+ b64DataUrl: /^data:\s*([^\s;,]+)\s*;\s*base64\s*,/i,+ // Commas as used in Latin, Sindhi, Chinese and various other scripts.+ // see: https://en.wikipedia.org/wiki/Comma#Comma_variants+ commas: /\u002C|\u060C|\uFE50|\uFE10|\uFE11|\u2E41|\u2E34|\u2E32|\uFF0C/g,+ // See: https://schema.org/Article+ jsonLdArticleTypes:+ /^Article|AdvertiserContentArticle|NewsArticle|AnalysisNewsArticle|AskPublicNewsArticle|BackgroundNewsArticle|OpinionNewsArticle|ReportageNewsArticle|ReviewNewsArticle|Report|SatiricalArticle|ScholarlyArticle|MedicalScholarlyArticle|SocialMediaPosting|BlogPosting|LiveBlogPosting|DiscussionForumPosting|TechArticle|APIReference$/,+ // used to see if a node's content matches words commonly used for ad blocks or loading indicators+ adWords:+ /^(ad(vertising|vertisement)?|pub(licité)?|werb(ung)?|广告|Реклама|Anuncio)$/iu,+ loadingWords:+ /^((loading|正在加载|Загрузка|chargement|cargando)(…|\.\.\.)?)$/iu,+ },++ UNLIKELY_ROLES: [+ "menu",+ "menubar",+ "complementary",+ "navigation",+ "alert",+ "alertdialog",+ "dialog",+ ],++ DIV_TO_P_ELEMS: new Set([+ "BLOCKQUOTE",+ "DL",+ "DIV",+ "IMG",+ "OL",+ "P",+ "PRE",+ "TABLE",+ "UL",+ ]),++ ALTER_TO_DIV_EXCEPTIONS: ["DIV", "ARTICLE", "SECTION", "P", "OL", "UL"],++ PRESENTATIONAL_ATTRIBUTES: [+ "align",+ "background",+ "bgcolor",+ "border",+ "cellpadding",+ "cellspacing",+ "frame",+ "hspace",+ "rules",+ "style",+ "valign",+ "vspace",+ ],++ DEPRECATED_SIZE_ATTRIBUTE_ELEMS: ["TABLE", "TH", "TD", "HR", "PRE"],++ // The commented out elements qualify as phrasing content but tend to be+ // removed by readability when put into paragraphs, so we ignore them here.+ PHRASING_ELEMS: [+ // "CANVAS", "IFRAME", "SVG", "VIDEO",+ "ABBR",+ "AUDIO",+ "B",+ "BDO",+ "BR",+ "BUTTON",+ "CITE",+ "CODE",+ "DATA",+ "DATALIST",+ "DFN",+ "EM",+ "EMBED",+ "I",+ "IMG",+ "INPUT",+ "KBD",+ "LABEL",+ "MARK",+ "MATH",+ "METER",+ "NOSCRIPT",+ "OBJECT",+ "OUTPUT",+ "PROGRESS",+ "Q",+ "RUBY",+ "SAMP",+ "SCRIPT",+ "SELECT",+ "SMALL",+ "SPAN",+ "STRONG",+ "SUB",+ "SUP",+ "TEXTAREA",+ "TIME",+ "VAR",+ "WBR",+ ],++ // These are the classes that readability sets itself.+ CLASSES_TO_PRESERVE: ["page"],++ // These are the list of HTML entities that need to be escaped.+ HTML_ESCAPE_MAP: {+ lt: "<",+ gt: ">",+ amp: "&",+ quot: '"',+ apos: "'",+ },++ /**+ * Run any post-process modifications to article content as necessary.+ *+ * @param Element+ * @return void+ **/+ _postProcessContent(articleContent) {+ // Readability cannot open relative uris so we convert them to absolute uris.+ this._fixRelativeUris(articleContent);++ this._simplifyNestedElements(articleContent);++ if (!this._keepClasses) {+ // Remove classes.+ this._cleanClasses(articleContent);+ }+ },++ /**+ * Iterates over a NodeList, calls `filterFn` for each node and removes node+ * if function returned `true`.+ *+ * If function is not passed, removes all the nodes in node list.+ *+ * @param NodeList nodeList The nodes to operate on+ * @param Function filterFn the function to use as a filter+ * @return void+ */+ _removeNodes(nodeList, filterFn) {+ // Avoid ever operating on live node lists.+ if (this._docJSDOMParser && nodeList._isLiveNodeList) {+ throw new Error("Do not pass live node lists to _removeNodes");+ }+ for (var i = nodeList.length - 1; i >= 0; i--) {+ var node = nodeList[i];+ var parentNode = node.parentNode;+ if (parentNode) {+ if (!filterFn || filterFn.call(this, node, i, nodeList)) {+ parentNode.removeChild(node);+ }+ }+ }+ },++ /**+ * Iterates over a NodeList, and calls _setNodeTag for each node.+ *+ * @param NodeList nodeList The nodes to operate on+ * @param String newTagName the new tag name to use+ * @return void+ */+ _replaceNodeTags(nodeList, newTagName) {+ // Avoid ever operating on live node lists.+ if (this._docJSDOMParser && nodeList._isLiveNodeList) {+ throw new Error("Do not pass live node lists to _replaceNodeTags");+ }+ for (const node of nodeList) {+ this._setNodeTag(node, newTagName);+ }+ },++ /**+ * Iterate over a NodeList, which doesn't natively fully implement the Array+ * interface.+ *+ * For convenience, the current object context is applied to the provided+ * iterate function.+ *+ * @param NodeList nodeList The NodeList.+ * @param Function fn The iterate function.+ * @return void+ */+ _forEachNode(nodeList, fn) {+ Array.prototype.forEach.call(nodeList, fn, this);+ },++ /**+ * Iterate over a NodeList, and return the first node that passes+ * the supplied test function+ *+ * For convenience, the current object context is applied to the provided+ * test function.+ *+ * @param NodeList nodeList The NodeList.+ * @param Function fn The test function.+ * @return void+ */+ _findNode(nodeList, fn) {+ return Array.prototype.find.call(nodeList, fn, this);+ },++ /**+ * Iterate over a NodeList, return true if any of the provided iterate+ * function calls returns true, false otherwise.+ *+ * For convenience, the current object context is applied to the+ * provided iterate function.+ *+ * @param NodeList nodeList The NodeList.+ * @param Function fn The iterate function.+ * @return Boolean+ */+ _someNode(nodeList, fn) {+ return Array.prototype.some.call(nodeList, fn, this);+ },++ /**+ * Iterate over a NodeList, return true if all of the provided iterate+ * function calls return true, false otherwise.+ *+ * For convenience, the current object context is applied to the+ * provided iterate function.+ *+ * @param NodeList nodeList The NodeList.+ * @param Function fn The iterate function.+ * @return Boolean+ */+ _everyNode(nodeList, fn) {+ return Array.prototype.every.call(nodeList, fn, this);+ },++ _getAllNodesWithTag(node, tagNames) {+ if (node.querySelectorAll) {+ return node.querySelectorAll(tagNames.join(","));+ }+ return [].concat.apply(+ [],+ tagNames.map(function (tag) {+ var collection = node.getElementsByTagName(tag);+ return Array.isArray(collection) ? collection : Array.from(collection);+ })+ );+ },++ /**+ * Removes the class="" attribute from every element in the given+ * subtree, except those that match CLASSES_TO_PRESERVE and+ * the classesToPreserve array from the options object.+ *+ * @param Element+ * @return void+ */+ _cleanClasses(node) {+ var classesToPreserve = this._classesToPreserve;+ var className = (node.getAttribute("class") || "")+ .split(/\s+/)+ .filter(cls => classesToPreserve.includes(cls))+ .join(" ");++ if (className) {+ node.setAttribute("class", className);+ } else {+ node.removeAttribute("class");+ }++ for (node = node.firstElementChild; node; node = node.nextElementSibling) {+ this._cleanClasses(node);+ }+ },++ /**+ * Tests whether a string is a URL or not.+ *+ * @param {string} str The string to test+ * @return {boolean} true if str is a URL, false if not+ */+ _isUrl(str) {+ try {+ new URL(str);+ return true;+ } catch {+ return false;+ }+ },+ /**+ * Converts each <a> and <img> uri in the given element to an absolute URI,+ * ignoring #ref URIs.+ *+ * @param Element+ * @return void+ */+ _fixRelativeUris(articleContent) {+ var baseURI = this._doc.baseURI;+ var documentURI = this._doc.documentURI;+ function toAbsoluteURI(uri) {+ // Leave hash links alone if the base URI matches the document URI:+ if (baseURI == documentURI && uri.charAt(0) == "#") {+ return uri;+ }++ // Otherwise, resolve against base URI:+ try {+ return new URL(uri, baseURI).href;+ } catch (ex) {+ // Something went wrong, just return the original:+ }+ return uri;+ }++ var links = this._getAllNodesWithTag(articleContent, ["a"]);+ this._forEachNode(links, function (link) {+ var href = link.getAttribute("href");+ if (href) {+ // Remove links with javascript: URIs, since+ // they won't work after scripts have been removed from the page.+ if (href.indexOf("javascript:") === 0) {+ // if the link only contains simple text content, it can be converted to a text node+ if (+ link.childNodes.length === 1 &&+ link.childNodes[0].nodeType === this.TEXT_NODE+ ) {+ var text = this._doc.createTextNode(link.textContent);+ link.parentNode.replaceChild(text, link);+ } else {+ // if the link has multiple children, they should all be preserved+ var container = this._doc.createElement("span");+ while (link.firstChild) {+ container.appendChild(link.firstChild);+ }+ link.parentNode.replaceChild(container, link);+ }+ } else {+ link.setAttribute("href", toAbsoluteURI(href));+ }+ }+ });++ var medias = this._getAllNodesWithTag(articleContent, [+ "img",+ "picture",+ "figure",+ "video",+ "audio",+ "source",+ ]);++ this._forEachNode(medias, function (media) {+ var src = media.getAttribute("src");+ var poster = media.getAttribute("poster");+ var srcset = media.getAttribute("srcset");++ if (src) {+ media.setAttribute("src", toAbsoluteURI(src));+ }++ if (poster) {+ media.setAttribute("poster", toAbsoluteURI(poster));+ }++ if (srcset) {+ var newSrcset = srcset.replace(+ this.REGEXPS.srcsetUrl,+ function (_, p1, p2, p3) {+ return toAbsoluteURI(p1) + (p2 || "") + p3;+ }+ );++ media.setAttribute("srcset", newSrcset);+ }+ });+ },++ _simplifyNestedElements(articleContent) {+ var node = articleContent;++ while (node) {+ if (+ node.parentNode &&+ ["DIV", "SECTION"].includes(node.tagName) &&+ !(node.id && node.id.startsWith("readability"))+ ) {+ if (this._isElementWithoutContent(node)) {+ node = this._removeAndGetNext(node);+ continue;+ } else if (+ this._hasSingleTagInsideElement(node, "DIV") ||+ this._hasSingleTagInsideElement(node, "SECTION")+ ) {+ var child = node.children[0];+ for (var i = 0; i < node.attributes.length; i++) {+ child.setAttributeNode(node.attributes[i].cloneNode());+ }+ node.parentNode.replaceChild(child, node);+ node = child;+ continue;+ }+ }++ node = this._getNextNode(node);+ }+ },++ /**+ * Get the article title as an H1.+ *+ * @return string+ **/+ _getArticleTitle() {+ var doc = this._doc;+ var curTitle = "";+ var origTitle = "";++ try {+ curTitle = origTitle = doc.title.trim();++ // If they had an element with id "title" in their HTML+ if (typeof curTitle !== "string") {+ curTitle = origTitle = this._getInnerText(+ doc.getElementsByTagName("title")[0]+ );+ }+ } catch (e) {+ /* ignore exceptions setting the title. */+ }++ var titleHadHierarchicalSeparators = false;+ function wordCount(str) {+ return str.split(/\s+/).length;+ }++ // If there's a separator in the title, first remove the final part+ const titleSeparators = /\|\-–—\\\/>»/.source;+ if (new RegExp(`\\s[${titleSeparators}]\\s`).test(curTitle)) {+ titleHadHierarchicalSeparators = /\s[\\\/>»]\s/.test(curTitle);+ let allSeparators = Array.from(+ origTitle.matchAll(new RegExp(`\\s[${titleSeparators}]\\s`, "gi"))+ );+ curTitle = origTitle.substring(0, allSeparators.pop().index);++ // If the resulting title is too short, remove the first part instead:+ if (wordCount(curTitle) < 3) {+ curTitle = origTitle.replace(+ new RegExp(`^[^${titleSeparators}]*[${titleSeparators}]`, "gi"),+ ""+ );+ }+ } else if (curTitle.includes(": ")) {+ // Check if we have an heading containing this exact string, so we+ // could assume it's the full title.+ var headings = this._getAllNodesWithTag(doc, ["h1", "h2"]);+ var trimmedTitle = curTitle.trim();+ var match = this._someNode(headings, function (heading) {+ return heading.textContent.trim() === trimmedTitle;+ });++ // If we don't, let's extract the title out of the original title string.+ if (!match) {+ curTitle = origTitle.substring(origTitle.lastIndexOf(":") + 1);++ // If the title is now too short, try the first colon instead:+ if (wordCount(curTitle) < 3) {+ curTitle = origTitle.substring(origTitle.indexOf(":") + 1);+ // But if we have too many words before the colon there's something weird+ // with the titles and the H tags so let's just use the original title instead+ } else if (wordCount(origTitle.substr(0, origTitle.indexOf(":"))) > 5) {+ curTitle = origTitle;+ }+ }+ } else if (curTitle.length > 150 || curTitle.length < 15) {+ var hOnes = doc.getElementsByTagName("h1");++ if (hOnes.length === 1) {+ curTitle = this._getInnerText(hOnes[0]);+ }+ }++ curTitle = curTitle.trim().replace(this.REGEXPS.normalize, " ");+ // If we now have 4 words or fewer as our title, and either no+ // 'hierarchical' separators (\, /, > or ») were found in the original+ // title or we decreased the number of words by more than 1 word, use+ // the original title.+ var curTitleWordCount = wordCount(curTitle);+ if (+ curTitleWordCount <= 4 &&+ (!titleHadHierarchicalSeparators ||+ curTitleWordCount !=+ wordCount(+ origTitle.replace(new RegExp(`\\s[${titleSeparators}]\\s`, "g"), "")+ ) -+ 1)+ ) {+ curTitle = origTitle;+ }++ return curTitle;+ },++ /**+ * Prepare the HTML document for readability to scrape it.+ * This includes things like stripping javascript, CSS, and handling terrible markup.+ *+ * @return void+ **/+ _prepDocument() {+ var doc = this._doc;++ // Remove all style tags in head+ this._removeNodes(this._getAllNodesWithTag(doc, ["style"]));++ if (doc.body) {+ this._replaceBrs(doc.body);+ }++ this._replaceNodeTags(this._getAllNodesWithTag(doc, ["font"]), "SPAN");+ },++ /**+ * Finds the next node, starting from the given node, and ignoring+ * whitespace in between. If the given node is an element, the same node is+ * returned.+ */+ _nextNode(node) {+ var next = node;+ while (+ next &&+ next.nodeType != this.ELEMENT_NODE &&+ this.REGEXPS.whitespace.test(next.textContent)+ ) {+ next = next.nextSibling;+ }+ return next;+ },++ /**+ * Replaces 2 or more successive <br> elements with a single <p>.+ * Whitespace between <br> elements are ignored. For example:+ * <div>foo<br>bar<br> <br><br>abc</div>+ * will become:+ * <div>foo<br>bar<p>abc</p></div>+ */+ _replaceBrs(elem) {+ this._forEachNode(this._getAllNodesWithTag(elem, ["br"]), function (br) {+ var next = br.nextSibling;++ // Whether 2 or more <br> elements have been found and replaced with a+ // <p> block.+ var replaced = false;++ // If we find a <br> chain, remove the <br>s until we hit another node+ // or non-whitespace. This leaves behind the first <br> in the chain+ // (which will be replaced with a <p> later).+ while ((next = this._nextNode(next)) && next.tagName == "BR") {+ replaced = true;+ var brSibling = next.nextSibling;+ next.remove();+ next = brSibling;+ }++ // If we removed a <br> chain, replace the remaining <br> with a <p>. Add+ // all sibling nodes as children of the <p> until we hit another <br>+ // chain.+ if (replaced) {+ var p = this._doc.createElement("p");+ br.parentNode.replaceChild(p, br);++ next = p.nextSibling;+ while (next) {+ // If we've hit another <br><br>, we're done adding children to this <p>.+ if (next.tagName == "BR") {+ var nextElem = this._nextNode(next.nextSibling);+ if (nextElem && nextElem.tagName == "BR") {+ break;+ }+ }++ if (!this._isPhrasingContent(next)) {+ break;+ }++ // Otherwise, make this node a child of the new <p>.+ var sibling = next.nextSibling;+ p.appendChild(next);+ next = sibling;+ }++ while (p.lastChild && this._isWhitespace(p.lastChild)) {+ p.lastChild.remove();+ }++ if (p.parentNode.tagName === "P") {+ this._setNodeTag(p.parentNode, "DIV");+ }+ }+ });+ },++ _setNodeTag(node, tag) {+ this.log("_setNodeTag", node, tag);+ if (this._docJSDOMParser) {+ node.localName = tag.toLowerCase();+ node.tagName = tag.toUpperCase();+ return node;+ }++ var replacement = node.ownerDocument.createElement(tag);+ while (node.firstChild) {+ replacement.appendChild(node.firstChild);+ }+ node.parentNode.replaceChild(replacement, node);+ if (node.readability) {+ replacement.readability = node.readability;+ }++ for (var i = 0; i < node.attributes.length; i++) {+ replacement.setAttributeNode(node.attributes[i].cloneNode());+ }+ return replacement;+ },++ /**+ * Prepare the article node for display. Clean out any inline styles,+ * iframes, forms, strip extraneous <p> tags, etc.+ *+ * @param Element+ * @return void+ **/+ _prepArticle(articleContent) {+ this._cleanStyles(articleContent);++ // Check for data tables before we continue, to avoid removing items in+ // those tables, which will often be isolated even though they're+ // visually linked to other content-ful elements (text, images, etc.).+ this._markDataTables(articleContent);++ this._fixLazyImages(articleContent);++ // Clean out junk from the article content+ this._cleanConditionally(articleContent, "form");+ this._cleanConditionally(articleContent, "fieldset");+ this._clean(articleContent, "object");+ this._clean(articleContent, "embed");+ this._clean(articleContent, "footer");+ this._clean(articleContent, "link");+ this._clean(articleContent, "aside");++ // Clean out elements with little content that have "share" in their id/class combinations from final top candidates,+ // which means we don't remove the top candidates even they have "share".++ var shareElementThreshold = this.DEFAULT_CHAR_THRESHOLD;++ this._forEachNode(articleContent.children, function (topCandidate) {+ this._cleanMatchedNodes(topCandidate, function (node, matchString) {+ return (+ this.REGEXPS.shareElements.test(matchString) &&+ node.textContent.length < shareElementThreshold+ );+ });+ });++ this._clean(articleContent, "iframe");+ this._clean(articleContent, "input");+ this._clean(articleContent, "textarea");+ this._clean(articleContent, "select");+ this._clean(articleContent, "button");+ this._cleanHeaders(articleContent);++ // Do these last as the previous stuff may have removed junk+ // that will affect these+ this._cleanConditionally(articleContent, "table");+ this._cleanConditionally(articleContent, "ul");+ this._cleanConditionally(articleContent, "div");++ // replace H1 with H2 as H1 should be only title that is displayed separately+ this._replaceNodeTags(+ this._getAllNodesWithTag(articleContent, ["h1"]),+ "h2"+ );++ // Remove extra paragraphs+ this._removeNodes(+ this._getAllNodesWithTag(articleContent, ["p"]),+ function (paragraph) {+ // At this point, nasty iframes have been removed; only embedded video+ // ones remain.+ var contentElementCount = this._getAllNodesWithTag(paragraph, [+ "img",+ "embed",+ "object",+ "iframe",+ ]).length;+ return (+ contentElementCount === 0 && !this._getInnerText(paragraph, false)+ );+ }+ );++ this._forEachNode(+ this._getAllNodesWithTag(articleContent, ["br"]),+ function (br) {+ var next = this._nextNode(br.nextSibling);+ if (next && next.tagName == "P") {+ br.remove();+ }+ }+ );++ // Remove single-cell tables+ this._forEachNode(+ this._getAllNodesWithTag(articleContent, ["table"]),+ function (table) {+ var tbody = this._hasSingleTagInsideElement(table, "TBODY")+ ? table.firstElementChild+ : table;+ if (this._hasSingleTagInsideElement(tbody, "TR")) {+ var row = tbody.firstElementChild;+ if (this._hasSingleTagInsideElement(row, "TD")) {+ var cell = row.firstElementChild;+ cell = this._setNodeTag(+ cell,+ this._everyNode(cell.childNodes, this._isPhrasingContent)+ ? "P"+ : "DIV"+ );+ table.parentNode.replaceChild(cell, table);+ }+ }+ }+ );+ },++ /**+ * Initialize a node with the readability object. Also checks the+ * className/id for special names to add to its score.+ *+ * @param Element+ * @return void+ **/+ _initializeNode(node) {+ node.readability = { contentScore: 0 };++ switch (node.tagName) {+ case "DIV":+ node.readability.contentScore += 5;+ break;++ case "PRE":+ case "TD":+ case "BLOCKQUOTE":+ node.readability.contentScore += 3;+ break;++ case "ADDRESS":+ case "OL":+ case "UL":+ case "DL":+ case "DD":+ case "DT":+ case "LI":+ case "FORM":+ node.readability.contentScore -= 3;+ break;++ case "H1":+ case "H2":+ case "H3":+ case "H4":+ case "H5":+ case "H6":+ case "TH":+ node.readability.contentScore -= 5;+ break;+ }++ node.readability.contentScore += this._getClassWeight(node);+ },++ _removeAndGetNext(node) {+ var nextNode = this._getNextNode(node, true);+ node.remove();+ return nextNode;+ },++ /**+ * Traverse the DOM from node to node, starting at the node passed in.+ * Pass true for the second parameter to indicate this node itself+ * (and its kids) are going away, and we want the next node over.+ *+ * Calling this in a loop will traverse the DOM depth-first.+ *+ * @param {Element} node+ * @param {boolean} ignoreSelfAndKids+ * @return {Element}+ */+ _getNextNode(node, ignoreSelfAndKids) {+ // First check for kids if those aren't being ignored+ if (!ignoreSelfAndKids && node.firstElementChild) {+ return node.firstElementChild;+ }+ // Then for siblings...+ if (node.nextElementSibling) {+ return node.nextElementSibling;+ }+ // And finally, move up the parent chain *and* find a sibling+ // (because this is depth-first traversal, we will have already+ // seen the parent nodes themselves).+ do {+ node = node.parentNode;+ } while (node && !node.nextElementSibling);+ return node && node.nextElementSibling;+ },++ // compares second text to first one+ // 1 = same text, 0 = completely different text+ // works the way that it splits both texts into words and then finds words that are unique in second text+ // the result is given by the lower length of unique parts+ _textSimilarity(textA, textB) {+ var tokensA = textA+ .toLowerCase()+ .split(this.REGEXPS.tokenize)+ .filter(Boolean);+ var tokensB = textB+ .toLowerCase()+ .split(this.REGEXPS.tokenize)+ .filter(Boolean);+ if (!tokensA.length || !tokensB.length) {+ return 0;+ }+ var uniqTokensB = tokensB.filter(token => !tokensA.includes(token));+ var distanceB = uniqTokensB.join(" ").length / tokensB.join(" ").length;+ return 1 - distanceB;+ },++ /**+ * Checks whether an element node contains a valid byline+ *+ * @param node {Element}+ * @param matchString {string}+ * @return boolean+ */+ _isValidByline(node, matchString) {+ var rel = node.getAttribute("rel");+ var itemprop = node.getAttribute("itemprop");+ var bylineLength = node.textContent.trim().length;++ return (+ (rel === "author" ||+ (itemprop && itemprop.includes("author")) ||+ this.REGEXPS.byline.test(matchString)) &&+ !!bylineLength &&+ bylineLength < 100+ );+ },++ _getNodeAncestors(node, maxDepth) {+ maxDepth = maxDepth || 0;+ var i = 0,+ ancestors = [];+ while (node.parentNode) {+ ancestors.push(node.parentNode);+ if (maxDepth && ++i === maxDepth) {+ break;+ }+ node = node.parentNode;+ }+ return ancestors;+ },++ /***+ * grabArticle - Using a variety of metrics (content score, classname, element types), find the content that is+ * most likely to be the stuff a user wants to read. Then return it wrapped up in a div.+ *+ * @param page a document to run upon. Needs to be a full document, complete with body.+ * @return Element+ **/+ /* eslint-disable-next-line complexity */+ _grabArticle(page) {+ this.log("**** grabArticle ****");+ var doc = this._doc;+ var isPaging = page !== null;+ page = page ? page : this._doc.body;++ // We can't grab an article if we don't have a page!+ if (!page) {+ this.log("No body found in document. Abort.");+ return null;+ }++ var pageCacheHtml = page.innerHTML;++ while (true) {+ this.log("Starting grabArticle loop");+ var stripUnlikelyCandidates = this._flagIsActive(+ this.FLAG_STRIP_UNLIKELYS+ );++ // First, node prepping. Trash nodes that look cruddy (like ones with the+ // class name "comment", etc), and turn divs into P tags where they have been+ // used inappropriately (as in, where they contain no other block level elements.)+ var elementsToScore = [];+ var node = this._doc.documentElement;++ let shouldRemoveTitleHeader = true;++ while (node) {+ if (node.tagName === "HTML") {+ this._articleLang = node.getAttribute("lang");+ }++ var matchString = node.className + " " + node.id;++ if (!this._isProbablyVisible(node)) {+ this.log("Removing hidden node - " + matchString);+ node = this._removeAndGetNext(node);+ continue;+ }++ // User is not able to see elements applied with both "aria-modal = true" and "role = dialog"+ if (+ node.getAttribute("aria-modal") == "true" &&+ node.getAttribute("role") == "dialog"+ ) {+ node = this._removeAndGetNext(node);+ continue;+ }++ // If we don't have a byline yet check to see if this node is a byline; if it is store the byline and remove the node.+ if (+ !this._articleByline &&+ !this._metadata.byline &&+ this._isValidByline(node, matchString)+ ) {+ // Find child node matching [itemprop="name"] and use that if it exists for a more accurate author name byline+ var endOfSearchMarkerNode = this._getNextNode(node, true);+ var next = this._getNextNode(node);+ var itemPropNameNode = null;+ while (next && next != endOfSearchMarkerNode) {+ var itemprop = next.getAttribute("itemprop");+ if (itemprop && itemprop.includes("name")) {+ itemPropNameNode = next;+ break;+ } else {+ next = this._getNextNode(next);+ }+ }+ this._articleByline = (itemPropNameNode ?? node).textContent.trim();+ node = this._removeAndGetNext(node);+ continue;+ }++ if (shouldRemoveTitleHeader && this._headerDuplicatesTitle(node)) {+ this.log(+ "Removing header: ",+ node.textContent.trim(),+ this._articleTitle.trim()+ );+ shouldRemoveTitleHeader = false;+ node = this._removeAndGetNext(node);+ continue;+ }++ // Remove unlikely candidates+ if (stripUnlikelyCandidates) {+ if (+ this.REGEXPS.unlikelyCandidates.test(matchString) &&+ !this.REGEXPS.okMaybeItsACandidate.test(matchString) &&+ !this._hasAncestorTag(node, "table") &&+ !this._hasAncestorTag(node, "code") &&+ node.tagName !== "BODY" &&+ node.tagName !== "A"+ ) {+ this.log("Removing unlikely candidate - " + matchString);+ node = this._removeAndGetNext(node);+ continue;+ }++ if (this.UNLIKELY_ROLES.includes(node.getAttribute("role"))) {+ this.log(+ "Removing content with role " ++ node.getAttribute("role") ++ " - " ++ matchString+ );+ node = this._removeAndGetNext(node);+ continue;+ }+ }++ // Remove DIV, SECTION, and HEADER nodes without any content(e.g. text, image, video, or iframe).+ if (+ (node.tagName === "DIV" ||+ node.tagName === "SECTION" ||+ node.tagName === "HEADER" ||+ node.tagName === "H1" ||+ node.tagName === "H2" ||+ node.tagName === "H3" ||+ node.tagName === "H4" ||+ node.tagName === "H5" ||+ node.tagName === "H6") &&+ this._isElementWithoutContent(node)+ ) {+ node = this._removeAndGetNext(node);+ continue;+ }++ if (this.DEFAULT_TAGS_TO_SCORE.includes(node.tagName)) {+ elementsToScore.push(node);+ }++ // Turn all divs that don't have children block level elements into p's+ if (node.tagName === "DIV") {+ // Put phrasing content into paragraphs.+ var childNode = node.firstChild;+ while (childNode) {+ var nextSibling = childNode.nextSibling;+ if (this._isPhrasingContent(childNode)) {+ var fragment = doc.createDocumentFragment();+ // Collect all consecutive phrasing content into a fragment.+ do {+ nextSibling = childNode.nextSibling;+ fragment.appendChild(childNode);+ childNode = nextSibling;+ } while (childNode && this._isPhrasingContent(childNode));++ // Trim leading and trailing whitespace from the fragment.+ while (+ fragment.firstChild &&+ this._isWhitespace(fragment.firstChild)+ ) {+ fragment.firstChild.remove();+ }+ while (+ fragment.lastChild &&+ this._isWhitespace(fragment.lastChild)+ ) {+ fragment.lastChild.remove();+ }++ // If the fragment contains anything, wrap it in a paragraph and+ // insert it before the next non-phrasing node.+ if (fragment.firstChild) {+ var p = doc.createElement("p");+ p.appendChild(fragment);+ node.insertBefore(p, nextSibling);+ }+ }+ childNode = nextSibling;+ }++ // Sites like http://mobile.slate.com encloses each paragraph with a DIV+ // element. DIVs with only a P element inside and no text content can be+ // safely converted into plain P elements to avoid confusing the scoring+ // algorithm with DIVs with are, in practice, paragraphs.+ if (+ this._hasSingleTagInsideElement(node, "P") &&+ this._getLinkDensity(node) < 0.25+ ) {+ var newNode = node.children[0];+ node.parentNode.replaceChild(newNode, node);+ node = newNode;+ elementsToScore.push(node);+ } else if (!this._hasChildBlockElement(node)) {+ node = this._setNodeTag(node, "P");+ elementsToScore.push(node);+ }+ }+ node = this._getNextNode(node);+ }++ /**+ * Loop through all paragraphs, and assign a score to them based on how content-y they look.+ * Then add their score to their parent node.+ *+ * A score is determined by things like number of commas, class names, etc. Maybe eventually link density.+ **/+ var candidates = [];+ this._forEachNode(elementsToScore, function (elementToScore) {+ if (+ !elementToScore.parentNode ||+ typeof elementToScore.parentNode.tagName === "undefined"+ ) {+ return;+ }++ // If this paragraph is less than 25 characters, don't even count it.+ var innerText = this._getInnerText(elementToScore);+ if (innerText.length < 25) {+ return;+ }++ // Exclude nodes with no ancestor.+ var ancestors = this._getNodeAncestors(elementToScore, 5);+ if (ancestors.length === 0) {+ return;+ }++ var contentScore = 0;++ // Add a point for the paragraph itself as a base.+ contentScore += 1;++ // Add points for any commas within this paragraph.+ contentScore += innerText.split(this.REGEXPS.commas).length;++ // For every 100 characters in this paragraph, add another point. Up to 3 points.+ contentScore += Math.min(Math.floor(innerText.length / 100), 3);++ // Initialize and score ancestors.+ this._forEachNode(ancestors, function (ancestor, level) {+ if (+ !ancestor.tagName ||+ !ancestor.parentNode ||+ typeof ancestor.parentNode.tagName === "undefined"+ ) {+ return;+ }++ if (typeof ancestor.readability === "undefined") {+ this._initializeNode(ancestor);+ candidates.push(ancestor);+ }++ // Node score divider:+ // - parent: 1 (no division)+ // - grandparent: 2+ // - great grandparent+: ancestor level * 3+ if (level === 0) {+ var scoreDivider = 1;+ } else if (level === 1) {+ scoreDivider = 2;+ } else {+ scoreDivider = level * 3;+ }+ ancestor.readability.contentScore += contentScore / scoreDivider;+ });+ });++ // After we've calculated scores, loop through all of the possible+ // candidate nodes we found and find the one with the highest score.+ var topCandidates = [];+ for (var c = 0, cl = candidates.length; c < cl; c += 1) {+ var candidate = candidates[c];++ // Scale the final candidates score based on link density. Good content+ // should have a relatively small link density (5% or less) and be mostly+ // unaffected by this operation.+ var candidateScore =+ candidate.readability.contentScore *+ (1 - this._getLinkDensity(candidate));+ candidate.readability.contentScore = candidateScore;++ this.log("Candidate:", candidate, "with score " + candidateScore);++ for (var t = 0; t < this._nbTopCandidates; t++) {+ var aTopCandidate = topCandidates[t];++ if (+ !aTopCandidate ||+ candidateScore > aTopCandidate.readability.contentScore+ ) {+ topCandidates.splice(t, 0, candidate);+ if (topCandidates.length > this._nbTopCandidates) {+ topCandidates.pop();+ }+ break;+ }+ }+ }++ var topCandidate = topCandidates[0] || null;+ var neededToCreateTopCandidate = false;+ var parentOfTopCandidate;++ // If we still have no top candidate, just use the body as a last resort.+ // We also have to copy the body node so it is something we can modify.+ if (topCandidate === null || topCandidate.tagName === "BODY") {+ // Move all of the page's children into topCandidate+ topCandidate = doc.createElement("DIV");+ neededToCreateTopCandidate = true;+ // Move everything (not just elements, also text nodes etc.) into the container+ // so we even include text directly in the body:+ while (page.firstChild) {+ this.log("Moving child out:", page.firstChild);+ topCandidate.appendChild(page.firstChild);+ }++ page.appendChild(topCandidate);++ this._initializeNode(topCandidate);+ } else if (topCandidate) {+ // Find a better top candidate node if it contains (at least three) nodes which belong to `topCandidates` array+ // and whose scores are quite closed with current `topCandidate` node.+ var alternativeCandidateAncestors = [];+ for (var i = 1; i < topCandidates.length; i++) {+ if (+ topCandidates[i].readability.contentScore /+ topCandidate.readability.contentScore >=+ 0.75+ ) {+ alternativeCandidateAncestors.push(+ this._getNodeAncestors(topCandidates[i])+ );+ }+ }+ var MINIMUM_TOPCANDIDATES = 3;+ if (alternativeCandidateAncestors.length >= MINIMUM_TOPCANDIDATES) {+ parentOfTopCandidate = topCandidate.parentNode;+ while (parentOfTopCandidate.tagName !== "BODY") {+ var listsContainingThisAncestor = 0;+ for (+ var ancestorIndex = 0;+ ancestorIndex < alternativeCandidateAncestors.length &&+ listsContainingThisAncestor < MINIMUM_TOPCANDIDATES;+ ancestorIndex+++ ) {+ listsContainingThisAncestor += Number(+ alternativeCandidateAncestors[ancestorIndex].includes(+ parentOfTopCandidate+ )+ );+ }+ if (listsContainingThisAncestor >= MINIMUM_TOPCANDIDATES) {+ topCandidate = parentOfTopCandidate;+ break;+ }+ parentOfTopCandidate = parentOfTopCandidate.parentNode;+ }+ }+ if (!topCandidate.readability) {+ this._initializeNode(topCandidate);+ }++ // Because of our bonus system, parents of candidates might have scores+ // themselves. They get half of the node. There won't be nodes with higher+ // scores than our topCandidate, but if we see the score going *up* in the first+ // few steps up the tree, that's a decent sign that there might be more content+ // lurking in other places that we want to unify in. The sibling stuff+ // below does some of that - but only if we've looked high enough up the DOM+ // tree.+ parentOfTopCandidate = topCandidate.parentNode;+ var lastScore = topCandidate.readability.contentScore;+ // The scores shouldn't get too low.+ var scoreThreshold = lastScore / 3;+ while (parentOfTopCandidate.tagName !== "BODY") {+ if (!parentOfTopCandidate.readability) {+ parentOfTopCandidate = parentOfTopCandidate.parentNode;+ continue;+ }+ var parentScore = parentOfTopCandidate.readability.contentScore;+ if (parentScore < scoreThreshold) {+ break;+ }+ if (parentScore > lastScore) {+ // Alright! We found a better parent to use.+ topCandidate = parentOfTopCandidate;+ break;+ }+ lastScore = parentOfTopCandidate.readability.contentScore;+ parentOfTopCandidate = parentOfTopCandidate.parentNode;+ }++ // If the top candidate is the only child, use parent instead. This will help sibling+ // joining logic when adjacent content is actually located in parent's sibling node.+ parentOfTopCandidate = topCandidate.parentNode;+ while (+ parentOfTopCandidate.tagName != "BODY" &&+ parentOfTopCandidate.children.length == 1+ ) {+ topCandidate = parentOfTopCandidate;+ parentOfTopCandidate = topCandidate.parentNode;+ }+ if (!topCandidate.readability) {+ this._initializeNode(topCandidate);+ }+ }++ // Now that we have the top candidate, look through its siblings for content+ // that might also be related. Things like preambles, content split by ads+ // that we removed, etc.+ var articleContent = doc.createElement("DIV");+ if (isPaging) {+ articleContent.id = "readability-content";+ }++ var siblingScoreThreshold = Math.max(+ 10,+ topCandidate.readability.contentScore * 0.2+ );+ // Keep potential top candidate's parent node to try to get text direction of it later.+ parentOfTopCandidate = topCandidate.parentNode;+ var siblings = parentOfTopCandidate.children;++ for (var s = 0, sl = siblings.length; s < sl; s++) {+ var sibling = siblings[s];+ var append = false;++ this.log(+ "Looking at sibling node:",+ sibling,+ sibling.readability+ ? "with score " + sibling.readability.contentScore+ : ""+ );+ this.log(+ "Sibling has score",+ sibling.readability ? sibling.readability.contentScore : "Unknown"+ );++ if (sibling === topCandidate) {+ append = true;+ } else {+ var contentBonus = 0;++ // Give a bonus if sibling nodes and top candidates have the example same classname+ if (+ sibling.className === topCandidate.className &&+ topCandidate.className !== ""+ ) {+ contentBonus += topCandidate.readability.contentScore * 0.2;+ }++ if (+ sibling.readability &&+ sibling.readability.contentScore + contentBonus >=+ siblingScoreThreshold+ ) {+ append = true;+ } else if (sibling.nodeName === "P") {+ var linkDensity = this._getLinkDensity(sibling);+ var nodeContent = this._getInnerText(sibling);+ var nodeLength = nodeContent.length;++ if (nodeLength > 80 && linkDensity < 0.25) {+ append = true;+ } else if (+ nodeLength < 80 &&+ nodeLength > 0 &&+ linkDensity === 0 &&+ nodeContent.search(/\.( |$)/) !== -1+ ) {+ append = true;+ }+ }+ }++ if (append) {+ this.log("Appending node:", sibling);++ if (!this.ALTER_TO_DIV_EXCEPTIONS.includes(sibling.nodeName)) {+ // We have a node that isn't a common block level element, like a form or td tag.+ // Turn it into a div so it doesn't get filtered out later by accident.+ this.log("Altering sibling:", sibling, "to div.");++ sibling = this._setNodeTag(sibling, "DIV");+ }++ articleContent.appendChild(sibling);+ // Fetch children again to make it compatible+ // with DOM parsers without live collection support.+ siblings = parentOfTopCandidate.children;+ // siblings is a reference to the children array, and+ // sibling is removed from the array when we call appendChild().+ // As a result, we must revisit this index since the nodes+ // have been shifted.+ s -= 1;+ sl -= 1;+ }+ }++ if (this._debug) {+ this.log("Article content pre-prep: " + articleContent.innerHTML);+ }+ // So we have all of the content that we need. Now we clean it up for presentation.+ this._prepArticle(articleContent);+ if (this._debug) {+ this.log("Article content post-prep: " + articleContent.innerHTML);+ }++ if (neededToCreateTopCandidate) {+ // We already created a fake div thing, and there wouldn't have been any siblings left+ // for the previous loop, so there's no point trying to create a new div, and then+ // move all the children over. Just assign IDs and class names here. No need to append+ // because that already happened anyway.+ topCandidate.id = "readability-page-1";+ topCandidate.className = "page";+ } else {+ var div = doc.createElement("DIV");+ div.id = "readability-page-1";+ div.className = "page";+ while (articleContent.firstChild) {+ div.appendChild(articleContent.firstChild);+ }+ articleContent.appendChild(div);+ }++ if (this._debug) {+ this.log("Article content after paging: " + articleContent.innerHTML);+ }++ var parseSuccessful = true;++ // Now that we've gone through the full algorithm, check to see if+ // we got any meaningful content. If we didn't, we may need to re-run+ // grabArticle with different flags set. This gives us a higher likelihood of+ // finding the content, and the sieve approach gives us a higher likelihood of+ // finding the -right- content.+ var textLength = this._getInnerText(articleContent, true).length;+ if (textLength < this._charThreshold) {+ parseSuccessful = false;+ // eslint-disable-next-line no-unsanitized/property+ page.innerHTML = pageCacheHtml;++ this._attempts.push({+ articleContent,+ textLength,+ });++ if (this._flagIsActive(this.FLAG_STRIP_UNLIKELYS)) {+ this._removeFlag(this.FLAG_STRIP_UNLIKELYS);+ } else if (this._flagIsActive(this.FLAG_WEIGHT_CLASSES)) {+ this._removeFlag(this.FLAG_WEIGHT_CLASSES);+ } else if (this._flagIsActive(this.FLAG_CLEAN_CONDITIONALLY)) {+ this._removeFlag(this.FLAG_CLEAN_CONDITIONALLY);+ } else {+ // No luck after removing flags, just return the longest text we found during the different loops+ this._attempts.sort(function (a, b) {+ return b.textLength - a.textLength;+ });++ // But first check if we actually have something+ if (!this._attempts[0].textLength) {+ return null;+ }++ articleContent = this._attempts[0].articleContent;+ parseSuccessful = true;+ }+ }++ if (parseSuccessful) {+ // Find out text direction from ancestors of final top candidate.+ var ancestors = [parentOfTopCandidate, topCandidate].concat(+ this._getNodeAncestors(parentOfTopCandidate)+ );+ this._someNode(ancestors, function (ancestor) {+ if (!ancestor.tagName) {+ return false;+ }+ var articleDir = ancestor.getAttribute("dir");+ if (articleDir) {+ this._articleDir = articleDir;+ return true;+ }+ return false;+ });+ return articleContent;+ }+ }+ },++ /**+ * Converts some of the common HTML entities in string to their corresponding characters.+ *+ * @param str {string} - a string to unescape.+ * @return string without HTML entity.+ */+ _unescapeHtmlEntities(str) {+ if (!str) {+ return str;+ }++ var htmlEscapeMap = this.HTML_ESCAPE_MAP;+ return str+ .replace(/&(quot|amp|apos|lt|gt);/g, function (_, tag) {+ return htmlEscapeMap[tag];+ })+ .replace(/&#(?:x([0-9a-f]+)|([0-9]+));/gi, function (_, hex, numStr) {+ var num = parseInt(hex || numStr, hex ? 16 : 10);++ // these character references are replaced by a conforming HTML parser+ if (num == 0 || num > 0x10ffff || (num >= 0xd800 && num <= 0xdfff)) {+ num = 0xfffd;+ }++ return String.fromCodePoint(num);+ });+ },++ /**+ * Try to extract metadata from JSON-LD object.+ * For now, only Schema.org objects of type Article or its subtypes are supported.+ * @return Object with any metadata that could be extracted (possibly none)+ */+ _getJSONLD(doc) {+ var scripts = this._getAllNodesWithTag(doc, ["script"]);++ var metadata;++ this._forEachNode(scripts, function (jsonLdElement) {+ if (+ !metadata &&+ jsonLdElement.getAttribute("type") === "application/ld+json"+ ) {+ try {+ // Strip CDATA markers if present+ var content = jsonLdElement.textContent.replace(+ /^\s*<!\[CDATA\[|\]\]>\s*$/g,+ ""+ );+ var parsed = JSON.parse(content);++ if (Array.isArray(parsed)) {+ parsed = parsed.find(it => {+ return (+ it["@type"] &&+ it["@type"].match(this.REGEXPS.jsonLdArticleTypes)+ );+ });+ if (!parsed) {+ return;+ }+ }++ var schemaDotOrgRegex = /^https?\:\/\/schema\.org\/?$/;+ var matches =+ (typeof parsed["@context"] === "string" &&+ parsed["@context"].match(schemaDotOrgRegex)) ||+ (typeof parsed["@context"] === "object" &&+ typeof parsed["@context"]["@vocab"] == "string" &&+ parsed["@context"]["@vocab"].match(schemaDotOrgRegex));++ if (!matches) {+ return;+ }++ if (!parsed["@type"] && Array.isArray(parsed["@graph"])) {+ parsed = parsed["@graph"].find(it => {+ return (it["@type"] || "").match(this.REGEXPS.jsonLdArticleTypes);+ });+ }++ if (+ !parsed ||+ !parsed["@type"] ||+ !parsed["@type"].match(this.REGEXPS.jsonLdArticleTypes)+ ) {+ return;+ }++ metadata = {};++ if (+ typeof parsed.name === "string" &&+ typeof parsed.headline === "string" &&+ parsed.name !== parsed.headline+ ) {+ // we have both name and headline element in the JSON-LD. They should both be the same but some websites like aktualne.cz+ // put their own name into "name" and the article title to "headline" which confuses Readability. So we try to check if either+ // "name" or "headline" closely matches the html title, and if so, use that one. If not, then we use "name" by default.++ var title = this._getArticleTitle();+ var nameMatches = this._textSimilarity(parsed.name, title) > 0.75;+ var headlineMatches =+ this._textSimilarity(parsed.headline, title) > 0.75;++ if (headlineMatches && !nameMatches) {+ metadata.title = parsed.headline;+ } else {+ metadata.title = parsed.name;+ }+ } else if (typeof parsed.name === "string") {+ metadata.title = parsed.name.trim();+ } else if (typeof parsed.headline === "string") {+ metadata.title = parsed.headline.trim();+ }+ if (parsed.author) {+ if (typeof parsed.author.name === "string") {+ metadata.byline = parsed.author.name.trim();+ } else if (+ Array.isArray(parsed.author) &&+ parsed.author[0] &&+ typeof parsed.author[0].name === "string"+ ) {+ metadata.byline = parsed.author+ .filter(function (author) {+ return author && typeof author.name === "string";+ })+ .map(function (author) {+ return author.name.trim();+ })+ .join(", ");+ }+ }+ if (typeof parsed.description === "string") {+ metadata.excerpt = parsed.description.trim();+ }+ if (parsed.publisher && typeof parsed.publisher.name === "string") {+ metadata.siteName = parsed.publisher.name.trim();+ }+ if (typeof parsed.datePublished === "string") {+ metadata.datePublished = parsed.datePublished.trim();+ }+ } catch (err) {+ this.log(err.message);+ }+ }+ });+ return metadata ? metadata : {};+ },++ /**+ * Attempts to get excerpt and byline metadata for the article.+ *+ * @param {Object} jsonld — object containing any metadata that+ * could be extracted from JSON-LD object.+ *+ * @return Object with optional "excerpt" and "byline" properties+ */+ _getArticleMetadata(jsonld) {+ var metadata = {};+ var values = {};+ var metaElements = this._doc.getElementsByTagName("meta");++ // property is a space-separated list of values+ var propertyPattern =+ /\s*(article|dc|dcterm|og|twitter)\s*:\s*(author|creator|description|published_time|title|site_name)\s*/gi;++ // name is a single value+ var namePattern =+ /^\s*(?:(dc|dcterm|og|twitter|parsely|weibo:(article|webpage))\s*[-\.:]\s*)?(author|creator|pub-date|description|title|site_name)\s*$/i;++ // Find description tags.+ this._forEachNode(metaElements, function (element) {+ var elementName = element.getAttribute("name");+ var elementProperty = element.getAttribute("property");+ var content = element.getAttribute("content");+ if (!content) {+ return;+ }+ var matches = null;+ var name = null;++ if (elementProperty) {+ matches = elementProperty.match(propertyPattern);+ if (matches) {+ // Convert to lowercase, and remove any whitespace+ // so we can match below.+ name = matches[0].toLowerCase().replace(/\s/g, "");+ // multiple authors+ values[name] = content.trim();+ }+ }+ if (!matches && elementName && namePattern.test(elementName)) {+ name = elementName;+ if (content) {+ // Convert to lowercase, remove any whitespace, and convert dots+ // to colons so we can match below.+ name = name.toLowerCase().replace(/\s/g, "").replace(/\./g, ":");+ values[name] = content.trim();+ }+ }+ });++ // get title+ metadata.title =+ jsonld.title ||+ values["dc:title"] ||+ values["dcterm:title"] ||+ values["og:title"] ||+ values["weibo:article:title"] ||+ values["weibo:webpage:title"] ||+ values.title ||+ values["twitter:title"] ||+ values["parsely-title"];++ if (!metadata.title) {+ metadata.title = this._getArticleTitle();+ }++ const articleAuthor =+ typeof values["article:author"] === "string" &&+ !this._isUrl(values["article:author"])+ ? values["article:author"]+ : undefined;++ // get author+ metadata.byline =+ jsonld.byline ||+ values["dc:creator"] ||+ values["dcterm:creator"] ||+ values.author ||+ values["parsely-author"] ||+ articleAuthor;++ // get description+ metadata.excerpt =+ jsonld.excerpt ||+ values["dc:description"] ||+ values["dcterm:description"] ||+ values["og:description"] ||+ values["weibo:article:description"] ||+ values["weibo:webpage:description"] ||+ values.description ||+ values["twitter:description"];++ // get site name+ metadata.siteName = jsonld.siteName || values["og:site_name"];++ // get article published time+ metadata.publishedTime =+ jsonld.datePublished ||+ values["article:published_time"] ||+ values["parsely-pub-date"] ||+ null;++ // in many sites the meta value is escaped with HTML entities,+ // so here we need to unescape it+ metadata.title = this._unescapeHtmlEntities(metadata.title);+ metadata.byline = this._unescapeHtmlEntities(metadata.byline);+ metadata.excerpt = this._unescapeHtmlEntities(metadata.excerpt);+ metadata.siteName = this._unescapeHtmlEntities(metadata.siteName);+ metadata.publishedTime = this._unescapeHtmlEntities(metadata.publishedTime);++ return metadata;+ },++ /**+ * Check if node is image, or if node contains exactly only one image+ * whether as a direct child or as its descendants.+ *+ * @param Element+ **/+ _isSingleImage(node) {+ while (node) {+ if (node.tagName === "IMG") {+ return true;+ }+ if (node.children.length !== 1 || node.textContent.trim() !== "") {+ return false;+ }+ node = node.children[0];+ }+ return false;+ },++ /**+ * Find all <noscript> that are located after <img> nodes, and which contain only one+ * <img> element. Replace the first image with the image from inside the <noscript> tag,+ * and remove the <noscript> tag. This improves the quality of the images we use on+ * some sites (e.g. Medium).+ *+ * @param Element+ **/+ _unwrapNoscriptImages(doc) {+ // Find img without source or attributes that might contains image, and remove it.+ // This is done to prevent a placeholder img is replaced by img from noscript in next step.+ var imgs = Array.from(doc.getElementsByTagName("img"));+ this._forEachNode(imgs, function (img) {+ for (var i = 0; i < img.attributes.length; i++) {+ var attr = img.attributes[i];+ switch (attr.name) {+ case "src":+ case "srcset":+ case "data-src":+ case "data-srcset":+ return;+ }++ if (/\.(jpg|jpeg|png|webp)/i.test(attr.value)) {+ return;+ }+ }++ img.remove();+ });++ // Next find noscript and try to extract its image+ var noscripts = Array.from(doc.getElementsByTagName("noscript"));+ this._forEachNode(noscripts, function (noscript) {+ // Parse content of noscript and make sure it only contains image+ if (!this._isSingleImage(noscript)) {+ return;+ }+ var tmp = doc.createElement("div");+ // We're running in the document context, and using unmodified+ // document contents, so doing this should be safe.+ // (Also we heavily discourage people from allowing script to+ // run at all in this document...)+ // eslint-disable-next-line no-unsanitized/property+ tmp.innerHTML = noscript.innerHTML;++ // If noscript has previous sibling and it only contains image,+ // replace it with noscript content. However we also keep old+ // attributes that might contains image.+ var prevElement = noscript.previousElementSibling;+ if (prevElement && this._isSingleImage(prevElement)) {+ var prevImg = prevElement;+ if (prevImg.tagName !== "IMG") {+ prevImg = prevElement.getElementsByTagName("img")[0];+ }++ var newImg = tmp.getElementsByTagName("img")[0];+ for (var i = 0; i < prevImg.attributes.length; i++) {+ var attr = prevImg.attributes[i];+ if (attr.value === "") {+ continue;+ }++ if (+ attr.name === "src" ||+ attr.name === "srcset" ||+ /\.(jpg|jpeg|png|webp)/i.test(attr.value)+ ) {+ if (newImg.getAttribute(attr.name) === attr.value) {+ continue;+ }++ var attrName = attr.name;+ if (newImg.hasAttribute(attrName)) {+ attrName = "data-old-" + attrName;+ }++ newImg.setAttribute(attrName, attr.value);+ }+ }++ noscript.parentNode.replaceChild(tmp.firstElementChild, prevElement);+ }+ });+ },++ /**+ * Removes script tags from the document.+ *+ * @param Element+ **/+ _removeScripts(doc) {+ this._removeNodes(this._getAllNodesWithTag(doc, ["script", "noscript"]));+ },++ /**+ * Check if this node has only whitespace and a single element with given tag+ * Returns false if the DIV node contains non-empty text nodes+ * or if it contains no element with given tag or more than 1 element.+ *+ * @param Element+ * @param string tag of child element+ **/+ _hasSingleTagInsideElement(element, tag) {+ // There should be exactly 1 element child with given tag+ if (element.children.length != 1 || element.children[0].tagName !== tag) {+ return false;+ }++ // And there should be no text nodes with real content+ return !this._someNode(element.childNodes, function (node) {+ return (+ node.nodeType === this.TEXT_NODE &&+ this.REGEXPS.hasContent.test(node.textContent)+ );+ });+ },++ _isElementWithoutContent(node) {+ return (+ node.nodeType === this.ELEMENT_NODE &&+ !node.textContent.trim().length &&+ (!node.children.length ||+ node.children.length ==+ node.getElementsByTagName("br").length ++ node.getElementsByTagName("hr").length)+ );+ },++ /**+ * Determine whether element has any children block level elements.+ *+ * @param Element+ */+ _hasChildBlockElement(element) {+ return this._someNode(element.childNodes, function (node) {+ return (+ this.DIV_TO_P_ELEMS.has(node.tagName) ||+ this._hasChildBlockElement(node)+ );+ });+ },++ /***+ * Determine if a node qualifies as phrasing content.+ * https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/Content_categories#Phrasing_content+ **/+ _isPhrasingContent(node) {+ return (+ node.nodeType === this.TEXT_NODE ||+ this.PHRASING_ELEMS.includes(node.tagName) ||+ ((node.tagName === "A" ||+ node.tagName === "DEL" ||+ node.tagName === "INS") &&+ this._everyNode(node.childNodes, this._isPhrasingContent))+ );+ },++ _isWhitespace(node) {+ return (+ (node.nodeType === this.TEXT_NODE &&+ node.textContent.trim().length === 0) ||+ (node.nodeType === this.ELEMENT_NODE && node.tagName === "BR")+ );+ },++ /**+ * Get the inner text of a node - cross browser compatibly.+ * This also strips out any excess whitespace to be found.+ *+ * @param Element+ * @param Boolean normalizeSpaces (default: true)+ * @return string+ **/+ _getInnerText(e, normalizeSpaces) {+ normalizeSpaces =+ typeof normalizeSpaces === "undefined" ? true : normalizeSpaces;+ var textContent = e.textContent.trim();++ if (normalizeSpaces) {+ return textContent.replace(this.REGEXPS.normalize, " ");+ }+ return textContent;+ },++ /**+ * Get the number of times a string s appears in the node e.+ *+ * @param Element+ * @param string - what to split on. Default is ","+ * @return number (integer)+ **/+ _getCharCount(e, s) {+ s = s || ",";+ return this._getInnerText(e).split(s).length - 1;+ },++ /**+ * Remove the style attribute on every e and under.+ * TODO: Test if getElementsByTagName(*) is faster.+ *+ * @param Element+ * @return void+ **/+ _cleanStyles(e) {+ if (!e || e.tagName.toLowerCase() === "svg") {+ return;+ }++ // Remove `style` and deprecated presentational attributes+ for (var i = 0; i < this.PRESENTATIONAL_ATTRIBUTES.length; i++) {+ e.removeAttribute(this.PRESENTATIONAL_ATTRIBUTES[i]);+ }++ if (this.DEPRECATED_SIZE_ATTRIBUTE_ELEMS.includes(e.tagName)) {+ e.removeAttribute("width");+ e.removeAttribute("height");+ }++ var cur = e.firstElementChild;+ while (cur !== null) {+ this._cleanStyles(cur);+ cur = cur.nextElementSibling;+ }+ },++ /**+ * Get the density of links as a percentage of the content+ * This is the amount of text that is inside a link divided by the total text in the node.+ *+ * @param Element+ * @return number (float)+ **/+ _getLinkDensity(element) {+ var textLength = this._getInnerText(element).length;+ if (textLength === 0) {+ return 0;+ }++ var linkLength = 0;++ // XXX implement _reduceNodeList?+ this._forEachNode(element.getElementsByTagName("a"), function (linkNode) {+ var href = linkNode.getAttribute("href");+ var coefficient = href && this.REGEXPS.hashUrl.test(href) ? 0.3 : 1;+ linkLength += this._getInnerText(linkNode).length * coefficient;+ });++ return linkLength / textLength;+ },++ /**+ * Get an elements class/id weight. Uses regular expressions to tell if this+ * element looks good or bad.+ *+ * @param Element+ * @return number (Integer)+ **/+ _getClassWeight(e) {+ if (!this._flagIsActive(this.FLAG_WEIGHT_CLASSES)) {+ return 0;+ }++ var weight = 0;++ // Look for a special classname+ if (typeof e.className === "string" && e.className !== "") {+ if (this.REGEXPS.negative.test(e.className)) {+ weight -= 25;+ }++ if (this.REGEXPS.positive.test(e.className)) {+ weight += 25;+ }+ }++ // Look for a special ID+ if (typeof e.id === "string" && e.id !== "") {+ if (this.REGEXPS.negative.test(e.id)) {+ weight -= 25;+ }++ if (this.REGEXPS.positive.test(e.id)) {+ weight += 25;+ }+ }++ return weight;+ },++ /**+ * Clean a node of all elements of type "tag".+ * (Unless it's a youtube/vimeo video. People love movies.)+ *+ * @param Element+ * @param string tag to clean+ * @return void+ **/+ _clean(e, tag) {+ var isEmbed = ["object", "embed", "iframe"].includes(tag);++ this._removeNodes(this._getAllNodesWithTag(e, [tag]), function (element) {+ // Allow youtube and vimeo videos through as people usually want to see those.+ if (isEmbed) {+ // First, check the elements attributes to see if any of them contain youtube or vimeo+ for (var i = 0; i < element.attributes.length; i++) {+ if (this._allowedVideoRegex.test(element.attributes[i].value)) {+ return false;+ }+ }++ // For embed with <object> tag, check inner HTML as well.+ if (+ element.tagName === "object" &&+ this._allowedVideoRegex.test(element.innerHTML)+ ) {+ return false;+ }+ }++ return true;+ });+ },++ /**+ * Check if a given node has one of its ancestor tag name matching the+ * provided one.+ * @param HTMLElement node+ * @param String tagName+ * @param Number maxDepth+ * @param Function filterFn a filter to invoke to determine whether this node 'counts'+ * @return Boolean+ */+ _hasAncestorTag(node, tagName, maxDepth, filterFn) {+ maxDepth = maxDepth || 3;+ tagName = tagName.toUpperCase();+ var depth = 0;+ while (node.parentNode) {+ if (maxDepth > 0 && depth > maxDepth) {+ return false;+ }+ if (+ node.parentNode.tagName === tagName &&+ (!filterFn || filterFn(node.parentNode))+ ) {+ return true;+ }+ node = node.parentNode;+ depth++;+ }+ return false;+ },++ /**+ * Return an object indicating how many rows and columns this table has.+ */+ _getRowAndColumnCount(table) {+ var rows = 0;+ var columns = 0;+ var trs = table.getElementsByTagName("tr");+ for (var i = 0; i < trs.length; i++) {+ var rowspan = trs[i].getAttribute("rowspan") || 0;+ if (rowspan) {+ rowspan = parseInt(rowspan, 10);+ }+ rows += rowspan || 1;++ // Now look for column-related info+ var columnsInThisRow = 0;+ var cells = trs[i].getElementsByTagName("td");+ for (var j = 0; j < cells.length; j++) {+ var colspan = cells[j].getAttribute("colspan") || 0;+ if (colspan) {+ colspan = parseInt(colspan, 10);+ }+ columnsInThisRow += colspan || 1;+ }+ columns = Math.max(columns, columnsInThisRow);+ }+ return { rows, columns };+ },++ /**+ * Look for 'data' (as opposed to 'layout') tables, for which we use+ * similar checks as+ * https://searchfox.org/mozilla-central/rev/f82d5c549f046cb64ce5602bfd894b7ae807c8f8/accessible/generic/TableAccessible.cpp#19+ */+ _markDataTables(root) {+ var tables = root.getElementsByTagName("table");+ for (var i = 0; i < tables.length; i++) {+ var table = tables[i];+ var role = table.getAttribute("role");+ if (role == "presentation") {+ table._readabilityDataTable = false;+ continue;+ }+ var datatable = table.getAttribute("datatable");+ if (datatable == "0") {+ table._readabilityDataTable = false;+ continue;+ }+ var summary = table.getAttribute("summary");+ if (summary) {+ table._readabilityDataTable = true;+ continue;+ }++ var caption = table.getElementsByTagName("caption")[0];+ if (caption && caption.childNodes.length) {+ table._readabilityDataTable = true;+ continue;+ }++ // If the table has a descendant with any of these tags, consider a data table:+ var dataTableDescendants = ["col", "colgroup", "tfoot", "thead", "th"];+ var descendantExists = function (tag) {+ return !!table.getElementsByTagName(tag)[0];+ };+ if (dataTableDescendants.some(descendantExists)) {+ this.log("Data table because found data-y descendant");+ table._readabilityDataTable = true;+ continue;+ }++ // Nested tables indicate a layout table:+ if (table.getElementsByTagName("table")[0]) {+ table._readabilityDataTable = false;+ continue;+ }++ var sizeInfo = this._getRowAndColumnCount(table);++ if (sizeInfo.columns == 1 || sizeInfo.rows == 1) {+ // single colum/row tables are commonly used for page layout purposes.+ table._readabilityDataTable = false;+ continue;+ }++ if (sizeInfo.rows >= 10 || sizeInfo.columns > 4) {+ table._readabilityDataTable = true;+ continue;+ }+ // Now just go by size entirely:+ table._readabilityDataTable = sizeInfo.rows * sizeInfo.columns > 10;+ }+ },++ /* convert images and figures that have properties like data-src into images that can be loaded without JS */+ _fixLazyImages(root) {+ this._forEachNode(+ this._getAllNodesWithTag(root, ["img", "picture", "figure"]),+ function (elem) {+ // In some sites (e.g. Kotaku), they put 1px square image as base64 data uri in the src attribute.+ // So, here we check if the data uri is too short, just might as well remove it.+ if (elem.src && this.REGEXPS.b64DataUrl.test(elem.src)) {+ // Make sure it's not SVG, because SVG can have a meaningful image in under 133 bytes.+ var parts = this.REGEXPS.b64DataUrl.exec(elem.src);+ if (parts[1] === "image/svg+xml") {+ return;+ }++ // Make sure this element has other attributes which contains image.+ // If it doesn't, then this src is important and shouldn't be removed.+ var srcCouldBeRemoved = false;+ for (var i = 0; i < elem.attributes.length; i++) {+ var attr = elem.attributes[i];+ if (attr.name === "src") {+ continue;+ }++ if (/\.(jpg|jpeg|png|webp)/i.test(attr.value)) {+ srcCouldBeRemoved = true;+ break;+ }+ }++ // Here we assume if image is less than 100 bytes (or 133 after encoded to base64)+ // it will be too small, therefore it might be placeholder image.+ if (srcCouldBeRemoved) {+ var b64starts = parts[0].length;+ var b64length = elem.src.length - b64starts;+ if (b64length < 133) {+ elem.removeAttribute("src");+ }+ }+ }++ // also check for "null" to work around https://github.com/jsdom/jsdom/issues/2580+ if (+ (elem.src || (elem.srcset && elem.srcset != "null")) &&+ !elem.className.toLowerCase().includes("lazy")+ ) {+ return;+ }++ for (var j = 0; j < elem.attributes.length; j++) {+ attr = elem.attributes[j];+ if (+ attr.name === "src" ||+ attr.name === "srcset" ||+ attr.name === "alt"+ ) {+ continue;+ }+ var copyTo = null;+ if (/\.(jpg|jpeg|png|webp)\s+\d/.test(attr.value)) {+ copyTo = "srcset";+ } else if (/^\s*\S+\.(jpg|jpeg|png|webp)\S*\s*$/.test(attr.value)) {+ copyTo = "src";+ }+ if (copyTo) {+ //if this is an img or picture, set the attribute directly+ if (elem.tagName === "IMG" || elem.tagName === "PICTURE") {+ elem.setAttribute(copyTo, attr.value);+ } else if (+ elem.tagName === "FIGURE" &&+ !this._getAllNodesWithTag(elem, ["img", "picture"]).length+ ) {+ //if the item is a <figure> that does not contain an image or picture, create one and place it inside the figure+ //see the nytimes-3 testcase for an example+ var img = this._doc.createElement("img");+ img.setAttribute(copyTo, attr.value);+ elem.appendChild(img);+ }+ }+ }+ }+ );+ },++ _getTextDensity(e, tags) {+ var textLength = this._getInnerText(e, true).length;+ if (textLength === 0) {+ return 0;+ }+ var childrenLength = 0;+ var children = this._getAllNodesWithTag(e, tags);+ this._forEachNode(+ children,+ child => (childrenLength += this._getInnerText(child, true).length)+ );+ return childrenLength / textLength;+ },++ /**+ * Clean an element of all tags of type "tag" if they look fishy.+ * "Fishy" is an algorithm based on content length, classnames, link density, number of images & embeds, etc.+ *+ * @return void+ **/+ _cleanConditionally(e, tag) {+ if (!this._flagIsActive(this.FLAG_CLEAN_CONDITIONALLY)) {+ return;+ }++ // Gather counts for other typical elements embedded within.+ // Traverse backwards so we can remove nodes at the same time+ // without effecting the traversal.+ //+ // TODO: Consider taking into account original contentScore here.+ this._removeNodes(this._getAllNodesWithTag(e, [tag]), function (node) {+ // First check if this node IS data table, in which case don't remove it.+ var isDataTable = function (t) {+ return t._readabilityDataTable;+ };++ var isList = tag === "ul" || tag === "ol";+ if (!isList) {+ var listLength = 0;+ var listNodes = this._getAllNodesWithTag(node, ["ul", "ol"]);+ this._forEachNode(+ listNodes,+ list => (listLength += this._getInnerText(list).length)+ );+ isList = listLength / this._getInnerText(node).length > 0.9;+ }++ if (tag === "table" && isDataTable(node)) {+ return false;+ }++ // Next check if we're inside a data table, in which case don't remove it as well.+ if (this._hasAncestorTag(node, "table", -1, isDataTable)) {+ return false;+ }++ if (this._hasAncestorTag(node, "code")) {+ return false;+ }++ // keep element if it has a data tables+ if (+ [...node.getElementsByTagName("table")].some(+ tbl => tbl._readabilityDataTable+ )+ ) {+ return false;+ }++ var weight = this._getClassWeight(node);++ this.log("Cleaning Conditionally", node);++ var contentScore = 0;++ if (weight + contentScore < 0) {+ return true;+ }++ if (this._getCharCount(node, ",") < 10) {+ // If there are not very many commas, and the number of+ // non-paragraph elements is more than paragraphs or other+ // ominous signs, remove the element.+ var p = node.getElementsByTagName("p").length;+ var img = node.getElementsByTagName("img").length;+ var li = node.getElementsByTagName("li").length - 100;+ var input = node.getElementsByTagName("input").length;+ var headingDensity = this._getTextDensity(node, [+ "h1",+ "h2",+ "h3",+ "h4",+ "h5",+ "h6",+ ]);++ var embedCount = 0;+ var embeds = this._getAllNodesWithTag(node, [+ "object",+ "embed",+ "iframe",+ ]);++ for (var i = 0; i < embeds.length; i++) {+ // If this embed has attribute that matches video regex, don't delete it.+ for (var j = 0; j < embeds[i].attributes.length; j++) {+ if (this._allowedVideoRegex.test(embeds[i].attributes[j].value)) {+ return false;+ }+ }++ // For embed with <object> tag, check inner HTML as well.+ if (+ embeds[i].tagName === "object" &&+ this._allowedVideoRegex.test(embeds[i].innerHTML)+ ) {+ return false;+ }++ embedCount++;+ }++ var innerText = this._getInnerText(node);++ // toss any node whose inner text contains nothing but suspicious words+ if (+ this.REGEXPS.adWords.test(innerText) ||+ this.REGEXPS.loadingWords.test(innerText)+ ) {+ return true;+ }++ var contentLength = innerText.length;+ var linkDensity = this._getLinkDensity(node);+ var textishTags = ["SPAN", "LI", "TD"].concat(+ Array.from(this.DIV_TO_P_ELEMS)+ );+ var textDensity = this._getTextDensity(node, textishTags);+ var isFigureChild = this._hasAncestorTag(node, "figure");++ // apply shadiness checks, then check for exceptions+ const shouldRemoveNode = () => {+ const errs = [];+ if (!isFigureChild && img > 1 && p / img < 0.5) {+ errs.push(`Bad p to img ratio (img=${img}, p=${p})`);+ }+ if (!isList && li > p) {+ errs.push(`Too many li's outside of a list. (li=${li} > p=${p})`);+ }+ if (input > Math.floor(p / 3)) {+ errs.push(`Too many inputs per p. (input=${input}, p=${p})`);+ }+ if (+ !isList &&+ !isFigureChild &&+ headingDensity < 0.9 &&+ contentLength < 25 &&+ (img === 0 || img > 2) &&+ linkDensity > 0+ ) {+ errs.push(+ `Suspiciously short. (headingDensity=${headingDensity}, img=${img}, linkDensity=${linkDensity})`+ );+ }+ if (+ !isList &&+ weight < 25 &&+ linkDensity > 0.2 + this._linkDensityModifier+ ) {+ errs.push(+ `Low weight and a little linky. (linkDensity=${linkDensity})`+ );+ }+ if (weight >= 25 && linkDensity > 0.5 + this._linkDensityModifier) {+ errs.push(+ `High weight and mostly links. (linkDensity=${linkDensity})`+ );+ }+ if ((embedCount === 1 && contentLength < 75) || embedCount > 1) {+ errs.push(+ `Suspicious embed. (embedCount=${embedCount}, contentLength=${contentLength})`+ );+ }+ if (img === 0 && textDensity === 0) {+ errs.push(+ `No useful content. (img=${img}, textDensity=${textDensity})`+ );+ }++ if (errs.length) {+ this.log("Checks failed", errs);+ return true;+ }++ return false;+ };++ var haveToRemove = shouldRemoveNode();++ // Allow simple lists of images to remain in pages+ if (isList && haveToRemove) {+ for (var x = 0; x < node.children.length; x++) {+ let child = node.children[x];+ // Don't filter in lists with li's that contain more than one child+ if (child.children.length > 1) {+ return haveToRemove;+ }+ }+ let li_count = node.getElementsByTagName("li").length;+ // Only allow the list to remain if every li contains an image+ if (img == li_count) {+ return false;+ }+ }+ return haveToRemove;+ }+ return false;+ });+ },++ /**+ * Clean out elements that match the specified conditions+ *+ * @param Element+ * @param Function determines whether a node should be removed+ * @return void+ **/+ _cleanMatchedNodes(e, filter) {+ var endOfSearchMarkerNode = this._getNextNode(e, true);+ var next = this._getNextNode(e);+ while (next && next != endOfSearchMarkerNode) {+ if (filter.call(this, next, next.className + " " + next.id)) {+ next = this._removeAndGetNext(next);+ } else {+ next = this._getNextNode(next);+ }+ }+ },++ /**+ * Clean out spurious headers from an Element.+ *+ * @param Element+ * @return void+ **/+ _cleanHeaders(e) {+ let headingNodes = this._getAllNodesWithTag(e, ["h1", "h2"]);+ this._removeNodes(headingNodes, function (node) {+ let shouldRemove = this._getClassWeight(node) < 0;+ if (shouldRemove) {+ this.log("Removing header with low class weight:", node);+ }+ return shouldRemove;+ });+ },++ /**+ * Check if this node is an H1 or H2 element whose content is mostly+ * the same as the article title.+ *+ * @param Element the node to check.+ * @return boolean indicating whether this is a title-like header.+ */+ _headerDuplicatesTitle(node) {+ if (node.tagName != "H1" && node.tagName != "H2") {+ return false;+ }+ var heading = this._getInnerText(node, false);+ this.log("Evaluating similarity of header:", heading, this._articleTitle);+ return this._textSimilarity(this._articleTitle, heading) > 0.75;+ },++ _flagIsActive(flag) {+ return (this._flags & flag) > 0;+ },++ _removeFlag(flag) {+ this._flags = this._flags & ~flag;+ },++ _isProbablyVisible(node) {+ // Have to null-check node.style and node.className.includes to deal with SVG and MathML nodes.+ return (+ (!node.style || node.style.display != "none") &&+ (!node.style || node.style.visibility != "hidden") &&+ !node.hasAttribute("hidden") &&+ //check for "fallback-image" so that wikimedia math images are displayed+ (!node.hasAttribute("aria-hidden") ||+ node.getAttribute("aria-hidden") != "true" ||+ (node.className &&+ node.className.includes &&+ node.className.includes("fallback-image")))+ );+ },++ /**+ * Runs readability.+ *+ * Workflow:+ * 1. Prep the document by removing script tags, css, etc.+ * 2. Build readability's DOM tree.+ * 3. Grab the article content from the current dom tree.+ * 4. Replace the current DOM tree with the new one.+ * 5. Read peacefully.+ *+ * @return void+ **/+ parse() {+ // Avoid parsing too large documents, as per configuration option+ if (this._maxElemsToParse > 0) {+ var numTags = this._doc.getElementsByTagName("*").length;+ if (numTags > this._maxElemsToParse) {+ throw new Error(+ "Aborting parsing document; " + numTags + " elements found"+ );+ }+ }++ // Unwrap image from noscript+ this._unwrapNoscriptImages(this._doc);++ // Extract JSON-LD metadata before removing scripts+ var jsonLd = this._disableJSONLD ? {} : this._getJSONLD(this._doc);++ // Remove script tags from the document.+ this._removeScripts(this._doc);++ this._prepDocument();++ var metadata = this._getArticleMetadata(jsonLd);+ this._metadata = metadata;+ this._articleTitle = metadata.title;++ var articleContent = this._grabArticle();+ if (!articleContent) {+ return null;+ }++ this.log("Grabbed: " + articleContent.innerHTML);++ this._postProcessContent(articleContent);++ // If we haven't found an excerpt in the article's metadata, use the article's+ // first paragraph as the excerpt. This is used for displaying a preview of+ // the article's content.+ if (!metadata.excerpt) {+ var paragraphs = articleContent.getElementsByTagName("p");+ if (paragraphs.length) {+ metadata.excerpt = paragraphs[0].textContent.trim();+ }+ }++ var textContent = articleContent.textContent;+ return {+ title: this._articleTitle,+ byline: metadata.byline || this._articleByline,+ dir: this._articleDir,+ lang: this._articleLang,+ content: this._serializer(articleContent),+ textContent,+ length: textContent.length,+ excerpt: metadata.excerpt,+ siteName: metadata.siteName || this._articleSiteName,+ publishedTime: metadata.publishedTime,+ };+ },+};++if (typeof module === "object") {+ /* eslint-disable-next-line no-redeclare */+ /* global module */+ module.exports = Readability;+}diff --git a/OCR-translation/src/main/assets/adblock-cosmetic.js b/OCR-translation/src/main/assets/adblock-cosmetic.jsnew file mode 100644index 0000000..6428d2e--- /dev/null+++ b/OCR-translation/src/main/assets/adblock-cosmetic.js@@ -0,0 +1,376 @@+(function () {+ var config = window.__translatorAdblockConfig;+ if (!config) return;++ if (window.__translatorAdblockRuntime) {+ window.__translatorAdblockRuntime.configure(config);+ return;+ }++ var state = {+ config: config,+ jsInjected: false,+ validatedHideCss: null,+ pendingRun: false,+ observer: null,+ };++ var RUN_DELAY_MS = 120;++ // Wire format: length-prefixed records `<len>:<text><len>:<text>...`+ // (UTF-16 code-unit counts; matches Kotlin String.length on the bridge+ // side). Robust to any content, no escape work.+ function encodeWire(items) {+ var s = '';+ for (var i = 0; i < items.length; i++) {+ var t = items[i];+ s += t.length + ':' + t;+ }+ return s;+ }++ function decodeWire(s) {+ var items = [];+ var i = 0;+ while (i < s.length) {+ var colon = s.indexOf(':', i);+ if (colon < 0) return null;+ var len = parseInt(s.slice(i, colon), 10);+ if (!isFinite(len) || len < 0) return null;+ var start = colon + 1;+ var end = start + len;+ if (end > s.length) return null;+ items.push(s.slice(start, end));+ i = end;+ }+ return items;+ }++ function current() {+ return state.config || {};+ }++ function isValidSelector(selector) {+ try {+ document.querySelector(selector);+ return true;+ } catch (e) {+ return false;+ }+ }++ function buildCssText() {+ var cfg = current();+ if (state.validatedHideCss === null) {+ var valid = [];+ var invalid = 0;+ var selectors = cfg.hideSelectors || [];+ for (var i = 0; i < selectors.length; i++) {+ if (isValidSelector(selectors[i])) valid.push(selectors[i]);+ else invalid++;+ }+ state.validatedHideCss = valid.length+ ? valid.join(',\n') + ' { display: none !important; min-height: 0 !important; min-width: 0 !important; height: 0 !important; }\n'+ : '';+ if (invalid) console.log('[adblock] skipped invalid cosmetic selectors: ' + invalid);+ }+ return state.validatedHideCss + (cfg.baseCss || '');+ }++ function rootNode() {+ return document.head || document.documentElement || document.body;+ }++ function applyCss() {+ var root = rootNode();+ if (!root) return false;+ try {+ var css = buildCssText();+ if (css) {+ var existing = document.querySelector('style[data-adblock="1"]');+ if (!existing || !existing.isConnected || existing.parentNode !== root) {+ if (existing && !existing.isConnected) existing.remove();+ var s = document.createElement('style');+ s.setAttribute('data-adblock', '1');+ s.textContent = css;+ root.appendChild(s);+ } else if (existing.textContent !== css) {+ existing.textContent = css;+ }+ }+ injectScriptlet(root);+ return true;+ } catch (e) {+ console.warn('[adblock] cosmetic apply failed', e);+ return true;+ }+ }++ function injectScriptlet(root) {+ var js = current().injectedScript || '';+ if (!js || state.jsInjected) return;+ var sc = document.createElement('script');+ sc.setAttribute('data-adblock', '1');+ sc.textContent = js;+ root.appendChild(sc);+ sc.remove();+ state.jsInjected = true;+ }++ function opTask(op) {+ var arg = op.arg;+ switch (op.type) {+ case 'CssSelector':+ return function (nodes) {+ if (nodes === null) {+ try {+ return Array.prototype.slice.call(document.querySelectorAll(arg));+ } catch (e) {+ return [];+ }+ }+ var out = [];+ for (var i = 0; i < nodes.length; i++) {+ try {+ out.push.apply(out, nodes[i].querySelectorAll(arg));+ } catch (e) {}+ }+ return out;+ };+ case 'HasText':+ var re;+ if (arg && arg.length > 1 && arg.charAt(0) === '/' && arg.lastIndexOf('/') > 0) {+ var slash = arg.lastIndexOf('/');+ try {+ re = new RegExp(arg.slice(1, slash), arg.slice(slash + 1));+ } catch (e) {}+ }+ var literal = arg;+ return function (nodes) {+ return nodes.filter(function (n) {+ var t = n.textContent || '';+ return re ? re.test(t) : t.indexOf(literal) >= 0;+ });+ };+ case 'MatchesCss':+ case 'MatchesCssBefore':+ case 'MatchesCssAfter':+ var idx = arg.indexOf(':');+ if (idx < 0) return function () { return []; };+ var prop = arg.slice(0, idx).trim();+ var val = arg.slice(idx + 1).trim();+ var pseudo = op.type === 'MatchesCssBefore' ? '::before'+ : op.type === 'MatchesCssAfter' ? '::after' : null;+ return function (nodes) {+ return nodes.filter(function (n) {+ try {+ var cs = window.getComputedStyle(n, pseudo);+ return cs && cs.getPropertyValue(prop).trim() === val;+ } catch (e) {+ return false;+ }+ });+ };+ case 'Upward':+ var n = parseInt(arg, 10);+ if (!isNaN(n) && /^-?\d+$/.test(String(arg))) {+ return function (nodes) {+ var out = [];+ for (var i = 0; i < nodes.length; i++) {+ var p = nodes[i];+ for (var k = 0; k < n && p; k++) p = p.parentElement;+ if (p) out.push(p);+ }+ return out;+ };+ }+ return function (nodes) {+ var out = [];+ for (var i = 0; i < nodes.length; i++) {+ try {+ var anc = nodes[i].parentElement && nodes[i].parentElement.closest(arg);+ if (anc) out.push(anc);+ } catch (e) {}+ }+ return out;+ };+ default:+ return null;+ }+ }++ function compileFilter(filter) {+ var tasks = [];+ for (var i = 0; i < filter.selector.length; i++) {+ var t = opTask(filter.selector[i]);+ if (!t) return null;+ tasks.push(t);+ }+ return tasks;+ }++ function runFilter(filter) {+ var tasks = compileFilter(filter);+ if (!tasks) return;+ var nodes = null;+ for (var i = 0; i < tasks.length; i++) nodes = tasks[i](nodes);+ if (!nodes || nodes.length === 0) return;+ var action = filter.action;+ if (!action) {+ for (var j = 0; j < nodes.length; j++) nodes[j].setAttribute('data-adblock-hide', '1');+ return;+ }+ switch (action.type) {+ case 'Style':+ for (var j2 = 0; j2 < nodes.length; j2++) {+ try {+ nodes[j2].style.cssText += ';' + action.arg;+ } catch (e) {}+ }+ return;+ case 'Remove':+ for (var j3 = 0; j3 < nodes.length; j3++) {+ try {+ nodes[j3].remove();+ } catch (e) {}+ }+ return;+ case 'RemoveAttr':+ for (var j4 = 0; j4 < nodes.length; j4++) {+ try {+ nodes[j4].removeAttribute(action.arg);+ } catch (e) {}+ }+ return;+ case 'RemoveClass':+ for (var j5 = 0; j5 < nodes.length; j5++) {+ try {+ nodes[j5].classList.remove(action.arg);+ } catch (e) {}+ }+ return;+ }+ }++ function runProcedurals() {+ var procedurals = current().proceduralFilters || [];+ if (procedurals.length === 0) return;+ for (var i = 0; i < procedurals.length; i++) {+ var f;+ try {+ f = JSON.parse(procedurals[i]);+ } catch (e) {+ continue;+ }+ try {+ runFilter(f);+ } catch (e) {}+ }+ }++ function applyGeneric() {+ var cfg = current();+ if (cfg.generichide) return;+ var adblockBridge = window[cfg.adblockBridgeName];+ if (!adblockBridge) return;+ var classes = new Set();+ var ids = new Set();+ var els = document.getElementsByTagName('*');+ for (var i = 0; i < els.length; i++) {+ var el = els[i];+ if (el.id) ids.add(el.id);+ var cls = el.getAttribute && el.getAttribute('class');+ if (cls) {+ var parts = cls.split(/\s+/);+ for (var j = 0; j < parts.length; j++) {+ if (parts[j]) classes.add(parts[j]);+ }+ }+ }++ var resultPayload;+ try {+ resultPayload = adblockBridge.lookupGenericSelectors(+ encodeWire(Array.from(classes)),+ encodeWire(Array.from(ids)),+ encodeWire(cfg.exceptions || []),+ cfg.bridgeToken+ );+ } catch (e) {+ console.warn('[adblock] generic lookup failed', e);+ return;+ }++ var selectors = decodeWire(resultPayload || '');+ if (!selectors || selectors.length === 0) return;++ var style = document.querySelector('style[data-adblock-generic="1"]');+ if (!style) {+ style = document.createElement('style');+ style.setAttribute('data-adblock-generic', '1');+ (rootNode() || document.documentElement).appendChild(style);+ }+ style.textContent =+ selectors.join(',\n') ++ ' { display: none !important; min-height: 0 !important; min-width: 0 !important; height: 0 !important; }';+ }++ function runAll() {+ state.pendingRun = false;+ applyCss();+ runProcedurals();+ applyGeneric();+ }++ function scheduleRun(delay) {+ if (state.pendingRun) return;+ state.pendingRun = true;+ setTimeout(runAll, delay == null ? RUN_DELAY_MS : delay);+ }++ function setupObserver() {+ if (state.observer || !document.documentElement) return;+ state.observer = new MutationObserver(function () {+ scheduleRun();+ });+ state.observer.observe(document.documentElement, {+ childList: true,+ subtree: true,+ characterData: true,+ attributes: true,+ attributeFilter: ['class', 'id', 'style'],+ });+ }++ function ready(fn) {+ if (document.readyState === 'loading') {+ document.addEventListener('DOMContentLoaded', fn, { once: true });+ } else {+ fn();+ }+ }++ window.__translatorAdblockRuntime = {+ configure: function (nextConfig) {+ state.config = nextConfig || {};+ state.validatedHideCss = null;+ applyCss();+ setupObserver();+ scheduleRun(0);+ },+ };++ if (!applyCss()) {+ var tries = 0;+ var iv = setInterval(function () {+ tries++;+ if (applyCss() || tries > 50) clearInterval(iv);+ }, 20);+ }++ ready(function () {+ applyCss();+ setupObserver();+ scheduleRun(0);+ });+})();diff --git a/OCR-translation/src/main/assets/index_v6.json b/OCR-translation/src/main/assets/index_v6.jsonnew file mode 100644index 0000000..16011f3--- /dev/null+++ b/OCR-translation/src/main/assets/index_v6.json@@ -0,0 +1,13947 @@+{+ "formatVersion": 6,+ "generatedAt": 1788658816,+ "dictionaryVersion": 1,+ "sources": {+ "languageIndexVersion": 1,+ "languageIndexUpdatedAt": 1788658816,+ "dictionaryIndexVersion": 1,+ "dictionaryIndexUpdatedAt": 1784028791,+ "gcsModelsUrl": "https://storage.googleapis.com/moz-fx-translations-data--303e-prod-translations-data/db/models.json",+ "gcsModelsGenerated": "2026-06-18T01:48:57Z",+ "piperVoiceCount": 158+ },+ "languages": {+ "ar": {+ "meta": {+ "code": "ar",+ "name": "Arabic",+ "shortName": "Arabic",+ "script": "Arab"+ },+ "assets": {+ "translate": [+ "translate-ar-en",+ "translate-en-ar"+ ],+ "dictionary": "dict-ar",+ "ocr": {+ "ppocr": "ocr-ppocr-arabic"+ }+ },+ "tts": {+ "defaultRegion": "JO",+ "regions": {+ "JO": {+ "displayName": "Jordan",+ "voices": [+ "tts-piper-ar-jo-kareem-medium",+ "tts-piper-ar-jo-kareem-low"+ ]+ }+ },+ "sampleText": "قوس قزح ظاهرة جوية تنتج عن انعكاس الضوء وانكساره وتشتته في قطرات الماء، مما يؤدي إلى ظهور طيف من الألوان في السماء."+ }+ },+ "az": {+ "meta": {+ "code": "az",+ "name": "Azerbaijani",+ "shortName": "Azerbaijani",+ "script": "Latn"+ },+ "assets": {+ "translate": [+ "translate-az-en",+ "translate-en-az"+ ],+ "dictionary": "dict-az",+ "ocr": {+ "ppocr": "ocr-ppocr-latin"+ }+ },+ "tts": {+ "defaultRegion": "AZ",+ "regions": {+ "AZ": {+ "displayName": "Azerbaijan",+ "voices": [+ "tts-mms-az-az-north-latin-mms"+ ]+ }+ },+ "sampleText": "Göy qurşağı işığın su damcılarında əks olunması, sınması və səpilməsi nəticəsində yaranan meteoroloji hadisədir və bunun nəticəsində səmada işıq spektri görünür."+ }+ },+ "be": {+ "meta": {+ "code": "be",+ "name": "Belarusian",+ "shortName": "Belarusian",+ "script": "Cyrl"+ },+ "assets": {+ "translate": [+ "translate-be-en"+ ],+ "dictionary": "dict-be",+ "ocr": {+ "ppocr": "ocr-ppocr-eslav"+ }+ },+ "tts": {+ "defaultRegion": "BY",+ "regions": {+ "BY": {+ "displayName": "Belarus",+ "voices": [+ "tts-glowtts_hifigan-be-by-alex73-glowtts-hifigan"+ ]+ }+ },+ "sampleText": "Вясёлка — гэта метэаралагічная з'ява, выкліканая адлюстраваннем, праламленнем і рассейваннем святла ў кроплях вады, у выніку чаго ў небе з'яўляецца спектр святла."+ }+ },+ "bg": {+ "meta": {+ "code": "bg",+ "name": "Bulgarian",+ "shortName": "Bulgarian",+ "script": "Cyrl"+ },+ "assets": {+ "translate": [+ "translate-bg-en",+ "translate-en-bg"+ ],+ "dictionary": "dict-bg",+ "ocr": {+ "ppocr": "ocr-ppocr-cyrillic"+ }+ },+ "tts": {+ "defaultRegion": "BG",+ "regions": {+ "BG": {+ "displayName": "Bulgaria",+ "voices": [+ "tts-piper-bg-bg-dimitar-medium"+ ]+ }+ },+ "sampleText": "Дъгата е метеорологично явление, причинено от отражението, пречупването и разсейването на светлината във водните капки, в резултат на което в небето се появява светлинен спектър."+ }+ },+ "bn": {+ "meta": {+ "code": "bn",+ "name": "Bengali",+ "shortName": "Bengali",+ "script": "Beng"+ },+ "assets": {+ "translate": [+ "translate-bn-en",+ "translate-en-bn"+ ],+ "dictionary": "dict-bn",+ "ocr": {+ "ppocr": "ocr-ppocr-indic"+ }+ },+ "tts": {+ "defaultRegion": "IN",+ "regions": {+ "IN": {+ "displayName": "India",+ "voices": [+ "tts-mms-bn-in-standard-mms"+ ]+ }+ },+ "sampleText": "রামধনু একটি আবহাওয়াগত ঘটনা, যা পানির ফোঁটার মধ্যে আলোর প্রতিফলন, প্রতিসরণ এবং বিচ্ছুরণের ফলে সৃষ্টি হয়, যার কারণে আকাশে আলোর বর্ণালী দেখা যায়।"+ }+ },+ "bs": {+ "meta": {+ "code": "bs",+ "name": "Bosnian",+ "shortName": "Bosnian",+ "script": "Latn"+ },+ "assets": {+ "translate": [+ "translate-bs-en",+ "translate-en-bs"+ ],+ "dictionary": "dict-hr",+ "ocr": {+ "ppocr": "ocr-ppocr-latin"+ }+ },+ "tts": {+ "defaultRegion": "BA",+ "regions": {+ "BA": {+ "displayName": "Bosnia and Herzegovina",+ "voices": [+ "tts-coqui_vits-bs-ba-cv-coqui-vits"+ ]+ }+ },+ "sampleText": "Duga je meteorološka pojava nastala refleksijom, refrakcijom i disperzijom svjetlosti u kapljicama vode, zbog čega se na nebu pojavljuje spektar svjetlosti."+ }+ },+ "ca": {+ "meta": {+ "code": "ca",+ "name": "Catalan",+ "shortName": "Catalan",+ "script": "Latn"+ },+ "assets": {+ "translate": [+ "translate-ca-en",+ "translate-en-ca"+ ],+ "dictionary": "dict-ca",+ "ocr": {+ "ppocr": "ocr-ppocr-latin"+ }+ },+ "tts": {+ "defaultRegion": "ES",+ "regions": {+ "ES": {+ "displayName": "Spain",+ "voices": [+ "tts-piper-ca-es-upc-ona-medium",+ "tts-piper-ca-es-upc-ona-x-low",+ "tts-piper-ca-es-upc-pau-x-low"+ ]+ }+ },+ "sampleText": "L'arc de Sant Martí és un fenomen meteorològic causat per la reflexió, la refracció i la dispersió de la llum en les gotes d'aigua, fet que dona lloc a un espectre de llum al cel."+ }+ },+ "cs": {+ "meta": {+ "code": "cs",+ "name": "Czech",+ "shortName": "Czech",+ "script": "Latn"+ },+ "assets": {+ "translate": [+ "translate-cs-en",+ "translate-en-cs"+ ],+ "dictionary": "dict-cs",+ "ocr": {+ "ppocr": "ocr-ppocr-latin"+ }+ },+ "tts": {+ "defaultRegion": "CZ",+ "regions": {+ "CZ": {+ "displayName": "Czech Republic",+ "voices": [+ "tts-piper-cs-cz-jirka-medium",+ "tts-piper-cs-cz-jirka-low"+ ]+ }+ },+ "sampleText": "Duha je meteorologický jev způsobený odrazem, lomem a rozptylem světla ve vodních kapkách, v důsledku čehož se na obloze objeví spektrum světla."+ }+ },+ "da": {+ "meta": {+ "code": "da",+ "name": "Danish",+ "shortName": "Danish",+ "script": "Latn"+ },+ "assets": {+ "translate": [+ "translate-da-en",+ "translate-en-da"+ ],+ "dictionary": "dict-da",+ "ocr": {+ "ppocr": "ocr-ppocr-latin"+ }+ },+ "tts": {+ "defaultRegion": "DK",+ "regions": {+ "DK": {+ "displayName": "Denmark",+ "voices": [+ "tts-piper-da-dk-talesyntese-medium"+ ]+ }+ },+ "sampleText": "En regnbue er et meteorologisk fænomen, der skyldes refleksion, brydning og spredning af lys i vanddråber, hvilket får et lysspektrum til at vise sig på himlen."+ }+ },+ "de": {+ "meta": {+ "code": "de",+ "name": "German",+ "shortName": "German",+ "script": "Latn"+ },+ "assets": {+ "translate": [+ "translate-de-en",+ "translate-en-de"+ ],+ "dictionary": "dict-de",+ "ocr": {+ "ppocr": "ocr-ppocr-latin"+ }+ },+ "tts": {+ "defaultRegion": "DE",+ "regions": {+ "DE": {+ "displayName": "Germany",+ "voices": [+ "tts-piper-de-de-thorsten-medium",+ "tts-piper-de-de-glados-medium",+ "tts-piper-de-de-thorsten-emotional-medium",+ "tts-piper-de-de-karlsson-low"+ ]+ }+ },+ "sampleText": "Ein Regenbogen ist ein meteorologisches Phänomen, das durch Reflexion, Brechung und Streuung von Licht in Wassertropfen entsteht, wodurch ein Lichtspektrum am Himmel erscheint."+ }+ },+ "el": {+ "meta": {+ "code": "el",+ "name": "Greek",+ "shortName": "Greek",+ "script": "Grek"+ },+ "assets": {+ "translate": [+ "translate-el-en",+ "translate-en-el"+ ],+ "dictionary": "dict-el",+ "ocr": {+ "ppocr": "ocr-ppocr-el"+ }+ },+ "tts": {+ "defaultRegion": "GR",+ "regions": {+ "GR": {+ "displayName": "Greece",+ "voices": [+ "tts-piper-el-gr-rapunzelina-medium",+ "tts-piper-el-gr-rapunzelina-low"+ ]+ }+ },+ "sampleText": "Το ουράνιο τόξο είναι ένα μετεωρολογικό φαινόμενο που προκαλείται από την ανάκλαση, τη διάθλαση και τη διασπορά του φωτός στις σταγόνες νερού, με αποτέλεσμα να εμφανίζεται ένα φάσμα φωτός στον ουρανό."+ }+ },+ "en": {+ "meta": {+ "code": "en",+ "name": "English",+ "shortName": "English",+ "script": "Latn"+ },+ "assets": {+ "translate": [+ "translate-ar-en",+ "translate-az-en",+ "translate-be-en",+ "translate-bg-en",+ "translate-bn-en",+ "translate-bs-en",+ "translate-ca-en",+ "translate-cs-en",+ "translate-da-en",+ "translate-de-en",+ "translate-el-en",+ "translate-en-ar",+ "translate-en-az",+ "translate-en-bg",+ "translate-en-bn",+ "translate-en-bs",+ "translate-en-ca",+ "translate-en-cs",+ "translate-en-da",+ "translate-en-de",+ "translate-en-el",+ "translate-en-es",+ "translate-en-et",+ "translate-en-eu",+ "translate-en-fa",+ "translate-en-fi",+ "translate-en-fr",+ "translate-en-gl",+ "translate-en-gu",+ "translate-en-he",+ "translate-en-hi",+ "translate-en-hr",+ "translate-en-hu",+ "translate-en-id",+ "translate-en-is",+ "translate-en-it",+ "translate-en-ja",+ "translate-en-ka",+ "translate-en-kn",+ "translate-en-ko",+ "translate-en-lt",+ "translate-en-lv",+ "translate-en-ml",+ "translate-en-ms",+ "translate-en-nb",+ "translate-en-nl",+ "translate-en-no",+ "translate-en-pl",+ "translate-en-pt",+ "translate-en-ro",+ "translate-en-ru",+ "translate-en-sk",+ "translate-en-sl",+ "translate-en-sq",+ "translate-en-sr",+ "translate-en-sv",+ "translate-en-sw",+ "translate-en-ta",+ "translate-en-te",+ "translate-en-th",+ "translate-en-tl",+ "translate-en-tr",+ "translate-en-ug",+ "translate-en-uk",+ "translate-en-vi",+ "translate-en-zh",+ "translate-en-zh_hant",+ "translate-es-en",+ "translate-et-en",+ "translate-eu-en",+ "translate-fa-en",+ "translate-fi-en",+ "translate-fr-en",+ "translate-gl-en",+ "translate-gu-en",+ "translate-he-en",+ "translate-hi-en",+ "translate-hr-en",+ "translate-hu-en",+ "translate-id-en",+ "translate-is-en",+ "translate-it-en",+ "translate-ja-en",+ "translate-ka-en",+ "translate-kn-en",+ "translate-ko-en",+ "translate-lt-en",+ "translate-lv-en",+ "translate-ml-en",+ "translate-mr-en",+ "translate-ms-en",+ "translate-nb-en",+ "translate-nl-en",+ "translate-nn-en",+ "translate-no-en",+ "translate-pl-en",+ "translate-pt-en",+ "translate-ro-en",+ "translate-ru-en",+ "translate-sk-en",+ "translate-sl-en",+ "translate-sq-en",+ "translate-sr-en",+ "translate-sv-en",+ "translate-sw-en",+ "translate-ta-en",+ "translate-te-en",+ "translate-th-en",+ "translate-tl-en",+ "translate-tr-en",+ "translate-ug-en",+ "translate-uk-en",+ "translate-ur-en",+ "translate-vi-en",+ "translate-zh-en",+ "translate-zh_hant-en"+ ],+ "dictionary": "dict-en",+ "ocr": {+ "ppocr": "ocr-ppocr-latin"+ }+ },+ "tts": {+ "defaultRegion": "US",+ "regions": {+ "GB": {+ "displayName": "Great Britain",+ "voices": [+ "tts-piper-en-gb-alan-medium",+ "tts-piper-en-gb-alba-medium",+ "tts-piper-en-gb-jenny-dioco-medium",+ "tts-piper-en-gb-northern-english-male-medium"+ ]+ },+ "US": {+ "displayName": "United States",+ "voices": [+ "tts-piper-en-us-amy-medium",+ "tts-piper-en-us-hfc-female-medium",+ "tts-piper-en-us-hfc-male-medium",+ "tts-piper-en-us-joe-medium"+ ]+ }+ },+ "sampleText": "A rainbow is a meteorological phenomenon that is caused by reflection, refraction and dispersion of light in water droplets resulting in a spectrum of light appearing in the sky."+ }+ },+ "es": {+ "meta": {+ "code": "es",+ "name": "Spanish",+ "shortName": "Spanish",+ "script": "Latn"+ },+ "assets": {+ "translate": [+ "translate-en-es",+ "translate-es-en"+ ],+ "dictionary": "dict-es",+ "ocr": {+ "ppocr": "ocr-ppocr-latin"+ }+ },+ "tts": {+ "defaultRegion": "ES",+ "regions": {+ "AR": {+ "displayName": "Argentina",+ "voices": [+ "tts-piper-es-ar-daniela-high"+ ]+ },+ "ES": {+ "displayName": "Spain",+ "voices": [+ "tts-piper-es-es-davefx-medium",+ "tts-piper-es-es-sharvard-medium",+ "tts-piper-es-es-carlfm-x-low"+ ]+ },+ "MX": {+ "displayName": "Mexico",+ "voices": [+ "tts-piper-es-mx-ald-medium",+ "tts-piper-es-mx-claude-high"+ ]+ }+ },+ "sampleText": "El arcoíris es un fenómeno meteorológico causado por la reflexión, la refracción y la dispersión de la luz en las gotas de agua, lo que da lugar a un espectro de luz que aparece en el cielo."+ }+ },+ "et": {+ "meta": {+ "code": "et",+ "name": "Estonian",+ "shortName": "Estonian",+ "script": "Latn"+ },+ "assets": {+ "translate": [+ "translate-en-et",+ "translate-et-en"+ ],+ "dictionary": "dict-et",+ "ocr": {+ "ppocr": "ocr-ppocr-latin"+ }+ },+ "tts": {+ "defaultRegion": "EE",+ "regions": {+ "EE": {+ "displayName": "Estonia",+ "voices": [+ "tts-coqui_vits-et-ee-cv-coqui-vits"+ ]+ }+ },+ "sampleText": "Vikerkaar on meteoroloogiline nähtus, mis tekib valguse peegeldumise, murdumise ja hajumise tõttu veepiiskades, mille tulemusena ilmub taevasse valgusspekter."+ }+ },+ "eu": {+ "meta": {+ "code": "eu",+ "name": "Basque",+ "shortName": "Basque",+ "script": "Latn"+ },+ "assets": {+ "translate": [+ "translate-en-eu",+ "translate-eu-en"+ ],+ "dictionary": "dict-eu",+ "ocr": {+ "ppocr": "ocr-ppocr-latin"+ }+ },+ "tts": {+ "defaultRegion": "ES",+ "regions": {+ "ES": {+ "displayName": "Spain",+ "voices": [+ "tts-piper-eu-es-antton-medium",+ "tts-piper-eu-es-maider-medium"+ ]+ }+ },+ "sampleText": "Ostadarra fenomeno meteorologiko bat da, argiaren islapenak, errefrakzioak eta sakabanaketak ur tantetan eragiten dutena, eta horren ondorioz argi-espektro bat agertzen da zeruan."+ }+ },+ "fa": {+ "meta": {+ "code": "fa",+ "name": "Persian",+ "shortName": "Persian",+ "script": "Arab"+ },+ "assets": {+ "translate": [+ "translate-en-fa",+ "translate-fa-en"+ ],+ "dictionary": "dict-fa",+ "ocr": {+ "ppocr": "ocr-ppocr-arabic"+ }+ },+ "tts": {+ "defaultRegion": "IR",+ "regions": {+ "IR": {+ "displayName": "Iran",+ "voices": [+ "tts-piper-fa-ir-gyro-medium",+ "tts-piper-fa-ir-reza-ibrahim-medium",+ "tts-piper-fa-ir-ganji-medium",+ "tts-piper-fa-ir-ganji-adabi-medium"+ ]+ }+ },+ "sampleText": "رنگینکمان یک پدیدهٔ هواشناسی است که بر اثر بازتاب، شکست و پراکندگی نور در قطرههای آب ایجاد میشود و در نتیجه طیفی از نور در آسمان دیده میشود."+ }+ },+ "fi": {+ "meta": {+ "code": "fi",+ "name": "Finnish",+ "shortName": "Finnish",+ "script": "Latn"+ },+ "assets": {+ "translate": [+ "translate-en-fi",+ "translate-fi-en"+ ],+ "dictionary": "dict-fi",+ "ocr": {+ "ppocr": "ocr-ppocr-latin"+ }+ },+ "tts": {+ "defaultRegion": "FI",+ "regions": {+ "FI": {+ "displayName": "Finland",+ "voices": [+ "tts-piper-fi-fi-harri-medium",+ "tts-piper-fi-fi-harri-low"+ ]+ }+ },+ "sampleText": "Sateenkaari on meteorologinen ilmiö, joka syntyy valon heijastumisesta, taittumisesta ja hajoamisesta vesipisaroissa, minkä seurauksena taivaalle ilmestyy valon spektri."+ }+ },+ "fr": {+ "meta": {+ "code": "fr",+ "name": "French",+ "shortName": "French",+ "script": "Latn"+ },+ "assets": {+ "translate": [+ "translate-en-fr",+ "translate-fr-en"+ ],+ "dictionary": "dict-fr",+ "ocr": {+ "ppocr": "ocr-ppocr-latin"+ }+ },+ "tts": {+ "defaultRegion": "FR",+ "regions": {+ "FR": {+ "displayName": "France",+ "voices": [+ "tts-piper-fr-fr-siwis-medium",+ "tts-piper-fr-fr-tom-medium",+ "tts-piper-fr-fr-upmc-medium",+ "tts-piper-fr-fr-mls-medium"+ ]+ }+ },+ "sampleText": "Un arc-en-ciel est un phénomène météorologique causé par la réflexion, la réfraction et la dispersion de la lumière dans les gouttelettes d'eau, ce qui fait apparaître un spectre lumineux dans le ciel."+ }+ },+ "gl": {+ "meta": {+ "code": "gl",+ "name": "Galician",+ "shortName": "Galician",+ "script": "Latn"+ },+ "assets": {+ "translate": [+ "translate-en-gl",+ "translate-gl-en"+ ],+ "dictionary": "dict-gl",+ "ocr": {+ "ppocr": "ocr-ppocr-latin"+ }+ },+ "tts": {+ "defaultRegion": "ES",+ "regions": {+ "ES": {+ "displayName": "Spain",+ "voices": [+ "tts-cotovia_vits-gl-es-sabela-cotovia-vits",+ "tts-cotovia_vits-gl-es-brais-cotovia-vits",+ "tts-cotovia_vits-gl-es-iago-cotovia-vits",+ "tts-cotovia_vits-gl-es-icia-cotovia-vits",+ "tts-cotovia_vits-gl-es-paulo-cotovia-vits"+ ]+ }+ },+ "sampleText": "O arco da vella é un fenómeno meteorolóxico causado pola reflexión, refracción e dispersión da luz nas pingas de auga, o que produce un espectro de luz que aparece no ceo."+ }+ },+ "gu": {+ "meta": {+ "code": "gu",+ "name": "Gujarati",+ "shortName": "Gujarati",+ "script": "Gujr"+ },+ "assets": {+ "translate": [+ "translate-en-gu",+ "translate-gu-en"+ ],+ "dictionary": "dict-gu",+ "ocr": {+ "ppocr": "ocr-ppocr-indic"+ }+ },+ "tts": {+ "defaultRegion": "IN",+ "regions": {+ "IN": {+ "displayName": "India",+ "voices": [+ "tts-mms-gu-in-standard-mms"+ ]+ }+ },+ "sampleText": "ઇન્દ્રધનુષ એક હવામાન સંબંધિત ઘટના છે, જે પાણીના ટીપાંમાં પ્રકાશના પ્રતિબિંબ, અપવર્તન અને વિખેરાણથી બને છે, જેના પરિણામે આકાશમાં પ્રકાશનું વર્ણપટ દેખાય છે."+ }+ },+ "he": {+ "meta": {+ "code": "he",+ "name": "Hebrew",+ "shortName": "Hebrew",+ "script": "Hebr"+ },+ "assets": {+ "translate": [+ "translate-en-he",+ "translate-he-en"+ ],+ "dictionary": "dict-he",+ "ocr": {+ "ppocr": "ocr-ppocr-hebrew"+ }+ },+ "tts": {+ "defaultRegion": "IL",+ "regions": {+ "IL": {+ "displayName": "Israel",+ "voices": [+ "tts-mms-he-il-standard-mms"+ ]+ }+ },+ "sampleText": "קשת בענן היא תופעה מטאורולוגית שנגרמת מהחזרה, שבירה ופיזור של אור בטיפות מים, וכתוצאה מכך מופיע בשמיים ספקטרום של אור."+ }+ },+ "hi": {+ "meta": {+ "code": "hi",+ "name": "Hindi",+ "shortName": "Hindi",+ "script": "Deva"+ },+ "assets": {+ "translate": [+ "translate-en-hi",+ "translate-hi-en"+ ],+ "dictionary": "dict-hi",+ "ocr": {+ "ppocr": "ocr-ppocr-devanagari"+ }+ },+ "tts": {+ "defaultRegion": "IN",+ "regions": {+ "IN": {+ "displayName": "India",+ "voices": [+ "tts-piper-hi-in-rohan-medium",+ "tts-piper-hi-in-pratham-medium",+ "tts-piper-hi-in-priyamvada-medium"+ ]+ }+ },+ "sampleText": "इंद्रधनुष एक मौसम संबंधी घटना है, जो पानी की बूंदों में प्रकाश के परावर्तन, अपवर्तन और प्रकीर्णन से बनती है, जिसके परिणामस्वरूप आकाश में प्रकाश का एक वर्णक्रम दिखाई देता है।"+ }+ },+ "hr": {+ "meta": {+ "code": "hr",+ "name": "Croatian",+ "shortName": "Croatian",+ "script": "Latn"+ },+ "assets": {+ "translate": [+ "translate-en-hr",+ "translate-hr-en"+ ],+ "dictionary": "dict-hr",+ "ocr": {+ "ppocr": "ocr-ppocr-latin"+ }+ },+ "tts": {+ "defaultRegion": "HR",+ "regions": {+ "HR": {+ "displayName": "Croatia",+ "voices": [+ "tts-coqui_vits-hr-hr-cv-coqui-vits"+ ]+ }+ },+ "sampleText": "Duga je meteorološka pojava uzrokovana refleksijom, lomom i raspršenjem svjetlosti u kapljicama vode, zbog čega se na nebu pojavljuje spektar svjetlosti."+ }+ },+ "hu": {+ "meta": {+ "code": "hu",+ "name": "Hungarian",+ "shortName": "Hungarian",+ "script": "Latn"+ },+ "assets": {+ "translate": [+ "translate-en-hu",+ "translate-hu-en"+ ],+ "dictionary": "dict-hu",+ "ocr": {+ "ppocr": "ocr-ppocr-latin"+ }+ },+ "tts": {+ "defaultRegion": "HU",+ "regions": {+ "HU": {+ "displayName": "Hungary",+ "voices": [+ "tts-piper-hu-hu-anna-medium",+ "tts-piper-hu-hu-berta-medium",+ "tts-piper-hu-hu-imre-medium"+ ]+ }+ },+ "sampleText": "A szivárvány egy meteorológiai jelenség, amelyet a fény visszaverődése, törése és szóródása okoz a vízcseppekben, aminek eredményeként fényspektrum jelenik meg az égen."+ }+ },+ "id": {+ "meta": {+ "code": "id",+ "name": "Indonesian",+ "shortName": "Indonesian",+ "script": "Latn"+ },+ "assets": {+ "translate": [+ "translate-en-id",+ "translate-id-en"+ ],+ "dictionary": "dict-id",+ "ocr": {+ "ppocr": "ocr-ppocr-latin"+ }+ },+ "tts": {+ "defaultRegion": "ID",+ "regions": {+ "ID": {+ "displayName": "Indonesia",+ "voices": [+ "tts-piper-id-id-news-tts-medium"+ ]+ }+ },+ "sampleText": "Pelangi adalah fenomena meteorologis yang disebabkan oleh pemantulan, pembiasan, dan dispersi cahaya di dalam tetesan air, sehingga spektrum cahaya tampak di langit."+ }+ },+ "is": {+ "meta": {+ "code": "is",+ "name": "Icelandic",+ "shortName": "Icelandic",+ "script": "Latn"+ },+ "assets": {+ "translate": [+ "translate-en-is",+ "translate-is-en"+ ],+ "dictionary": "dict-is",+ "ocr": {+ "ppocr": "ocr-ppocr-latin"+ }+ },+ "tts": {+ "defaultRegion": "IS",+ "regions": {+ "IS": {+ "displayName": "Iceland",+ "voices": [+ "tts-piper-is-is-bui-medium",+ "tts-piper-is-is-salka-medium",+ "tts-piper-is-is-steinn-medium",+ "tts-piper-is-is-ugla-medium"+ ]+ }+ },+ "sampleText": "Regnbogi er veðurfræðilegt fyrirbæri sem verður til við endurkast, ljósbrot og dreifingu ljóss í vatnsdropum, sem leiðir til þess að litróf birtist á himninum."+ }+ },+ "it": {+ "meta": {+ "code": "it",+ "name": "Italian",+ "shortName": "Italian",+ "script": "Latn"+ },+ "assets": {+ "translate": [+ "translate-en-it",+ "translate-it-en"+ ],+ "dictionary": "dict-it",+ "ocr": {+ "ppocr": "ocr-ppocr-latin"+ }+ },+ "tts": {+ "defaultRegion": "IT",+ "regions": {+ "IT": {+ "displayName": "Italy",+ "voices": [+ "tts-piper-it-it-paola-medium",+ "tts-piper-it-it-riccardo-x-low"+ ]+ }+ },+ "sampleText": "L'arcobaleno è un fenomeno meteorologico causato dalla riflessione, dalla rifrazione e dalla dispersione della luce nelle gocce d'acqua, con il risultato che nel cielo appare uno spettro di luce."+ }+ },+ "ja": {+ "meta": {+ "code": "ja",+ "name": "Japanese",+ "shortName": "Japanese",+ "script": "Jpan"+ },+ "assets": {+ "translate": [+ "translate-en-ja",+ "translate-ja-en"+ ],+ "support": [+ "support-ja-mucab"+ ],+ "dictionary": "dict-ja",+ "ocr": {+ "ppocr": "ocr-ppocr-cj"+ }+ },+ "tts": {+ "defaultRegion": "JP",+ "regions": {+ "JP": {+ "displayName": "Japan",+ "voices": [+ "tts-kokoro_mnn-ja-jp-jf-alpha-kokoro-mnn-v1.0"+ ]+ }+ },+ "sampleText": "虹は、水滴の中で光が反射、屈折、分散することによって生じ、空に光のスペクトルが現れる気象現象です。"+ }+ },+ "ka": {+ "meta": {+ "code": "ka",+ "name": "Georgian",+ "shortName": "Georgian",+ "script": "Geor"+ },+ "assets": {+ "translate": [+ "translate-en-ka",+ "translate-ka-en"+ ],+ "ocr": {+ "ppocr": "ocr-ppocr-georgian"+ }+ },+ "tts": {+ "defaultRegion": "GE",+ "regions": {+ "GE": {+ "displayName": "Georgia",+ "voices": [+ "tts-piper-ka-ge-natia-medium"+ ]+ }+ },+ "sampleText": "ცისარტყელა არის მეტეოროლოგიური მოვლენა, რომელიც გამოწვეულია წყლის წვეთებში სინათლის არეკვლით, გარდატეხითა და დისპერსიით, რის შედეგადაც ცაზე ჩნდება სინათლის სპექტრი."+ }+ },+ "kn": {+ "meta": {+ "code": "kn",+ "name": "Kannada",+ "shortName": "Kannada",+ "script": "Knda"+ },+ "assets": {+ "translate": [+ "translate-en-kn",+ "translate-kn-en"+ ],+ "dictionary": "dict-kn",+ "ocr": {+ "ppocr": "ocr-ppocr-indic"+ }+ },+ "tts": {+ "defaultRegion": "IN",+ "regions": {+ "IN": {+ "displayName": "India",+ "voices": [+ "tts-mms-kn-in-standard-mms"+ ]+ }+ },+ "sampleText": "ಇಂದ್ರಧನುಷ್ ಒಂದು ಹವಾಮಾನ ಸಂಬಂಧಿತ ಪ್ರಕೃತಿ ಘಟನೆ; ಇದು ನೀರಿನ ಹನಿಗಳಲ್ಲಿನ ಬೆಳಕಿನ ಪ್ರತಿಫಲನ, ಅಪವर्तन ಮತ್ತು ಚದುರಿಕೆಯಿಂದ ಉಂಟಾಗಿ ಆಕಾಶದಲ್ಲಿ ಬೆಳಕಿನ ವರ್ಣಪಟ ಕಾಣಿಸುತ್ತದೆ。"+ }+ },+ "ko": {+ "meta": {+ "code": "ko",+ "name": "Korean",+ "shortName": "Korean",+ "script": "Hang"+ },+ "assets": {+ "translate": [+ "translate-en-ko",+ "translate-ko-en"+ ],+ "dictionary": "dict-ko",+ "ocr": {+ "ppocr": "ocr-ppocr-korean"+ }+ },+ "tts": {+ "defaultRegion": "KR",+ "regions": {+ "KR": {+ "displayName": "South Korea",+ "voices": [+ "tts-mimic3-ko-ko-kss-low",+ "tts-kokoro_mnn-ko-kr-jf-alpha-kokoro-mnn-v1.0"+ ]+ }+ },+ "sampleText": "무지개는 물방울 속에서 빛이 반사되고 굴절되며 분산되어 하늘에 빛의 스펙트럼이 나타나는 기상 현상입니다."+ }+ },+ "lt": {+ "meta": {+ "code": "lt",+ "name": "Lithuanian",+ "shortName": "Lithuanian",+ "script": "Latn"+ },+ "assets": {+ "translate": [+ "translate-en-lt",+ "translate-lt-en"+ ],+ "dictionary": "dict-lt",+ "ocr": {+ "ppocr": "ocr-ppocr-latin"+ }+ },+ "tts": {+ "defaultRegion": "LT",+ "regions": {+ "LT": {+ "displayName": "Lithuania",+ "voices": [+ "tts-coqui_vits-lt-lt-cv-coqui-vits"+ ]+ }+ },+ "sampleText": "Vaivorykštė yra meteorologinis reiškinys, kurį sukelia šviesos atspindys, lūžis ir sklaida vandens lašeliuose, todėl danguje pasirodo šviesos spektras."+ }+ },+ "lv": {+ "meta": {+ "code": "lv",+ "name": "Latvian",+ "shortName": "Latvian",+ "script": "Latn"+ },+ "assets": {+ "translate": [+ "translate-en-lv",+ "translate-lv-en"+ ],+ "dictionary": "dict-lv",+ "ocr": {+ "ppocr": "ocr-ppocr-latin"+ }+ },+ "tts": {+ "defaultRegion": "LV",+ "regions": {+ "LV": {+ "displayName": "Latvia",+ "voices": [+ "tts-piper-lv-lv-aivars-medium"+ ]+ }+ },+ "sampleText": "Varavīksne ir meteoroloģiska parādība, ko izraisa gaismas atstarošanās, laušana un izkliede ūdens pilienos, kā rezultātā debesīs parādās gaismas spektrs."+ }+ },+ "ml": {+ "meta": {+ "code": "ml",+ "name": "Malayalam",+ "shortName": "Malayalam",+ "script": "Mlym"+ },+ "assets": {+ "translate": [+ "translate-en-ml",+ "translate-ml-en"+ ],+ "dictionary": "dict-ml",+ "ocr": {+ "ppocr": "ocr-ppocr-indic"+ }+ },+ "tts": {+ "defaultRegion": "IN",+ "regions": {+ "IN": {+ "displayName": "India",+ "voices": [+ "tts-piper-ml-in-arjun-medium",+ "tts-piper-ml-in-meera-medium"+ ]+ }+ },+ "sampleText": "മഴവില്ല് ഒരു കാലാവസ്ഥാ പ്രതിഭാസമാണ്; ജലത്തുള്ളികളിലെ പ്രകാശത്തിന്റെ പ്രതിഫലനം, പ്രതിസരണം, ചിതറൽ എന്നിവ മൂലം ആകാശത്തിൽ പ്രകാശത്തിന്റെ വർണ്ണപടലം പ്രത്യക്ഷപ്പെടുന്നു."+ }+ },+ "mr": {+ "meta": {+ "code": "mr",+ "name": "Marathi",+ "shortName": "Marathi",+ "script": "Deva"+ },+ "assets": {+ "translate": [+ "translate-mr-en"+ ],+ "dictionary": "dict-mr",+ "ocr": {+ "ppocr": "ocr-ppocr-devanagari"+ }+ },+ "tts": {+ "defaultRegion": "IN",+ "regions": {+ "IN": {+ "displayName": "India",+ "voices": [+ "tts-mms-mr-in-standard-mms"+ ]+ }+ },+ "sampleText": "इंद्रधनुष्य ही एक हवामानशास्त्रीय घटना आहे, जी पाण्याच्या थेंबांमध्ये प्रकाशाचे परावर्तन, अपवर्तन आणि विकिरण यांमुळे निर्माण होते, ज्यामुळे आकाशात प्रकाशाचा वर्णपट दिसतो."+ }+ },+ "ms": {+ "meta": {+ "code": "ms",+ "name": "Malay",+ "shortName": "Malay",+ "script": "Latn"+ },+ "assets": {+ "translate": [+ "translate-en-ms",+ "translate-ms-en"+ ],+ "dictionary": "dict-ms",+ "ocr": {+ "ppocr": "ocr-ppocr-latin"+ }+ },+ "tts": {+ "defaultRegion": "MY",+ "regions": {+ "MY": {+ "displayName": "Malaysia",+ "voices": [+ "tts-mms-ms-my-standard-mms"+ ]+ }+ },+ "sampleText": "Pelangi ialah fenomena meteorologi yang disebabkan oleh pantulan, pembiasan dan penyebaran cahaya dalam titisan air, lalu menghasilkan spektrum cahaya yang kelihatan di langit."+ }+ },+ "nb": {+ "meta": {+ "code": "nb",+ "name": "Norwegian Bokmal",+ "shortName": "Bokmal",+ "script": "Latn"+ },+ "assets": {+ "translate": [+ "translate-en-nb",+ "translate-nb-en"+ ],+ "dictionary": "dict-nb",+ "ocr": {+ "ppocr": "ocr-ppocr-latin"+ }+ },+ "tts": {+ "defaultRegion": "NO",+ "regions": {+ "NO": {+ "displayName": "Norway",+ "voices": [+ "tts-piper-no-no-talesyntese-medium"+ ]+ }+ },+ "sampleText": "En regnbue er et meteorologisk fenomen som skyldes refleksjon, brytning og spredning av lys i vanndråper, noe som fører til at et lysspekter blir synlig på himmelen."+ }+ },+ "nl": {+ "meta": {+ "code": "nl",+ "name": "Dutch",+ "shortName": "Dutch",+ "script": "Latn"+ },+ "assets": {+ "translate": [+ "translate-en-nl",+ "translate-nl-en"+ ],+ "dictionary": "dict-nl",+ "ocr": {+ "ppocr": "ocr-ppocr-latin"+ }+ },+ "tts": {+ "defaultRegion": "NL",+ "regions": {+ "BE": {+ "displayName": "Belgium",+ "voices": [+ "tts-piper-nl-be-rdh-medium",+ "tts-piper-nl-be-nathalie-medium",+ "tts-piper-nl-be-nathalie-x-low",+ "tts-piper-nl-be-rdh-x-low"+ ]+ },+ "NL": {+ "displayName": "Netherlands",+ "voices": [+ "tts-piper-nl-nl-ronnie-medium",+ "tts-piper-nl-nl-pim-medium",+ "tts-piper-nl-nl-alex-medium"+ ]+ }+ },+ "sampleText": "Een regenboog is een meteorologisch verschijnsel dat wordt veroorzaakt door reflectie, breking en verstrooiing van licht in waterdruppels, waardoor een lichtspectrum aan de hemel verschijnt."+ }+ },+ "nn": {+ "meta": {+ "code": "nn",+ "name": "Norwegian Nynorsk",+ "shortName": "Nynorsk",+ "script": "Latn"+ },+ "assets": {+ "translate": [+ "translate-nn-en"+ ],+ "dictionary": "dict-nn",+ "ocr": {+ "ppocr": "ocr-ppocr-latin"+ }+ },+ "tts": {+ "defaultRegion": "NO",+ "regions": {+ "NO": {+ "displayName": "Norway",+ "voices": [+ "tts-piper-no-no-talesyntese-medium"+ ]+ }+ },+ "sampleText": "Ein regnboge er eit meteorologisk fenomen som skuldast refleksjon, bryting og spreiing av lys i vassdropar, noko som fører til at eit lysspekter blir synleg på himmelen."+ }+ },+ "no": {+ "meta": {+ "code": "no",+ "name": "Norwegian",+ "shortName": "Norwegian",+ "script": "Latn"+ },+ "assets": {+ "translate": [+ "translate-en-no",+ "translate-no-en"+ ],+ "dictionary": "dict-no",+ "ocr": {+ "ppocr": "ocr-ppocr-latin"+ }+ },+ "tts": {+ "defaultRegion": "NO",+ "regions": {+ "NO": {+ "displayName": "Norway",+ "voices": [+ "tts-piper-no-no-talesyntese-medium"+ ]+ }+ },+ "sampleText": "En regnbue er et meteorologisk fenomen som skyldes refleksjon, brytning og spredning av lys i vanndråper, noe som fører til at et lysspekter blir synlig på himmelen."+ }+ },+ "pl": {+ "meta": {+ "code": "pl",+ "name": "Polish",+ "shortName": "Polish",+ "script": "Latn"+ },+ "assets": {+ "translate": [+ "translate-en-pl",+ "translate-pl-en"+ ],+ "dictionary": "dict-pl",+ "ocr": {+ "ppocr": "ocr-ppocr-latin"+ }+ },+ "tts": {+ "defaultRegion": "PL",+ "regions": {+ "PL": {+ "displayName": "Poland",+ "voices": [+ "tts-piper-pl-pl-darkman-medium",+ "tts-piper-pl-pl-gosia-medium",+ "tts-piper-pl-pl-mc-speech-medium",+ "tts-piper-pl-pl-jarvis-wg-glos-medium"+ ]+ }+ },+ "sampleText": "Tęcza to zjawisko meteorologiczne spowodowane odbiciem, załamaniem i rozszczepieniem światła w kroplach wody, w wyniku czego na niebie pojawia się widmo światła."+ }+ },+ "pt": {+ "meta": {+ "code": "pt",+ "name": "Portuguese",+ "shortName": "Portuguese",+ "script": "Latn"+ },+ "assets": {+ "translate": [+ "translate-en-pt",+ "translate-pt-en"+ ],+ "dictionary": "dict-pt",+ "ocr": {+ "ppocr": "ocr-ppocr-latin"+ }+ },+ "tts": {+ "defaultRegion": "BR",+ "regions": {+ "BR": {+ "displayName": "Brazil",+ "voices": [+ "tts-piper-pt-br-cadu-medium",+ "tts-piper-pt-br-jeff-medium",+ "tts-piper-pt-br-faber-medium",+ "tts-piper-pt-br-edresson-low"+ ]+ },+ "PT": {+ "displayName": "Portugal",+ "voices": [+ "tts-piper-pt-pt-tugão-medium"+ ]+ }+ },+ "sampleText": "O arco-íris é um fenómeno meteorológico causado pela reflexão, refração e dispersão da luz nas gotas de água, resultando num espectro de luz visível no céu."+ }+ },+ "ro": {+ "meta": {+ "code": "ro",+ "name": "Romanian",+ "shortName": "Romanian",+ "script": "Latn"+ },+ "assets": {+ "translate": [+ "translate-en-ro",+ "translate-ro-en"+ ],+ "dictionary": "dict-ro",+ "ocr": {+ "ppocr": "ocr-ppocr-latin"+ }+ },+ "tts": {+ "defaultRegion": "RO",+ "regions": {+ "RO": {+ "displayName": "Romania",+ "voices": [+ "tts-piper-ro-ro-mihai-medium"+ ]+ }+ },+ "sampleText": "Curcubeul este un fenomen meteorologic cauzat de reflexia, refracția și dispersia luminii în picăturile de apă, ceea ce face ca un spectru de lumină să apară pe cer."+ }+ },+ "ru": {+ "meta": {+ "code": "ru",+ "name": "Russian",+ "shortName": "Russian",+ "script": "Cyrl"+ },+ "assets": {+ "translate": [+ "translate-en-ru",+ "translate-ru-en"+ ],+ "dictionary": "dict-ru",+ "ocr": {+ "ppocr": "ocr-ppocr-eslav"+ }+ },+ "tts": {+ "defaultRegion": "RU",+ "regions": {+ "RU": {+ "displayName": "Russia",+ "voices": [+ "tts-piper-ru-ru-denis-medium",+ "tts-piper-ru-ru-dmitri-medium",+ "tts-piper-ru-ru-irina-medium",+ "tts-piper-ru-ru-ruslan-medium"+ ]+ }+ },+ "sampleText": "Радуга — это метеорологическое явление, вызванное отражением, преломлением и рассеянием света в каплях воды, в результате чего в небе появляется спектр света."+ }+ },+ "sk": {+ "meta": {+ "code": "sk",+ "name": "Slovak",+ "shortName": "Slovak",+ "script": "Latn"+ },+ "assets": {+ "translate": [+ "translate-en-sk",+ "translate-sk-en"+ ],+ "dictionary": "dict-sk",+ "ocr": {+ "ppocr": "ocr-ppocr-latin"+ }+ },+ "tts": {+ "defaultRegion": "SK",+ "regions": {+ "SK": {+ "displayName": "Slovakia",+ "voices": [+ "tts-piper-sk-sk-lili-medium"+ ]+ }+ },+ "sampleText": "Dúha je meteorologický jav spôsobený odrazom, lomom a rozptylom svetla vo vodných kvapkách, v dôsledku čoho sa na oblohe objaví spektrum svetla."+ }+ },+ "sl": {+ "meta": {+ "code": "sl",+ "name": "Slovenian",+ "shortName": "Slovenian",+ "script": "Latn"+ },+ "assets": {+ "translate": [+ "translate-en-sl",+ "translate-sl-en"+ ],+ "dictionary": "dict-sl",+ "ocr": {+ "ppocr": "ocr-ppocr-latin"+ }+ },+ "tts": {+ "defaultRegion": "SI",+ "regions": {+ "SI": {+ "displayName": "Slovenia",+ "voices": [+ "tts-piper-sl-si-artur-medium"+ ]+ }+ },+ "sampleText": "Mavrica je meteorološki pojav, ki nastane zaradi odboja, loma in razpršitve svetlobe v vodnih kapljicah, zato se na nebu pojavi svetlobni spekter."+ }+ },+ "sq": {+ "meta": {+ "code": "sq",+ "name": "Albanian",+ "shortName": "Albanian",+ "script": "Latn"+ },+ "assets": {+ "translate": [+ "translate-en-sq",+ "translate-sq-en"+ ],+ "dictionary": "dict-sq",+ "ocr": {+ "ppocr": "ocr-ppocr-latin"+ }+ },+ "tts": {+ "defaultRegion": "AL",+ "regions": {+ "AL": {+ "displayName": "Albania",+ "voices": [+ "tts-piper-sq-al-edon-medium"+ ]+ }+ },+ "sampleText": "Ylberi është një fenomen meteorologjik i shkaktuar nga pasqyrimi, përthyerja dhe shpërndarja e dritës në pikat e ujit, duke bërë që në qiell të shfaqet një spektër drite."+ }+ },+ "sr": {+ "meta": {+ "code": "sr",+ "name": "Serbian",+ "shortName": "Serbian",+ "script": "Cyrl"+ },+ "assets": {+ "translate": [+ "translate-en-sr",+ "translate-sr-en"+ ],+ "dictionary": "dict-hr",+ "ocr": {+ "ppocr": "ocr-ppocr-cyrillic"+ }+ },+ "tts": {+ "defaultRegion": "RS",+ "regions": {+ "RS": {+ "displayName": "Serbia",+ "voices": [+ "tts-piper-sr-rs-serbski-institut-medium"+ ]+ }+ },+ "sampleText": "Дуга је метеоролошка појава настала одбијањем, преламањем и расипањем светлости у капљицама воде, због чега се на небу појављује спектар светлости."+ }+ },+ "sv": {+ "meta": {+ "code": "sv",+ "name": "Swedish",+ "shortName": "Swedish",+ "script": "Latn"+ },+ "assets": {+ "translate": [+ "translate-en-sv",+ "translate-sv-en"+ ],+ "dictionary": "dict-sv",+ "ocr": {+ "ppocr": "ocr-ppocr-latin"+ }+ },+ "tts": {+ "defaultRegion": "SE",+ "regions": {+ "SE": {+ "displayName": "Sweden",+ "voices": [+ "tts-piper-sv-se-nst-medium",+ "tts-piper-sv-se-alma-medium",+ "tts-piper-sv-se-lisa-medium"+ ]+ }+ },+ "sampleText": "En regnbåge är ett meteorologiskt fenomen som orsakas av ljusets reflektion, brytning och spridning i vattendroppar, vilket gör att ett spektrum av ljus syns på himlen."+ }+ },+ "sw": {+ "meta": {+ "code": "sw",+ "name": "Swahili",+ "shortName": "Swahili",+ "script": "Latn"+ },+ "assets": {+ "translate": [+ "translate-en-sw",+ "translate-sw-en"+ ],+ "dictionary": "dict-sw",+ "ocr": {+ "ppocr": "ocr-ppocr-latin"+ }+ },+ "tts": {+ "defaultRegion": "CD",+ "regions": {+ "CD": {+ "displayName": "Democratic Republic of the Congo",+ "voices": [+ "tts-piper-sw-cd-lanfrica-medium"+ ]+ }+ },+ "sampleText": "Upinde wa mvua ni tukio la hali ya hewa ambalo husababishwa na uakisi, kuvunjika na kuenea kwa mwanga katika matone ya maji na kusababisha wigo wa mwanga unaoonekana angani."+ }+ },+ "ta": {+ "meta": {+ "code": "ta",+ "name": "Tamil",+ "shortName": "Tamil",+ "script": "Taml"+ },+ "assets": {+ "translate": [+ "translate-en-ta",+ "translate-ta-en"+ ],+ "dictionary": "dict-ta",+ "ocr": {+ "ppocr": "ocr-ppocr-ta"+ }+ },+ "tts": {+ "defaultRegion": "IN",+ "regions": {+ "IN": {+ "displayName": "India",+ "voices": [+ "tts-mms-ta-in-standard-mms"+ ]+ }+ },+ "sampleText": "வானவில் என்பது நீர்த்துளிகளில் ஒளியின் பிரதிபலிப்பு, ஒளிவிலக்கம் மற்றும் சிதறல் காரணமாக உருவாகும் ஒரு வானிலை நிகழ்வு; இதன் விளைவாக வானில் ஒளியின் நிறவரிசை தோன்றுகிறது."+ }+ },+ "te": {+ "meta": {+ "code": "te",+ "name": "Telugu",+ "shortName": "Telugu",+ "script": "Telu"+ },+ "assets": {+ "translate": [+ "translate-en-te",+ "translate-te-en"+ ],+ "dictionary": "dict-te",+ "ocr": {+ "ppocr": "ocr-ppocr-te"+ }+ },+ "tts": {+ "defaultRegion": "IN",+ "regions": {+ "IN": {+ "displayName": "India",+ "voices": [+ "tts-piper-te-in-maya-medium",+ "tts-piper-te-in-padmavathi-medium",+ "tts-piper-te-in-venkatesh-medium"+ ]+ }+ },+ "sampleText": "ఇంద్రధనుస్సు ఒక వాతావరణ సంబంధిత సంఘటన; ఇది నీటి బిందువులలో కాంతి ప్రతిబింబం, అపవర్తనం మరియు విక్షేపణం వల్ల ఏర్పడి ఆకాశంలో కాంతి వర్ణక్రమం కనిపిస్తుంది."+ }+ },+ "th": {+ "meta": {+ "code": "th",+ "name": "Thai",+ "shortName": "Thai",+ "script": "Thai"+ },+ "assets": {+ "translate": [+ "translate-en-th",+ "translate-th-en"+ ],+ "dictionary": "dict-th",+ "ocr": {+ "ppocr": "ocr-ppocr-th"+ }+ },+ "tts": {+ "defaultRegion": "TH",+ "regions": {+ "TH": {+ "displayName": "Thailand",+ "voices": [+ "tts-mms-th-th-standard-mms"+ ]+ }+ },+ "sampleText": "รุ้งกินน้ำเป็นปรากฏการณ์ทางอุตุนิยมวิทยาที่เกิดจากการสะท้อน การหักเห และการกระจายตัวของแสงในหยดน้ำ ทำให้เกิดสเปกตรัมของแสงปรากฏบนท้องฟ้า"+ }+ },+ "tl": {+ "meta": {+ "code": "tl",+ "name": "Tagalog",+ "shortName": "Tagalog",+ "script": "Latn"+ },+ "assets": {+ "translate": [+ "translate-en-tl",+ "translate-tl-en"+ ],+ "dictionary": "dict-tl",+ "ocr": {+ "ppocr": "ocr-ppocr-latin"+ }+ },+ "tts": {+ "defaultRegion": "PH",+ "regions": {+ "PH": {+ "displayName": "Philippines",+ "voices": [+ "tts-mms-tl-ph-standard-mms"+ ]+ }+ },+ "sampleText": "Ang bahaghari ay isang penomenong meteorolohiko na dulot ng pagsalamin, pagbaluktot, at pagkalat ng liwanag sa mga patak ng tubig, na nagreresulta sa isang spektrum ng liwanag na lumilitaw sa langit."+ }+ },+ "tr": {+ "meta": {+ "code": "tr",+ "name": "Turkish",+ "shortName": "Turkish",+ "script": "Latn"+ },+ "assets": {+ "translate": [+ "translate-en-tr",+ "translate-tr-en"+ ],+ "dictionary": "dict-tr",+ "ocr": {+ "ppocr": "ocr-ppocr-latin"+ }+ },+ "tts": {+ "defaultRegion": "TR",+ "regions": {+ "TR": {+ "displayName": "Turkey",+ "voices": [+ "tts-piper-tr-tr-dfki-medium"+ ]+ }+ },+ "sampleText": "Gökkuşağı, ışığın su damlacıklarında yansıması, kırılması ve dağılması sonucu oluşan meteorolojik bir olaydır ve bunun sonucunda gökyüzünde bir ışık tayfı görünür."+ }+ },+ "ug": {+ "meta": {+ "code": "ug",+ "name": "Uyghur",+ "shortName": "Uyghur",+ "script": "Arab"+ },+ "assets": {+ "translate": [+ "translate-en-ug",+ "translate-ug-en"+ ],+ "ocr": {+ "ppocr": "ocr-ppocr-arabic"+ }+ },+ "tts": {+ "defaultRegion": "CN",+ "regions": {+ "CN": {+ "displayName": "China",+ "voices": [+ "tts-mms-ug-cn-standard-mms"+ ]+ }+ },+ "sampleText": "ھەسەن-ھۈسەن سۇ تامچىلىرىدا نۇرنىڭ قايتىشى، سۇنۇشى ۋە تارقىلىشى نەتىجىسىدە ھاسىل بولىدىغان مېتېئورولوگىيىلىك ھادىسە بولۇپ، ئۇنىڭ تەسىرىدە ئاسماندا نۇر سپېكتىرى پەيدا بولىدۇ."+ }+ },+ "uk": {+ "meta": {+ "code": "uk",+ "name": "Ukrainian",+ "shortName": "Ukrainian",+ "script": "Cyrl"+ },+ "assets": {+ "translate": [+ "translate-en-uk",+ "translate-uk-en"+ ],+ "dictionary": "dict-uk",+ "ocr": {+ "ppocr": "ocr-ppocr-eslav"+ }+ },+ "tts": {+ "defaultRegion": "UA",+ "regions": {+ "UA": {+ "displayName": "Ukraine",+ "voices": [+ "tts-piper-uk-ua-ukrainian-tts-medium",+ "tts-piper-uk-ua-lada-x-low"+ ]+ }+ },+ "sampleText": "Веселка — це метеорологічне явище, спричинене відбиттям, заломленням і розсіюванням світла у краплях води, внаслідок чого в небі з'являється спектр світла."+ }+ },+ "ur": {+ "meta": {+ "code": "ur",+ "name": "Urdu",+ "shortName": "Urdu",+ "script": "Arab"+ },+ "assets": {+ "translate": [+ "translate-ur-en"+ ],+ "dictionary": "dict-ur",+ "ocr": {+ "ppocr": "ocr-ppocr-arabic"+ }+ },+ "tts": {+ "defaultRegion": "PK",+ "regions": {+ "PK": {+ "displayName": "Pakistan",+ "voices": [+ "tts-piper-ur-pk-fasih-medium"+ ]+ }+ },+ "sampleText": "قوسِ قزح ایک موسمیاتی مظہر ہے جو پانی کے قطروں میں روشنی کے انعکاس، انعطاف اور انتشار کی وجہ سے پیدا ہوتا ہے، جس کے نتیجے میں آسمان پر روشنی کا طیف نمودار ہوتا ہے۔"+ }+ },+ "vi": {+ "meta": {+ "code": "vi",+ "name": "Vietnamese",+ "shortName": "Vietnamese",+ "script": "Latn"+ },+ "assets": {+ "translate": [+ "translate-en-vi",+ "translate-vi-en"+ ],+ "dictionary": "dict-vi",+ "ocr": {+ "ppocr": "ocr-ppocr-latin"+ }+ },+ "tts": {+ "defaultRegion": "VN",+ "regions": {+ "VN": {+ "displayName": "Vietnam",+ "voices": [+ "tts-piper-vi-vn-vais1000-medium",+ "tts-piper-vi-vn-25hours-single-low",+ "tts-piper-vi-vn-vivos-x-low"+ ]+ }+ },+ "sampleText": "Cầu vồng là một hiện tượng khí tượng do sự phản xạ, khúc xạ và tán sắc của ánh sáng trong các giọt nước, tạo ra một quang phổ ánh sáng xuất hiện trên bầu trời."+ }+ },+ "zh": {+ "meta": {+ "code": "zh",+ "name": "Chinese (简体)",+ "shortName": "简体",+ "script": "Hans"+ },+ "assets": {+ "translate": [+ "translate-en-zh",+ "translate-zh-en"+ ],+ "dictionary": "dict-zh",+ "ocr": {+ "ppocr": "ocr-ppocr-cj"+ }+ },+ "tts": {+ "defaultRegion": "CN",+ "regions": {+ "CN": {+ "displayName": "China",+ "voices": [+ "tts-piper-zh-cn-huayan-medium",+ "tts-piper-zh-cn-huayan-x-low"+ ]+ }+ },+ "sampleText": "彩虹是一种气象现象,由光线在水滴中发生反射、折射和色散而形成,因此天空中会出现一道光谱。"+ }+ },+ "zh_hant": {+ "meta": {+ "code": "zh_hant",+ "name": "Chinese (繁體)",+ "shortName": "繁體",+ "script": "Hant"+ },+ "assets": {+ "translate": [+ "translate-en-zh_hant",+ "translate-zh_hant-en"+ ],+ "dictionary": "dict-zh",+ "ocr": {+ "ppocr": "ocr-ppocr-cj"+ }+ },+ "tts": {+ "defaultRegion": "TW",+ "regions": {+ "HK": {+ "displayName": "Hong Kong",+ "voices": [+ "tts-sherpa_vits-zh-hk-cantonese-medium"+ ]+ },+ "TW": {+ "displayName": "Taiwan",+ "voices": [+ "tts-piper-zh-tw-mandarin-traditional-medium"+ ]+ }+ },+ "sampleText": "彩虹是一種氣象現象,由光線在水滴中發生反射、折射與色散所形成,因此天空中會出現一道光譜。"+ }+ }+ },+ "packs": {+ "dict-ar": {+ "feature": "dictionary",+ "dictionaryCode": "ar",+ "languages": [+ "ar"+ ],+ "files": [+ {+ "name": "ar.dict",+ "sizeBytes": 901080,+ "installPath": "dictionaries/ar.dict",+ "url": "https://offline-translator.davidv.dev/dictionaries/1/ar.dict",+ "role": "dictionary",+ "priority": 0+ }+ ],+ "dependsOn": [],+ "metadata": {+ "date": 1758204389,+ "type": "english",+ "wordCount": 55376+ }+ },+ "dict-az": {+ "feature": "dictionary",+ "dictionaryCode": "az",+ "languages": [+ "az"+ ],+ "files": [+ {+ "name": "az.dict",+ "sizeBytes": 344665,+ "installPath": "dictionaries/az.dict",+ "url": "https://offline-translator.davidv.dev/dictionaries/1/az.dict",+ "role": "dictionary",+ "priority": 0+ }+ ],+ "dependsOn": [],+ "metadata": {+ "date": 1758204389,+ "type": "english",+ "wordCount": 12877+ }+ },+ "dict-be": {+ "feature": "dictionary",+ "dictionaryCode": "be",+ "languages": [+ "be"+ ],+ "files": [+ {+ "name": "be.dict",+ "sizeBytes": 203909,+ "installPath": "dictionaries/be.dict",+ "url": "https://offline-translator.davidv.dev/dictionaries/1/be.dict",+ "role": "dictionary",+ "priority": 0+ }+ ],+ "dependsOn": [],+ "metadata": {+ "date": 1774864382,+ "type": "english",+ "wordCount": 6879+ }+ },+ "dict-bg": {+ "feature": "dictionary",+ "dictionaryCode": "bg",+ "languages": [+ "bg"+ ],+ "files": [+ {+ "name": "bg.dict",+ "sizeBytes": 828145,+ "installPath": "dictionaries/bg.dict",+ "url": "https://offline-translator.davidv.dev/dictionaries/1/bg.dict",+ "role": "dictionary",+ "priority": 0+ }+ ],+ "dependsOn": [],+ "metadata": {+ "date": 1758204389,+ "type": "english",+ "wordCount": 48951+ }+ },+ "dict-bn": {+ "feature": "dictionary",+ "dictionaryCode": "bn",+ "languages": [+ "bn"+ ],+ "files": [+ {+ "name": "bn.dict",+ "sizeBytes": 233173,+ "installPath": "dictionaries/bn.dict",+ "url": "https://offline-translator.davidv.dev/dictionaries/1/bn.dict",+ "role": "dictionary",+ "priority": 0+ }+ ],+ "dependsOn": [],+ "metadata": {+ "date": 1758204389,+ "type": "english",+ "wordCount": 8536+ }+ },+ "dict-ca": {+ "feature": "dictionary",+ "dictionaryCode": "ca",+ "languages": [+ "ca"+ ],+ "files": [+ {+ "name": "ca.dict",+ "sizeBytes": 1743759,+ "installPath": "dictionaries/ca.dict",+ "url": "https://offline-translator.davidv.dev/dictionaries/1/ca.dict",+ "role": "dictionary",+ "priority": 0+ }+ ],+ "dependsOn": [],+ "metadata": {+ "date": 1758204389,+ "type": "english",+ "wordCount": 184490+ }+ },+ "dict-cs": {+ "feature": "dictionary",+ "dictionaryCode": "cs",+ "languages": [+ "cs"+ ],+ "files": [+ {+ "name": "cs.dict",+ "sizeBytes": 1310029,+ "installPath": "dictionaries/cs.dict",+ "url": "https://offline-translator.davidv.dev/dictionaries/1/cs.dict",+ "role": "dictionary",+ "priority": 0+ }+ ],+ "dependsOn": [],+ "metadata": {+ "date": 1758204389,+ "type": "bilingual",+ "wordCount": 62171+ }+ },+ "dict-da": {+ "feature": "dictionary",+ "dictionaryCode": "da",+ "languages": [+ "da"+ ],+ "files": [+ {+ "name": "da.dict",+ "sizeBytes": 717848,+ "installPath": "dictionaries/da.dict",+ "url": "https://offline-translator.davidv.dev/dictionaries/1/da.dict",+ "role": "dictionary",+ "priority": 0+ }+ ],+ "dependsOn": [],+ "metadata": {+ "date": 1758204389,+ "type": "english",+ "wordCount": 48487+ }+ },+ "dict-de": {+ "feature": "dictionary",+ "dictionaryCode": "de",+ "languages": [+ "de"+ ],+ "files": [+ {+ "name": "de.dict",+ "sizeBytes": 29940942,+ "installPath": "dictionaries/de.dict",+ "url": "https://offline-translator.davidv.dev/dictionaries/1/de.dict",+ "role": "dictionary",+ "priority": 0+ }+ ],+ "dependsOn": [],+ "metadata": {+ "date": 1758204389,+ "type": "bilingual",+ "wordCount": 898517+ }+ },+ "dict-el": {+ "feature": "dictionary",+ "dictionaryCode": "el",+ "languages": [+ "el"+ ],+ "files": [+ {+ "name": "el.dict",+ "sizeBytes": 10843652,+ "installPath": "dictionaries/el.dict",+ "url": "https://offline-translator.davidv.dev/dictionaries/1/el.dict",+ "role": "dictionary",+ "priority": 0+ }+ ],+ "dependsOn": [],+ "metadata": {+ "date": 1758204389,+ "type": "bilingual",+ "wordCount": 773782+ }+ },+ "dict-en": {+ "feature": "dictionary",+ "dictionaryCode": "en",+ "languages": [+ "en"+ ],+ "files": [+ {+ "name": "en.dict",+ "sizeBytes": 22748995,+ "installPath": "dictionaries/en.dict",+ "url": "https://offline-translator.davidv.dev/dictionaries/1/en.dict",+ "role": "dictionary",+ "priority": 0+ }+ ],+ "dependsOn": [],+ "metadata": {+ "date": 1758204389,+ "type": "english",+ "wordCount": 1017608+ }+ },+ "dict-es": {+ "feature": "dictionary",+ "dictionaryCode": "es",+ "languages": [+ "es"+ ],+ "files": [+ {+ "name": "es.dict",+ "sizeBytes": 21559131,+ "installPath": "dictionaries/es.dict",+ "url": "https://offline-translator.davidv.dev/dictionaries/1/es.dict",+ "role": "dictionary",+ "priority": 0+ }+ ],+ "dependsOn": [],+ "metadata": {+ "date": 1758204389,+ "type": "bilingual",+ "wordCount": 1102610+ }+ },+ "dict-et": {+ "feature": "dictionary",+ "dictionaryCode": "et",+ "languages": [+ "et"+ ],+ "files": [+ {+ "name": "et.dict",+ "sizeBytes": 246469,+ "installPath": "dictionaries/et.dict",+ "url": "https://offline-translator.davidv.dev/dictionaries/1/et.dict",+ "role": "dictionary",+ "priority": 0+ }+ ],+ "dependsOn": [],+ "metadata": {+ "date": 1758204389,+ "type": "english",+ "wordCount": 11645+ }+ },+ "dict-eu": {+ "feature": "dictionary",+ "dictionaryCode": "eu",+ "languages": [+ "eu"+ ],+ "files": [+ {+ "name": "eu.dict",+ "sizeBytes": 216917,+ "installPath": "dictionaries/eu.dict",+ "url": "https://offline-translator.davidv.dev/dictionaries/1/eu.dict",+ "role": "dictionary",+ "priority": 0+ }+ ],+ "dependsOn": [],+ "metadata": {+ "date": 1781815948,+ "type": "english",+ "wordCount": 9599+ }+ },+ "dict-fa": {+ "feature": "dictionary",+ "dictionaryCode": "fa",+ "languages": [+ "fa"+ ],+ "files": [+ {+ "name": "fa.dict",+ "sizeBytes": 369903,+ "installPath": "dictionaries/fa.dict",+ "url": "https://offline-translator.davidv.dev/dictionaries/1/fa.dict",+ "role": "dictionary",+ "priority": 0+ }+ ],+ "dependsOn": [],+ "metadata": {+ "date": 1758204389,+ "type": "english",+ "wordCount": 14088+ }+ },+ "dict-fi": {+ "feature": "dictionary",+ "dictionaryCode": "fi",+ "languages": [+ "fi"+ ],+ "files": [+ {+ "name": "fi.dict",+ "sizeBytes": 5255475,+ "installPath": "dictionaries/fi.dict",+ "url": "https://offline-translator.davidv.dev/dictionaries/1/fi.dict",+ "role": "dictionary",+ "priority": 0+ }+ ],+ "dependsOn": [],+ "metadata": {+ "date": 1758204389,+ "type": "english",+ "wordCount": 242681+ }+ },+ "dict-fr": {+ "feature": "dictionary",+ "dictionaryCode": "fr",+ "languages": [+ "fr"+ ],+ "files": [+ {+ "name": "fr.dict",+ "sizeBytes": 31812323,+ "installPath": "dictionaries/fr.dict",+ "url": "https://offline-translator.davidv.dev/dictionaries/1/fr.dict",+ "role": "dictionary",+ "priority": 0+ }+ ],+ "dependsOn": [],+ "metadata": {+ "date": 1758204389,+ "type": "bilingual",+ "wordCount": 1891044+ }+ },+ "dict-gl": {+ "feature": "dictionary",+ "dictionaryCode": "gl",+ "languages": [+ "gl"+ ],+ "files": [+ {+ "name": "gl.dict",+ "sizeBytes": 1290562,+ "installPath": "dictionaries/gl.dict",+ "url": "https://offline-translator.davidv.dev/dictionaries/1/gl.dict",+ "role": "dictionary",+ "priority": 0+ }+ ],+ "dependsOn": [],+ "metadata": {+ "date": 1781815948,+ "type": "english",+ "wordCount": 198673+ }+ },+ "dict-gu": {+ "feature": "dictionary",+ "dictionaryCode": "gu",+ "languages": [+ "gu"+ ],+ "files": [+ {+ "name": "gu.dict",+ "sizeBytes": 159284,+ "installPath": "dictionaries/gu.dict",+ "url": "https://offline-translator.davidv.dev/dictionaries/1/gu.dict",+ "role": "dictionary",+ "priority": 0+ }+ ],+ "dependsOn": [],+ "metadata": {+ "date": 1758204389,+ "type": "english",+ "wordCount": 5849+ }+ },+ "dict-he": {+ "feature": "dictionary",+ "dictionaryCode": "he",+ "languages": [+ "he"+ ],+ "files": [+ {+ "name": "he.dict",+ "sizeBytes": 339526,+ "installPath": "dictionaries/he.dict",+ "url": "https://offline-translator.davidv.dev/dictionaries/1/he.dict",+ "role": "dictionary",+ "priority": 0+ }+ ],+ "dependsOn": [],+ "metadata": {+ "date": 1758204389,+ "type": "english",+ "wordCount": 11478+ }+ },+ "dict-hi": {+ "feature": "dictionary",+ "dictionaryCode": "hi",+ "languages": [+ "hi"+ ],+ "files": [+ {+ "name": "hi.dict",+ "sizeBytes": 690397,+ "installPath": "dictionaries/hi.dict",+ "url": "https://offline-translator.davidv.dev/dictionaries/1/hi.dict",+ "role": "dictionary",+ "priority": 0+ }+ ],+ "dependsOn": [],+ "metadata": {+ "date": 1758204389,+ "type": "english",+ "wordCount": 28300+ }+ },+ "dict-hr": {+ "feature": "dictionary",+ "dictionaryCode": "hr",+ "languages": [+ "bs",+ "hr",+ "sr"+ ],+ "files": [+ {+ "name": "hr.dict",+ "sizeBytes": 1529839,+ "installPath": "dictionaries/hr.dict",+ "url": "https://offline-translator.davidv.dev/dictionaries/1/hr.dict",+ "role": "dictionary",+ "priority": 0+ }+ ],+ "dependsOn": [],+ "metadata": {+ "date": 1758366416,+ "type": "english",+ "wordCount": 62894+ }+ },+ "dict-hu": {+ "feature": "dictionary",+ "dictionaryCode": "hu",+ "languages": [+ "hu"+ ],+ "files": [+ {+ "name": "hu.dict",+ "sizeBytes": 1966339,+ "installPath": "dictionaries/hu.dict",+ "url": "https://offline-translator.davidv.dev/dictionaries/1/hu.dict",+ "role": "dictionary",+ "priority": 0+ }+ ],+ "dependsOn": [],+ "metadata": {+ "date": 1758204389,+ "type": "english",+ "wordCount": 70308+ }+ },+ "dict-id": {+ "feature": "dictionary",+ "dictionaryCode": "id",+ "languages": [+ "id"+ ],+ "files": [+ {+ "name": "id.dict",+ "sizeBytes": 2788182,+ "installPath": "dictionaries/id.dict",+ "url": "https://offline-translator.davidv.dev/dictionaries/1/id.dict",+ "role": "dictionary",+ "priority": 0+ }+ ],+ "dependsOn": [],+ "metadata": {+ "date": 1758204389,+ "type": "bilingual",+ "wordCount": 82529+ }+ },+ "dict-is": {+ "feature": "dictionary",+ "dictionaryCode": "is",+ "languages": [+ "is"+ ],+ "files": [+ {+ "name": "is.dict",+ "sizeBytes": 493231,+ "installPath": "dictionaries/is.dict",+ "url": "https://offline-translator.davidv.dev/dictionaries/1/is.dict",+ "role": "dictionary",+ "priority": 0+ }+ ],+ "dependsOn": [],+ "metadata": {+ "date": 1758204389,+ "type": "english",+ "wordCount": 21793+ }+ },+ "dict-it": {+ "feature": "dictionary",+ "dictionaryCode": "it",+ "languages": [+ "it"+ ],+ "files": [+ {+ "name": "it.dict",+ "sizeBytes": 10638315,+ "installPath": "dictionaries/it.dict",+ "url": "https://offline-translator.davidv.dev/dictionaries/1/it.dict",+ "role": "dictionary",+ "priority": 0+ }+ ],+ "dependsOn": [],+ "metadata": {+ "date": 1758204389,+ "type": "bilingual",+ "wordCount": 597363+ }+ },+ "dict-ja": {+ "feature": "dictionary",+ "dictionaryCode": "ja",+ "languages": [+ "ja"+ ],+ "files": [+ {+ "name": "ja.dict",+ "sizeBytes": 7362403,+ "installPath": "dictionaries/ja.dict",+ "url": "https://offline-translator.davidv.dev/dictionaries/1/ja.dict",+ "role": "dictionary",+ "priority": 0+ }+ ],+ "dependsOn": [],+ "metadata": {+ "date": 1758204389,+ "type": "bilingual",+ "wordCount": 210298+ }+ },+ "dict-kn": {+ "feature": "dictionary",+ "dictionaryCode": "kn",+ "languages": [+ "kn"+ ],+ "files": [+ {+ "name": "kn.dict",+ "sizeBytes": 58645,+ "installPath": "dictionaries/kn.dict",+ "url": "https://offline-translator.davidv.dev/dictionaries/1/kn.dict",+ "role": "dictionary",+ "priority": 0+ }+ ],+ "dependsOn": [],+ "metadata": {+ "date": 1758204389,+ "type": "english",+ "wordCount": 2172+ }+ },+ "dict-ko": {+ "feature": "dictionary",+ "dictionaryCode": "ko",+ "languages": [+ "ko"+ ],+ "files": [+ {+ "name": "ko.dict",+ "sizeBytes": 3291793,+ "installPath": "dictionaries/ko.dict",+ "url": "https://offline-translator.davidv.dev/dictionaries/1/ko.dict",+ "role": "dictionary",+ "priority": 0+ }+ ],+ "dependsOn": [],+ "metadata": {+ "date": 1758204389,+ "type": "bilingual",+ "wordCount": 129264+ }+ },+ "dict-lt": {+ "feature": "dictionary",+ "dictionaryCode": "lt",+ "languages": [+ "lt"+ ],+ "files": [+ {+ "name": "lt.dict",+ "sizeBytes": 408964,+ "installPath": "dictionaries/lt.dict",+ "url": "https://offline-translator.davidv.dev/dictionaries/1/lt.dict",+ "role": "dictionary",+ "priority": 0+ }+ ],+ "dependsOn": [],+ "metadata": {+ "date": 1758204389,+ "type": "english",+ "wordCount": 26356+ }+ },+ "dict-lv": {+ "feature": "dictionary",+ "dictionaryCode": "lv",+ "languages": [+ "lv"+ ],+ "files": [+ {+ "name": "lv.dict",+ "sizeBytes": 1144802,+ "installPath": "dictionaries/lv.dict",+ "url": "https://offline-translator.davidv.dev/dictionaries/1/lv.dict",+ "role": "dictionary",+ "priority": 0+ }+ ],+ "dependsOn": [],+ "metadata": {+ "date": 1758204389,+ "type": "english",+ "wordCount": 121674+ }+ },+ "dict-ml": {+ "feature": "dictionary",+ "dictionaryCode": "ml",+ "languages": [+ "ml"+ ],+ "files": [+ {+ "name": "ml.dict",+ "sizeBytes": 243670,+ "installPath": "dictionaries/ml.dict",+ "url": "https://offline-translator.davidv.dev/dictionaries/1/ml.dict",+ "role": "dictionary",+ "priority": 0+ }+ ],+ "dependsOn": [],+ "metadata": {+ "date": 1758204389,+ "type": "english",+ "wordCount": 10022+ }+ },+ "dict-mr": {+ "feature": "dictionary",+ "dictionaryCode": "mr",+ "languages": [+ "mr"+ ],+ "files": [+ {+ "name": "mr.dict",+ "sizeBytes": 117924,+ "installPath": "dictionaries/mr.dict",+ "url": "https://offline-translator.davidv.dev/dictionaries/1/mr.dict",+ "role": "dictionary",+ "priority": 0+ }+ ],+ "dependsOn": [],+ "metadata": {+ "date": 1781815948,+ "type": "english",+ "wordCount": 4164+ }+ },+ "dict-ms": {+ "feature": "dictionary",+ "dictionaryCode": "ms",+ "languages": [+ "ms"+ ],+ "files": [+ {+ "name": "ms.dict",+ "sizeBytes": 550668,+ "installPath": "dictionaries/ms.dict",+ "url": "https://offline-translator.davidv.dev/dictionaries/1/ms.dict",+ "role": "dictionary",+ "priority": 0+ }+ ],+ "dependsOn": [],+ "metadata": {+ "date": 1758204389,+ "type": "bilingual",+ "wordCount": 16211+ }+ },+ "dict-nb": {+ "feature": "dictionary",+ "dictionaryCode": "nb",+ "languages": [+ "nb"+ ],+ "files": [+ {+ "name": "nb.dict",+ "sizeBytes": 834490,+ "installPath": "dictionaries/nb.dict",+ "url": "https://offline-translator.davidv.dev/dictionaries/1/nb.dict",+ "role": "dictionary",+ "priority": 0+ }+ ],+ "dependsOn": [],+ "metadata": {+ "date": 1774864382,+ "type": "english",+ "wordCount": 69343+ }+ },+ "dict-nl": {+ "feature": "dictionary",+ "dictionaryCode": "nl",+ "languages": [+ "nl"+ ],+ "files": [+ {+ "name": "nl.dict",+ "sizeBytes": 14256198,+ "installPath": "dictionaries/nl.dict",+ "url": "https://offline-translator.davidv.dev/dictionaries/1/nl.dict",+ "role": "dictionary",+ "priority": 0+ }+ ],+ "dependsOn": [],+ "metadata": {+ "date": 1758204389,+ "type": "bilingual",+ "wordCount": 559438+ }+ },+ "dict-nn": {+ "feature": "dictionary",+ "dictionaryCode": "nn",+ "languages": [+ "nn"+ ],+ "files": [+ {+ "name": "nn.dict",+ "sizeBytes": 769090,+ "installPath": "dictionaries/nn.dict",+ "url": "https://offline-translator.davidv.dev/dictionaries/1/nn.dict",+ "role": "dictionary",+ "priority": 0+ }+ ],+ "dependsOn": [],+ "metadata": {+ "date": 1774864382,+ "type": "english",+ "wordCount": 56394+ }+ },+ "dict-no": {+ "feature": "dictionary",+ "dictionaryCode": "no",+ "languages": [+ "no"+ ],+ "files": [+ {+ "name": "no.dict",+ "sizeBytes": 30563,+ "installPath": "dictionaries/no.dict",+ "url": "https://offline-translator.davidv.dev/dictionaries/1/no.dict",+ "role": "dictionary",+ "priority": 0+ }+ ],+ "dependsOn": [],+ "metadata": {+ "date": 1774864382,+ "type": "english",+ "wordCount": 1576+ }+ },+ "dict-pl": {+ "feature": "dictionary",+ "dictionaryCode": "pl",+ "languages": [+ "pl"+ ],+ "files": [+ {+ "name": "pl.dict",+ "sizeBytes": 7601814,+ "installPath": "dictionaries/pl.dict",+ "url": "https://offline-translator.davidv.dev/dictionaries/1/pl.dict",+ "role": "dictionary",+ "priority": 0+ }+ ],+ "dependsOn": [],+ "metadata": {+ "date": 1758204389,+ "type": "bilingual",+ "wordCount": 201681+ }+ },+ "dict-pt": {+ "feature": "dictionary",+ "dictionaryCode": "pt",+ "languages": [+ "pt"+ ],+ "files": [+ {+ "name": "pt.dict",+ "sizeBytes": 9044098,+ "installPath": "dictionaries/pt.dict",+ "url": "https://offline-translator.davidv.dev/dictionaries/1/pt.dict",+ "role": "dictionary",+ "priority": 0+ }+ ],+ "dependsOn": [],+ "metadata": {+ "date": 1758204389,+ "type": "bilingual",+ "wordCount": 538348+ }+ },+ "dict-ro": {+ "feature": "dictionary",+ "dictionaryCode": "ro",+ "languages": [+ "ro"+ ],+ "files": [+ {+ "name": "ro.dict",+ "sizeBytes": 1474168,+ "installPath": "dictionaries/ro.dict",+ "url": "https://offline-translator.davidv.dev/dictionaries/1/ro.dict",+ "role": "dictionary",+ "priority": 0+ }+ ],+ "dependsOn": [],+ "metadata": {+ "date": 1758204389,+ "type": "english",+ "wordCount": 114525+ }+ },+ "dict-ru": {+ "feature": "dictionary",+ "dictionaryCode": "ru",+ "languages": [+ "ru"+ ],+ "files": [+ {+ "name": "ru.dict",+ "sizeBytes": 21377315,+ "installPath": "dictionaries/ru.dict",+ "url": "https://offline-translator.davidv.dev/dictionaries/1/ru.dict",+ "role": "dictionary",+ "priority": 0+ }+ ],+ "dependsOn": [],+ "metadata": {+ "date": 1758204389,+ "type": "bilingual",+ "wordCount": 763134+ }+ },+ "dict-sk": {+ "feature": "dictionary",+ "dictionaryCode": "sk",+ "languages": [+ "sk"+ ],+ "files": [+ {+ "name": "sk.dict",+ "sizeBytes": 319474,+ "installPath": "dictionaries/sk.dict",+ "url": "https://offline-translator.davidv.dev/dictionaries/1/sk.dict",+ "role": "dictionary",+ "priority": 0+ }+ ],+ "dependsOn": [],+ "metadata": {+ "date": 1758204389,+ "type": "english",+ "wordCount": 15069+ }+ },+ "dict-sl": {+ "feature": "dictionary",+ "dictionaryCode": "sl",+ "languages": [+ "sl"+ ],+ "files": [+ {+ "name": "sl.dict",+ "sizeBytes": 171049,+ "installPath": "dictionaries/sl.dict",+ "url": "https://offline-translator.davidv.dev/dictionaries/1/sl.dict",+ "role": "dictionary",+ "priority": 0+ }+ ],+ "dependsOn": [],+ "metadata": {+ "date": 1758204389,+ "type": "english",+ "wordCount": 6955+ }+ },+ "dict-sq": {+ "feature": "dictionary",+ "dictionaryCode": "sq",+ "languages": [+ "sq"+ ],+ "files": [+ {+ "name": "sq.dict",+ "sizeBytes": 354067,+ "installPath": "dictionaries/sq.dict",+ "url": "https://offline-translator.davidv.dev/dictionaries/1/sq.dict",+ "role": "dictionary",+ "priority": 0+ }+ ],+ "dependsOn": [],+ "metadata": {+ "date": 1758204389,+ "type": "english",+ "wordCount": 17989+ }+ },+ "dict-sv": {+ "feature": "dictionary",+ "dictionaryCode": "sv",+ "languages": [+ "sv"+ ],+ "files": [+ {+ "name": "sv.dict",+ "sizeBytes": 2818616,+ "installPath": "dictionaries/sv.dict",+ "url": "https://offline-translator.davidv.dev/dictionaries/1/sv.dict",+ "role": "dictionary",+ "priority": 0+ }+ ],+ "dependsOn": [],+ "metadata": {+ "date": 1758204389,+ "type": "english",+ "wordCount": 286313+ }+ },+ "dict-sw": {+ "feature": "dictionary",+ "dictionaryCode": "sw",+ "languages": [+ "sw"+ ],+ "files": [+ {+ "name": "sw.dict",+ "sizeBytes": 257620,+ "installPath": "dictionaries/sw.dict",+ "url": "https://offline-translator.davidv.dev/dictionaries/1/sw.dict",+ "role": "dictionary",+ "priority": 0+ }+ ],+ "dependsOn": [],+ "metadata": {+ "date": 1784028791,+ "type": "english",+ "wordCount": 15954+ }+ },+ "dict-ta": {+ "feature": "dictionary",+ "dictionaryCode": "ta",+ "languages": [+ "ta"+ ],+ "files": [+ {+ "name": "ta.dict",+ "sizeBytes": 332774,+ "installPath": "dictionaries/ta.dict",+ "url": "https://offline-translator.davidv.dev/dictionaries/1/ta.dict",+ "role": "dictionary",+ "priority": 0+ }+ ],+ "dependsOn": [],+ "metadata": {+ "date": 1758204389,+ "type": "english",+ "wordCount": 8592+ }+ },+ "dict-te": {+ "feature": "dictionary",+ "dictionaryCode": "te",+ "languages": [+ "te"+ ],+ "files": [+ {+ "name": "te.dict",+ "sizeBytes": 428546,+ "installPath": "dictionaries/te.dict",+ "url": "https://offline-translator.davidv.dev/dictionaries/1/te.dict",+ "role": "dictionary",+ "priority": 0+ }+ ],+ "dependsOn": [],+ "metadata": {+ "date": 1758204389,+ "type": "english",+ "wordCount": 20102+ }+ },+ "dict-th": {+ "feature": "dictionary",+ "dictionaryCode": "th",+ "languages": [+ "th"+ ],+ "files": [+ {+ "name": "th.dict",+ "sizeBytes": 1935529,+ "installPath": "dictionaries/th.dict",+ "url": "https://offline-translator.davidv.dev/dictionaries/1/th.dict",+ "role": "dictionary",+ "priority": 0+ }+ ],+ "dependsOn": [],+ "metadata": {+ "date": 1774864382,+ "type": "bilingual",+ "wordCount": 34786+ }+ },+ "dict-tl": {+ "feature": "dictionary",+ "dictionaryCode": "tl",+ "languages": [+ "tl"+ ],+ "files": [+ {+ "name": "tl.dict",+ "sizeBytes": 944566,+ "installPath": "dictionaries/tl.dict",+ "url": "https://offline-translator.davidv.dev/dictionaries/1/tl.dict",+ "role": "dictionary",+ "priority": 0+ }+ ],+ "dependsOn": [],+ "metadata": {+ "date": 1784028791,+ "type": "english",+ "wordCount": 26137+ }+ },+ "dict-tr": {+ "feature": "dictionary",+ "dictionaryCode": "tr",+ "languages": [+ "tr"+ ],+ "files": [+ {+ "name": "tr.dict",+ "sizeBytes": 4279915,+ "installPath": "dictionaries/tr.dict",+ "url": "https://offline-translator.davidv.dev/dictionaries/1/tr.dict",+ "role": "dictionary",+ "priority": 0+ }+ ],+ "dependsOn": [],+ "metadata": {+ "date": 1758204389,+ "type": "bilingual",+ "wordCount": 264946+ }+ },+ "dict-uk": {+ "feature": "dictionary",+ "dictionaryCode": "uk",+ "languages": [+ "uk"+ ],+ "files": [+ {+ "name": "uk.dict",+ "sizeBytes": 1294460,+ "installPath": "dictionaries/uk.dict",+ "url": "https://offline-translator.davidv.dev/dictionaries/1/uk.dict",+ "role": "dictionary",+ "priority": 0+ }+ ],+ "dependsOn": [],+ "metadata": {+ "date": 1758204389,+ "type": "english",+ "wordCount": 47095+ }+ },+ "dict-ur": {+ "feature": "dictionary",+ "dictionaryCode": "ur",+ "languages": [+ "ur"+ ],+ "files": [+ {+ "name": "ur.dict",+ "sizeBytes": 225606,+ "installPath": "dictionaries/ur.dict",+ "url": "https://offline-translator.davidv.dev/dictionaries/1/ur.dict",+ "role": "dictionary",+ "priority": 0+ }+ ],+ "dependsOn": [],+ "metadata": {+ "date": 1781815948,+ "type": "english",+ "wordCount": 7069+ }+ },+ "dict-vi": {+ "feature": "dictionary",+ "dictionaryCode": "vi",+ "languages": [+ "vi"+ ],+ "files": [+ {+ "name": "vi.dict",+ "sizeBytes": 844488,+ "installPath": "dictionaries/vi.dict",+ "url": "https://offline-translator.davidv.dev/dictionaries/1/vi.dict",+ "role": "dictionary",+ "priority": 0+ }+ ],+ "dependsOn": [],+ "metadata": {+ "date": 1774864382,+ "type": "bilingual",+ "wordCount": 20394+ }+ },+ "dict-zh": {+ "feature": "dictionary",+ "dictionaryCode": "zh",+ "languages": [+ "zh",+ "zh_hant"+ ],+ "files": [+ {+ "name": "zh.dict",+ "sizeBytes": 10139921,+ "installPath": "dictionaries/zh.dict",+ "url": "https://offline-translator.davidv.dev/dictionaries/1/zh.dict",+ "role": "dictionary",+ "priority": 0+ }+ ],+ "dependsOn": [],+ "metadata": {+ "date": 1758204389,+ "type": "bilingual",+ "wordCount": 435742+ }+ },+ "support-ja-mucab": {+ "feature": "support",+ "language": "ja",+ "kind": "mucab",+ "files": [+ {+ "name": "mucab.bin",+ "sizeBytes": 6967556,+ "installPath": "bin/mucab.bin",+ "url": "https://offline-translator.davidv.dev/dictionaries/extra/mucab.bin",+ "role": "mucab",+ "priority": 0+ }+ ],+ "dependsOn": []+ },+ "translate-ar-en": {+ "feature": "translation",+ "from": "ar",+ "to": "en",+ "experimental": false,+ "files": [+ {+ "name": "model.aren.intgemm.alphas.bin",+ "sizeBytes": 23224456,+ "installPath": "bin/model.aren.intgemm.alphas.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/ar-en/retrain_base-memory_X9fDxFreTOCslPKzb1CXTg/exported/model.aren.intgemm.alphas.bin.gz",+ "role": "model",+ "priority": 0+ },+ {+ "name": "lex.50.50.aren.s2t.bin",+ "sizeBytes": 2259861,+ "installPath": "bin/lex.50.50.aren.s2t.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/ar-en/retrain_base-memory_X9fDxFreTOCslPKzb1CXTg/exported/lex.50.50.aren.s2t.bin.gz",+ "role": "lex",+ "priority": 0+ },+ {+ "name": "vocab.aren.spm",+ "sizeBytes": 416700,+ "installPath": "bin/vocab.aren.spm",+ "url": "https://offline-translator.davidv.dev/translation/1/models/ar-en/retrain_base-memory_X9fDxFreTOCslPKzb1CXTg/exported/vocab.aren.spm.gz",+ "role": "vocab",+ "priority": 0+ }+ ],+ "dependsOn": []+ },+ "translate-az-en": {+ "feature": "translation",+ "from": "az",+ "to": "en",+ "experimental": true,+ "files": [+ {+ "name": "model.azen.intgemm.alphas.bin",+ "sizeBytes": 12740106,+ "installPath": "bin/model.azen.intgemm.alphas.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/az-en/h1-2025_Tm4nvtoLQnakAWSGhBZ-eA/exported/model.azen.intgemm.alphas.bin.gz",+ "role": "model",+ "priority": 0+ },+ {+ "name": "lex.50.50.azen.s2t.bin",+ "sizeBytes": 2267101,+ "installPath": "bin/lex.50.50.azen.s2t.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/az-en/h1-2025_Tm4nvtoLQnakAWSGhBZ-eA/exported/lex.50.50.azen.s2t.bin.gz",+ "role": "lex",+ "priority": 0+ },+ {+ "name": "vocab.azen.spm",+ "sizeBytes": 418965,+ "installPath": "bin/vocab.azen.spm",+ "url": "https://offline-translator.davidv.dev/translation/1/models/az-en/h1-2025_Tm4nvtoLQnakAWSGhBZ-eA/exported/vocab.azen.spm.gz",+ "role": "vocab",+ "priority": 0+ }+ ],+ "dependsOn": []+ },+ "translate-be-en": {+ "feature": "translation",+ "from": "be",+ "to": "en",+ "experimental": true,+ "files": [+ {+ "name": "model.been.intgemm.alphas.bin",+ "sizeBytes": 12413897,+ "installPath": "bin/model.been.intgemm.alphas.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/be-en/h1-2025_ARgOSPOSRVmOWTwFvRVOjA/exported/model.been.intgemm.alphas.bin.gz",+ "role": "model",+ "priority": 0+ },+ {+ "name": "lex.50.50.been.s2t.bin",+ "sizeBytes": 2197076,+ "installPath": "bin/lex.50.50.been.s2t.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/be-en/h1-2025_ARgOSPOSRVmOWTwFvRVOjA/exported/lex.50.50.been.s2t.bin.gz",+ "role": "lex",+ "priority": 0+ },+ {+ "name": "vocab.been.spm",+ "sizeBytes": 435364,+ "installPath": "bin/vocab.been.spm",+ "url": "https://offline-translator.davidv.dev/translation/1/models/be-en/h1-2025_ARgOSPOSRVmOWTwFvRVOjA/exported/vocab.been.spm.gz",+ "role": "vocab",+ "priority": 0+ }+ ],+ "dependsOn": []+ },+ "translate-bg-en": {+ "feature": "translation",+ "from": "bg",+ "to": "en",+ "experimental": false,+ "files": [+ {+ "name": "model.bgen.intgemm.alphas.bin",+ "sizeBytes": 22399269,+ "installPath": "bin/model.bgen.intgemm.alphas.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/bg-en/retrain_hr_WvwHu4k6TgmJ2YTvL4Mu2g/exported/model.bgen.intgemm.alphas.bin.gz",+ "role": "model",+ "priority": 0+ },+ {+ "name": "lex.50.50.bgen.s2t.bin",+ "sizeBytes": 2187053,+ "installPath": "bin/lex.50.50.bgen.s2t.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/bg-en/retrain_hr_WvwHu4k6TgmJ2YTvL4Mu2g/exported/lex.50.50.bgen.s2t.bin.gz",+ "role": "lex",+ "priority": 0+ },+ {+ "name": "vocab.bgen.spm",+ "sizeBytes": 434940,+ "installPath": "bin/vocab.bgen.spm",+ "url": "https://offline-translator.davidv.dev/translation/1/models/bg-en/retrain_hr_WvwHu4k6TgmJ2YTvL4Mu2g/exported/vocab.bgen.spm.gz",+ "role": "vocab",+ "priority": 0+ }+ ],+ "dependsOn": []+ },+ "translate-bn-en": {+ "feature": "translation",+ "from": "bn",+ "to": "en",+ "experimental": false,+ "files": [+ {+ "name": "model.bnen.intgemm.alphas.bin",+ "sizeBytes": 12665857,+ "installPath": "bin/model.bnen.intgemm.alphas.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/bn-en/h1-2025_XcpBlhA1SyOJCH2UzoIMyQ/exported/model.bnen.intgemm.alphas.bin.gz",+ "role": "model",+ "priority": 0+ },+ {+ "name": "lex.50.50.bnen.s2t.bin",+ "sizeBytes": 2264284,+ "installPath": "bin/lex.50.50.bnen.s2t.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/bn-en/h1-2025_XcpBlhA1SyOJCH2UzoIMyQ/exported/lex.50.50.bnen.s2t.bin.gz",+ "role": "lex",+ "priority": 0+ },+ {+ "name": "vocab.bnen.spm",+ "sizeBytes": 437571,+ "installPath": "bin/vocab.bnen.spm",+ "url": "https://offline-translator.davidv.dev/translation/1/models/bn-en/h1-2025_XcpBlhA1SyOJCH2UzoIMyQ/exported/vocab.bnen.spm.gz",+ "role": "vocab",+ "priority": 0+ }+ ],+ "dependsOn": []+ },+ "translate-bs-en": {+ "feature": "translation",+ "from": "bs",+ "to": "en",+ "experimental": true,+ "files": [+ {+ "name": "model.bsen.intgemm.alphas.bin",+ "sizeBytes": 13415215,+ "installPath": "bin/model.bsen.intgemm.alphas.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/bs-en/spring-2024_ArlZLOUDTlqbe5WcnWGt_A/exported/model.bsen.intgemm.alphas.bin.gz",+ "role": "model",+ "priority": 0+ },+ {+ "name": "lex.50.50.bsen.s2t.bin",+ "sizeBytes": 1426937,+ "installPath": "bin/lex.50.50.bsen.s2t.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/bs-en/spring-2024_ArlZLOUDTlqbe5WcnWGt_A/exported/lex.50.50.bsen.s2t.bin.gz",+ "role": "lex",+ "priority": 0+ },+ {+ "name": "vocab.bsen.spm",+ "sizeBytes": 396913,+ "installPath": "bin/vocab.bsen.spm",+ "url": "https://offline-translator.davidv.dev/translation/1/models/bs-en/spring-2024_ArlZLOUDTlqbe5WcnWGt_A/exported/vocab.bsen.spm.gz",+ "role": "vocab",+ "priority": 0+ }+ ],+ "dependsOn": []+ },+ "translate-ca-en": {+ "feature": "translation",+ "from": "ca",+ "to": "en",+ "experimental": false,+ "files": [+ {+ "name": "model.caen.intgemm.alphas.bin",+ "sizeBytes": 22787743,+ "installPath": "bin/model.caen.intgemm.alphas.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/ca-en/target-side-dedup_xxxxxxxxRxSxxxxxxxxxxA/exported/model.caen.intgemm.alphas.bin.gz",+ "role": "model",+ "priority": 0+ },+ {+ "name": "lex.50.50.caen.s2t.bin",+ "sizeBytes": 2257590,+ "installPath": "bin/lex.50.50.caen.s2t.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/ca-en/target-side-dedup_xxxxxxxxRxSxxxxxxxxxxA/exported/lex.50.50.caen.s2t.bin.gz",+ "role": "lex",+ "priority": 0+ },+ {+ "name": "vocab.caen.spm",+ "sizeBytes": 409662,+ "installPath": "bin/vocab.caen.spm",+ "url": "https://offline-translator.davidv.dev/translation/1/models/ca-en/target-side-dedup_xxxxxxxxRxSxxxxxxxxxxA/exported/vocab.caen.spm.gz",+ "role": "vocab",+ "priority": 0+ }+ ],+ "dependsOn": []+ },+ "translate-cs-en": {+ "feature": "translation",+ "from": "cs",+ "to": "en",+ "experimental": false,+ "files": [+ {+ "name": "model.csen.intgemm.alphas.bin",+ "sizeBytes": 22830296,+ "installPath": "bin/model.csen.intgemm.alphas.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/cs-en/retrain_hr_EwWhUov8TP6D_oolATvbUA/exported/model.csen.intgemm.alphas.bin.gz",+ "role": "model",+ "priority": 0+ },+ {+ "name": "lex.50.50.csen.s2t.bin",+ "sizeBytes": 2493702,+ "installPath": "bin/lex.50.50.csen.s2t.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/cs-en/retrain_hr_EwWhUov8TP6D_oolATvbUA/exported/lex.50.50.csen.s2t.bin.gz",+ "role": "lex",+ "priority": 0+ },+ {+ "name": "vocab.csen.spm",+ "sizeBytes": 412691,+ "installPath": "bin/vocab.csen.spm",+ "url": "https://offline-translator.davidv.dev/translation/1/models/cs-en/retrain_hr_EwWhUov8TP6D_oolATvbUA/exported/vocab.csen.spm.gz",+ "role": "vocab",+ "priority": 0+ }+ ],+ "dependsOn": []+ },+ "translate-da-en": {+ "feature": "translation",+ "from": "da",+ "to": "en",+ "experimental": false,+ "files": [+ {+ "name": "model.daen.intgemm.alphas.bin",+ "sizeBytes": 12525769,+ "installPath": "bin/model.daen.intgemm.alphas.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/da-en/spring-2024_U1vVpsWWT-K4L9pRfP1K1g/exported/model.daen.intgemm.alphas.bin.gz",+ "role": "model",+ "priority": 0+ },+ {+ "name": "lex.50.50.daen.s2t.bin",+ "sizeBytes": 2170970,+ "installPath": "bin/lex.50.50.daen.s2t.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/da-en/spring-2024_U1vVpsWWT-K4L9pRfP1K1g/exported/lex.50.50.daen.s2t.bin.gz",+ "role": "lex",+ "priority": 0+ },+ {+ "name": "vocab.daen.spm",+ "sizeBytes": 399344,+ "installPath": "bin/vocab.daen.spm",+ "url": "https://offline-translator.davidv.dev/translation/1/models/da-en/spring-2024_U1vVpsWWT-K4L9pRfP1K1g/exported/vocab.daen.spm.gz",+ "role": "vocab",+ "priority": 0+ }+ ],+ "dependsOn": []+ },+ "translate-de-en": {+ "feature": "translation",+ "from": "de",+ "to": "en",+ "experimental": false,+ "files": [+ {+ "name": "model.deen.intgemm.alphas.bin",+ "sizeBytes": 22403755,+ "installPath": "bin/model.deen.intgemm.alphas.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/de-en/retrain_hr2_WZOW24i4QJmIib61LeHfwg/exported/model.deen.intgemm.alphas.bin.gz",+ "role": "model",+ "priority": 0+ },+ {+ "name": "lex.50.50.deen.s2t.bin",+ "sizeBytes": 2626658,+ "installPath": "bin/lex.50.50.deen.s2t.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/de-en/retrain_hr2_WZOW24i4QJmIib61LeHfwg/exported/lex.50.50.deen.s2t.bin.gz",+ "role": "lex",+ "priority": 0+ },+ {+ "name": "vocab.deen.spm",+ "sizeBytes": 413879,+ "installPath": "bin/vocab.deen.spm",+ "url": "https://offline-translator.davidv.dev/translation/1/models/de-en/retrain_hr2_WZOW24i4QJmIib61LeHfwg/exported/vocab.deen.spm.gz",+ "role": "vocab",+ "priority": 0+ }+ ],+ "dependsOn": []+ },+ "translate-el-en": {+ "feature": "translation",+ "from": "el",+ "to": "en",+ "experimental": false,+ "files": [+ {+ "name": "model.elen.intgemm.alphas.bin",+ "sizeBytes": 12696541,+ "installPath": "bin/model.elen.intgemm.alphas.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/el-en/spring-2024_RJucgx7LRMKB9E4oSSzdtA/exported/model.elen.intgemm.alphas.bin.gz",+ "role": "model",+ "priority": 0+ },+ {+ "name": "lex.50.50.elen.s2t.bin",+ "sizeBytes": 1851246,+ "installPath": "bin/lex.50.50.elen.s2t.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/el-en/spring-2024_RJucgx7LRMKB9E4oSSzdtA/exported/lex.50.50.elen.s2t.bin.gz",+ "role": "lex",+ "priority": 0+ },+ {+ "name": "vocab.elen.spm",+ "sizeBytes": 419174,+ "installPath": "bin/vocab.elen.spm",+ "url": "https://offline-translator.davidv.dev/translation/1/models/el-en/spring-2024_RJucgx7LRMKB9E4oSSzdtA/exported/vocab.elen.spm.gz",+ "role": "vocab",+ "priority": 0+ }+ ],+ "dependsOn": []+ },+ "translate-en-ar": {+ "feature": "translation",+ "from": "en",+ "to": "ar",+ "experimental": false,+ "files": [+ {+ "name": "model.enar.intgemm.alphas.bin",+ "sizeBytes": 22857819,+ "installPath": "bin/model.enar.intgemm.alphas.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/en-ar/retrain_base-memory_G3CmhwG_TZext3cys-udHg/exported/model.enar.intgemm.alphas.bin.gz",+ "role": "model",+ "priority": 0+ },+ {+ "name": "lex.50.50.enar.s2t.bin",+ "sizeBytes": 1639219,+ "installPath": "bin/lex.50.50.enar.s2t.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/en-ar/retrain_base-memory_G3CmhwG_TZext3cys-udHg/exported/lex.50.50.enar.s2t.bin.gz",+ "role": "lex",+ "priority": 0+ },+ {+ "name": "vocab.enar.spm",+ "sizeBytes": 418930,+ "installPath": "bin/vocab.enar.spm",+ "url": "https://offline-translator.davidv.dev/translation/1/models/en-ar/retrain_base-memory_G3CmhwG_TZext3cys-udHg/exported/vocab.enar.spm.gz",+ "role": "vocab",+ "priority": 0+ }+ ],+ "dependsOn": []+ },+ "translate-en-az": {+ "feature": "translation",+ "from": "en",+ "to": "az",+ "experimental": false,+ "files": [+ {+ "name": "model.enaz.intgemm.alphas.bin",+ "sizeBytes": 13233108,+ "installPath": "bin/model.enaz.intgemm.alphas.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/en-az/h1-2025_fu1HFuR0QY-zVBcKYQkJIA/exported/model.enaz.intgemm.alphas.bin.gz",+ "role": "model",+ "priority": 0+ },+ {+ "name": "lex.50.50.enaz.s2t.bin",+ "sizeBytes": 1711544,+ "installPath": "bin/lex.50.50.enaz.s2t.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/en-az/h1-2025_fu1HFuR0QY-zVBcKYQkJIA/exported/lex.50.50.enaz.s2t.bin.gz",+ "role": "lex",+ "priority": 0+ },+ {+ "name": "vocab.enaz.spm",+ "sizeBytes": 418956,+ "installPath": "bin/vocab.enaz.spm",+ "url": "https://offline-translator.davidv.dev/translation/1/models/en-az/h1-2025_fu1HFuR0QY-zVBcKYQkJIA/exported/vocab.enaz.spm.gz",+ "role": "vocab",+ "priority": 0+ }+ ],+ "dependsOn": []+ },+ "translate-en-bg": {+ "feature": "translation",+ "from": "en",+ "to": "bg",+ "experimental": false,+ "files": [+ {+ "name": "model.enbg.intgemm.alphas.bin",+ "sizeBytes": 23432015,+ "installPath": "bin/model.enbg.intgemm.alphas.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/en-bg/retrain_hr_eAF9fkYRScmBmvvfdT4XWw/exported/model.enbg.intgemm.alphas.bin.gz",+ "role": "model",+ "priority": 0+ },+ {+ "name": "lex.50.50.enbg.s2t.bin",+ "sizeBytes": 1548577,+ "installPath": "bin/lex.50.50.enbg.s2t.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/en-bg/retrain_hr_eAF9fkYRScmBmvvfdT4XWw/exported/lex.50.50.enbg.s2t.bin.gz",+ "role": "lex",+ "priority": 0+ },+ {+ "name": "vocab.enbg.spm",+ "sizeBytes": 434940,+ "installPath": "bin/vocab.enbg.spm",+ "url": "https://offline-translator.davidv.dev/translation/1/models/en-bg/retrain_hr_eAF9fkYRScmBmvvfdT4XWw/exported/vocab.enbg.spm.gz",+ "role": "vocab",+ "priority": 0+ }+ ],+ "dependsOn": []+ },+ "translate-en-bn": {+ "feature": "translation",+ "from": "en",+ "to": "bn",+ "experimental": false,+ "files": [+ {+ "name": "model.enbn.intgemm.alphas.bin",+ "sizeBytes": 12821521,+ "installPath": "bin/model.enbn.intgemm.alphas.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/en-bn/h1-2025_TYlSskC_Sk6lBlfWRetXmg/exported/model.enbn.intgemm.alphas.bin.gz",+ "role": "model",+ "priority": 0+ },+ {+ "name": "lex.50.50.enbn.s2t.bin",+ "sizeBytes": 1607697,+ "installPath": "bin/lex.50.50.enbn.s2t.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/en-bn/h1-2025_TYlSskC_Sk6lBlfWRetXmg/exported/lex.50.50.enbn.s2t.bin.gz",+ "role": "lex",+ "priority": 0+ },+ {+ "name": "vocab.enbn.spm",+ "sizeBytes": 437373,+ "installPath": "bin/vocab.enbn.spm",+ "url": "https://offline-translator.davidv.dev/translation/1/models/en-bn/h1-2025_TYlSskC_Sk6lBlfWRetXmg/exported/vocab.enbn.spm.gz",+ "role": "vocab",+ "priority": 0+ }+ ],+ "dependsOn": []+ },+ "translate-en-bs": {+ "feature": "translation",+ "from": "en",+ "to": "bs",+ "experimental": false,+ "files": [+ {+ "name": "model.enbs.intgemm.alphas.bin",+ "sizeBytes": 22932779,+ "installPath": "bin/model.enbs.intgemm.alphas.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/en-bs/hbs-topk10_HBBkp2ozSYaY9f7WVGRtpA/exported/model.enbs.intgemm.alphas.bin.gz",+ "role": "model",+ "priority": 0+ },+ {+ "name": "lex.50.50.enbs.s2t.bin",+ "sizeBytes": 1682912,+ "installPath": "bin/lex.50.50.enbs.s2t.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/en-bs/hbs-topk10_HBBkp2ozSYaY9f7WVGRtpA/exported/lex.50.50.enbs.s2t.bin.gz",+ "role": "lex",+ "priority": 0+ },+ {+ "name": "vocab.enbs.spm",+ "sizeBytes": 412204,+ "installPath": "bin/vocab.enbs.spm",+ "url": "https://offline-translator.davidv.dev/translation/1/models/en-bs/hbs-topk10_HBBkp2ozSYaY9f7WVGRtpA/exported/vocab.enbs.spm.gz",+ "role": "vocab",+ "priority": 0+ }+ ],+ "dependsOn": []+ },+ "translate-en-ca": {+ "feature": "translation",+ "from": "en",+ "to": "ca",+ "experimental": false,+ "files": [+ {+ "name": "model.enca.intgemm.alphas.bin",+ "sizeBytes": 23174479,+ "installPath": "bin/model.enca.intgemm.alphas.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/en-ca/short-sentences_dqpjVFEaT2WLVB2nV0_H2g/exported/model.enca.intgemm.alphas.bin.gz",+ "role": "model",+ "priority": 0+ },+ {+ "name": "lex.50.50.enca.s2t.bin",+ "sizeBytes": 2085904,+ "installPath": "bin/lex.50.50.enca.s2t.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/en-ca/short-sentences_dqpjVFEaT2WLVB2nV0_H2g/exported/lex.50.50.enca.s2t.bin.gz",+ "role": "lex",+ "priority": 0+ },+ {+ "name": "vocab.enca.spm",+ "sizeBytes": 409866,+ "installPath": "bin/vocab.enca.spm",+ "url": "https://offline-translator.davidv.dev/translation/1/models/en-ca/short-sentences_dqpjVFEaT2WLVB2nV0_H2g/exported/vocab.enca.spm.gz",+ "role": "vocab",+ "priority": 0+ }+ ],+ "dependsOn": []+ },+ "translate-en-cs": {+ "feature": "translation",+ "from": "en",+ "to": "cs",+ "experimental": false,+ "files": [+ {+ "name": "model.encs.intgemm.alphas.bin",+ "sizeBytes": 23192301,+ "installPath": "bin/model.encs.intgemm.alphas.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/en-cs/retrain_hr_F_JF0vqvSjSwn3caQQcicA/exported/model.encs.intgemm.alphas.bin.gz",+ "role": "model",+ "priority": 0+ },+ {+ "name": "lex.50.50.encs.s2t.bin",+ "sizeBytes": 1896925,+ "installPath": "bin/lex.50.50.encs.s2t.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/en-cs/retrain_hr_F_JF0vqvSjSwn3caQQcicA/exported/lex.50.50.encs.s2t.bin.gz",+ "role": "lex",+ "priority": 0+ },+ {+ "name": "vocab.encs.spm",+ "sizeBytes": 412691,+ "installPath": "bin/vocab.encs.spm",+ "url": "https://offline-translator.davidv.dev/translation/1/models/en-cs/retrain_hr_F_JF0vqvSjSwn3caQQcicA/exported/vocab.encs.spm.gz",+ "role": "vocab",+ "priority": 0+ }+ ],+ "dependsOn": []+ },+ "translate-en-da": {+ "feature": "translation",+ "from": "en",+ "to": "da",+ "experimental": false,+ "files": [+ {+ "name": "model.enda.intgemm.alphas.bin",+ "sizeBytes": 12723889,+ "installPath": "bin/model.enda.intgemm.alphas.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/en-da/spring-2024_XUm0Ij8WSfabkKeKA_Xv_g/exported/model.enda.intgemm.alphas.bin.gz",+ "role": "model",+ "priority": 0+ },+ {+ "name": "lex.50.50.enda.s2t.bin",+ "sizeBytes": 1582768,+ "installPath": "bin/lex.50.50.enda.s2t.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/en-da/spring-2024_XUm0Ij8WSfabkKeKA_Xv_g/exported/lex.50.50.enda.s2t.bin.gz",+ "role": "lex",+ "priority": 0+ },+ {+ "name": "vocab.enda.spm",+ "sizeBytes": 398818,+ "installPath": "bin/vocab.enda.spm",+ "url": "https://offline-translator.davidv.dev/translation/1/models/en-da/spring-2024_XUm0Ij8WSfabkKeKA_Xv_g/exported/vocab.enda.spm.gz",+ "role": "vocab",+ "priority": 0+ }+ ],+ "dependsOn": []+ },+ "translate-en-de": {+ "feature": "translation",+ "from": "en",+ "to": "de",+ "experimental": false,+ "files": [+ {+ "name": "model.ende.intgemm.alphas.bin",+ "sizeBytes": 22992073,+ "installPath": "bin/model.ende.intgemm.alphas.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/en-de/retrain_hr_fix_names_SCgGhxUPQ2WAECHLRtzrMg/exported/model.ende.intgemm.alphas.bin.gz",+ "role": "model",+ "priority": 0+ },+ {+ "name": "lex.50.50.ende.s2t.bin",+ "sizeBytes": 2314750,+ "installPath": "bin/lex.50.50.ende.s2t.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/en-de/retrain_hr_fix_names_SCgGhxUPQ2WAECHLRtzrMg/exported/lex.50.50.ende.s2t.bin.gz",+ "role": "lex",+ "priority": 0+ },+ {+ "name": "vocab.ende.spm",+ "sizeBytes": 413879,+ "installPath": "bin/vocab.ende.spm",+ "url": "https://offline-translator.davidv.dev/translation/1/models/en-de/retrain_hr_fix_names_SCgGhxUPQ2WAECHLRtzrMg/exported/vocab.ende.spm.gz",+ "role": "vocab",+ "priority": 0+ }+ ],+ "dependsOn": []+ },+ "translate-en-el": {+ "feature": "translation",+ "from": "en",+ "to": "el",+ "experimental": false,+ "files": [+ {+ "name": "model.enel.intgemm.alphas.bin",+ "sizeBytes": 12808027,+ "installPath": "bin/model.enel.intgemm.alphas.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/en-el/spring-2024_Y3ThG3XkTxG4ROUQK2LpVg/exported/model.enel.intgemm.alphas.bin.gz",+ "role": "model",+ "priority": 0+ },+ {+ "name": "lex.50.50.enel.s2t.bin",+ "sizeBytes": 1352643,+ "installPath": "bin/lex.50.50.enel.s2t.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/en-el/spring-2024_Y3ThG3XkTxG4ROUQK2LpVg/exported/lex.50.50.enel.s2t.bin.gz",+ "role": "lex",+ "priority": 0+ },+ {+ "name": "vocab.enel.spm",+ "sizeBytes": 419275,+ "installPath": "bin/vocab.enel.spm",+ "url": "https://offline-translator.davidv.dev/translation/1/models/en-el/spring-2024_Y3ThG3XkTxG4ROUQK2LpVg/exported/vocab.enel.spm.gz",+ "role": "vocab",+ "priority": 0+ }+ ],+ "dependsOn": []+ },+ "translate-en-es": {+ "feature": "translation",+ "from": "en",+ "to": "es",+ "experimental": false,+ "files": [+ {+ "name": "model.enes.intgemm.alphas.bin",+ "sizeBytes": 22698792,+ "installPath": "bin/model.enes.intgemm.alphas.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/en-es/retrain_hr_fix_names_CUAEXUHoQum_cFqh-ZAryw/exported/model.enes.intgemm.alphas.bin.gz",+ "role": "model",+ "priority": 0+ },+ {+ "name": "lex.50.50.enes.s2t.bin",+ "sizeBytes": 2265250,+ "installPath": "bin/lex.50.50.enes.s2t.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/en-es/retrain_hr_fix_names_CUAEXUHoQum_cFqh-ZAryw/exported/lex.50.50.enes.s2t.bin.gz",+ "role": "lex",+ "priority": 0+ },+ {+ "name": "vocab.enes.spm",+ "sizeBytes": 409312,+ "installPath": "bin/vocab.enes.spm",+ "url": "https://offline-translator.davidv.dev/translation/1/models/en-es/retrain_hr_fix_names_CUAEXUHoQum_cFqh-ZAryw/exported/vocab.enes.spm.gz",+ "role": "vocab",+ "priority": 0+ }+ ],+ "dependsOn": []+ },+ "translate-en-et": {+ "feature": "translation",+ "from": "en",+ "to": "et",+ "experimental": false,+ "files": [+ {+ "name": "model.enet.intgemm.alphas.bin",+ "sizeBytes": 22951751,+ "installPath": "bin/model.enet.intgemm.alphas.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/en-et/retrain_hr_GubU3EaMRY2VkR8p1dPUNw/exported/model.enet.intgemm.alphas.bin.gz",+ "role": "model",+ "priority": 0+ },+ {+ "name": "lex.50.50.enet.s2t.bin",+ "sizeBytes": 1865410,+ "installPath": "bin/lex.50.50.enet.s2t.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/en-et/retrain_hr_GubU3EaMRY2VkR8p1dPUNw/exported/lex.50.50.enet.s2t.bin.gz",+ "role": "lex",+ "priority": 0+ },+ {+ "name": "vocab.enet.spm",+ "sizeBytes": 414262,+ "installPath": "bin/vocab.enet.spm",+ "url": "https://offline-translator.davidv.dev/translation/1/models/en-et/retrain_hr_GubU3EaMRY2VkR8p1dPUNw/exported/vocab.enet.spm.gz",+ "role": "vocab",+ "priority": 0+ }+ ],+ "dependsOn": []+ },+ "translate-en-eu": {+ "feature": "translation",+ "from": "en",+ "to": "eu",+ "experimental": false,+ "files": [+ {+ "name": "model.eneu.intgemm.alphas.bin",+ "sizeBytes": 23068167,+ "installPath": "bin/model.eneu.intgemm.alphas.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/en-eu/eneu-baseline_IXuA7hOrQPCVZJOp6LIYVw/exported/model.eneu.intgemm.alphas.bin.gz",+ "role": "model",+ "priority": 0+ },+ {+ "name": "lex.50.50.eneu.s2t.bin",+ "sizeBytes": 1638880,+ "installPath": "bin/lex.50.50.eneu.s2t.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/en-eu/eneu-baseline_IXuA7hOrQPCVZJOp6LIYVw/exported/lex.50.50.eneu.s2t.bin.gz",+ "role": "lex",+ "priority": 0+ },+ {+ "name": "vocab.eneu.spm",+ "sizeBytes": 409774,+ "installPath": "bin/vocab.eneu.spm",+ "url": "https://offline-translator.davidv.dev/translation/1/models/en-eu/eneu-baseline_IXuA7hOrQPCVZJOp6LIYVw/exported/vocab.eneu.spm.gz",+ "role": "vocab",+ "priority": 0+ }+ ],+ "dependsOn": []+ },+ "translate-en-fa": {+ "feature": "translation",+ "from": "en",+ "to": "fa",+ "experimental": false,+ "files": [+ {+ "name": "model.enfa.intgemm.alphas.bin",+ "sizeBytes": 13058508,+ "installPath": "bin/model.enfa.intgemm.alphas.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/en-fa/h1-2025_c_TYU1BOTByxOnnkAunO7g/exported/model.enfa.intgemm.alphas.bin.gz",+ "role": "model",+ "priority": 0+ },+ {+ "name": "lex.50.50.enfa.s2t.bin",+ "sizeBytes": 1728367,+ "installPath": "bin/lex.50.50.enfa.s2t.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/en-fa/h1-2025_c_TYU1BOTByxOnnkAunO7g/exported/lex.50.50.enfa.s2t.bin.gz",+ "role": "lex",+ "priority": 0+ },+ {+ "name": "vocab.enfa.spm",+ "sizeBytes": 416223,+ "installPath": "bin/vocab.enfa.spm",+ "url": "https://offline-translator.davidv.dev/translation/1/models/en-fa/h1-2025_c_TYU1BOTByxOnnkAunO7g/exported/vocab.enfa.spm.gz",+ "role": "vocab",+ "priority": 0+ }+ ],+ "dependsOn": []+ },+ "translate-en-fi": {+ "feature": "translation",+ "from": "en",+ "to": "fi",+ "experimental": false,+ "files": [+ {+ "name": "model.enfi.intgemm.alphas.bin",+ "sizeBytes": 22580027,+ "installPath": "bin/model.enfi.intgemm.alphas.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/en-fi/retrain_hr_b45LsGaNQFyDRhHAvBbKrA/exported/model.enfi.intgemm.alphas.bin.gz",+ "role": "model",+ "priority": 0+ },+ {+ "name": "lex.50.50.enfi.s2t.bin",+ "sizeBytes": 1875557,+ "installPath": "bin/lex.50.50.enfi.s2t.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/en-fi/retrain_hr_b45LsGaNQFyDRhHAvBbKrA/exported/lex.50.50.enfi.s2t.bin.gz",+ "role": "lex",+ "priority": 0+ },+ {+ "name": "vocab.enfi.spm",+ "sizeBytes": 414280,+ "installPath": "bin/vocab.enfi.spm",+ "url": "https://offline-translator.davidv.dev/translation/1/models/en-fi/retrain_hr_b45LsGaNQFyDRhHAvBbKrA/exported/vocab.enfi.spm.gz",+ "role": "vocab",+ "priority": 0+ }+ ],+ "dependsOn": []+ },+ "translate-en-fr": {+ "feature": "translation",+ "from": "en",+ "to": "fr",+ "experimental": false,+ "files": [+ {+ "name": "model.enfr.intgemm.alphas.bin",+ "sizeBytes": 23045432,+ "installPath": "bin/model.enfr.intgemm.alphas.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/en-fr/retrain_hr_NLIxDbE1TBGyOTI-zwZagw/exported/model.enfr.intgemm.alphas.bin.gz",+ "role": "model",+ "priority": 0+ },+ {+ "name": "lex.50.50.enfr.s2t.bin",+ "sizeBytes": 2297334,+ "installPath": "bin/lex.50.50.enfr.s2t.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/en-fr/retrain_hr_NLIxDbE1TBGyOTI-zwZagw/exported/lex.50.50.enfr.s2t.bin.gz",+ "role": "lex",+ "priority": 0+ },+ {+ "name": "vocab.enfr.spm",+ "sizeBytes": 409706,+ "installPath": "bin/vocab.enfr.spm",+ "url": "https://offline-translator.davidv.dev/translation/1/models/en-fr/retrain_hr_NLIxDbE1TBGyOTI-zwZagw/exported/vocab.enfr.spm.gz",+ "role": "vocab",+ "priority": 0+ }+ ],+ "dependsOn": []+ },+ "translate-en-gl": {+ "feature": "translation",+ "from": "en",+ "to": "gl",+ "experimental": false,+ "files": [+ {+ "name": "model.engl.intgemm.alphas.bin",+ "sizeBytes": 23269843,+ "installPath": "bin/model.engl.intgemm.alphas.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/en-gl/engl-scielo_R-ohtLgdRzaBOXRG0v66NA/exported/model.engl.intgemm.alphas.bin.gz",+ "role": "model",+ "priority": 0+ },+ {+ "name": "lex.50.50.engl.s2t.bin",+ "sizeBytes": 1581710,+ "installPath": "bin/lex.50.50.engl.s2t.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/en-gl/engl-scielo_R-ohtLgdRzaBOXRG0v66NA/exported/lex.50.50.engl.s2t.bin.gz",+ "role": "lex",+ "priority": 0+ },+ {+ "name": "vocab.engl.spm",+ "sizeBytes": 410683,+ "installPath": "bin/vocab.engl.spm",+ "url": "https://offline-translator.davidv.dev/translation/1/models/en-gl/engl-scielo_R-ohtLgdRzaBOXRG0v66NA/exported/vocab.engl.spm.gz",+ "role": "vocab",+ "priority": 0+ }+ ],+ "dependsOn": []+ },+ "translate-en-gu": {+ "feature": "translation",+ "from": "en",+ "to": "gu",+ "experimental": false,+ "files": [+ {+ "name": "model.engu.intgemm.alphas.bin",+ "sizeBytes": 12657911,+ "installPath": "bin/model.engu.intgemm.alphas.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/en-gu/h1-2025_Na2-WpCIR1Sdy17l-XDeLA/exported/model.engu.intgemm.alphas.bin.gz",+ "role": "model",+ "priority": 0+ },+ {+ "name": "lex.50.50.engu.s2t.bin",+ "sizeBytes": 1529098,+ "installPath": "bin/lex.50.50.engu.s2t.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/en-gu/h1-2025_Na2-WpCIR1Sdy17l-XDeLA/exported/lex.50.50.engu.s2t.bin.gz",+ "role": "lex",+ "priority": 0+ },+ {+ "name": "vocab.engu.spm",+ "sizeBytes": 434881,+ "installPath": "bin/vocab.engu.spm",+ "url": "https://offline-translator.davidv.dev/translation/1/models/en-gu/h1-2025_Na2-WpCIR1Sdy17l-XDeLA/exported/vocab.engu.spm.gz",+ "role": "vocab",+ "priority": 0+ }+ ],+ "dependsOn": []+ },+ "translate-en-he": {+ "feature": "translation",+ "from": "en",+ "to": "he",+ "experimental": false,+ "files": [+ {+ "name": "model.enhe.intgemm.alphas.bin",+ "sizeBytes": 12979964,+ "installPath": "bin/model.enhe.intgemm.alphas.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/en-he/h1-2025_QtanzRiDRISacRVw4WzWYQ/exported/model.enhe.intgemm.alphas.bin.gz",+ "role": "model",+ "priority": 0+ },+ {+ "name": "lex.50.50.enhe.s2t.bin",+ "sizeBytes": 1567190,+ "installPath": "bin/lex.50.50.enhe.s2t.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/en-he/h1-2025_QtanzRiDRISacRVw4WzWYQ/exported/lex.50.50.enhe.s2t.bin.gz",+ "role": "lex",+ "priority": 0+ },+ {+ "name": "vocab.enhe.spm",+ "sizeBytes": 411686,+ "installPath": "bin/vocab.enhe.spm",+ "url": "https://offline-translator.davidv.dev/translation/1/models/en-he/h1-2025_QtanzRiDRISacRVw4WzWYQ/exported/vocab.enhe.spm.gz",+ "role": "vocab",+ "priority": 0+ }+ ],+ "dependsOn": []+ },+ "translate-en-hi": {+ "feature": "translation",+ "from": "en",+ "to": "hi",+ "experimental": false,+ "files": [+ {+ "name": "model.enhi.intgemm.alphas.bin",+ "sizeBytes": 12736263,+ "installPath": "bin/model.enhi.intgemm.alphas.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/en-hi/h1-2025_KoJuCNf_Q42R2Bz6j2jlOQ/exported/model.enhi.intgemm.alphas.bin.gz",+ "role": "model",+ "priority": 0+ },+ {+ "name": "lex.50.50.enhi.s2t.bin",+ "sizeBytes": 1690062,+ "installPath": "bin/lex.50.50.enhi.s2t.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/en-hi/h1-2025_KoJuCNf_Q42R2Bz6j2jlOQ/exported/lex.50.50.enhi.s2t.bin.gz",+ "role": "lex",+ "priority": 0+ },+ {+ "name": "vocab.enhi.spm",+ "sizeBytes": 430026,+ "installPath": "bin/vocab.enhi.spm",+ "url": "https://offline-translator.davidv.dev/translation/1/models/en-hi/h1-2025_KoJuCNf_Q42R2Bz6j2jlOQ/exported/vocab.enhi.spm.gz",+ "role": "vocab",+ "priority": 0+ }+ ],+ "dependsOn": []+ },+ "translate-en-hr": {+ "feature": "translation",+ "from": "en",+ "to": "hr",+ "experimental": false,+ "files": [+ {+ "name": "model.enhr.intgemm.alphas.bin",+ "sizeBytes": 22758240,+ "installPath": "bin/model.enhr.intgemm.alphas.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/en-hr/hbs-topk10_PLHJ-5OxSNyWlwZM12Kghw/exported/model.enhr.intgemm.alphas.bin.gz",+ "role": "model",+ "priority": 0+ },+ {+ "name": "lex.50.50.enhr.s2t.bin",+ "sizeBytes": 1713561,+ "installPath": "bin/lex.50.50.enhr.s2t.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/en-hr/hbs-topk10_PLHJ-5OxSNyWlwZM12Kghw/exported/lex.50.50.enhr.s2t.bin.gz",+ "role": "lex",+ "priority": 0+ },+ {+ "name": "vocab.enhr.spm",+ "sizeBytes": 410897,+ "installPath": "bin/vocab.enhr.spm",+ "url": "https://offline-translator.davidv.dev/translation/1/models/en-hr/hbs-topk10_PLHJ-5OxSNyWlwZM12Kghw/exported/vocab.enhr.spm.gz",+ "role": "vocab",+ "priority": 0+ }+ ],+ "dependsOn": []+ },+ "translate-en-hu": {+ "feature": "translation",+ "from": "en",+ "to": "hu",+ "experimental": false,+ "files": [+ {+ "name": "model.enhu.intgemm.alphas.bin",+ "sizeBytes": 23710206,+ "installPath": "bin/model.enhu.intgemm.alphas.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/en-hu/h1-2025_J8_9zNmQT2GfHg7_heOI_Q/exported/model.enhu.intgemm.alphas.bin.gz",+ "role": "model",+ "priority": 0+ },+ {+ "name": "lex.50.50.enhu.s2t.bin",+ "sizeBytes": 1768398,+ "installPath": "bin/lex.50.50.enhu.s2t.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/en-hu/h1-2025_J8_9zNmQT2GfHg7_heOI_Q/exported/lex.50.50.enhu.s2t.bin.gz",+ "role": "lex",+ "priority": 0+ },+ {+ "name": "vocab.enhu.spm",+ "sizeBytes": 405720,+ "installPath": "bin/vocab.enhu.spm",+ "url": "https://offline-translator.davidv.dev/translation/1/models/en-hu/h1-2025_J8_9zNmQT2GfHg7_heOI_Q/exported/vocab.enhu.spm.gz",+ "role": "vocab",+ "priority": 0+ }+ ],+ "dependsOn": []+ },+ "translate-en-id": {+ "feature": "translation",+ "from": "en",+ "to": "id",+ "experimental": false,+ "files": [+ {+ "name": "model.enid.intgemm.alphas.bin",+ "sizeBytes": 12503257,+ "installPath": "bin/model.enid.intgemm.alphas.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/en-id/spring-2024_bbjDBFoDTNGSUo2if3ET_A/exported/model.enid.intgemm.alphas.bin.gz",+ "role": "model",+ "priority": 0+ },+ {+ "name": "lex.50.50.enid.s2t.bin",+ "sizeBytes": 1734565,+ "installPath": "bin/lex.50.50.enid.s2t.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/en-id/spring-2024_bbjDBFoDTNGSUo2if3ET_A/exported/lex.50.50.enid.s2t.bin.gz",+ "role": "lex",+ "priority": 0+ },+ {+ "name": "vocab.enid.spm",+ "sizeBytes": 379806,+ "installPath": "bin/vocab.enid.spm",+ "url": "https://offline-translator.davidv.dev/translation/1/models/en-id/spring-2024_bbjDBFoDTNGSUo2if3ET_A/exported/vocab.enid.spm.gz",+ "role": "vocab",+ "priority": 0+ }+ ],+ "dependsOn": []+ },+ "translate-en-is": {+ "feature": "translation",+ "from": "en",+ "to": "is",+ "experimental": false,+ "files": [+ {+ "name": "model.enis.intgemm.alphas.bin",+ "sizeBytes": 22588003,+ "installPath": "bin/model.enis.intgemm.alphas.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/en-is/docmt-vocab_EkZBaZqDS5Cce_lC2BpxlA/exported/model.enis.intgemm.alphas.bin.gz",+ "role": "model",+ "priority": 0+ },+ {+ "name": "lex.50.50.enis.s2t.bin",+ "sizeBytes": 1977789,+ "installPath": "bin/lex.50.50.enis.s2t.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/en-is/docmt-vocab_EkZBaZqDS5Cce_lC2BpxlA/exported/lex.50.50.enis.s2t.bin.gz",+ "role": "lex",+ "priority": 0+ },+ {+ "name": "vocab.enis.spm",+ "sizeBytes": 413543,+ "installPath": "bin/vocab.enis.spm",+ "url": "https://offline-translator.davidv.dev/translation/1/models/en-is/docmt-vocab_EkZBaZqDS5Cce_lC2BpxlA/exported/vocab.enis.spm.gz",+ "role": "vocab",+ "priority": 0+ }+ ],+ "dependsOn": []+ },+ "translate-en-it": {+ "feature": "translation",+ "from": "en",+ "to": "it",+ "experimental": false,+ "files": [+ {+ "name": "model.enit.intgemm.alphas.bin",+ "sizeBytes": 23892889,+ "installPath": "bin/model.enit.intgemm.alphas.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/en-it/retrain_hr_fix_names_GPSr_u8PSmC9fOx1ZDCHoA/exported/model.enit.intgemm.alphas.bin.gz",+ "role": "model",+ "priority": 0+ },+ {+ "name": "lex.50.50.enit.s2t.bin",+ "sizeBytes": 2209348,+ "installPath": "bin/lex.50.50.enit.s2t.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/en-it/retrain_hr_fix_names_GPSr_u8PSmC9fOx1ZDCHoA/exported/lex.50.50.enit.s2t.bin.gz",+ "role": "lex",+ "priority": 0+ },+ {+ "name": "vocab.enit.spm",+ "sizeBytes": 407598,+ "installPath": "bin/vocab.enit.spm",+ "url": "https://offline-translator.davidv.dev/translation/1/models/en-it/retrain_hr_fix_names_GPSr_u8PSmC9fOx1ZDCHoA/exported/vocab.enit.spm.gz",+ "role": "vocab",+ "priority": 0+ }+ ],+ "dependsOn": []+ },+ "translate-en-ja": {+ "feature": "translation",+ "from": "en",+ "to": "ja",+ "experimental": false,+ "files": [+ {+ "name": "model.enja.intgemm.alphas.bin",+ "sizeBytes": 33052218,+ "installPath": "bin/model.enja.intgemm.alphas.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/en-ja/llmaat_finetune10M_qe8_f2_ApiGGQIwTKuF9i_k3n9Q2Q/exported/model.enja.intgemm.alphas.bin.gz",+ "role": "model",+ "priority": 0+ },+ {+ "name": "lex.50.50.enja.s2t.bin",+ "sizeBytes": 2341409,+ "installPath": "bin/lex.50.50.enja.s2t.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/en-ja/llmaat_finetune10M_qe8_f2_ApiGGQIwTKuF9i_k3n9Q2Q/exported/lex.50.50.enja.s2t.bin.gz",+ "role": "lex",+ "priority": 0+ },+ {+ "name": "srcvocab.enja.spm",+ "sizeBytes": 404352,+ "installPath": "bin/srcvocab.enja.spm",+ "url": "https://offline-translator.davidv.dev/translation/1/models/en-ja/llmaat_finetune10M_qe8_f2_ApiGGQIwTKuF9i_k3n9Q2Q/exported/srcvocab.enja.spm.gz",+ "role": "srcVocab",+ "priority": 0+ },+ {+ "name": "trgvocab.enja.spm",+ "sizeBytes": 431278,+ "installPath": "bin/trgvocab.enja.spm",+ "url": "https://offline-translator.davidv.dev/translation/1/models/en-ja/llmaat_finetune10M_qe8_f2_ApiGGQIwTKuF9i_k3n9Q2Q/exported/trgvocab.enja.spm.gz",+ "role": "tgtVocab",+ "priority": 0+ }+ ],+ "dependsOn": []+ },+ "translate-en-ka": {+ "feature": "translation",+ "from": "en",+ "to": "ka",+ "experimental": false,+ "files": [+ {+ "name": "model.enka.intgemm.alphas.bin",+ "sizeBytes": 24369762,+ "installPath": "bin/model.enka.intgemm.alphas.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/en-ka/lmt60_distill_20260902/exported/model.enka.intgemm.alphas.bin.gz",+ "role": "model",+ "priority": 0+ },+ {+ "name": "lex.50.50.enka.s2t.bin",+ "sizeBytes": 1750960,+ "installPath": "bin/lex.50.50.enka.s2t.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/en-ka/lmt60_distill_20260902/exported/lex.50.50.enka.s2t.bin.gz",+ "role": "lex",+ "priority": 0+ },+ {+ "name": "vocab.enka.spm",+ "sizeBytes": 416365,+ "installPath": "bin/vocab.enka.spm",+ "url": "https://offline-translator.davidv.dev/translation/1/models/en-ka/lmt60_distill_20260902/exported/vocab.enka.spm.gz",+ "role": "vocab",+ "priority": 0+ }+ ],+ "dependsOn": []+ },+ "translate-en-kn": {+ "feature": "translation",+ "from": "en",+ "to": "kn",+ "experimental": false,+ "files": [+ {+ "name": "model.enkn.intgemm.alphas.bin",+ "sizeBytes": 13009213,+ "installPath": "bin/model.enkn.intgemm.alphas.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/en-kn/h1-2025_DDVsjRwsQ8GL3-JAiAmmfQ/exported/model.enkn.intgemm.alphas.bin.gz",+ "role": "model",+ "priority": 0+ },+ {+ "name": "lex.50.50.enkn.s2t.bin",+ "sizeBytes": 1416160,+ "installPath": "bin/lex.50.50.enkn.s2t.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/en-kn/h1-2025_DDVsjRwsQ8GL3-JAiAmmfQ/exported/lex.50.50.enkn.s2t.bin.gz",+ "role": "lex",+ "priority": 0+ },+ {+ "name": "vocab.enkn.spm",+ "sizeBytes": 450046,+ "installPath": "bin/vocab.enkn.spm",+ "url": "https://offline-translator.davidv.dev/translation/1/models/en-kn/h1-2025_DDVsjRwsQ8GL3-JAiAmmfQ/exported/vocab.enkn.spm.gz",+ "role": "vocab",+ "priority": 0+ }+ ],+ "dependsOn": []+ },+ "translate-en-ko": {+ "feature": "translation",+ "from": "en",+ "to": "ko",+ "experimental": false,+ "files": [+ {+ "name": "model.enko.intgemm.alphas.bin",+ "sizeBytes": 33738001,+ "installPath": "bin/model.enko.intgemm.alphas.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/en-ko/cjk_retrain_base-memory_GP50C3MpQ9apCWZOW-f3PA/exported/model.enko.intgemm.alphas.bin.gz",+ "role": "model",+ "priority": 0+ },+ {+ "name": "lex.50.50.enko.s2t.bin",+ "sizeBytes": 3471311,+ "installPath": "bin/lex.50.50.enko.s2t.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/en-ko/cjk_retrain_base-memory_GP50C3MpQ9apCWZOW-f3PA/exported/lex.50.50.enko.s2t.bin.gz",+ "role": "lex",+ "priority": 0+ },+ {+ "name": "srcvocab.enko.spm",+ "sizeBytes": 402480,+ "installPath": "bin/srcvocab.enko.spm",+ "url": "https://offline-translator.davidv.dev/translation/1/models/en-ko/cjk_retrain_base-memory_GP50C3MpQ9apCWZOW-f3PA/exported/srcvocab.enko.spm.gz",+ "role": "srcVocab",+ "priority": 0+ },+ {+ "name": "trgvocab.enko.spm",+ "sizeBytes": 412614,+ "installPath": "bin/trgvocab.enko.spm",+ "url": "https://offline-translator.davidv.dev/translation/1/models/en-ko/cjk_retrain_base-memory_GP50C3MpQ9apCWZOW-f3PA/exported/trgvocab.enko.spm.gz",+ "role": "tgtVocab",+ "priority": 0+ }+ ],+ "dependsOn": []+ },+ "translate-en-lt": {+ "feature": "translation",+ "from": "en",+ "to": "lt",+ "experimental": false,+ "files": [+ {+ "name": "model.enlt.intgemm.alphas.bin",+ "sizeBytes": 22865642,+ "installPath": "bin/model.enlt.intgemm.alphas.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/en-lt/h1-2025_CpawQ31iTrmnax9Xi0DkBw/exported/model.enlt.intgemm.alphas.bin.gz",+ "role": "model",+ "priority": 0+ },+ {+ "name": "lex.50.50.enlt.s2t.bin",+ "sizeBytes": 1769752,+ "installPath": "bin/lex.50.50.enlt.s2t.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/en-lt/h1-2025_CpawQ31iTrmnax9Xi0DkBw/exported/lex.50.50.enlt.s2t.bin.gz",+ "role": "lex",+ "priority": 0+ },+ {+ "name": "vocab.enlt.spm",+ "sizeBytes": 403356,+ "installPath": "bin/vocab.enlt.spm",+ "url": "https://offline-translator.davidv.dev/translation/1/models/en-lt/h1-2025_CpawQ31iTrmnax9Xi0DkBw/exported/vocab.enlt.spm.gz",+ "role": "vocab",+ "priority": 0+ }+ ],+ "dependsOn": []+ },+ "translate-en-lv": {+ "feature": "translation",+ "from": "en",+ "to": "lv",+ "experimental": false,+ "files": [+ {+ "name": "model.enlv.intgemm.alphas.bin",+ "sizeBytes": 23727668,+ "installPath": "bin/model.enlv.intgemm.alphas.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/en-lv/h1-2025_L9sajlF2TCKfEzDro4tK3Q/exported/model.enlv.intgemm.alphas.bin.gz",+ "role": "model",+ "priority": 0+ },+ {+ "name": "lex.50.50.enlv.s2t.bin",+ "sizeBytes": 1725879,+ "installPath": "bin/lex.50.50.enlv.s2t.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/en-lv/h1-2025_L9sajlF2TCKfEzDro4tK3Q/exported/lex.50.50.enlv.s2t.bin.gz",+ "role": "lex",+ "priority": 0+ },+ {+ "name": "vocab.enlv.spm",+ "sizeBytes": 407540,+ "installPath": "bin/vocab.enlv.spm",+ "url": "https://offline-translator.davidv.dev/translation/1/models/en-lv/h1-2025_L9sajlF2TCKfEzDro4tK3Q/exported/vocab.enlv.spm.gz",+ "role": "vocab",+ "priority": 0+ }+ ],+ "dependsOn": []+ },+ "translate-en-ml": {+ "feature": "translation",+ "from": "en",+ "to": "ml",+ "experimental": false,+ "files": [+ {+ "name": "model.enml.intgemm.alphas.bin",+ "sizeBytes": 12570038,+ "installPath": "bin/model.enml.intgemm.alphas.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/en-ml/h1-2025_UylcthuMRoelqd6lsCbXJw/exported/model.enml.intgemm.alphas.bin.gz",+ "role": "model",+ "priority": 0+ },+ {+ "name": "lex.50.50.enml.s2t.bin",+ "sizeBytes": 1275347,+ "installPath": "bin/lex.50.50.enml.s2t.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/en-ml/h1-2025_UylcthuMRoelqd6lsCbXJw/exported/lex.50.50.enml.s2t.bin.gz",+ "role": "lex",+ "priority": 0+ },+ {+ "name": "vocab.enml.spm",+ "sizeBytes": 454768,+ "installPath": "bin/vocab.enml.spm",+ "url": "https://offline-translator.davidv.dev/translation/1/models/en-ml/h1-2025_UylcthuMRoelqd6lsCbXJw/exported/vocab.enml.spm.gz",+ "role": "vocab",+ "priority": 0+ }+ ],+ "dependsOn": []+ },+ "translate-en-ms": {+ "feature": "translation",+ "from": "en",+ "to": "ms",+ "experimental": false,+ "files": [+ {+ "name": "model.enms.intgemm.alphas.bin",+ "sizeBytes": 13039668,+ "installPath": "bin/model.enms.intgemm.alphas.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/en-ms/h1-2025_Ba76abX1Qtums6Vbv95tzg/exported/model.enms.intgemm.alphas.bin.gz",+ "role": "model",+ "priority": 0+ },+ {+ "name": "lex.50.50.enms.s2t.bin",+ "sizeBytes": 2044118,+ "installPath": "bin/lex.50.50.enms.s2t.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/en-ms/h1-2025_Ba76abX1Qtums6Vbv95tzg/exported/lex.50.50.enms.s2t.bin.gz",+ "role": "lex",+ "priority": 0+ },+ {+ "name": "vocab.enms.spm",+ "sizeBytes": 404033,+ "installPath": "bin/vocab.enms.spm",+ "url": "https://offline-translator.davidv.dev/translation/1/models/en-ms/h1-2025_Ba76abX1Qtums6Vbv95tzg/exported/vocab.enms.spm.gz",+ "role": "vocab",+ "priority": 0+ }+ ],+ "dependsOn": []+ },+ "translate-en-nb": {+ "feature": "translation",+ "from": "en",+ "to": "nb",+ "experimental": false,+ "files": [+ {+ "name": "model.ennb.intgemm.alphas.bin",+ "sizeBytes": 12713727,+ "installPath": "bin/model.ennb.intgemm.alphas.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/en-nb/h1-2025_A0d8NsivR6Szy2dI4Nz6FQ/exported/model.ennb.intgemm.alphas.bin.gz",+ "role": "model",+ "priority": 0+ },+ {+ "name": "lex.50.50.ennb.s2t.bin",+ "sizeBytes": 2193397,+ "installPath": "bin/lex.50.50.ennb.s2t.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/en-nb/h1-2025_A0d8NsivR6Szy2dI4Nz6FQ/exported/lex.50.50.ennb.s2t.bin.gz",+ "role": "lex",+ "priority": 0+ },+ {+ "name": "vocab.ennb.spm",+ "sizeBytes": 409037,+ "installPath": "bin/vocab.ennb.spm",+ "url": "https://offline-translator.davidv.dev/translation/1/models/en-nb/h1-2025_A0d8NsivR6Szy2dI4Nz6FQ/exported/vocab.ennb.spm.gz",+ "role": "vocab",+ "priority": 0+ }+ ],+ "dependsOn": []+ },+ "translate-en-nl": {+ "feature": "translation",+ "from": "en",+ "to": "nl",+ "experimental": false,+ "files": [+ {+ "name": "model.ennl.intgemm.alphas.bin",+ "sizeBytes": 23386633,+ "installPath": "bin/model.ennl.intgemm.alphas.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/en-nl/retrain_hr_fix_names_fR8XhBiBQniIbi4I_ebJ2Q/exported/model.ennl.intgemm.alphas.bin.gz",+ "role": "model",+ "priority": 0+ },+ {+ "name": "lex.50.50.ennl.s2t.bin",+ "sizeBytes": 2155034,+ "installPath": "bin/lex.50.50.ennl.s2t.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/en-nl/retrain_hr_fix_names_fR8XhBiBQniIbi4I_ebJ2Q/exported/lex.50.50.ennl.s2t.bin.gz",+ "role": "lex",+ "priority": 0+ },+ {+ "name": "vocab.ennl.spm",+ "sizeBytes": 410222,+ "installPath": "bin/vocab.ennl.spm",+ "url": "https://offline-translator.davidv.dev/translation/1/models/en-nl/retrain_hr_fix_names_fR8XhBiBQniIbi4I_ebJ2Q/exported/vocab.ennl.spm.gz",+ "role": "vocab",+ "priority": 0+ }+ ],+ "dependsOn": []+ },+ "translate-en-no": {+ "feature": "translation",+ "from": "en",+ "to": "no",+ "experimental": false,+ "files": [+ {+ "name": "model.enno.intgemm.alphas.bin",+ "sizeBytes": 12713727,+ "installPath": "bin/model.enno.intgemm.alphas.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/en-no/h1-2025_A0d8NsivR6Szy2dI4Nz6FQ/exported/model.enno.intgemm.alphas.bin.gz",+ "role": "model",+ "priority": 0+ },+ {+ "name": "lex.50.50.enno.s2t.bin",+ "sizeBytes": 2193397,+ "installPath": "bin/lex.50.50.enno.s2t.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/en-no/h1-2025_A0d8NsivR6Szy2dI4Nz6FQ/exported/lex.50.50.enno.s2t.bin.gz",+ "role": "lex",+ "priority": 0+ },+ {+ "name": "vocab.enno.spm",+ "sizeBytes": 409037,+ "installPath": "bin/vocab.enno.spm",+ "url": "https://offline-translator.davidv.dev/translation/1/models/en-no/h1-2025_A0d8NsivR6Szy2dI4Nz6FQ/exported/vocab.enno.spm.gz",+ "role": "vocab",+ "priority": 0+ }+ ],+ "dependsOn": []+ },+ "translate-en-pl": {+ "feature": "translation",+ "from": "en",+ "to": "pl",+ "experimental": false,+ "files": [+ {+ "name": "model.enpl.intgemm.alphas.bin",+ "sizeBytes": 22577447,+ "installPath": "bin/model.enpl.intgemm.alphas.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/en-pl/retrain_hr_fix_names_YmTlfuUsSKCbUp75UXaUuw/exported/model.enpl.intgemm.alphas.bin.gz",+ "role": "model",+ "priority": 0+ },+ {+ "name": "lex.50.50.enpl.s2t.bin",+ "sizeBytes": 1874327,+ "installPath": "bin/lex.50.50.enpl.s2t.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/en-pl/retrain_hr_fix_names_YmTlfuUsSKCbUp75UXaUuw/exported/lex.50.50.enpl.s2t.bin.gz",+ "role": "lex",+ "priority": 0+ },+ {+ "name": "vocab.enpl.spm",+ "sizeBytes": 413194,+ "installPath": "bin/vocab.enpl.spm",+ "url": "https://offline-translator.davidv.dev/translation/1/models/en-pl/retrain_hr_fix_names_YmTlfuUsSKCbUp75UXaUuw/exported/vocab.enpl.spm.gz",+ "role": "vocab",+ "priority": 0+ }+ ],+ "dependsOn": []+ },+ "translate-en-pt": {+ "feature": "translation",+ "from": "en",+ "to": "pt",+ "experimental": false,+ "files": [+ {+ "name": "model.enpt.intgemm.alphas.bin",+ "sizeBytes": 23340019,+ "installPath": "bin/model.enpt.intgemm.alphas.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/en-pt/retrain_hr_fix_names_Vnb0RUXTTd67hR-oLHM3eg/exported/model.enpt.intgemm.alphas.bin.gz",+ "role": "model",+ "priority": 0+ },+ {+ "name": "lex.50.50.enpt.s2t.bin",+ "sizeBytes": 2117608,+ "installPath": "bin/lex.50.50.enpt.s2t.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/en-pt/retrain_hr_fix_names_Vnb0RUXTTd67hR-oLHM3eg/exported/lex.50.50.enpt.s2t.bin.gz",+ "role": "lex",+ "priority": 0+ },+ {+ "name": "vocab.enpt.spm",+ "sizeBytes": 408686,+ "installPath": "bin/vocab.enpt.spm",+ "url": "https://offline-translator.davidv.dev/translation/1/models/en-pt/retrain_hr_fix_names_Vnb0RUXTTd67hR-oLHM3eg/exported/vocab.enpt.spm.gz",+ "role": "vocab",+ "priority": 0+ }+ ],+ "dependsOn": []+ },+ "translate-en-ro": {+ "feature": "translation",+ "from": "en",+ "to": "ro",+ "experimental": false,+ "files": [+ {+ "name": "model.enro.intgemm.alphas.bin",+ "sizeBytes": 12207487,+ "installPath": "bin/model.enro.intgemm.alphas.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/en-ro/spring-2024_Ov3G4D_DRJa-4qTlILkPhg/exported/model.enro.intgemm.alphas.bin.gz",+ "role": "model",+ "priority": 0+ },+ {+ "name": "lex.50.50.enro.s2t.bin",+ "sizeBytes": 1846074,+ "installPath": "bin/lex.50.50.enro.s2t.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/en-ro/spring-2024_Ov3G4D_DRJa-4qTlILkPhg/exported/lex.50.50.enro.s2t.bin.gz",+ "role": "lex",+ "priority": 0+ },+ {+ "name": "vocab.enro.spm",+ "sizeBytes": 397137,+ "installPath": "bin/vocab.enro.spm",+ "url": "https://offline-translator.davidv.dev/translation/1/models/en-ro/spring-2024_Ov3G4D_DRJa-4qTlILkPhg/exported/vocab.enro.spm.gz",+ "role": "vocab",+ "priority": 0+ }+ ],+ "dependsOn": []+ },+ "translate-en-ru": {+ "feature": "translation",+ "from": "en",+ "to": "ru",+ "experimental": false,+ "files": [+ {+ "name": "model.enru.intgemm.alphas.bin",+ "sizeBytes": 21988864,+ "installPath": "bin/model.enru.intgemm.alphas.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/en-ru/retrain_base-memory_KJ23-iDVTcymG1ZldWY17w/exported/model.enru.intgemm.alphas.bin.gz",+ "role": "model",+ "priority": 0+ },+ {+ "name": "lex.50.50.enru.s2t.bin",+ "sizeBytes": 1378563,+ "installPath": "bin/lex.50.50.enru.s2t.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/en-ru/retrain_base-memory_KJ23-iDVTcymG1ZldWY17w/exported/lex.50.50.enru.s2t.bin.gz",+ "role": "lex",+ "priority": 0+ },+ {+ "name": "vocab.enru.spm",+ "sizeBytes": 419005,+ "installPath": "bin/vocab.enru.spm",+ "url": "https://offline-translator.davidv.dev/translation/1/models/en-ru/retrain_base-memory_KJ23-iDVTcymG1ZldWY17w/exported/vocab.enru.spm.gz",+ "role": "vocab",+ "priority": 0+ }+ ],+ "dependsOn": []+ },+ "translate-en-sk": {+ "feature": "translation",+ "from": "en",+ "to": "sk",+ "experimental": false,+ "files": [+ {+ "name": "model.ensk.intgemm.alphas.bin",+ "sizeBytes": 22902983,+ "installPath": "bin/model.ensk.intgemm.alphas.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/en-sk/h1-2025_NbGVkenLTPiss8w800509A/exported/model.ensk.intgemm.alphas.bin.gz",+ "role": "model",+ "priority": 0+ },+ {+ "name": "lex.50.50.ensk.s2t.bin",+ "sizeBytes": 1708788,+ "installPath": "bin/lex.50.50.ensk.s2t.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/en-sk/h1-2025_NbGVkenLTPiss8w800509A/exported/lex.50.50.ensk.s2t.bin.gz",+ "role": "lex",+ "priority": 0+ },+ {+ "name": "vocab.ensk.spm",+ "sizeBytes": 405652,+ "installPath": "bin/vocab.ensk.spm",+ "url": "https://offline-translator.davidv.dev/translation/1/models/en-sk/h1-2025_NbGVkenLTPiss8w800509A/exported/vocab.ensk.spm.gz",+ "role": "vocab",+ "priority": 0+ }+ ],+ "dependsOn": []+ },+ "translate-en-sl": {+ "feature": "translation",+ "from": "en",+ "to": "sl",+ "experimental": false,+ "files": [+ {+ "name": "model.ensl.intgemm.alphas.bin",+ "sizeBytes": 22669559,+ "installPath": "bin/model.ensl.intgemm.alphas.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/en-sl/h1-2025_Ph0DK4RhRMe7z4cLk-f7eg/exported/model.ensl.intgemm.alphas.bin.gz",+ "role": "model",+ "priority": 0+ },+ {+ "name": "lex.50.50.ensl.s2t.bin",+ "sizeBytes": 1741316,+ "installPath": "bin/lex.50.50.ensl.s2t.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/en-sl/h1-2025_Ph0DK4RhRMe7z4cLk-f7eg/exported/lex.50.50.ensl.s2t.bin.gz",+ "role": "lex",+ "priority": 0+ },+ {+ "name": "vocab.ensl.spm",+ "sizeBytes": 398763,+ "installPath": "bin/vocab.ensl.spm",+ "url": "https://offline-translator.davidv.dev/translation/1/models/en-sl/h1-2025_Ph0DK4RhRMe7z4cLk-f7eg/exported/vocab.ensl.spm.gz",+ "role": "vocab",+ "priority": 0+ }+ ],+ "dependsOn": []+ },+ "translate-en-sq": {+ "feature": "translation",+ "from": "en",+ "to": "sq",+ "experimental": true,+ "files": [+ {+ "name": "model.ensq.intgemm.alphas.bin",+ "sizeBytes": 13366206,+ "installPath": "bin/model.ensq.intgemm.alphas.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/en-sq/h1-2025_HIreYm8_RDymI1qFdn0V5Q/exported/model.ensq.intgemm.alphas.bin.gz",+ "role": "model",+ "priority": 0+ },+ {+ "name": "lex.50.50.ensq.s2t.bin",+ "sizeBytes": 1599959,+ "installPath": "bin/lex.50.50.ensq.s2t.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/en-sq/h1-2025_HIreYm8_RDymI1qFdn0V5Q/exported/lex.50.50.ensq.s2t.bin.gz",+ "role": "lex",+ "priority": 0+ },+ {+ "name": "vocab.ensq.spm",+ "sizeBytes": 410650,+ "installPath": "bin/vocab.ensq.spm",+ "url": "https://offline-translator.davidv.dev/translation/1/models/en-sq/h1-2025_HIreYm8_RDymI1qFdn0V5Q/exported/vocab.ensq.spm.gz",+ "role": "vocab",+ "priority": 0+ }+ ],+ "dependsOn": []+ },+ "translate-en-sr": {+ "feature": "translation",+ "from": "en",+ "to": "sr",+ "experimental": false,+ "files": [+ {+ "name": "model.ensr.intgemm.alphas.bin",+ "sizeBytes": 23014587,+ "installPath": "bin/model.ensr.intgemm.alphas.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/en-sr/hbs-topk10_KZK68xhrQWWeK6xcMRtd9A/exported/model.ensr.intgemm.alphas.bin.gz",+ "role": "model",+ "priority": 0+ },+ {+ "name": "lex.50.50.ensr.s2t.bin",+ "sizeBytes": 1289317,+ "installPath": "bin/lex.50.50.ensr.s2t.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/en-sr/hbs-topk10_KZK68xhrQWWeK6xcMRtd9A/exported/lex.50.50.ensr.s2t.bin.gz",+ "role": "lex",+ "priority": 0+ },+ {+ "name": "vocab.ensr.spm",+ "sizeBytes": 433623,+ "installPath": "bin/vocab.ensr.spm",+ "url": "https://offline-translator.davidv.dev/translation/1/models/en-sr/hbs-topk10_KZK68xhrQWWeK6xcMRtd9A/exported/vocab.ensr.spm.gz",+ "role": "vocab",+ "priority": 0+ }+ ],+ "dependsOn": []+ },+ "translate-en-sv": {+ "feature": "translation",+ "from": "en",+ "to": "sv",+ "experimental": false,+ "files": [+ {+ "name": "model.ensv.intgemm.alphas.bin",+ "sizeBytes": 12775086,+ "installPath": "bin/model.ensv.intgemm.alphas.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/en-sv/spring-2024_bQQme71PS4eZRDl3NM-kgA/exported/model.ensv.intgemm.alphas.bin.gz",+ "role": "model",+ "priority": 0+ },+ {+ "name": "lex.50.50.ensv.s2t.bin",+ "sizeBytes": 1921270,+ "installPath": "bin/lex.50.50.ensv.s2t.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/en-sv/spring-2024_bQQme71PS4eZRDl3NM-kgA/exported/lex.50.50.ensv.s2t.bin.gz",+ "role": "lex",+ "priority": 0+ },+ {+ "name": "vocab.ensv.spm",+ "sizeBytes": 398384,+ "installPath": "bin/vocab.ensv.spm",+ "url": "https://offline-translator.davidv.dev/translation/1/models/en-sv/spring-2024_bQQme71PS4eZRDl3NM-kgA/exported/vocab.ensv.spm.gz",+ "role": "vocab",+ "priority": 0+ }+ ],+ "dependsOn": []+ },+ "translate-en-sw": {+ "feature": "translation",+ "from": "en",+ "to": "sw",+ "experimental": false,+ "files": [+ {+ "name": "model.ensw.intgemm.alphas.bin",+ "sizeBytes": 25744545,+ "installPath": "bin/model.ensw.intgemm.alphas.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/en-sw/nllb_distill_20260714/exported/model.ensw.intgemm.alphas.bin.gz",+ "role": "model",+ "priority": 0+ },+ {+ "name": "lex.50.50.ensw.s2t.bin",+ "sizeBytes": 1034657,+ "installPath": "bin/lex.50.50.ensw.s2t.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/en-sw/nllb_distill_20260714/exported/lex.50.50.ensw.s2t.bin.gz",+ "role": "lex",+ "priority": 0+ },+ {+ "name": "vocab.ensw.spm",+ "sizeBytes": 391114,+ "installPath": "bin/vocab.ensw.spm",+ "url": "https://offline-translator.davidv.dev/translation/1/models/en-sw/nllb_distill_20260714/exported/vocab.ensw.spm.gz",+ "role": "vocab",+ "priority": 0+ }+ ],+ "dependsOn": []+ },+ "translate-en-ta": {+ "feature": "translation",+ "from": "en",+ "to": "ta",+ "experimental": false,+ "files": [+ {+ "name": "model.enta.intgemm.alphas.bin",+ "sizeBytes": 12645399,+ "installPath": "bin/model.enta.intgemm.alphas.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/en-ta/h1-2025_aPztISjSRums11fBuT--4A/exported/model.enta.intgemm.alphas.bin.gz",+ "role": "model",+ "priority": 0+ },+ {+ "name": "lex.50.50.enta.s2t.bin",+ "sizeBytes": 1453949,+ "installPath": "bin/lex.50.50.enta.s2t.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/en-ta/h1-2025_aPztISjSRums11fBuT--4A/exported/lex.50.50.enta.s2t.bin.gz",+ "role": "lex",+ "priority": 0+ },+ {+ "name": "vocab.enta.spm",+ "sizeBytes": 446752,+ "installPath": "bin/vocab.enta.spm",+ "url": "https://offline-translator.davidv.dev/translation/1/models/en-ta/h1-2025_aPztISjSRums11fBuT--4A/exported/vocab.enta.spm.gz",+ "role": "vocab",+ "priority": 0+ }+ ],+ "dependsOn": []+ },+ "translate-en-te": {+ "feature": "translation",+ "from": "en",+ "to": "te",+ "experimental": false,+ "files": [+ {+ "name": "model.ente.intgemm.alphas.bin",+ "sizeBytes": 12590862,+ "installPath": "bin/model.ente.intgemm.alphas.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/en-te/h1-2025_J_7yoPHaRJqsevUR512RsQ/exported/model.ente.intgemm.alphas.bin.gz",+ "role": "model",+ "priority": 0+ },+ {+ "name": "lex.50.50.ente.s2t.bin",+ "sizeBytes": 1434105,+ "installPath": "bin/lex.50.50.ente.s2t.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/en-te/h1-2025_J_7yoPHaRJqsevUR512RsQ/exported/lex.50.50.ente.s2t.bin.gz",+ "role": "lex",+ "priority": 0+ },+ {+ "name": "vocab.ente.spm",+ "sizeBytes": 448838,+ "installPath": "bin/vocab.ente.spm",+ "url": "https://offline-translator.davidv.dev/translation/1/models/en-te/h1-2025_J_7yoPHaRJqsevUR512RsQ/exported/vocab.ente.spm.gz",+ "role": "vocab",+ "priority": 0+ }+ ],+ "dependsOn": []+ },+ "translate-en-th": {+ "feature": "translation",+ "from": "en",+ "to": "th",+ "experimental": false,+ "files": [+ {+ "name": "model.enth.intgemm.alphas.bin",+ "sizeBytes": 22976729,+ "installPath": "bin/model.enth.intgemm.alphas.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/en-th/new-opuscleaner-en-th-onestage-topk10_WIvJuHhrSyiXLtJBJOUrsA/exported/model.enth.intgemm.alphas.bin.gz",+ "role": "model",+ "priority": 0+ },+ {+ "name": "lex.50.50.enth.s2t.bin",+ "sizeBytes": 1601933,+ "installPath": "bin/lex.50.50.enth.s2t.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/en-th/new-opuscleaner-en-th-onestage-topk10_WIvJuHhrSyiXLtJBJOUrsA/exported/lex.50.50.enth.s2t.bin.gz",+ "role": "lex",+ "priority": 0+ },+ {+ "name": "vocab.enth.spm",+ "sizeBytes": 450379,+ "installPath": "bin/vocab.enth.spm",+ "url": "https://offline-translator.davidv.dev/translation/1/models/en-th/new-opuscleaner-en-th-onestage-topk10_WIvJuHhrSyiXLtJBJOUrsA/exported/vocab.enth.spm.gz",+ "role": "vocab",+ "priority": 0+ }+ ],+ "dependsOn": []+ },+ "translate-en-tl": {+ "feature": "translation",+ "from": "en",+ "to": "tl",+ "experimental": false,+ "files": [+ {+ "name": "model.entl.intgemm.alphas.bin",+ "sizeBytes": 25170505,+ "installPath": "bin/model.entl.intgemm.alphas.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/en-tl/opusmt_distill_20260712/exported/model.entl.intgemm.alphas.bin.gz",+ "role": "model",+ "priority": 1+ },+ {+ "name": "lex.50.50.entl.s2t.bin",+ "sizeBytes": 1003287,+ "installPath": "bin/lex.50.50.entl.s2t.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/en-tl/opusmt_distill_20260712/exported/lex.50.50.entl.s2t.bin.gz",+ "role": "lex",+ "priority": 1+ },+ {+ "name": "vocab.entl.spm",+ "sizeBytes": 387511,+ "installPath": "bin/vocab.entl.spm",+ "url": "https://offline-translator.davidv.dev/translation/1/models/en-tl/opusmt_distill_20260712/exported/vocab.entl.spm.gz",+ "role": "vocab",+ "priority": 1+ },+ {+ "name": "model.entl.intgemm.alphas.bin",+ "sizeBytes": 24206122,+ "installPath": "bin/en-tl/hymt2_distill_20260722/model.entl.intgemm.alphas.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/en-tl/hymt2_distill_20260722/exported/model.entl.intgemm.alphas.bin.gz",+ "role": "model",+ "priority": 2+ },+ {+ "name": "lex.50.50.entl.s2t.bin",+ "sizeBytes": 926122,+ "installPath": "bin/en-tl/hymt2_distill_20260722/lex.50.50.entl.s2t.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/en-tl/hymt2_distill_20260722/exported/lex.50.50.entl.s2t.bin.gz",+ "role": "lex",+ "priority": 2+ },+ {+ "name": "vocab.entl.spm",+ "sizeBytes": 384909,+ "installPath": "bin/en-tl/hymt2_distill_20260722/vocab.entl.spm",+ "url": "https://offline-translator.davidv.dev/translation/1/models/en-tl/hymt2_distill_20260722/exported/vocab.entl.spm.gz",+ "role": "vocab",+ "priority": 2+ }+ ],+ "dependsOn": []+ },+ "translate-en-tr": {+ "feature": "translation",+ "from": "en",+ "to": "tr",+ "experimental": false,+ "files": [+ {+ "name": "model.entr.intgemm.alphas.bin",+ "sizeBytes": 13159314,+ "installPath": "bin/model.entr.intgemm.alphas.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/en-tr/spring-2024_LiFGeNrEQpKdNlziG2qP_A/exported/model.entr.intgemm.alphas.bin.gz",+ "role": "model",+ "priority": 0+ },+ {+ "name": "lex.50.50.entr.s2t.bin",+ "sizeBytes": 1546258,+ "installPath": "bin/lex.50.50.entr.s2t.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/en-tr/spring-2024_LiFGeNrEQpKdNlziG2qP_A/exported/lex.50.50.entr.s2t.bin.gz",+ "role": "lex",+ "priority": 0+ },+ {+ "name": "vocab.entr.spm",+ "sizeBytes": 395473,+ "installPath": "bin/vocab.entr.spm",+ "url": "https://offline-translator.davidv.dev/translation/1/models/en-tr/spring-2024_LiFGeNrEQpKdNlziG2qP_A/exported/vocab.entr.spm.gz",+ "role": "vocab",+ "priority": 0+ }+ ],+ "dependsOn": []+ },+ "translate-en-ug": {+ "feature": "translation",+ "from": "en",+ "to": "ug",+ "experimental": false,+ "files": [+ {+ "name": "model.enug.intgemm.alphas.bin",+ "sizeBytes": 24223157,+ "installPath": "bin/model.enug.intgemm.alphas.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/en-ug/hymt2_distill_20260719/exported/model.enug.intgemm.alphas.bin.gz",+ "role": "model",+ "priority": 0+ },+ {+ "name": "lex.50.50.enug.s2t.bin",+ "sizeBytes": 990376,+ "installPath": "bin/lex.50.50.enug.s2t.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/en-ug/hymt2_distill_20260719/exported/lex.50.50.enug.s2t.bin.gz",+ "role": "lex",+ "priority": 0+ },+ {+ "name": "vocab.enug.spm",+ "sizeBytes": 406290,+ "installPath": "bin/vocab.enug.spm",+ "url": "https://offline-translator.davidv.dev/translation/1/models/en-ug/hymt2_distill_20260719/exported/vocab.enug.spm.gz",+ "role": "vocab",+ "priority": 0+ }+ ],+ "dependsOn": []+ },+ "translate-en-uk": {+ "feature": "translation",+ "from": "en",+ "to": "uk",+ "experimental": false,+ "files": [+ {+ "name": "model.enuk.intgemm.alphas.bin",+ "sizeBytes": 22864374,+ "installPath": "bin/model.enuk.intgemm.alphas.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/en-uk/docmt-vocab_a2OVwdI-Sg-SBZ_0Joqb0w/exported/model.enuk.intgemm.alphas.bin.gz",+ "role": "model",+ "priority": 0+ },+ {+ "name": "lex.50.50.enuk.s2t.bin",+ "sizeBytes": 1564122,+ "installPath": "bin/lex.50.50.enuk.s2t.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/en-uk/docmt-vocab_a2OVwdI-Sg-SBZ_0Joqb0w/exported/lex.50.50.enuk.s2t.bin.gz",+ "role": "lex",+ "priority": 0+ },+ {+ "name": "vocab.enuk.spm",+ "sizeBytes": 436850,+ "installPath": "bin/vocab.enuk.spm",+ "url": "https://offline-translator.davidv.dev/translation/1/models/en-uk/docmt-vocab_a2OVwdI-Sg-SBZ_0Joqb0w/exported/vocab.enuk.spm.gz",+ "role": "vocab",+ "priority": 0+ }+ ],+ "dependsOn": []+ },+ "translate-en-vi": {+ "feature": "translation",+ "from": "en",+ "to": "vi",+ "experimental": false,+ "files": [+ {+ "name": "model.envi.intgemm.alphas.bin",+ "sizeBytes": 24244705,+ "installPath": "bin/model.envi.intgemm.alphas.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/en-vi/test_prompsit_Ep8JhBQ3QRizDT91JVy8KQ/exported/model.envi.intgemm.alphas.bin.gz",+ "role": "model",+ "priority": 0+ },+ {+ "name": "lex.50.50.envi.s2t.bin",+ "sizeBytes": 2246027,+ "installPath": "bin/lex.50.50.envi.s2t.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/en-vi/test_prompsit_Ep8JhBQ3QRizDT91JVy8KQ/exported/lex.50.50.envi.s2t.bin.gz",+ "role": "lex",+ "priority": 0+ },+ {+ "name": "vocab.envi.spm",+ "sizeBytes": 400183,+ "installPath": "bin/vocab.envi.spm",+ "url": "https://offline-translator.davidv.dev/translation/1/models/en-vi/test_prompsit_Ep8JhBQ3QRizDT91JVy8KQ/exported/vocab.envi.spm.gz",+ "role": "vocab",+ "priority": 0+ }+ ],+ "dependsOn": []+ },+ "translate-en-zh": {+ "feature": "translation",+ "from": "en",+ "to": "zh",+ "experimental": false,+ "files": [+ {+ "name": "model.enzh.intgemm.alphas.bin",+ "sizeBytes": 33375922,+ "installPath": "bin/model.enzh.intgemm.alphas.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/en-zh/llmaat_finetune10M_qe8_f2_ByQcSxGXQRqGi-UTxYE43g/exported/model.enzh.intgemm.alphas.bin.gz",+ "role": "model",+ "priority": 0+ },+ {+ "name": "lex.50.50.enzh.s2t.bin",+ "sizeBytes": 2536039,+ "installPath": "bin/lex.50.50.enzh.s2t.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/en-zh/llmaat_finetune10M_qe8_f2_ByQcSxGXQRqGi-UTxYE43g/exported/lex.50.50.enzh.s2t.bin.gz",+ "role": "lex",+ "priority": 0+ },+ {+ "name": "srcvocab.enzh.spm",+ "sizeBytes": 407784,+ "installPath": "bin/srcvocab.enzh.spm",+ "url": "https://offline-translator.davidv.dev/translation/1/models/en-zh/llmaat_finetune10M_qe8_f2_ByQcSxGXQRqGi-UTxYE43g/exported/srcvocab.enzh.spm.gz",+ "role": "srcVocab",+ "priority": 0+ },+ {+ "name": "trgvocab.enzh.spm",+ "sizeBytes": 425748,+ "installPath": "bin/trgvocab.enzh.spm",+ "url": "https://offline-translator.davidv.dev/translation/1/models/en-zh/llmaat_finetune10M_qe8_f2_ByQcSxGXQRqGi-UTxYE43g/exported/trgvocab.enzh.spm.gz",+ "role": "tgtVocab",+ "priority": 0+ }+ ],+ "dependsOn": []+ },+ "translate-en-zh_hant": {+ "feature": "translation",+ "from": "en",+ "to": "zh_hant",+ "experimental": false,+ "files": [+ {+ "name": "model.enzh_hant.intgemm.alphas.bin",+ "sizeBytes": 33291007,+ "installPath": "bin/model.enzh_hant.intgemm.alphas.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/en-zh_hant/zh_hant_llmaat_finetune10M_qe8_f2_aQ8azdOMQOSBVjBDOVDIZQ/exported/model.enzh_hant.intgemm.alphas.bin.gz",+ "role": "model",+ "priority": 0+ },+ {+ "name": "lex.50.50.enzh_hant.s2t.bin",+ "sizeBytes": 2290215,+ "installPath": "bin/lex.50.50.enzh_hant.s2t.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/en-zh_hant/zh_hant_llmaat_finetune10M_qe8_f2_aQ8azdOMQOSBVjBDOVDIZQ/exported/lex.50.50.enzh_hant.s2t.bin.gz",+ "role": "lex",+ "priority": 0+ },+ {+ "name": "srcvocab.enzh_hant.spm",+ "sizeBytes": 404976,+ "installPath": "bin/srcvocab.enzh_hant.spm",+ "url": "https://offline-translator.davidv.dev/translation/1/models/en-zh_hant/zh_hant_llmaat_finetune10M_qe8_f2_aQ8azdOMQOSBVjBDOVDIZQ/exported/srcvocab.enzh_hant.spm.gz",+ "role": "srcVocab",+ "priority": 0+ },+ {+ "name": "trgvocab.enzh_hant.spm",+ "sizeBytes": 416659,+ "installPath": "bin/trgvocab.enzh_hant.spm",+ "url": "https://offline-translator.davidv.dev/translation/1/models/en-zh_hant/zh_hant_llmaat_finetune10M_qe8_f2_aQ8azdOMQOSBVjBDOVDIZQ/exported/trgvocab.enzh_hant.spm.gz",+ "role": "tgtVocab",+ "priority": 0+ }+ ],+ "dependsOn": []+ },+ "translate-es-en": {+ "feature": "translation",+ "from": "es",+ "to": "en",+ "experimental": false,+ "files": [+ {+ "name": "model.esen.intgemm.alphas.bin",+ "sizeBytes": 23288494,+ "installPath": "bin/model.esen.intgemm.alphas.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/es-en/retrain_hr_HbNjJ60BTwmVTbhfFxuduA/exported/model.esen.intgemm.alphas.bin.gz",+ "role": "model",+ "priority": 0+ },+ {+ "name": "lex.50.50.esen.s2t.bin",+ "sizeBytes": 2543246,+ "installPath": "bin/lex.50.50.esen.s2t.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/es-en/retrain_hr_HbNjJ60BTwmVTbhfFxuduA/exported/lex.50.50.esen.s2t.bin.gz",+ "role": "lex",+ "priority": 0+ },+ {+ "name": "vocab.esen.spm",+ "sizeBytes": 409312,+ "installPath": "bin/vocab.esen.spm",+ "url": "https://offline-translator.davidv.dev/translation/1/models/es-en/retrain_hr_HbNjJ60BTwmVTbhfFxuduA/exported/vocab.esen.spm.gz",+ "role": "vocab",+ "priority": 0+ }+ ],+ "dependsOn": []+ },+ "translate-et-en": {+ "feature": "translation",+ "from": "et",+ "to": "en",+ "experimental": false,+ "files": [+ {+ "name": "model.eten.intgemm.alphas.bin",+ "sizeBytes": 22785077,+ "installPath": "bin/model.eten.intgemm.alphas.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/et-en/retrain_hr_RNXxp-Q9Q4GRExCoMAT77Q/exported/model.eten.intgemm.alphas.bin.gz",+ "role": "model",+ "priority": 0+ },+ {+ "name": "lex.50.50.eten.s2t.bin",+ "sizeBytes": 2321326,+ "installPath": "bin/lex.50.50.eten.s2t.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/et-en/retrain_hr_RNXxp-Q9Q4GRExCoMAT77Q/exported/lex.50.50.eten.s2t.bin.gz",+ "role": "lex",+ "priority": 0+ },+ {+ "name": "vocab.eten.spm",+ "sizeBytes": 414262,+ "installPath": "bin/vocab.eten.spm",+ "url": "https://offline-translator.davidv.dev/translation/1/models/et-en/retrain_hr_RNXxp-Q9Q4GRExCoMAT77Q/exported/vocab.eten.spm.gz",+ "role": "vocab",+ "priority": 0+ }+ ],+ "dependsOn": []+ },+ "translate-eu-en": {+ "feature": "translation",+ "from": "eu",+ "to": "en",+ "experimental": false,+ "files": [+ {+ "name": "model.euen.intgemm.alphas.bin",+ "sizeBytes": 22759889,+ "installPath": "bin/model.euen.intgemm.alphas.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/eu-en/euen-topk10_ebPYPysJRlmwmEIVWuv-YQ/exported/model.euen.intgemm.alphas.bin.gz",+ "role": "model",+ "priority": 0+ },+ {+ "name": "lex.50.50.euen.s2t.bin",+ "sizeBytes": 2059844,+ "installPath": "bin/lex.50.50.euen.s2t.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/eu-en/euen-topk10_ebPYPysJRlmwmEIVWuv-YQ/exported/lex.50.50.euen.s2t.bin.gz",+ "role": "lex",+ "priority": 0+ },+ {+ "name": "vocab.euen.spm",+ "sizeBytes": 409462,+ "installPath": "bin/vocab.euen.spm",+ "url": "https://offline-translator.davidv.dev/translation/1/models/eu-en/euen-topk10_ebPYPysJRlmwmEIVWuv-YQ/exported/vocab.euen.spm.gz",+ "role": "vocab",+ "priority": 0+ }+ ],+ "dependsOn": []+ },+ "translate-fa-en": {+ "feature": "translation",+ "from": "fa",+ "to": "en",+ "experimental": false,+ "files": [+ {+ "name": "model.faen.intgemm.alphas.bin",+ "sizeBytes": 13071390,+ "installPath": "bin/model.faen.intgemm.alphas.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/fa-en/h1-2025_dyvKzoMQToKWHx7bbP-TtQ/exported/model.faen.intgemm.alphas.bin.gz",+ "role": "model",+ "priority": 0+ },+ {+ "name": "lex.50.50.faen.s2t.bin",+ "sizeBytes": 1939291,+ "installPath": "bin/lex.50.50.faen.s2t.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/fa-en/h1-2025_dyvKzoMQToKWHx7bbP-TtQ/exported/lex.50.50.faen.s2t.bin.gz",+ "role": "lex",+ "priority": 0+ },+ {+ "name": "vocab.faen.spm",+ "sizeBytes": 416123,+ "installPath": "bin/vocab.faen.spm",+ "url": "https://offline-translator.davidv.dev/translation/1/models/fa-en/h1-2025_dyvKzoMQToKWHx7bbP-TtQ/exported/vocab.faen.spm.gz",+ "role": "vocab",+ "priority": 0+ }+ ],+ "dependsOn": []+ },+ "translate-fi-en": {+ "feature": "translation",+ "from": "fi",+ "to": "en",+ "experimental": false,+ "files": [+ {+ "name": "model.fien.intgemm.alphas.bin",+ "sizeBytes": 22935246,+ "installPath": "bin/model.fien.intgemm.alphas.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/fi-en/retrain_hr_C7-zSzS7Tm6zkOfVP7k0Gw/exported/model.fien.intgemm.alphas.bin.gz",+ "role": "model",+ "priority": 0+ },+ {+ "name": "lex.50.50.fien.s2t.bin",+ "sizeBytes": 2580517,+ "installPath": "bin/lex.50.50.fien.s2t.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/fi-en/retrain_hr_C7-zSzS7Tm6zkOfVP7k0Gw/exported/lex.50.50.fien.s2t.bin.gz",+ "role": "lex",+ "priority": 0+ },+ {+ "name": "vocab.fien.spm",+ "sizeBytes": 414280,+ "installPath": "bin/vocab.fien.spm",+ "url": "https://offline-translator.davidv.dev/translation/1/models/fi-en/retrain_hr_C7-zSzS7Tm6zkOfVP7k0Gw/exported/vocab.fien.spm.gz",+ "role": "vocab",+ "priority": 0+ }+ ],+ "dependsOn": []+ },+ "translate-fr-en": {+ "feature": "translation",+ "from": "fr",+ "to": "en",+ "experimental": false,+ "files": [+ {+ "name": "model.fren.intgemm.alphas.bin",+ "sizeBytes": 23175075,+ "installPath": "bin/model.fren.intgemm.alphas.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/fr-en/retrain_hr_EFgIftH_RrCyzl5gjemVNg/exported/model.fren.intgemm.alphas.bin.gz",+ "role": "model",+ "priority": 0+ },+ {+ "name": "lex.50.50.fren.s2t.bin",+ "sizeBytes": 2649934,+ "installPath": "bin/lex.50.50.fren.s2t.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/fr-en/retrain_hr_EFgIftH_RrCyzl5gjemVNg/exported/lex.50.50.fren.s2t.bin.gz",+ "role": "lex",+ "priority": 0+ },+ {+ "name": "vocab.fren.spm",+ "sizeBytes": 409706,+ "installPath": "bin/vocab.fren.spm",+ "url": "https://offline-translator.davidv.dev/translation/1/models/fr-en/retrain_hr_EFgIftH_RrCyzl5gjemVNg/exported/vocab.fren.spm.gz",+ "role": "vocab",+ "priority": 0+ }+ ],+ "dependsOn": []+ },+ "translate-gl-en": {+ "feature": "translation",+ "from": "gl",+ "to": "en",+ "experimental": false,+ "files": [+ {+ "name": "model.glen.intgemm.alphas.bin",+ "sizeBytes": 23501364,+ "installPath": "bin/model.glen.intgemm.alphas.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/gl-en/gl-topk10_JaJ_E6cmSMSMhMEs8zHqzw/exported/model.glen.intgemm.alphas.bin.gz",+ "role": "model",+ "priority": 0+ },+ {+ "name": "lex.50.50.glen.s2t.bin",+ "sizeBytes": 2215790,+ "installPath": "bin/lex.50.50.glen.s2t.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/gl-en/gl-topk10_JaJ_E6cmSMSMhMEs8zHqzw/exported/lex.50.50.glen.s2t.bin.gz",+ "role": "lex",+ "priority": 0+ },+ {+ "name": "vocab.glen.spm",+ "sizeBytes": 409308,+ "installPath": "bin/vocab.glen.spm",+ "url": "https://offline-translator.davidv.dev/translation/1/models/gl-en/gl-topk10_JaJ_E6cmSMSMhMEs8zHqzw/exported/vocab.glen.spm.gz",+ "role": "vocab",+ "priority": 0+ }+ ],+ "dependsOn": []+ },+ "translate-gu-en": {+ "feature": "translation",+ "from": "gu",+ "to": "en",+ "experimental": false,+ "files": [+ {+ "name": "model.guen.intgemm.alphas.bin",+ "sizeBytes": 12917932,+ "installPath": "bin/model.guen.intgemm.alphas.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/gu-en/h1-2025_AbHCTUgSSguJ1-Pq-XLnVA/exported/model.guen.intgemm.alphas.bin.gz",+ "role": "model",+ "priority": 0+ },+ {+ "name": "lex.50.50.guen.s2t.bin",+ "sizeBytes": 2028621,+ "installPath": "bin/lex.50.50.guen.s2t.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/gu-en/h1-2025_AbHCTUgSSguJ1-Pq-XLnVA/exported/lex.50.50.guen.s2t.bin.gz",+ "role": "lex",+ "priority": 0+ },+ {+ "name": "vocab.guen.spm",+ "sizeBytes": 435011,+ "installPath": "bin/vocab.guen.spm",+ "url": "https://offline-translator.davidv.dev/translation/1/models/gu-en/h1-2025_AbHCTUgSSguJ1-Pq-XLnVA/exported/vocab.guen.spm.gz",+ "role": "vocab",+ "priority": 0+ }+ ],+ "dependsOn": []+ },+ "translate-he-en": {+ "feature": "translation",+ "from": "he",+ "to": "en",+ "experimental": false,+ "files": [+ {+ "name": "model.heen.intgemm.alphas.bin",+ "sizeBytes": 12999905,+ "installPath": "bin/model.heen.intgemm.alphas.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/he-en/h1-2025_IZKPrf3xQaKu56F3zmH0cw/exported/model.heen.intgemm.alphas.bin.gz",+ "role": "model",+ "priority": 0+ },+ {+ "name": "lex.50.50.heen.s2t.bin",+ "sizeBytes": 2232949,+ "installPath": "bin/lex.50.50.heen.s2t.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/he-en/h1-2025_IZKPrf3xQaKu56F3zmH0cw/exported/lex.50.50.heen.s2t.bin.gz",+ "role": "lex",+ "priority": 0+ },+ {+ "name": "vocab.heen.spm",+ "sizeBytes": 411769,+ "installPath": "bin/vocab.heen.spm",+ "url": "https://offline-translator.davidv.dev/translation/1/models/he-en/h1-2025_IZKPrf3xQaKu56F3zmH0cw/exported/vocab.heen.spm.gz",+ "role": "vocab",+ "priority": 0+ }+ ],+ "dependsOn": []+ },+ "translate-hi-en": {+ "feature": "translation",+ "from": "hi",+ "to": "en",+ "experimental": false,+ "files": [+ {+ "name": "model.hien.intgemm.alphas.bin",+ "sizeBytes": 12752013,+ "installPath": "bin/model.hien.intgemm.alphas.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/hi-en/h1-2025_IcUQD-GbSJWB6WV08oDoEw/exported/model.hien.intgemm.alphas.bin.gz",+ "role": "model",+ "priority": 0+ },+ {+ "name": "lex.50.50.hien.s2t.bin",+ "sizeBytes": 2319675,+ "installPath": "bin/lex.50.50.hien.s2t.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/hi-en/h1-2025_IcUQD-GbSJWB6WV08oDoEw/exported/lex.50.50.hien.s2t.bin.gz",+ "role": "lex",+ "priority": 0+ },+ {+ "name": "vocab.hien.spm",+ "sizeBytes": 430096,+ "installPath": "bin/vocab.hien.spm",+ "url": "https://offline-translator.davidv.dev/translation/1/models/hi-en/h1-2025_IcUQD-GbSJWB6WV08oDoEw/exported/vocab.hien.spm.gz",+ "role": "vocab",+ "priority": 0+ }+ ],+ "dependsOn": []+ },+ "translate-hr-en": {+ "feature": "translation",+ "from": "hr",+ "to": "en",+ "experimental": true,+ "files": [+ {+ "name": "model.hren.intgemm.alphas.bin",+ "sizeBytes": 13050395,+ "installPath": "bin/model.hren.intgemm.alphas.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/hr-en/spring-2024_eIcYjCedS26HE07kVyt5Qw/exported/model.hren.intgemm.alphas.bin.gz",+ "role": "model",+ "priority": 0+ },+ {+ "name": "lex.50.50.hren.s2t.bin",+ "sizeBytes": 1888089,+ "installPath": "bin/lex.50.50.hren.s2t.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/hr-en/spring-2024_eIcYjCedS26HE07kVyt5Qw/exported/lex.50.50.hren.s2t.bin.gz",+ "role": "lex",+ "priority": 0+ },+ {+ "name": "vocab.hren.spm",+ "sizeBytes": 394548,+ "installPath": "bin/vocab.hren.spm",+ "url": "https://offline-translator.davidv.dev/translation/1/models/hr-en/spring-2024_eIcYjCedS26HE07kVyt5Qw/exported/vocab.hren.spm.gz",+ "role": "vocab",+ "priority": 0+ }+ ],+ "dependsOn": []+ },+ "translate-hu-en": {+ "feature": "translation",+ "from": "hu",+ "to": "en",+ "experimental": false,+ "files": [+ {+ "name": "model.huen.intgemm.alphas.bin",+ "sizeBytes": 13181613,+ "installPath": "bin/model.huen.intgemm.alphas.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/hu-en/andre_xxxxxxxxRxSxxxxxxxxxxA/exported/model.huen.intgemm.alphas.bin.gz",+ "role": "model",+ "priority": 0+ },+ {+ "name": "lex.50.50.huen.s2t.bin",+ "sizeBytes": 2778202,+ "installPath": "bin/lex.50.50.huen.s2t.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/hu-en/andre_xxxxxxxxRxSxxxxxxxxxxA/exported/lex.50.50.huen.s2t.bin.gz",+ "role": "lex",+ "priority": 0+ },+ {+ "name": "vocab.huen.spm",+ "sizeBytes": 419908,+ "installPath": "bin/vocab.huen.spm",+ "url": "https://offline-translator.davidv.dev/translation/1/models/hu-en/andre_xxxxxxxxRxSxxxxxxxxxxA/exported/vocab.huen.spm.gz",+ "role": "vocab",+ "priority": 0+ }+ ],+ "dependsOn": []+ },+ "translate-id-en": {+ "feature": "translation",+ "from": "id",+ "to": "en",+ "experimental": false,+ "files": [+ {+ "name": "model.iden.intgemm.alphas.bin",+ "sizeBytes": 13010657,+ "installPath": "bin/model.iden.intgemm.alphas.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/id-en/spring-2024_Yl0wXq-iQE6G9PpA3AQfcg/exported/model.iden.intgemm.alphas.bin.gz",+ "role": "model",+ "priority": 0+ },+ {+ "name": "lex.50.50.iden.s2t.bin",+ "sizeBytes": 1818222,+ "installPath": "bin/lex.50.50.iden.s2t.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/id-en/spring-2024_Yl0wXq-iQE6G9PpA3AQfcg/exported/lex.50.50.iden.s2t.bin.gz",+ "role": "lex",+ "priority": 0+ },+ {+ "name": "vocab.iden.spm",+ "sizeBytes": 379859,+ "installPath": "bin/vocab.iden.spm",+ "url": "https://offline-translator.davidv.dev/translation/1/models/id-en/spring-2024_Yl0wXq-iQE6G9PpA3AQfcg/exported/vocab.iden.spm.gz",+ "role": "vocab",+ "priority": 0+ }+ ],+ "dependsOn": []+ },+ "translate-is-en": {+ "feature": "translation",+ "from": "is",+ "to": "en",+ "experimental": false,+ "files": [+ {+ "name": "model.isen.intgemm.alphas.bin",+ "sizeBytes": 23229378,+ "installPath": "bin/model.isen.intgemm.alphas.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/is-en/docmt-vocab_I4Fy2MnOQHSOT4SYlCjPWw/exported/model.isen.intgemm.alphas.bin.gz",+ "role": "model",+ "priority": 0+ },+ {+ "name": "lex.50.50.isen.s2t.bin",+ "sizeBytes": 2012853,+ "installPath": "bin/lex.50.50.isen.s2t.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/is-en/docmt-vocab_I4Fy2MnOQHSOT4SYlCjPWw/exported/lex.50.50.isen.s2t.bin.gz",+ "role": "lex",+ "priority": 0+ },+ {+ "name": "vocab.isen.spm",+ "sizeBytes": 412304,+ "installPath": "bin/vocab.isen.spm",+ "url": "https://offline-translator.davidv.dev/translation/1/models/is-en/docmt-vocab_I4Fy2MnOQHSOT4SYlCjPWw/exported/vocab.isen.spm.gz",+ "role": "vocab",+ "priority": 0+ }+ ],+ "dependsOn": []+ },+ "translate-it-en": {+ "feature": "translation",+ "from": "it",+ "to": "en",+ "experimental": false,+ "files": [+ {+ "name": "model.iten.intgemm.alphas.bin",+ "sizeBytes": 23301774,+ "installPath": "bin/model.iten.intgemm.alphas.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/it-en/retrain_hr_d1nPDwVeSD6t-HdtWA4xNg/exported/model.iten.intgemm.alphas.bin.gz",+ "role": "model",+ "priority": 0+ },+ {+ "name": "lex.50.50.iten.s2t.bin",+ "sizeBytes": 2532929,+ "installPath": "bin/lex.50.50.iten.s2t.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/it-en/retrain_hr_d1nPDwVeSD6t-HdtWA4xNg/exported/lex.50.50.iten.s2t.bin.gz",+ "role": "lex",+ "priority": 0+ },+ {+ "name": "vocab.iten.spm",+ "sizeBytes": 407598,+ "installPath": "bin/vocab.iten.spm",+ "url": "https://offline-translator.davidv.dev/translation/1/models/it-en/retrain_hr_d1nPDwVeSD6t-HdtWA4xNg/exported/vocab.iten.spm.gz",+ "role": "vocab",+ "priority": 0+ }+ ],+ "dependsOn": []+ },+ "translate-ja-en": {+ "feature": "translation",+ "from": "ja",+ "to": "en",+ "experimental": false,+ "files": [+ {+ "name": "model.jaen.intgemm.alphas.bin",+ "sizeBytes": 32577435,+ "installPath": "bin/model.jaen.intgemm.alphas.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/ja-en/cjk_retrain_base-memory_NLRJLD_pQFyrvgKtbie2nA/exported/model.jaen.intgemm.alphas.bin.gz",+ "role": "model",+ "priority": 0+ },+ {+ "name": "lex.50.50.jaen.s2t.bin",+ "sizeBytes": 4819610,+ "installPath": "bin/lex.50.50.jaen.s2t.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/ja-en/cjk_retrain_base-memory_NLRJLD_pQFyrvgKtbie2nA/exported/lex.50.50.jaen.s2t.bin.gz",+ "role": "lex",+ "priority": 0+ },+ {+ "name": "vocab.jaen.spm",+ "sizeBytes": 746616,+ "installPath": "bin/vocab.jaen.spm",+ "url": "https://offline-translator.davidv.dev/translation/1/models/ja-en/cjk_retrain_base-memory_NLRJLD_pQFyrvgKtbie2nA/exported/vocab.jaen.spm.gz",+ "role": "vocab",+ "priority": 0+ }+ ],+ "dependsOn": []+ },+ "translate-ka-en": {+ "feature": "translation",+ "from": "ka",+ "to": "en",+ "experimental": false,+ "files": [+ {+ "name": "model.kaen.intgemm.alphas.bin",+ "sizeBytes": 25210570,+ "installPath": "bin/model.kaen.intgemm.alphas.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/ka-en/lmt60_distill_20260902/exported/model.kaen.intgemm.alphas.bin.gz",+ "role": "model",+ "priority": 0+ },+ {+ "name": "lex.50.50.kaen.s2t.bin",+ "sizeBytes": 1894639,+ "installPath": "bin/lex.50.50.kaen.s2t.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/ka-en/lmt60_distill_20260902/exported/lex.50.50.kaen.s2t.bin.gz",+ "role": "lex",+ "priority": 0+ },+ {+ "name": "vocab.kaen.spm",+ "sizeBytes": 416365,+ "installPath": "bin/vocab.kaen.spm",+ "url": "https://offline-translator.davidv.dev/translation/1/models/ka-en/lmt60_distill_20260902/exported/vocab.kaen.spm.gz",+ "role": "vocab",+ "priority": 0+ }+ ],+ "dependsOn": []+ },+ "translate-kn-en": {+ "feature": "translation",+ "from": "kn",+ "to": "en",+ "experimental": false,+ "files": [+ {+ "name": "model.knen.intgemm.alphas.bin",+ "sizeBytes": 13077357,+ "installPath": "bin/model.knen.intgemm.alphas.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/kn-en/h1-2025_Ql24XjW0Sp-zWsmLrV5TGQ/exported/model.knen.intgemm.alphas.bin.gz",+ "role": "model",+ "priority": 0+ },+ {+ "name": "lex.50.50.knen.s2t.bin",+ "sizeBytes": 2128860,+ "installPath": "bin/lex.50.50.knen.s2t.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/kn-en/h1-2025_Ql24XjW0Sp-zWsmLrV5TGQ/exported/lex.50.50.knen.s2t.bin.gz",+ "role": "lex",+ "priority": 0+ },+ {+ "name": "vocab.knen.spm",+ "sizeBytes": 450324,+ "installPath": "bin/vocab.knen.spm",+ "url": "https://offline-translator.davidv.dev/translation/1/models/kn-en/h1-2025_Ql24XjW0Sp-zWsmLrV5TGQ/exported/vocab.knen.spm.gz",+ "role": "vocab",+ "priority": 0+ }+ ],+ "dependsOn": []+ },+ "translate-ko-en": {+ "feature": "translation",+ "from": "ko",+ "to": "en",+ "experimental": false,+ "files": [+ {+ "name": "model.koen.intgemm.alphas.bin",+ "sizeBytes": 32152814,+ "installPath": "bin/model.koen.intgemm.alphas.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/ko-en/cjk_retrain_base-memory_QgYNtG3BTzKBFSV1wl06Pg/exported/model.koen.intgemm.alphas.bin.gz",+ "role": "model",+ "priority": 0+ },+ {+ "name": "lex.50.50.koen.s2t.bin",+ "sizeBytes": 4381854,+ "installPath": "bin/lex.50.50.koen.s2t.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/ko-en/cjk_retrain_base-memory_QgYNtG3BTzKBFSV1wl06Pg/exported/lex.50.50.koen.s2t.bin.gz",+ "role": "lex",+ "priority": 0+ },+ {+ "name": "vocab.koen.spm",+ "sizeBytes": 706864,+ "installPath": "bin/vocab.koen.spm",+ "url": "https://offline-translator.davidv.dev/translation/1/models/ko-en/cjk_retrain_base-memory_QgYNtG3BTzKBFSV1wl06Pg/exported/vocab.koen.spm.gz",+ "role": "vocab",+ "priority": 0+ }+ ],+ "dependsOn": []+ },+ "translate-lt-en": {+ "feature": "translation",+ "from": "lt",+ "to": "en",+ "experimental": false,+ "files": [+ {+ "name": "model.lten.intgemm.alphas.bin",+ "sizeBytes": 12571257,+ "installPath": "bin/model.lten.intgemm.alphas.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/lt-en/spring-2024_aAroslw9Ru-c5cam6SvLBg/exported/model.lten.intgemm.alphas.bin.gz",+ "role": "model",+ "priority": 0+ },+ {+ "name": "lex.50.50.lten.s2t.bin",+ "sizeBytes": 2308876,+ "installPath": "bin/lex.50.50.lten.s2t.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/lt-en/spring-2024_aAroslw9Ru-c5cam6SvLBg/exported/lex.50.50.lten.s2t.bin.gz",+ "role": "lex",+ "priority": 0+ },+ {+ "name": "vocab.lten.spm",+ "sizeBytes": 403960,+ "installPath": "bin/vocab.lten.spm",+ "url": "https://offline-translator.davidv.dev/translation/1/models/lt-en/spring-2024_aAroslw9Ru-c5cam6SvLBg/exported/vocab.lten.spm.gz",+ "role": "vocab",+ "priority": 0+ }+ ],+ "dependsOn": []+ },+ "translate-lv-en": {+ "feature": "translation",+ "from": "lv",+ "to": "en",+ "experimental": false,+ "files": [+ {+ "name": "model.lven.intgemm.alphas.bin",+ "sizeBytes": 12689153,+ "installPath": "bin/model.lven.intgemm.alphas.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/lv-en/spring-2024_fkUrjGNcQiWrTQ5BcYbkgg/exported/model.lven.intgemm.alphas.bin.gz",+ "role": "model",+ "priority": 0+ },+ {+ "name": "lex.50.50.lven.s2t.bin",+ "sizeBytes": 2131786,+ "installPath": "bin/lex.50.50.lven.s2t.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/lv-en/spring-2024_fkUrjGNcQiWrTQ5BcYbkgg/exported/lex.50.50.lven.s2t.bin.gz",+ "role": "lex",+ "priority": 0+ },+ {+ "name": "vocab.lven.spm",+ "sizeBytes": 407237,+ "installPath": "bin/vocab.lven.spm",+ "url": "https://offline-translator.davidv.dev/translation/1/models/lv-en/spring-2024_fkUrjGNcQiWrTQ5BcYbkgg/exported/vocab.lven.spm.gz",+ "role": "vocab",+ "priority": 0+ }+ ],+ "dependsOn": []+ },+ "translate-ml-en": {+ "feature": "translation",+ "from": "ml",+ "to": "en",+ "experimental": false,+ "files": [+ {+ "name": "model.mlen.intgemm.alphas.bin",+ "sizeBytes": 12792306,+ "installPath": "bin/model.mlen.intgemm.alphas.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/ml-en/h1-2025_Ahkzk6jNTAut7rz6laKkGQ/exported/model.mlen.intgemm.alphas.bin.gz",+ "role": "model",+ "priority": 0+ },+ {+ "name": "lex.50.50.mlen.s2t.bin",+ "sizeBytes": 2296381,+ "installPath": "bin/lex.50.50.mlen.s2t.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/ml-en/h1-2025_Ahkzk6jNTAut7rz6laKkGQ/exported/lex.50.50.mlen.s2t.bin.gz",+ "role": "lex",+ "priority": 0+ },+ {+ "name": "vocab.mlen.spm",+ "sizeBytes": 454911,+ "installPath": "bin/vocab.mlen.spm",+ "url": "https://offline-translator.davidv.dev/translation/1/models/ml-en/h1-2025_Ahkzk6jNTAut7rz6laKkGQ/exported/vocab.mlen.spm.gz",+ "role": "vocab",+ "priority": 0+ }+ ],+ "dependsOn": []+ },+ "translate-mr-en": {+ "feature": "translation",+ "from": "mr",+ "to": "en",+ "experimental": true,+ "files": [+ {+ "name": "model.mren.intgemm.alphas.bin",+ "sizeBytes": 23528866,+ "installPath": "bin/model.mren.intgemm.alphas.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/mr-en/next26_XkZJEQltRmKRcBirmiL30g/exported/model.mren.intgemm.alphas.bin.gz",+ "role": "model",+ "priority": 0+ },+ {+ "name": "lex.50.50.mren.s2t.bin",+ "sizeBytes": 2469059,+ "installPath": "bin/lex.50.50.mren.s2t.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/mr-en/next26_XkZJEQltRmKRcBirmiL30g/exported/lex.50.50.mren.s2t.bin.gz",+ "role": "lex",+ "priority": 0+ },+ {+ "name": "vocab.mren.spm",+ "sizeBytes": 442209,+ "installPath": "bin/vocab.mren.spm",+ "url": "https://offline-translator.davidv.dev/translation/1/models/mr-en/next26_XkZJEQltRmKRcBirmiL30g/exported/vocab.mren.spm.gz",+ "role": "vocab",+ "priority": 0+ }+ ],+ "dependsOn": []+ },+ "translate-ms-en": {+ "feature": "translation",+ "from": "ms",+ "to": "en",+ "experimental": false,+ "files": [+ {+ "name": "model.msen.intgemm.alphas.bin",+ "sizeBytes": 12538542,+ "installPath": "bin/model.msen.intgemm.alphas.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/ms-en/h1-2025_afzwIUAqQRWx5PtvozOHnw/exported/model.msen.intgemm.alphas.bin.gz",+ "role": "model",+ "priority": 0+ },+ {+ "name": "lex.50.50.msen.s2t.bin",+ "sizeBytes": 2141259,+ "installPath": "bin/lex.50.50.msen.s2t.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/ms-en/h1-2025_afzwIUAqQRWx5PtvozOHnw/exported/lex.50.50.msen.s2t.bin.gz",+ "role": "lex",+ "priority": 0+ },+ {+ "name": "vocab.msen.spm",+ "sizeBytes": 403877,+ "installPath": "bin/vocab.msen.spm",+ "url": "https://offline-translator.davidv.dev/translation/1/models/ms-en/h1-2025_afzwIUAqQRWx5PtvozOHnw/exported/vocab.msen.spm.gz",+ "role": "vocab",+ "priority": 0+ }+ ],+ "dependsOn": []+ },+ "translate-nb-en": {+ "feature": "translation",+ "from": "nb",+ "to": "en",+ "experimental": false,+ "files": [+ {+ "name": "model.nben.intgemm.alphas.bin",+ "sizeBytes": 13193689,+ "installPath": "bin/model.nben.intgemm.alphas.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/nb-en/h1-2025_YKogHXi6Q4es3P7fEWEaBw/exported/model.nben.intgemm.alphas.bin.gz",+ "role": "model",+ "priority": 0+ },+ {+ "name": "lex.50.50.nben.s2t.bin",+ "sizeBytes": 2308582,+ "installPath": "bin/lex.50.50.nben.s2t.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/nb-en/h1-2025_YKogHXi6Q4es3P7fEWEaBw/exported/lex.50.50.nben.s2t.bin.gz",+ "role": "lex",+ "priority": 0+ },+ {+ "name": "vocab.nben.spm",+ "sizeBytes": 409135,+ "installPath": "bin/vocab.nben.spm",+ "url": "https://offline-translator.davidv.dev/translation/1/models/nb-en/h1-2025_YKogHXi6Q4es3P7fEWEaBw/exported/vocab.nben.spm.gz",+ "role": "vocab",+ "priority": 0+ }+ ],+ "dependsOn": []+ },+ "translate-nl-en": {+ "feature": "translation",+ "from": "nl",+ "to": "en",+ "experimental": false,+ "files": [+ {+ "name": "model.nlen.intgemm.alphas.bin",+ "sizeBytes": 22647743,+ "installPath": "bin/model.nlen.intgemm.alphas.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/nl-en/retrain_hr_JbTCb42HREGvK8d6aOCjFQ/exported/model.nlen.intgemm.alphas.bin.gz",+ "role": "model",+ "priority": 0+ },+ {+ "name": "lex.50.50.nlen.s2t.bin",+ "sizeBytes": 2616098,+ "installPath": "bin/lex.50.50.nlen.s2t.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/nl-en/retrain_hr_JbTCb42HREGvK8d6aOCjFQ/exported/lex.50.50.nlen.s2t.bin.gz",+ "role": "lex",+ "priority": 0+ },+ {+ "name": "vocab.nlen.spm",+ "sizeBytes": 410222,+ "installPath": "bin/vocab.nlen.spm",+ "url": "https://offline-translator.davidv.dev/translation/1/models/nl-en/retrain_hr_JbTCb42HREGvK8d6aOCjFQ/exported/vocab.nlen.spm.gz",+ "role": "vocab",+ "priority": 0+ }+ ],+ "dependsOn": []+ },+ "translate-nn-en": {+ "feature": "translation",+ "from": "nn",+ "to": "en",+ "experimental": true,+ "files": [+ {+ "name": "model.nnen.intgemm.alphas.bin",+ "sizeBytes": 10465158,+ "installPath": "bin/model.nnen.intgemm.alphas.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/nn-en/statmt_xxxxxxxxRxSxxxxxxxxxxA/exported/model.nnen.intgemm.alphas.bin.gz",+ "role": "model",+ "priority": 0+ },+ {+ "name": "lex.50.50.nnen.s2t.bin",+ "sizeBytes": 731899,+ "installPath": "bin/lex.50.50.nnen.s2t.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/nn-en/statmt_xxxxxxxxRxSxxxxxxxxxxA/exported/lex.50.50.nnen.s2t.bin.gz",+ "role": "lex",+ "priority": 0+ },+ {+ "name": "vocab.nnen.spm",+ "sizeBytes": 269397,+ "installPath": "bin/vocab.nnen.spm",+ "url": "https://offline-translator.davidv.dev/translation/1/models/nn-en/statmt_xxxxxxxxRxSxxxxxxxxxxA/exported/vocab.nnen.spm.gz",+ "role": "vocab",+ "priority": 0+ }+ ],+ "dependsOn": []+ },+ "translate-no-en": {+ "feature": "translation",+ "from": "no",+ "to": "en",+ "experimental": false,+ "files": [+ {+ "name": "model.noen.intgemm.alphas.bin",+ "sizeBytes": 13193689,+ "installPath": "bin/model.noen.intgemm.alphas.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/no-en/h1-2025_YKogHXi6Q4es3P7fEWEaBw/exported/model.noen.intgemm.alphas.bin.gz",+ "role": "model",+ "priority": 0+ },+ {+ "name": "lex.50.50.noen.s2t.bin",+ "sizeBytes": 2308582,+ "installPath": "bin/lex.50.50.noen.s2t.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/no-en/h1-2025_YKogHXi6Q4es3P7fEWEaBw/exported/lex.50.50.noen.s2t.bin.gz",+ "role": "lex",+ "priority": 0+ },+ {+ "name": "vocab.noen.spm",+ "sizeBytes": 409135,+ "installPath": "bin/vocab.noen.spm",+ "url": "https://offline-translator.davidv.dev/translation/1/models/no-en/h1-2025_YKogHXi6Q4es3P7fEWEaBw/exported/vocab.noen.spm.gz",+ "role": "vocab",+ "priority": 0+ }+ ],+ "dependsOn": []+ },+ "translate-pl-en": {+ "feature": "translation",+ "from": "pl",+ "to": "en",+ "experimental": false,+ "files": [+ {+ "name": "model.plen.intgemm.alphas.bin",+ "sizeBytes": 22630393,+ "installPath": "bin/model.plen.intgemm.alphas.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/pl-en/retrain_hr_HLLa6ZwsSomB0kyBr7Iz6w/exported/model.plen.intgemm.alphas.bin.gz",+ "role": "model",+ "priority": 0+ },+ {+ "name": "lex.50.50.plen.s2t.bin",+ "sizeBytes": 2489764,+ "installPath": "bin/lex.50.50.plen.s2t.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/pl-en/retrain_hr_HLLa6ZwsSomB0kyBr7Iz6w/exported/lex.50.50.plen.s2t.bin.gz",+ "role": "lex",+ "priority": 0+ },+ {+ "name": "vocab.plen.spm",+ "sizeBytes": 413194,+ "installPath": "bin/vocab.plen.spm",+ "url": "https://offline-translator.davidv.dev/translation/1/models/pl-en/retrain_hr_HLLa6ZwsSomB0kyBr7Iz6w/exported/vocab.plen.spm.gz",+ "role": "vocab",+ "priority": 0+ }+ ],+ "dependsOn": []+ },+ "translate-pt-en": {+ "feature": "translation",+ "from": "pt",+ "to": "en",+ "experimental": false,+ "files": [+ {+ "name": "model.pten.intgemm.alphas.bin",+ "sizeBytes": 22700409,+ "installPath": "bin/model.pten.intgemm.alphas.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/pt-en/retrain_hr_drxrs5bGSsOWvfK9lyZISw/exported/model.pten.intgemm.alphas.bin.gz",+ "role": "model",+ "priority": 0+ },+ {+ "name": "lex.50.50.pten.s2t.bin",+ "sizeBytes": 2487847,+ "installPath": "bin/lex.50.50.pten.s2t.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/pt-en/retrain_hr_drxrs5bGSsOWvfK9lyZISw/exported/lex.50.50.pten.s2t.bin.gz",+ "role": "lex",+ "priority": 0+ },+ {+ "name": "vocab.pten.spm",+ "sizeBytes": 408686,+ "installPath": "bin/vocab.pten.spm",+ "url": "https://offline-translator.davidv.dev/translation/1/models/pt-en/retrain_hr_drxrs5bGSsOWvfK9lyZISw/exported/vocab.pten.spm.gz",+ "role": "vocab",+ "priority": 0+ }+ ],+ "dependsOn": []+ },+ "translate-ro-en": {+ "feature": "translation",+ "from": "ro",+ "to": "en",+ "experimental": false,+ "files": [+ {+ "name": "model.roen.intgemm.alphas.bin",+ "sizeBytes": 12722200,+ "installPath": "bin/model.roen.intgemm.alphas.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/ro-en/spring-2024_RwH0W_MDRK2BmZA6VzAmBg/exported/model.roen.intgemm.alphas.bin.gz",+ "role": "model",+ "priority": 0+ },+ {+ "name": "lex.50.50.roen.s2t.bin",+ "sizeBytes": 2159556,+ "installPath": "bin/lex.50.50.roen.s2t.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/ro-en/spring-2024_RwH0W_MDRK2BmZA6VzAmBg/exported/lex.50.50.roen.s2t.bin.gz",+ "role": "lex",+ "priority": 0+ },+ {+ "name": "vocab.roen.spm",+ "sizeBytes": 396717,+ "installPath": "bin/vocab.roen.spm",+ "url": "https://offline-translator.davidv.dev/translation/1/models/ro-en/spring-2024_RwH0W_MDRK2BmZA6VzAmBg/exported/vocab.roen.spm.gz",+ "role": "vocab",+ "priority": 0+ }+ ],+ "dependsOn": []+ },+ "translate-ru-en": {+ "feature": "translation",+ "from": "ru",+ "to": "en",+ "experimental": false,+ "files": [+ {+ "name": "model.ruen.intgemm.alphas.bin",+ "sizeBytes": 12613599,+ "installPath": "bin/model.ruen.intgemm.alphas.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/ru-en/spring-2024_QrcdYgbwS7e7xbhtOSdoNQ/exported/model.ruen.intgemm.alphas.bin.gz",+ "role": "model",+ "priority": 0+ },+ {+ "name": "lex.50.50.ruen.s2t.bin",+ "sizeBytes": 1962008,+ "installPath": "bin/lex.50.50.ruen.s2t.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/ru-en/spring-2024_QrcdYgbwS7e7xbhtOSdoNQ/exported/lex.50.50.ruen.s2t.bin.gz",+ "role": "lex",+ "priority": 0+ },+ {+ "name": "vocab.ruen.spm",+ "sizeBytes": 419860,+ "installPath": "bin/vocab.ruen.spm",+ "url": "https://offline-translator.davidv.dev/translation/1/models/ru-en/spring-2024_QrcdYgbwS7e7xbhtOSdoNQ/exported/vocab.ruen.spm.gz",+ "role": "vocab",+ "priority": 0+ }+ ],+ "dependsOn": []+ },+ "translate-sk-en": {+ "feature": "translation",+ "from": "sk",+ "to": "en",+ "experimental": false,+ "files": [+ {+ "name": "model.sken.intgemm.alphas.bin",+ "sizeBytes": 12821519,+ "installPath": "bin/model.sken.intgemm.alphas.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/sk-en/spring-2024_TD01UwWXRKacv3wnYeVKbg/exported/model.sken.intgemm.alphas.bin.gz",+ "role": "model",+ "priority": 0+ },+ {+ "name": "lex.50.50.sken.s2t.bin",+ "sizeBytes": 2348184,+ "installPath": "bin/lex.50.50.sken.s2t.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/sk-en/spring-2024_TD01UwWXRKacv3wnYeVKbg/exported/lex.50.50.sken.s2t.bin.gz",+ "role": "lex",+ "priority": 0+ },+ {+ "name": "vocab.sken.spm",+ "sizeBytes": 405122,+ "installPath": "bin/vocab.sken.spm",+ "url": "https://offline-translator.davidv.dev/translation/1/models/sk-en/spring-2024_TD01UwWXRKacv3wnYeVKbg/exported/vocab.sken.spm.gz",+ "role": "vocab",+ "priority": 0+ }+ ],+ "dependsOn": []+ },+ "translate-sl-en": {+ "feature": "translation",+ "from": "sl",+ "to": "en",+ "experimental": false,+ "files": [+ {+ "name": "model.slen.intgemm.alphas.bin",+ "sizeBytes": 23730414,+ "installPath": "bin/model.slen.intgemm.alphas.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/sl-en/h1-2025_TCeLyjkQRL2YbTXrUhTlAg/exported/model.slen.intgemm.alphas.bin.gz",+ "role": "model",+ "priority": 0+ },+ {+ "name": "lex.50.50.slen.s2t.bin",+ "sizeBytes": 2138548,+ "installPath": "bin/lex.50.50.slen.s2t.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/sl-en/h1-2025_TCeLyjkQRL2YbTXrUhTlAg/exported/lex.50.50.slen.s2t.bin.gz",+ "role": "lex",+ "priority": 0+ },+ {+ "name": "vocab.slen.spm",+ "sizeBytes": 398535,+ "installPath": "bin/vocab.slen.spm",+ "url": "https://offline-translator.davidv.dev/translation/1/models/sl-en/h1-2025_TCeLyjkQRL2YbTXrUhTlAg/exported/vocab.slen.spm.gz",+ "role": "vocab",+ "priority": 0+ }+ ],+ "dependsOn": []+ },+ "translate-sq-en": {+ "feature": "translation",+ "from": "sq",+ "to": "en",+ "experimental": false,+ "files": [+ {+ "name": "model.sqen.intgemm.alphas.bin",+ "sizeBytes": 12593638,+ "installPath": "bin/model.sqen.intgemm.alphas.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/sq-en/h1-2025_I8xy7KMeQoe3mMEV3umzfQ/exported/model.sqen.intgemm.alphas.bin.gz",+ "role": "model",+ "priority": 0+ },+ {+ "name": "lex.50.50.sqen.s2t.bin",+ "sizeBytes": 2165940,+ "installPath": "bin/lex.50.50.sqen.s2t.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/sq-en/h1-2025_I8xy7KMeQoe3mMEV3umzfQ/exported/lex.50.50.sqen.s2t.bin.gz",+ "role": "lex",+ "priority": 0+ },+ {+ "name": "vocab.sqen.spm",+ "sizeBytes": 410423,+ "installPath": "bin/vocab.sqen.spm",+ "url": "https://offline-translator.davidv.dev/translation/1/models/sq-en/h1-2025_I8xy7KMeQoe3mMEV3umzfQ/exported/vocab.sqen.spm.gz",+ "role": "vocab",+ "priority": 0+ }+ ],+ "dependsOn": []+ },+ "translate-sr-en": {+ "feature": "translation",+ "from": "sr",+ "to": "en",+ "experimental": true,+ "files": [+ {+ "name": "model.sren.intgemm.alphas.bin",+ "sizeBytes": 12729754,+ "installPath": "bin/model.sren.intgemm.alphas.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/sr-en/spring-2024_H5GCfsx4SnqOP4YFIQdkdA/exported/model.sren.intgemm.alphas.bin.gz",+ "role": "model",+ "priority": 0+ },+ {+ "name": "lex.50.50.sren.s2t.bin",+ "sizeBytes": 2117763,+ "installPath": "bin/lex.50.50.sren.s2t.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/sr-en/spring-2024_H5GCfsx4SnqOP4YFIQdkdA/exported/lex.50.50.sren.s2t.bin.gz",+ "role": "lex",+ "priority": 0+ },+ {+ "name": "vocab.sren.spm",+ "sizeBytes": 403515,+ "installPath": "bin/vocab.sren.spm",+ "url": "https://offline-translator.davidv.dev/translation/1/models/sr-en/spring-2024_H5GCfsx4SnqOP4YFIQdkdA/exported/vocab.sren.spm.gz",+ "role": "vocab",+ "priority": 0+ }+ ],+ "dependsOn": []+ },+ "translate-sv-en": {+ "feature": "translation",+ "from": "sv",+ "to": "en",+ "experimental": false,+ "files": [+ {+ "name": "model.sven.intgemm.alphas.bin",+ "sizeBytes": 12847259,+ "installPath": "bin/model.sven.intgemm.alphas.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/sv-en/spring-2024_ObaRXwXeSW6HA_-J5_dE-g/exported/model.sven.intgemm.alphas.bin.gz",+ "role": "model",+ "priority": 0+ },+ {+ "name": "lex.50.50.sven.s2t.bin",+ "sizeBytes": 2165215,+ "installPath": "bin/lex.50.50.sven.s2t.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/sv-en/spring-2024_ObaRXwXeSW6HA_-J5_dE-g/exported/lex.50.50.sven.s2t.bin.gz",+ "role": "lex",+ "priority": 0+ },+ {+ "name": "vocab.sven.spm",+ "sizeBytes": 397625,+ "installPath": "bin/vocab.sven.spm",+ "url": "https://offline-translator.davidv.dev/translation/1/models/sv-en/spring-2024_ObaRXwXeSW6HA_-J5_dE-g/exported/vocab.sven.spm.gz",+ "role": "vocab",+ "priority": 0+ }+ ],+ "dependsOn": []+ },+ "translate-sw-en": {+ "feature": "translation",+ "from": "sw",+ "to": "en",+ "experimental": false,+ "files": [+ {+ "name": "model.swen.intgemm.alphas.bin",+ "sizeBytes": 24613843,+ "installPath": "bin/model.swen.intgemm.alphas.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/sw-en/nllb_distill_20260714/exported/model.swen.intgemm.alphas.bin.gz",+ "role": "model",+ "priority": 0+ },+ {+ "name": "lex.50.50.swen.s2t.bin",+ "sizeBytes": 1217351,+ "installPath": "bin/lex.50.50.swen.s2t.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/sw-en/nllb_distill_20260714/exported/lex.50.50.swen.s2t.bin.gz",+ "role": "lex",+ "priority": 0+ },+ {+ "name": "vocab.swen.spm",+ "sizeBytes": 391114,+ "installPath": "bin/vocab.swen.spm",+ "url": "https://offline-translator.davidv.dev/translation/1/models/sw-en/nllb_distill_20260714/exported/vocab.swen.spm.gz",+ "role": "vocab",+ "priority": 0+ }+ ],+ "dependsOn": []+ },+ "translate-ta-en": {+ "feature": "translation",+ "from": "ta",+ "to": "en",+ "experimental": true,+ "files": [+ {+ "name": "model.taen.intgemm.alphas.bin",+ "sizeBytes": 23526938,+ "installPath": "bin/model.taen.intgemm.alphas.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/ta-en/next26_dwRqBIcMSDG7drW2_xDIMA/exported/model.taen.intgemm.alphas.bin.gz",+ "role": "model",+ "priority": 0+ },+ {+ "name": "lex.50.50.taen.s2t.bin",+ "sizeBytes": 2410364,+ "installPath": "bin/lex.50.50.taen.s2t.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/ta-en/next26_dwRqBIcMSDG7drW2_xDIMA/exported/lex.50.50.taen.s2t.bin.gz",+ "role": "lex",+ "priority": 0+ },+ {+ "name": "vocab.taen.spm",+ "sizeBytes": 451486,+ "installPath": "bin/vocab.taen.spm",+ "url": "https://offline-translator.davidv.dev/translation/1/models/ta-en/next26_dwRqBIcMSDG7drW2_xDIMA/exported/vocab.taen.spm.gz",+ "role": "vocab",+ "priority": 0+ }+ ],+ "dependsOn": []+ },+ "translate-te-en": {+ "feature": "translation",+ "from": "te",+ "to": "en",+ "experimental": false,+ "files": [+ {+ "name": "model.teen.intgemm.alphas.bin",+ "sizeBytes": 13202063,+ "installPath": "bin/model.teen.intgemm.alphas.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/te-en/h1-2025_YEapi_rWRsSUVTqbBTqupw/exported/model.teen.intgemm.alphas.bin.gz",+ "role": "model",+ "priority": 0+ },+ {+ "name": "lex.50.50.teen.s2t.bin",+ "sizeBytes": 2209444,+ "installPath": "bin/lex.50.50.teen.s2t.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/te-en/h1-2025_YEapi_rWRsSUVTqbBTqupw/exported/lex.50.50.teen.s2t.bin.gz",+ "role": "lex",+ "priority": 0+ },+ {+ "name": "vocab.teen.spm",+ "sizeBytes": 448555,+ "installPath": "bin/vocab.teen.spm",+ "url": "https://offline-translator.davidv.dev/translation/1/models/te-en/h1-2025_YEapi_rWRsSUVTqbBTqupw/exported/vocab.teen.spm.gz",+ "role": "vocab",+ "priority": 0+ }+ ],+ "dependsOn": []+ },+ "translate-th-en": {+ "feature": "translation",+ "from": "th",+ "to": "en",+ "experimental": false,+ "files": [+ {+ "name": "model.then.intgemm.alphas.bin",+ "sizeBytes": 22974117,+ "installPath": "bin/model.then.intgemm.alphas.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/th-en/new-opuscleaner-en-th_aIiNAAZbRny4ODcYGOMlEA/exported/model.then.intgemm.alphas.bin.gz",+ "role": "model",+ "priority": 0+ },+ {+ "name": "lex.50.50.then.s2t.bin",+ "sizeBytes": 2239323,+ "installPath": "bin/lex.50.50.then.s2t.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/th-en/new-opuscleaner-en-th_aIiNAAZbRny4ODcYGOMlEA/exported/lex.50.50.then.s2t.bin.gz",+ "role": "lex",+ "priority": 0+ },+ {+ "name": "vocab.then.spm",+ "sizeBytes": 451231,+ "installPath": "bin/vocab.then.spm",+ "url": "https://offline-translator.davidv.dev/translation/1/models/th-en/new-opuscleaner-en-th_aIiNAAZbRny4ODcYGOMlEA/exported/vocab.then.spm.gz",+ "role": "vocab",+ "priority": 0+ }+ ],+ "dependsOn": []+ },+ "translate-tl-en": {+ "feature": "translation",+ "from": "tl",+ "to": "en",+ "experimental": false,+ "files": [+ {+ "name": "model.tlen.intgemm.alphas.bin",+ "sizeBytes": 24582686,+ "installPath": "bin/model.tlen.intgemm.alphas.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/tl-en/opusmt_distill_20260713/exported/model.tlen.intgemm.alphas.bin.gz",+ "role": "model",+ "priority": 0+ },+ {+ "name": "lex.50.50.tlen.s2t.bin",+ "sizeBytes": 1281937,+ "installPath": "bin/lex.50.50.tlen.s2t.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/tl-en/opusmt_distill_20260713/exported/lex.50.50.tlen.s2t.bin.gz",+ "role": "lex",+ "priority": 0+ },+ {+ "name": "vocab.tlen.spm",+ "sizeBytes": 387511,+ "installPath": "bin/vocab.tlen.spm",+ "url": "https://offline-translator.davidv.dev/translation/1/models/tl-en/opusmt_distill_20260713/exported/vocab.tlen.spm.gz",+ "role": "vocab",+ "priority": 0+ }+ ],+ "dependsOn": []+ },+ "translate-tr-en": {+ "feature": "translation",+ "from": "tr",+ "to": "en",+ "experimental": false,+ "files": [+ {+ "name": "model.tren.intgemm.alphas.bin",+ "sizeBytes": 12362908,+ "installPath": "bin/model.tren.intgemm.alphas.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/tr-en/statmt_xxxxxxxxRxSxxxxxxxxxxA/exported/model.tren.intgemm.alphas.bin.gz",+ "role": "model",+ "priority": 0+ },+ {+ "name": "lex.50.50.tren.s2t.bin",+ "sizeBytes": 2470683,+ "installPath": "bin/lex.50.50.tren.s2t.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/tr-en/statmt_xxxxxxxxRxSxxxxxxxxxxA/exported/lex.50.50.tren.s2t.bin.gz",+ "role": "lex",+ "priority": 0+ },+ {+ "name": "vocab.tren.spm",+ "sizeBytes": 409060,+ "installPath": "bin/vocab.tren.spm",+ "url": "https://offline-translator.davidv.dev/translation/1/models/tr-en/statmt_xxxxxxxxRxSxxxxxxxxxxA/exported/vocab.tren.spm.gz",+ "role": "vocab",+ "priority": 0+ }+ ],+ "dependsOn": []+ },+ "translate-ug-en": {+ "feature": "translation",+ "from": "ug",+ "to": "en",+ "experimental": false,+ "files": [+ {+ "name": "model.ugen.intgemm.alphas.bin",+ "sizeBytes": 23536190,+ "installPath": "bin/model.ugen.intgemm.alphas.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/ug-en/hymt2_distill_20260718/exported/model.ugen.intgemm.alphas.bin.gz",+ "role": "model",+ "priority": 0+ },+ {+ "name": "lex.50.50.ugen.s2t.bin",+ "sizeBytes": 1702175,+ "installPath": "bin/lex.50.50.ugen.s2t.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/ug-en/hymt2_distill_20260718/exported/lex.50.50.ugen.s2t.bin.gz",+ "role": "lex",+ "priority": 0+ },+ {+ "name": "vocab.ugen.spm",+ "sizeBytes": 406295,+ "installPath": "bin/vocab.ugen.spm",+ "url": "https://offline-translator.davidv.dev/translation/1/models/ug-en/hymt2_distill_20260718/exported/vocab.ugen.spm.gz",+ "role": "vocab",+ "priority": 0+ }+ ],+ "dependsOn": []+ },+ "translate-uk-en": {+ "feature": "translation",+ "from": "uk",+ "to": "en",+ "experimental": false,+ "files": [+ {+ "name": "model.uken.intgemm.alphas.bin",+ "sizeBytes": 12677432,+ "installPath": "bin/model.uken.intgemm.alphas.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/uk-en/spring-2024_WEPBsc-zQWSDn34b5KFscw/exported/model.uken.intgemm.alphas.bin.gz",+ "role": "model",+ "priority": 0+ },+ {+ "name": "lex.50.50.uken.s2t.bin",+ "sizeBytes": 1790588,+ "installPath": "bin/lex.50.50.uken.s2t.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/uk-en/spring-2024_WEPBsc-zQWSDn34b5KFscw/exported/lex.50.50.uken.s2t.bin.gz",+ "role": "lex",+ "priority": 0+ },+ {+ "name": "vocab.uken.spm",+ "sizeBytes": 415266,+ "installPath": "bin/vocab.uken.spm",+ "url": "https://offline-translator.davidv.dev/translation/1/models/uk-en/spring-2024_WEPBsc-zQWSDn34b5KFscw/exported/vocab.uken.spm.gz",+ "role": "vocab",+ "priority": 0+ }+ ],+ "dependsOn": []+ },+ "translate-ur-en": {+ "feature": "translation",+ "from": "ur",+ "to": "en",+ "experimental": true,+ "files": [+ {+ "name": "model.uren.intgemm.alphas.bin",+ "sizeBytes": 23064952,+ "installPath": "bin/model.uren.intgemm.alphas.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/ur-en/next26-lowerbc_YQbMSoalT82NnQU9H1-G-w/exported/model.uren.intgemm.alphas.bin.gz",+ "role": "model",+ "priority": 0+ },+ {+ "name": "lex.50.50.uren.s2t.bin",+ "sizeBytes": 1922245,+ "installPath": "bin/lex.50.50.uren.s2t.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/ur-en/next26-lowerbc_YQbMSoalT82NnQU9H1-G-w/exported/lex.50.50.uren.s2t.bin.gz",+ "role": "lex",+ "priority": 0+ },+ {+ "name": "vocab.uren.spm",+ "sizeBytes": 417745,+ "installPath": "bin/vocab.uren.spm",+ "url": "https://offline-translator.davidv.dev/translation/1/models/ur-en/next26-lowerbc_YQbMSoalT82NnQU9H1-G-w/exported/vocab.uren.spm.gz",+ "role": "vocab",+ "priority": 0+ }+ ],+ "dependsOn": []+ },+ "translate-vi-en": {+ "feature": "translation",+ "from": "vi",+ "to": "en",+ "experimental": false,+ "files": [+ {+ "name": "model.vien.intgemm.alphas.bin",+ "sizeBytes": 12914609,+ "installPath": "bin/model.vien.intgemm.alphas.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/vi-en/spring-2024_Nc0SHbrgQaiFt4_FmKBXOA/exported/model.vien.intgemm.alphas.bin.gz",+ "role": "model",+ "priority": 0+ },+ {+ "name": "lex.50.50.vien.s2t.bin",+ "sizeBytes": 1887658,+ "installPath": "bin/lex.50.50.vien.s2t.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/vi-en/spring-2024_Nc0SHbrgQaiFt4_FmKBXOA/exported/lex.50.50.vien.s2t.bin.gz",+ "role": "lex",+ "priority": 0+ },+ {+ "name": "vocab.vien.spm",+ "sizeBytes": 375643,+ "installPath": "bin/vocab.vien.spm",+ "url": "https://offline-translator.davidv.dev/translation/1/models/vi-en/spring-2024_Nc0SHbrgQaiFt4_FmKBXOA/exported/vocab.vien.spm.gz",+ "role": "vocab",+ "priority": 0+ }+ ],+ "dependsOn": []+ },+ "translate-zh-en": {+ "feature": "translation",+ "from": "zh",+ "to": "en",+ "experimental": false,+ "files": [+ {+ "name": "model.zhen.intgemm.alphas.bin",+ "sizeBytes": 32726806,+ "installPath": "bin/model.zhen.intgemm.alphas.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/zh-en/cjk_retrain_base-memory_cNY_yaJCStGwnTeXgW8A5w/exported/model.zhen.intgemm.alphas.bin.gz",+ "role": "model",+ "priority": 0+ },+ {+ "name": "lex.50.50.zhen.s2t.bin",+ "sizeBytes": 4822158,+ "installPath": "bin/lex.50.50.zhen.s2t.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/zh-en/cjk_retrain_base-memory_cNY_yaJCStGwnTeXgW8A5w/exported/lex.50.50.zhen.s2t.bin.gz",+ "role": "lex",+ "priority": 0+ },+ {+ "name": "vocab.zhen.spm",+ "sizeBytes": 738862,+ "installPath": "bin/vocab.zhen.spm",+ "url": "https://offline-translator.davidv.dev/translation/1/models/zh-en/cjk_retrain_base-memory_cNY_yaJCStGwnTeXgW8A5w/exported/vocab.zhen.spm.gz",+ "role": "vocab",+ "priority": 0+ }+ ],+ "dependsOn": []+ },+ "translate-zh_hant-en": {+ "feature": "translation",+ "from": "zh_hant",+ "to": "en",+ "experimental": false,+ "files": [+ {+ "name": "model.zh_hanten.intgemm.alphas.bin",+ "sizeBytes": 33653648,+ "installPath": "bin/model.zh_hanten.intgemm.alphas.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/zh_hant-en/zh_hant_openlid_zh_tw_lr0002_WJi5Ozi7SZWC6hgfD5GhTA/exported/model.zh_hanten.intgemm.alphas.bin.gz",+ "role": "model",+ "priority": 0+ },+ {+ "name": "lex.50.50.zh_hanten.s2t.bin",+ "sizeBytes": 3268812,+ "installPath": "bin/lex.50.50.zh_hanten.s2t.bin",+ "url": "https://offline-translator.davidv.dev/translation/1/models/zh_hant-en/zh_hant_openlid_zh_tw_lr0002_WJi5Ozi7SZWC6hgfD5GhTA/exported/lex.50.50.zh_hanten.s2t.bin.gz",+ "role": "lex",+ "priority": 0+ },+ {+ "name": "srcvocab.zh_hanten.spm",+ "sizeBytes": 423691,+ "installPath": "bin/srcvocab.zh_hanten.spm",+ "url": "https://offline-translator.davidv.dev/translation/1/models/zh_hant-en/zh_hant_openlid_zh_tw_lr0002_WJi5Ozi7SZWC6hgfD5GhTA/exported/srcvocab.zh_hanten.spm.gz",+ "role": "srcVocab",+ "priority": 0+ },+ {+ "name": "trgvocab.zh_hanten.spm",+ "sizeBytes": 408143,+ "installPath": "bin/trgvocab.zh_hanten.spm",+ "url": "https://offline-translator.davidv.dev/translation/1/models/zh_hant-en/zh_hant_openlid_zh_tw_lr0002_WJi5Ozi7SZWC6hgfD5GhTA/exported/trgvocab.zh_hanten.spm.gz",+ "role": "tgtVocab",+ "priority": 0+ }+ ],+ "dependsOn": []+ },+ "tts-espeak-core-v1": {+ "feature": "support",+ "kind": "tts-espeak-core",+ "files": [+ {+ "name": "espeak-ng-data.zip",+ "sizeBytes": 425969,+ "installPath": "bin/espeak-ng-data.zip",+ "url": "https://offline-translator.davidv.dev/tts/1/espeak-ng-data.zip",+ "archiveFormat": "zip",+ "extractTo": "bin",+ "deleteAfterExtract": true,+ "installMarkerPath": "bin/espeak-ng-data/.install-info.json",+ "installMarkerVersion": 1,+ "role": "espeakCore",+ "priority": 0+ }+ ],+ "dependsOn": []+ },+ "tts-espeak-dict-ar": {+ "feature": "support",+ "kind": "tts-espeak-dict",+ "files": [+ {+ "name": "ar_dict",+ "sizeBytes": 478165,+ "installPath": "bin/espeak-ng-data/ar_dict",+ "url": "https://offline-translator.davidv.dev/tts/1/espeak-ng-data/ar_dict",+ "role": "espeakDict",+ "priority": 0+ }+ ],+ "dependsOn": [+ "tts-espeak-core-v1"+ ]+ },+ "tts-espeak-dict-bg": {+ "feature": "support",+ "kind": "tts-espeak-dict",+ "files": [+ {+ "name": "bg_dict",+ "sizeBytes": 87051,+ "installPath": "bin/espeak-ng-data/bg_dict",+ "url": "https://offline-translator.davidv.dev/tts/1/espeak-ng-data/bg_dict",+ "role": "espeakDict",+ "priority": 0+ }+ ],+ "dependsOn": [+ "tts-espeak-core-v1"+ ]+ },+ "tts-espeak-dict-ca": {+ "feature": "support",+ "kind": "tts-espeak-dict",+ "files": [+ {+ "name": "ca_dict",+ "sizeBytes": 310331,+ "installPath": "bin/espeak-ng-data/ca_dict",+ "url": "https://offline-translator.davidv.dev/tts/1/espeak-ng-data/ca_dict",+ "role": "espeakDict",+ "priority": 0+ }+ ],+ "dependsOn": [+ "tts-espeak-core-v1"+ ]+ },+ "tts-espeak-dict-cmn": {+ "feature": "support",+ "kind": "tts-espeak-dict",+ "files": [+ {+ "name": "cmn_dict",+ "sizeBytes": 1566347,+ "installPath": "bin/espeak-ng-data/cmn_dict",+ "url": "https://offline-translator.davidv.dev/tts/1/espeak-ng-data/cmn_dict",+ "role": "espeakDict",+ "priority": 0+ }+ ],+ "dependsOn": [+ "tts-espeak-core-v1"+ ]+ },+ "tts-espeak-dict-cs": {+ "feature": "support",+ "kind": "tts-espeak-dict",+ "files": [+ {+ "name": "cs_dict",+ "sizeBytes": 50455,+ "installPath": "bin/espeak-ng-data/cs_dict",+ "url": "https://offline-translator.davidv.dev/tts/1/espeak-ng-data/cs_dict",+ "role": "espeakDict",+ "priority": 0+ }+ ],+ "dependsOn": [+ "tts-espeak-core-v1"+ ]+ },+ "tts-espeak-dict-da": {+ "feature": "support",+ "kind": "tts-espeak-dict",+ "files": [+ {+ "name": "da_dict",+ "sizeBytes": 245287,+ "installPath": "bin/espeak-ng-data/da_dict",+ "url": "https://offline-translator.davidv.dev/tts/1/espeak-ng-data/da_dict",+ "role": "espeakDict",+ "priority": 0+ }+ ],+ "dependsOn": [+ "tts-espeak-core-v1"+ ]+ },+ "tts-espeak-dict-de": {+ "feature": "support",+ "kind": "tts-espeak-dict",+ "files": [+ {+ "name": "de_dict",+ "sizeBytes": 69277,+ "installPath": "bin/espeak-ng-data/de_dict",+ "url": "https://offline-translator.davidv.dev/tts/1/espeak-ng-data/de_dict",+ "role": "espeakDict",+ "priority": 0+ }+ ],+ "dependsOn": [+ "tts-espeak-core-v1"+ ]+ },+ "tts-espeak-dict-el": {+ "feature": "support",+ "kind": "tts-espeak-dict",+ "files": [+ {+ "name": "el_dict",+ "sizeBytes": 72841,+ "installPath": "bin/espeak-ng-data/el_dict",+ "url": "https://offline-translator.davidv.dev/tts/1/espeak-ng-data/el_dict",+ "role": "espeakDict",+ "priority": 0+ }+ ],+ "dependsOn": [+ "tts-espeak-core-v1"+ ]+ },+ "tts-espeak-dict-en": {+ "feature": "support",+ "kind": "tts-espeak-dict",+ "files": [+ {+ "name": "en_dict",+ "sizeBytes": 168204,+ "installPath": "bin/espeak-ng-data/en_dict",+ "url": "https://offline-translator.davidv.dev/tts/1/espeak-ng-data/en_dict",+ "role": "espeakDict",+ "priority": 0+ }+ ],+ "dependsOn": [+ "tts-espeak-core-v1"+ ]+ },+ "tts-espeak-dict-es": {+ "feature": "support",+ "kind": "tts-espeak-dict",+ "files": [+ {+ "name": "es_dict",+ "sizeBytes": 49285,+ "installPath": "bin/espeak-ng-data/es_dict",+ "url": "https://offline-translator.davidv.dev/tts/1/espeak-ng-data/es_dict",+ "role": "espeakDict",+ "priority": 0+ }+ ],+ "dependsOn": [+ "tts-espeak-core-v1"+ ]+ },+ "tts-espeak-dict-eu": {+ "feature": "support",+ "kind": "tts-espeak-dict",+ "files": [+ {+ "name": "eu_dict",+ "sizeBytes": 48841,+ "installPath": "bin/espeak-ng-data/eu_dict",+ "url": "https://offline-translator.davidv.dev/tts/1/espeak-ng-data/eu_dict",+ "role": "espeakDict",+ "priority": 0+ }+ ],+ "dependsOn": [+ "tts-espeak-core-v1"+ ]+ },+ "tts-espeak-dict-fa": {+ "feature": "support",+ "kind": "tts-espeak-dict",+ "files": [+ {+ "name": "fa_dict",+ "sizeBytes": 292907,+ "installPath": "bin/espeak-ng-data/fa_dict",+ "url": "https://offline-translator.davidv.dev/tts/1/espeak-ng-data/fa_dict",+ "role": "espeakDict",+ "priority": 0+ }+ ],+ "dependsOn": [+ "tts-espeak-core-v1"+ ]+ },+ "tts-espeak-dict-fi": {+ "feature": "support",+ "kind": "tts-espeak-dict",+ "files": [+ {+ "name": "fi_dict",+ "sizeBytes": 43928,+ "installPath": "bin/espeak-ng-data/fi_dict",+ "url": "https://offline-translator.davidv.dev/tts/1/espeak-ng-data/fi_dict",+ "role": "espeakDict",+ "priority": 0+ }+ ],+ "dependsOn": [+ "tts-espeak-core-v1"+ ]+ },+ "tts-espeak-dict-fr": {+ "feature": "support",+ "kind": "tts-espeak-dict",+ "files": [+ {+ "name": "fr_dict",+ "sizeBytes": 63727,+ "installPath": "bin/espeak-ng-data/fr_dict",+ "url": "https://offline-translator.davidv.dev/tts/1/espeak-ng-data/fr_dict",+ "role": "espeakDict",+ "priority": 0+ }+ ],+ "dependsOn": [+ "tts-espeak-core-v1"+ ]+ },+ "tts-espeak-dict-hi": {+ "feature": "support",+ "kind": "tts-espeak-dict",+ "files": [+ {+ "name": "hi_dict",+ "sizeBytes": 92143,+ "installPath": "bin/espeak-ng-data/hi_dict",+ "url": "https://offline-translator.davidv.dev/tts/1/espeak-ng-data/hi_dict",+ "role": "espeakDict",+ "priority": 0+ }+ ],+ "dependsOn": [+ "tts-espeak-core-v1"+ ]+ },+ "tts-espeak-dict-hu": {+ "feature": "support",+ "kind": "tts-espeak-dict",+ "files": [+ {+ "name": "hu_dict",+ "sizeBytes": 177886,+ "installPath": "bin/espeak-ng-data/hu_dict",+ "url": "https://offline-translator.davidv.dev/tts/1/espeak-ng-data/hu_dict",+ "role": "espeakDict",+ "priority": 0+ }+ ],+ "dependsOn": [+ "tts-espeak-core-v1"+ ]+ },+ "tts-espeak-dict-id": {+ "feature": "support",+ "kind": "tts-espeak-dict",+ "files": [+ {+ "name": "id_dict",+ "sizeBytes": 43458,+ "installPath": "bin/espeak-ng-data/id_dict",+ "url": "https://offline-translator.davidv.dev/tts/1/espeak-ng-data/id_dict",+ "role": "espeakDict",+ "priority": 0+ }+ ],+ "dependsOn": [+ "tts-espeak-core-v1"+ ]+ },+ "tts-espeak-dict-is": {+ "feature": "support",+ "kind": "tts-espeak-dict",+ "files": [+ {+ "name": "is_dict",+ "sizeBytes": 44354,+ "installPath": "bin/espeak-ng-data/is_dict",+ "url": "https://offline-translator.davidv.dev/tts/1/espeak-ng-data/is_dict",+ "role": "espeakDict",+ "priority": 0+ }+ ],+ "dependsOn": [+ "tts-espeak-core-v1"+ ]+ },+ "tts-espeak-dict-it": {+ "feature": "support",+ "kind": "tts-espeak-dict",+ "files": [+ {+ "name": "it_dict",+ "sizeBytes": 154408,+ "installPath": "bin/espeak-ng-data/it_dict",+ "url": "https://offline-translator.davidv.dev/tts/1/espeak-ng-data/it_dict",+ "role": "espeakDict",+ "priority": 0+ }+ ],+ "dependsOn": [+ "tts-espeak-core-v1"+ ]+ },+ "tts-espeak-dict-ja": {+ "feature": "support",+ "kind": "tts-espeak-dict",+ "files": [+ {+ "name": "ja_dict",+ "sizeBytes": 47652,+ "installPath": "bin/espeak-ng-data/ja_dict",+ "url": "https://offline-translator.davidv.dev/tts/1/espeak-ng-data/ja_dict",+ "role": "espeakDict",+ "priority": 0+ }+ ],+ "dependsOn": [+ "tts-espeak-core-v1"+ ]+ },+ "tts-espeak-dict-ka": {+ "feature": "support",+ "kind": "tts-espeak-dict",+ "files": [+ {+ "name": "ka_dict",+ "sizeBytes": 87775,+ "installPath": "bin/espeak-ng-data/ka_dict",+ "url": "https://offline-translator.davidv.dev/tts/1/espeak-ng-data/ka_dict",+ "role": "espeakDict",+ "priority": 0+ }+ ],+ "dependsOn": [+ "tts-espeak-core-v1"+ ]+ },+ "tts-espeak-dict-ko": {+ "feature": "support",+ "kind": "tts-espeak-dict",+ "files": [+ {+ "name": "ko_dict",+ "sizeBytes": 47523,+ "installPath": "bin/espeak-ng-data/ko_dict",+ "url": "https://offline-translator.davidv.dev/tts/1/espeak-ng-data/ko_dict",+ "role": "espeakDict",+ "priority": 0+ }+ ],+ "dependsOn": [+ "tts-espeak-core-v1"+ ]+ },+ "tts-espeak-dict-lv": {+ "feature": "support",+ "kind": "tts-espeak-dict",+ "files": [+ {+ "name": "lv_dict",+ "sizeBytes": 66337,+ "installPath": "bin/espeak-ng-data/lv_dict",+ "url": "https://offline-translator.davidv.dev/tts/1/espeak-ng-data/lv_dict",+ "role": "espeakDict",+ "priority": 0+ }+ ],+ "dependsOn": [+ "tts-espeak-core-v1"+ ]+ },+ "tts-espeak-dict-ml": {+ "feature": "support",+ "kind": "tts-espeak-dict",+ "files": [+ {+ "name": "ml_dict",+ "sizeBytes": 92345,+ "installPath": "bin/espeak-ng-data/ml_dict",+ "url": "https://offline-translator.davidv.dev/tts/1/espeak-ng-data/ml_dict",+ "role": "espeakDict",+ "priority": 0+ }+ ],+ "dependsOn": [+ "tts-espeak-core-v1"+ ]+ },+ "tts-espeak-dict-nl": {+ "feature": "support",+ "kind": "tts-espeak-dict",+ "files": [+ {+ "name": "nl_dict",+ "sizeBytes": 65396,+ "installPath": "bin/espeak-ng-data/nl_dict",+ "url": "https://offline-translator.davidv.dev/tts/1/espeak-ng-data/nl_dict",+ "role": "espeakDict",+ "priority": 0+ }+ ],+ "dependsOn": [+ "tts-espeak-core-v1"+ ]+ },+ "tts-espeak-dict-no": {+ "feature": "support",+ "kind": "tts-espeak-dict",+ "files": [+ {+ "name": "no_dict",+ "sizeBytes": 4178,+ "installPath": "bin/espeak-ng-data/no_dict",+ "url": "https://offline-translator.davidv.dev/tts/1/espeak-ng-data/no_dict",+ "role": "espeakDict",+ "priority": 0+ }+ ],+ "dependsOn": [+ "tts-espeak-core-v1"+ ]+ },+ "tts-espeak-dict-pl": {+ "feature": "support",+ "kind": "tts-espeak-dict",+ "files": [+ {+ "name": "pl_dict",+ "sizeBytes": 76620,+ "installPath": "bin/espeak-ng-data/pl_dict",+ "url": "https://offline-translator.davidv.dev/tts/1/espeak-ng-data/pl_dict",+ "role": "espeakDict",+ "priority": 0+ }+ ],+ "dependsOn": [+ "tts-espeak-core-v1"+ ]+ },+ "tts-espeak-dict-pt": {+ "feature": "support",+ "kind": "tts-espeak-dict",+ "files": [+ {+ "name": "pt_dict",+ "sizeBytes": 76389,+ "installPath": "bin/espeak-ng-data/pt_dict",+ "url": "https://offline-translator.davidv.dev/tts/1/espeak-ng-data/pt_dict",+ "role": "espeakDict",+ "priority": 0+ }+ ],+ "dependsOn": [+ "tts-espeak-core-v1"+ ]+ },+ "tts-espeak-dict-ro": {+ "feature": "support",+ "kind": "tts-espeak-dict",+ "files": [+ {+ "name": "ro_dict",+ "sizeBytes": 68538,+ "installPath": "bin/espeak-ng-data/ro_dict",+ "url": "https://offline-translator.davidv.dev/tts/1/espeak-ng-data/ro_dict",+ "role": "espeakDict",+ "priority": 0+ }+ ],+ "dependsOn": [+ "tts-espeak-core-v1"+ ]+ },+ "tts-espeak-dict-ru": {+ "feature": "support",+ "kind": "tts-espeak-dict",+ "files": [+ {+ "name": "ru_dict",+ "sizeBytes": 8538195,+ "installPath": "bin/espeak-ng-data/ru_dict",+ "url": "https://offline-translator.davidv.dev/tts/1/espeak-ng-data/ru_dict",+ "role": "espeakDict",+ "priority": 0+ }+ ],+ "dependsOn": [+ "tts-espeak-core-v1"+ ]+ },+ "tts-espeak-dict-sk": {+ "feature": "support",+ "kind": "tts-espeak-dict",+ "files": [+ {+ "name": "sk_dict",+ "sizeBytes": 50002,+ "installPath": "bin/espeak-ng-data/sk_dict",+ "url": "https://offline-translator.davidv.dev/tts/1/espeak-ng-data/sk_dict",+ "role": "espeakDict",+ "priority": 0+ }+ ],+ "dependsOn": [+ "tts-espeak-core-v1"+ ]+ },+ "tts-espeak-dict-sl": {+ "feature": "support",+ "kind": "tts-espeak-dict",+ "files": [+ {+ "name": "sl_dict",+ "sizeBytes": 45047,+ "installPath": "bin/espeak-ng-data/sl_dict",+ "url": "https://offline-translator.davidv.dev/tts/1/espeak-ng-data/sl_dict",+ "role": "espeakDict",+ "priority": 0+ }+ ],+ "dependsOn": [+ "tts-espeak-core-v1"+ ]+ },+ "tts-espeak-dict-sq": {+ "feature": "support",+ "kind": "tts-espeak-dict",+ "files": [+ {+ "name": "sq_dict",+ "sizeBytes": 45003,+ "installPath": "bin/espeak-ng-data/sq_dict",+ "url": "https://offline-translator.davidv.dev/tts/1/espeak-ng-data/sq_dict",+ "role": "espeakDict",+ "priority": 0+ }+ ],+ "dependsOn": [+ "tts-espeak-core-v1"+ ]+ },+ "tts-espeak-dict-sr": {+ "feature": "support",+ "kind": "tts-espeak-dict",+ "files": [+ {+ "name": "sr_dict",+ "sizeBytes": 46832,+ "installPath": "bin/espeak-ng-data/sr_dict",+ "url": "https://offline-translator.davidv.dev/tts/1/espeak-ng-data/sr_dict",+ "role": "espeakDict",+ "priority": 0+ }+ ],+ "dependsOn": [+ "tts-espeak-core-v1"+ ]+ },+ "tts-espeak-dict-sv": {+ "feature": "support",+ "kind": "tts-espeak-dict",+ "files": [+ {+ "name": "sv_dict",+ "sizeBytes": 47836,+ "installPath": "bin/espeak-ng-data/sv_dict",+ "url": "https://offline-translator.davidv.dev/tts/1/espeak-ng-data/sv_dict",+ "role": "espeakDict",+ "priority": 0+ }+ ],+ "dependsOn": [+ "tts-espeak-core-v1"+ ]+ },+ "tts-espeak-dict-sw": {+ "feature": "support",+ "kind": "tts-espeak-dict",+ "files": [+ {+ "name": "sw_dict",+ "sizeBytes": 47804,+ "installPath": "bin/espeak-ng-data/sw_dict",+ "url": "https://offline-translator.davidv.dev/tts/1/espeak-ng-data/sw_dict",+ "role": "espeakDict",+ "priority": 0+ }+ ],+ "dependsOn": [+ "tts-espeak-core-v1"+ ]+ },+ "tts-espeak-dict-te": {+ "feature": "support",+ "kind": "tts-espeak-dict",+ "files": [+ {+ "name": "te_dict",+ "sizeBytes": 94837,+ "installPath": "bin/espeak-ng-data/te_dict",+ "url": "https://offline-translator.davidv.dev/tts/1/espeak-ng-data/te_dict",+ "role": "espeakDict",+ "priority": 0+ }+ ],+ "dependsOn": [+ "tts-espeak-core-v1"+ ]+ },+ "tts-espeak-dict-tr": {+ "feature": "support",+ "kind": "tts-espeak-dict",+ "files": [+ {+ "name": "tr_dict",+ "sizeBytes": 46793,+ "installPath": "bin/espeak-ng-data/tr_dict",+ "url": "https://offline-translator.davidv.dev/tts/1/espeak-ng-data/tr_dict",+ "role": "espeakDict",+ "priority": 0+ }+ ],+ "dependsOn": [+ "tts-espeak-core-v1"+ ]+ },+ "tts-espeak-dict-uk": {+ "feature": "support",+ "kind": "tts-espeak-dict",+ "files": [+ {+ "name": "uk_dict",+ "sizeBytes": 3492,+ "installPath": "bin/espeak-ng-data/uk_dict",+ "url": "https://offline-translator.davidv.dev/tts/1/espeak-ng-data/uk_dict",+ "role": "espeakDict",+ "priority": 0+ }+ ],+ "dependsOn": [+ "tts-espeak-core-v1"+ ]+ },+ "tts-espeak-dict-ur": {+ "feature": "support",+ "kind": "tts-espeak-dict",+ "files": [+ {+ "name": "ur_dict",+ "sizeBytes": 133556,+ "installPath": "bin/espeak-ng-data/ur_dict",+ "url": "https://offline-translator.davidv.dev/tts/1/espeak-ng-data/ur_dict",+ "role": "espeakDict",+ "priority": 0+ }+ ],+ "dependsOn": [+ "tts-espeak-core-v1"+ ]+ },+ "tts-espeak-dict-vi": {+ "feature": "support",+ "kind": "tts-espeak-dict",+ "files": [+ {+ "name": "vi_dict",+ "sizeBytes": 52608,+ "installPath": "bin/espeak-ng-data/vi_dict",+ "url": "https://offline-translator.davidv.dev/tts/1/espeak-ng-data/vi_dict",+ "role": "espeakDict",+ "priority": 0+ }+ ],+ "dependsOn": [+ "tts-espeak-core-v1"+ ]+ },+ "tts-kokoro-voices-v1.0": {+ "feature": "support",+ "kind": "tts-kokoro-voices",+ "files": [+ {+ "name": "voices-v1.0.bin",+ "sizeBytes": 28214398,+ "installPath": "bin/kokoro/voices-v1.0.bin",+ "url": "https://offline-translator.davidv.dev/tts/1/kokoro/voices-v1.0.bin",+ "role": "voices",+ "priority": 0+ }+ ],+ "dependsOn": []+ },+ "tts-kokoro-mnn-v1.0-core": {+ "feature": "support",+ "kind": "tts-kokoro-mnn-core",+ "files": [+ {+ "name": "kokoro.mnn",+ "sizeBytes": 1028464,+ "installPath": "bin/kokoro_mnn/kokoro.mnn",+ "url": "https://offline-translator.davidv.dev/tts/1/kokoro_mnn/kokoro.mnn",+ "role": "model",+ "priority": 0+ },+ {+ "name": "kokoro.mnn.weight",+ "sizeBytes": 86949555,+ "installPath": "bin/kokoro_mnn/kokoro.mnn.weight",+ "url": "https://offline-translator.davidv.dev/tts/1/kokoro_mnn/kokoro.mnn.weight",+ "role": "modelWeight",+ "priority": 0+ }+ ],+ "dependsOn": [+ "tts-kokoro-voices-v1.0"+ ]+ },+ "tts-cotovia-lexicon-gl": {+ "feature": "support",+ "kind": "tts-cotovia-lexicon",+ "files": [+ {+ "name": "gl_lexicon.txt.zst",+ "sizeBytes": 995200,+ "installPath": "bin/cotovia_vits/gl/gl_lexicon.txt.zst",+ "url": "https://offline-translator.davidv.dev/tts/1/cotovia_vits/gl/gl_lexicon.txt.zst",+ "role": "lexicon",+ "priority": 0+ }+ ],+ "dependsOn": []+ },+ "tts-piper-ar-jo-kareem-medium": {+ "feature": "tts",+ "engine": "piper",+ "auxRole": "sidecar",+ "language": "ar",+ "locale": "ar_JO",+ "region": "JO",+ "voice": "kareem",+ "quality": "medium",+ "numSpeakers": 1,+ "aliases": [],+ "files": [+ {+ "name": "ar_JO-kareem-medium.mnn",+ "sizeBytes": 16864416,+ "installPath": "bin/piper/ar/ar_JO/kareem/medium/ar_JO-kareem-medium.mnn",+ "url": "https://offline-translator.davidv.dev/tts/1/ar/ar_JO/kareem/medium/ar_JO-kareem-medium.mnn",+ "role": "model",+ "priority": 0+ },+ {+ "name": "ar_JO-kareem-medium.onnx.json",+ "sizeBytes": 5024,+ "installPath": "bin/piper/ar/ar_JO/kareem/medium/ar_JO-kareem-medium.onnx.json",+ "url": "https://offline-translator.davidv.dev/tts/1/ar/ar_JO/kareem/medium/ar_JO-kareem-medium.onnx.json",+ "role": "sidecar",+ "priority": 0+ }+ ],+ "dependsOn": [+ "tts-espeak-dict-ar"+ ],+ "sampleUrl": "https://offline-translator.davidv.dev/samples_ogg/ar/kareem_medium.opus"+ },+ "tts-piper-ar-jo-kareem-low": {+ "feature": "tts",+ "engine": "piper",+ "auxRole": "sidecar",+ "language": "ar",+ "locale": "ar_JO",+ "region": "JO",+ "voice": "kareem",+ "quality": "low",+ "numSpeakers": 1,+ "aliases": [],+ "files": [+ {+ "name": "ar_JO-kareem-low.mnn",+ "sizeBytes": 16864416,+ "installPath": "bin/piper/ar/ar_JO/kareem/low/ar_JO-kareem-low.mnn",+ "url": "https://offline-translator.davidv.dev/tts/1/ar/ar_JO/kareem/low/ar_JO-kareem-low.mnn",+ "role": "model",+ "priority": 0+ },+ {+ "name": "ar_JO-kareem-low.onnx.json",+ "sizeBytes": 5022,+ "installPath": "bin/piper/ar/ar_JO/kareem/low/ar_JO-kareem-low.onnx.json",+ "url": "https://offline-translator.davidv.dev/tts/1/ar/ar_JO/kareem/low/ar_JO-kareem-low.onnx.json",+ "role": "sidecar",+ "priority": 0+ }+ ],+ "dependsOn": [+ "tts-espeak-dict-ar"+ ],+ "sampleUrl": "https://offline-translator.davidv.dev/samples_ogg/ar/kareem_low.opus"+ },+ "tts-mms-az-az-north-latin-mms": {+ "feature": "tts",+ "engine": "mms",+ "auxRole": "tokens",+ "language": "az",+ "locale": "az_AZ",+ "region": "AZ",+ "voice": "north_latin",+ "quality": "medium",+ "numSpeakers": 1,+ "aliases": [],+ "files": [+ {+ "name": "model.mnn",+ "sizeBytes": 29592420,+ "installPath": "bin/mms/az/az_AZ/north_latin/medium/model.mnn",+ "url": "https://offline-translator.davidv.dev/tts/1/az/az_AZ/north_latin/medium/model.mnn",+ "role": "model",+ "priority": 0+ },+ {+ "name": "tokens.txt",+ "sizeBytes": 361,+ "installPath": "bin/mms/az/az_AZ/north_latin/medium/tokens.txt",+ "url": "https://offline-translator.davidv.dev/tts/1/az/az_AZ/north_latin/medium/tokens.txt",+ "role": "tokens",+ "priority": 0+ }+ ],+ "dependsOn": [],+ "sampleUrl": "https://offline-translator.davidv.dev/samples_ogg/az/north_latin_medium.opus"+ },+ "tts-glowtts_hifigan-be-by-alex73-glowtts-hifigan": {+ "feature": "tts",+ "engine": "glowtts_hifigan",+ "auxRole": "lexicon",+ "language": "be",+ "locale": "be_BY",+ "region": "BY",+ "voice": "alex73",+ "quality": "medium",+ "numSpeakers": 1,+ "aliases": [],+ "files": [+ {+ "name": "glowtts.mnn",+ "sizeBytes": 29431392,+ "installPath": "bin/glowtts_hifigan/be/be_BY/alex73/medium/glowtts.mnn",+ "url": "https://offline-translator.davidv.dev/tts/1/be/be_BY/alex73/medium/glowtts.mnn",+ "role": "model",+ "priority": 0+ },+ {+ "name": "hifigan.mnn",+ "sizeBytes": 14083764,+ "installPath": "bin/glowtts_hifigan/be/be_BY/alex73/medium/hifigan.mnn",+ "url": "https://offline-translator.davidv.dev/tts/1/be/be_BY/alex73/medium/hifigan.mnn",+ "role": "vocoder",+ "priority": 0+ },+ {+ "name": "be_lexicon.bin",+ "sizeBytes": 3586841,+ "installPath": "bin/glowtts_hifigan/be/be_BY/alex73/medium/be_lexicon.bin",+ "url": "https://offline-translator.davidv.dev/tts/1/be/be_BY/alex73/medium/be_lexicon.bin",+ "role": "lexicon",+ "priority": 0+ }+ ],+ "dependsOn": [],+ "sampleUrl": "https://offline-translator.davidv.dev/samples_ogg/be/alex73_medium.opus"+ },+ "tts-piper-bg-bg-dimitar-medium": {+ "feature": "tts",+ "engine": "piper",+ "auxRole": "sidecar",+ "language": "bg",+ "locale": "bg_BG",+ "region": "BG",+ "voice": "dimitar",+ "quality": "medium",+ "numSpeakers": 1,+ "aliases": [],+ "files": [+ {+ "name": "bg_BG-dimitar-medium.mnn",+ "sizeBytes": 16845408,+ "installPath": "bin/piper/bg/bg_BG/dimitar/medium/bg_BG-dimitar-medium.mnn",+ "url": "https://offline-translator.davidv.dev/tts/1/bg/bg_BG/dimitar/medium/bg_BG-dimitar-medium.mnn",+ "role": "model",+ "priority": 0+ },+ {+ "name": "bg_BG-dimitar-medium.onnx.json",+ "sizeBytes": 5123,+ "installPath": "bin/piper/bg/bg_BG/dimitar/medium/bg_BG-dimitar-medium.onnx.json",+ "url": "https://offline-translator.davidv.dev/tts/1/bg/bg_BG/dimitar/medium/bg_BG-dimitar-medium.onnx.json",+ "role": "sidecar",+ "priority": 0+ }+ ],+ "dependsOn": [+ "tts-espeak-dict-bg"+ ],+ "sampleUrl": "https://offline-translator.davidv.dev/samples_ogg/bg/dimitar_medium.opus"+ },+ "tts-mms-bn-in-standard-mms": {+ "feature": "tts",+ "engine": "mms",+ "auxRole": "tokens",+ "language": "bn",+ "locale": "bn_IN",+ "region": "IN",+ "voice": "standard",+ "quality": "medium",+ "numSpeakers": 1,+ "aliases": [],+ "files": [+ {+ "name": "model.mnn",+ "sizeBytes": 29616996,+ "installPath": "bin/mms/bn/bn_IN/standard/medium/model.mnn",+ "url": "https://offline-translator.davidv.dev/tts/1/bn/bn_IN/standard/medium/model.mnn",+ "role": "model",+ "priority": 0+ },+ {+ "name": "tokens.txt",+ "sizeBytes": 480,+ "installPath": "bin/mms/bn/bn_IN/standard/medium/tokens.txt",+ "url": "https://offline-translator.davidv.dev/tts/1/bn/bn_IN/standard/medium/tokens.txt",+ "role": "tokens",+ "priority": 0+ }+ ],+ "dependsOn": [],+ "sampleUrl": "https://offline-translator.davidv.dev/samples_ogg/bn/standard_medium.opus"+ },+ "tts-coqui_vits-bs-ba-cv-coqui-vits": {+ "feature": "tts",+ "engine": "coqui_vits",+ "auxRole": "config",+ "language": "bs",+ "locale": "bs_BA",+ "region": "BA",+ "voice": "cv",+ "quality": "medium",+ "numSpeakers": 1,+ "aliases": [],+ "files": [+ {+ "name": "model.mnn",+ "sizeBytes": 18894620,+ "installPath": "bin/coqui_vits/bs/bs_BA/cv/medium/model.mnn",+ "url": "https://offline-translator.davidv.dev/tts/1/bs/bs_BA/cv/medium/model.mnn",+ "role": "model",+ "priority": 0+ },+ {+ "name": "config.json",+ "sizeBytes": 8448,+ "installPath": "bin/coqui_vits/bs/bs_BA/cv/medium/config.json",+ "url": "https://offline-translator.davidv.dev/tts/1/bs/bs_BA/cv/medium/config.json",+ "role": "config",+ "priority": 0+ },+ {+ "name": "language_ids.json",+ "sizeBytes": 29,+ "installPath": "bin/coqui_vits/bs/bs_BA/cv/medium/language_ids.json",+ "url": "https://offline-translator.davidv.dev/tts/1/bs/bs_BA/cv/medium/language_ids.json",+ "role": "languageIds",+ "priority": 0+ },+ {+ "name": "speaker_ids.json",+ "sizeBytes": 19,+ "installPath": "bin/coqui_vits/bs/bs_BA/cv/medium/speaker_ids.json",+ "url": "https://offline-translator.davidv.dev/tts/1/bs/bs_BA/cv/medium/speaker_ids.json",+ "role": "speakerIds",+ "priority": 0+ },+ {+ "name": "tokens.txt",+ "sizeBytes": 1760,+ "installPath": "bin/coqui_vits/bs/bs_BA/cv/medium/tokens.txt",+ "url": "https://offline-translator.davidv.dev/tts/1/bs/bs_BA/cv/medium/tokens.txt",+ "role": "tokens",+ "priority": 0+ }+ ],+ "dependsOn": [],+ "sampleUrl": "https://offline-translator.davidv.dev/samples_ogg/bs/cv_medium.opus"+ },+ "tts-piper-ca-es-upc-ona-medium": {+ "feature": "tts",+ "engine": "piper",+ "auxRole": "sidecar",+ "language": "ca",+ "locale": "ca_ES",+ "region": "ES",+ "voice": "upc_ona",+ "quality": "medium",+ "numSpeakers": 1,+ "aliases": [],+ "files": [+ {+ "name": "ca_ES-upc_ona-medium.mnn",+ "sizeBytes": 16864416,+ "installPath": "bin/piper/ca/ca_ES/upc_ona/medium/ca_ES-upc_ona-medium.mnn",+ "url": "https://offline-translator.davidv.dev/tts/1/ca/ca_ES/upc_ona/medium/ca_ES-upc_ona-medium.mnn",+ "role": "model",+ "priority": 0+ },+ {+ "name": "ca_ES-upc_ona-medium.onnx.json",+ "sizeBytes": 4875,+ "installPath": "bin/piper/ca/ca_ES/upc_ona/medium/ca_ES-upc_ona-medium.onnx.json",+ "url": "https://offline-translator.davidv.dev/tts/1/ca/ca_ES/upc_ona/medium/ca_ES-upc_ona-medium.onnx.json",+ "role": "sidecar",+ "priority": 0+ }+ ],+ "dependsOn": [+ "tts-espeak-dict-ca"+ ],+ "sampleUrl": "https://offline-translator.davidv.dev/samples_ogg/ca/upc_ona_medium.opus"+ },+ "tts-piper-ca-es-upc-ona-x-low": {+ "feature": "tts",+ "engine": "piper",+ "auxRole": "sidecar",+ "language": "ca",+ "locale": "ca_ES",+ "region": "ES",+ "voice": "upc_ona",+ "quality": "x_low",+ "numSpeakers": 1,+ "aliases": [+ "ca-upc_ona-x-low"+ ],+ "files": [+ {+ "name": "ca_ES-upc_ona-x_low.mnn",+ "sizeBytes": 5915616,+ "installPath": "bin/piper/ca/ca_ES/upc_ona/x_low/ca_ES-upc_ona-x_low.mnn",+ "url": "https://offline-translator.davidv.dev/tts/1/ca/ca_ES/upc_ona/x_low/ca_ES-upc_ona-x_low.mnn",+ "role": "model",+ "priority": 0+ },+ {+ "name": "ca_ES-upc_ona-x_low.onnx.json",+ "sizeBytes": 4159,+ "installPath": "bin/piper/ca/ca_ES/upc_ona/x_low/ca_ES-upc_ona-x_low.onnx.json",+ "url": "https://offline-translator.davidv.dev/tts/1/ca/ca_ES/upc_ona/x_low/ca_ES-upc_ona-x_low.onnx.json",+ "role": "sidecar",+ "priority": 0+ }+ ],+ "dependsOn": [+ "tts-espeak-dict-ca"+ ],+ "sampleUrl": "https://offline-translator.davidv.dev/samples_ogg/ca/upc_ona_x_low.opus"+ },+ "tts-piper-ca-es-upc-pau-x-low": {+ "feature": "tts",+ "engine": "piper",+ "auxRole": "sidecar",+ "language": "ca",+ "locale": "ca_ES",+ "region": "ES",+ "voice": "upc_pau",+ "quality": "x_low",+ "numSpeakers": 1,+ "aliases": [+ "ca-upc_pau-x-low"+ ],+ "files": [+ {+ "name": "ca_ES-upc_pau-x_low.mnn",+ "sizeBytes": 5944328,+ "installPath": "bin/piper/ca/ca_ES/upc_pau/x_low/ca_ES-upc_pau-x_low.mnn",+ "url": "https://offline-translator.davidv.dev/tts/1/ca/ca_ES/upc_pau/x_low/ca_ES-upc_pau-x_low.mnn",+ "role": "model",+ "priority": 0+ },+ {+ "name": "ca_ES-upc_pau-x_low.onnx.json",+ "sizeBytes": 4159,+ "installPath": "bin/piper/ca/ca_ES/upc_pau/x_low/ca_ES-upc_pau-x_low.onnx.json",+ "url": "https://offline-translator.davidv.dev/tts/1/ca/ca_ES/upc_pau/x_low/ca_ES-upc_pau-x_low.onnx.json",+ "role": "sidecar",+ "priority": 0+ }+ ],+ "dependsOn": [+ "tts-espeak-dict-ca"+ ],+ "sampleUrl": "https://offline-translator.davidv.dev/samples_ogg/ca/upc_pau_x_low.opus"+ },+ "tts-piper-cs-cz-jirka-medium": {+ "feature": "tts",+ "engine": "piper",+ "auxRole": "sidecar",+ "language": "cs",+ "locale": "cs_CZ",+ "region": "CZ",+ "voice": "jirka",+ "quality": "medium",+ "numSpeakers": 1,+ "aliases": [],+ "files": [+ {+ "name": "cs_CZ-jirka-medium.mnn",+ "sizeBytes": 16864416,+ "installPath": "bin/piper/cs/cs_CZ/jirka/medium/cs_CZ-jirka-medium.mnn",+ "url": "https://offline-translator.davidv.dev/tts/1/cs/cs_CZ/jirka/medium/cs_CZ-jirka-medium.mnn",+ "role": "model",+ "priority": 0+ },+ {+ "name": "cs_CZ-jirka-medium.onnx.json",+ "sizeBytes": 5025,+ "installPath": "bin/piper/cs/cs_CZ/jirka/medium/cs_CZ-jirka-medium.onnx.json",+ "url": "https://offline-translator.davidv.dev/tts/1/cs/cs_CZ/jirka/medium/cs_CZ-jirka-medium.onnx.json",+ "role": "sidecar",+ "priority": 0+ }+ ],+ "dependsOn": [+ "tts-espeak-dict-cs"+ ],+ "sampleUrl": "https://offline-translator.davidv.dev/samples_ogg/cs/jirka_medium.opus"+ },+ "tts-piper-cs-cz-jirka-low": {+ "feature": "tts",+ "engine": "piper",+ "auxRole": "sidecar",+ "language": "cs",+ "locale": "cs_CZ",+ "region": "CZ",+ "voice": "jirka",+ "quality": "low",+ "numSpeakers": 1,+ "aliases": [],+ "files": [+ {+ "name": "cs_CZ-jirka-low.mnn",+ "sizeBytes": 16864416,+ "installPath": "bin/piper/cs/cs_CZ/jirka/low/cs_CZ-jirka-low.mnn",+ "url": "https://offline-translator.davidv.dev/tts/1/cs/cs_CZ/jirka/low/cs_CZ-jirka-low.mnn",+ "role": "model",+ "priority": 0+ },+ {+ "name": "cs_CZ-jirka-low.onnx.json",+ "sizeBytes": 5022,+ "installPath": "bin/piper/cs/cs_CZ/jirka/low/cs_CZ-jirka-low.onnx.json",+ "url": "https://offline-translator.davidv.dev/tts/1/cs/cs_CZ/jirka/low/cs_CZ-jirka-low.onnx.json",+ "role": "sidecar",+ "priority": 0+ }+ ],+ "dependsOn": [+ "tts-espeak-dict-cs"+ ],+ "sampleUrl": "https://offline-translator.davidv.dev/samples_ogg/cs/jirka_low.opus"+ },+ "tts-piper-da-dk-talesyntese-medium": {+ "feature": "tts",+ "engine": "piper",+ "auxRole": "sidecar",+ "language": "da",+ "locale": "da_DK",+ "region": "DK",+ "voice": "talesyntese",+ "quality": "medium",+ "numSpeakers": 1,+ "aliases": [+ "da-nst_talesyntese-medium"+ ],+ "files": [+ {+ "name": "da_DK-talesyntese-medium.mnn",+ "sizeBytes": 16864416,+ "installPath": "bin/piper/da/da_DK/talesyntese/medium/da_DK-talesyntese-medium.mnn",+ "url": "https://offline-translator.davidv.dev/tts/1/da/da_DK/talesyntese/medium/da_DK-talesyntese-medium.mnn",+ "role": "model",+ "priority": 0+ },+ {+ "name": "da_DK-talesyntese-medium.onnx.json",+ "sizeBytes": 4878,+ "installPath": "bin/piper/da/da_DK/talesyntese/medium/da_DK-talesyntese-medium.onnx.json",+ "url": "https://offline-translator.davidv.dev/tts/1/da/da_DK/talesyntese/medium/da_DK-talesyntese-medium.onnx.json",+ "role": "sidecar",+ "priority": 0+ }+ ],+ "dependsOn": [+ "tts-espeak-dict-da"+ ],+ "sampleUrl": "https://offline-translator.davidv.dev/samples_ogg/da/talesyntese_medium.opus"+ },+ "tts-piper-de-de-thorsten-medium": {+ "feature": "tts",+ "engine": "piper",+ "auxRole": "sidecar",+ "language": "de",+ "locale": "de_DE",+ "region": "DE",+ "voice": "thorsten",+ "quality": "medium",+ "numSpeakers": 1,+ "aliases": [],+ "files": [+ {+ "name": "de_DE-thorsten-medium.mnn",+ "sizeBytes": 16864416,+ "installPath": "bin/piper/de/de_DE/thorsten/medium/de_DE-thorsten-medium.mnn",+ "url": "https://offline-translator.davidv.dev/tts/1/de/de_DE/thorsten/medium/de_DE-thorsten-medium.mnn",+ "role": "model",+ "priority": 0+ },+ {+ "name": "de_DE-thorsten-medium.onnx.json",+ "sizeBytes": 4819,+ "installPath": "bin/piper/de/de_DE/thorsten/medium/de_DE-thorsten-medium.onnx.json",+ "url": "https://offline-translator.davidv.dev/tts/1/de/de_DE/thorsten/medium/de_DE-thorsten-medium.onnx.json",+ "role": "sidecar",+ "priority": 0+ }+ ],+ "dependsOn": [+ "tts-espeak-dict-de"+ ],+ "sampleUrl": "https://offline-translator.davidv.dev/samples_ogg/de/thorsten_medium.opus"+ },+ "tts-piper-de-de-glados-medium": {+ "feature": "tts",+ "engine": "piper",+ "auxRole": "sidecar",+ "language": "de",+ "locale": "de_DE",+ "region": "DE",+ "voice": "glados",+ "quality": "medium",+ "numSpeakers": 1,+ "aliases": [],+ "files": [+ {+ "name": "de_DE-glados-medium.mnn",+ "sizeBytes": 16848916,+ "installPath": "bin/piper/de/de_DE/glados/medium/de_DE-glados-medium.mnn",+ "url": "https://offline-translator.davidv.dev/tts/1/de/de_DE/glados/medium/de_DE-glados-medium.mnn",+ "role": "model",+ "priority": 0+ },+ {+ "name": "de_DE-glados-medium.onnx.json",+ "sizeBytes": 7100,+ "installPath": "bin/piper/de/de_DE/glados/medium/de_DE-glados-medium.onnx.json",+ "url": "https://offline-translator.davidv.dev/tts/1/de/de_DE/glados/medium/de_DE-glados-medium.onnx.json",+ "role": "sidecar",+ "priority": 0+ }+ ],+ "dependsOn": [+ "tts-espeak-dict-de"+ ],+ "sampleUrl": "https://offline-translator.davidv.dev/samples_ogg/de/glados_medium.opus"+ },+ "tts-piper-de-de-thorsten-emotional-medium": {+ "feature": "tts",+ "engine": "piper",+ "auxRole": "sidecar",+ "language": "de",+ "locale": "de_DE",+ "region": "DE",+ "voice": "thorsten_emotional",+ "quality": "medium",+ "numSpeakers": 8,+ "defaultSpeakerId": 0,+ "aliases": [],+ "files": [+ {+ "name": "de_DE-thorsten_emotional-medium.mnn",+ "sizeBytes": 20334452,+ "installPath": "bin/piper/de/de_DE/thorsten_emotional/medium/de_DE-thorsten_emotional-medium.mnn",+ "url": "https://offline-translator.davidv.dev/tts/1/de/de_DE/thorsten_emotional/medium/de_DE-thorsten_emotional-medium.mnn",+ "role": "model",+ "priority": 0+ },+ {+ "name": "de_DE-thorsten_emotional-medium.onnx.json",+ "sizeBytes": 5031,+ "installPath": "bin/piper/de/de_DE/thorsten_emotional/medium/de_DE-thorsten_emotional-medium.onnx.json",+ "url": "https://offline-translator.davidv.dev/tts/1/de/de_DE/thorsten_emotional/medium/de_DE-thorsten_emotional-medium.onnx.json",+ "role": "sidecar",+ "priority": 0+ }+ ],+ "dependsOn": [+ "tts-espeak-dict-de"+ ],+ "sampleUrl": "https://offline-translator.davidv.dev/samples_ogg/de/thorsten_emotional_medium.opus"+ },+ "tts-piper-de-de-karlsson-low": {+ "feature": "tts",+ "engine": "piper",+ "auxRole": "sidecar",+ "language": "de",+ "locale": "de_DE",+ "region": "DE",+ "voice": "karlsson",+ "quality": "low",+ "numSpeakers": 1,+ "aliases": [+ "de-karlsson-low"+ ],+ "files": [+ {+ "name": "de_DE-karlsson-low.mnn",+ "sizeBytes": 16767648,+ "installPath": "bin/piper/de/de_DE/karlsson/low/de_DE-karlsson-low.mnn",+ "url": "https://offline-translator.davidv.dev/tts/1/de/de_DE/karlsson/low/de_DE-karlsson-low.mnn",+ "role": "model",+ "priority": 0+ },+ {+ "name": "de_DE-karlsson-low.onnx.json",+ "sizeBytes": 4159,+ "installPath": "bin/piper/de/de_DE/karlsson/low/de_DE-karlsson-low.onnx.json",+ "url": "https://offline-translator.davidv.dev/tts/1/de/de_DE/karlsson/low/de_DE-karlsson-low.onnx.json",+ "role": "sidecar",+ "priority": 0+ }+ ],+ "dependsOn": [+ "tts-espeak-dict-de"+ ],+ "sampleUrl": "https://offline-translator.davidv.dev/samples_ogg/de/karlsson_low.opus"+ },+ "tts-piper-el-gr-rapunzelina-medium": {+ "feature": "tts",+ "engine": "piper",+ "auxRole": "sidecar",+ "language": "el",+ "locale": "el_GR",+ "region": "GR",+ "voice": "rapunzelina",+ "quality": "medium",+ "numSpeakers": 1,+ "aliases": [],+ "files": [+ {+ "name": "el_GR-rapunzelina-medium.mnn",+ "sizeBytes": 16763672,+ "installPath": "bin/piper/el/el_GR/rapunzelina/medium/el_GR-rapunzelina-medium.mnn",+ "url": "https://offline-translator.davidv.dev/tts/1/el/el_GR/rapunzelina/medium/el_GR-rapunzelina-medium.mnn",+ "role": "model",+ "priority": 0+ },+ {+ "name": "el_GR-rapunzelina-medium.onnx.json",+ "sizeBytes": 4973,+ "installPath": "bin/piper/el/el_GR/rapunzelina/medium/el_GR-rapunzelina-medium.onnx.json",+ "url": "https://offline-translator.davidv.dev/tts/1/el/el_GR/rapunzelina/medium/el_GR-rapunzelina-medium.onnx.json",+ "role": "sidecar",+ "priority": 0+ }+ ],+ "dependsOn": [+ "tts-espeak-dict-el"+ ],+ "sampleUrl": "https://offline-translator.davidv.dev/samples_ogg/el/rapunzelina_medium.opus"+ },+ "tts-piper-el-gr-rapunzelina-low": {+ "feature": "tts",+ "engine": "piper",+ "auxRole": "sidecar",+ "language": "el",+ "locale": "el_GR",+ "region": "GR",+ "voice": "rapunzelina",+ "quality": "low",+ "numSpeakers": 1,+ "aliases": [],+ "files": [+ {+ "name": "el_GR-rapunzelina-low.mnn",+ "sizeBytes": 16767648,+ "installPath": "bin/piper/el/el_GR/rapunzelina/low/el_GR-rapunzelina-low.mnn",+ "url": "https://offline-translator.davidv.dev/tts/1/el/el_GR/rapunzelina/low/el_GR-rapunzelina-low.mnn",+ "role": "model",+ "priority": 0+ },+ {+ "name": "el_GR-rapunzelina-low.onnx.json",+ "sizeBytes": 4198,+ "installPath": "bin/piper/el/el_GR/rapunzelina/low/el_GR-rapunzelina-low.onnx.json",+ "url": "https://offline-translator.davidv.dev/tts/1/el/el_GR/rapunzelina/low/el_GR-rapunzelina-low.onnx.json",+ "role": "sidecar",+ "priority": 0+ }+ ],+ "dependsOn": [+ "tts-espeak-dict-el"+ ],+ "sampleUrl": "https://offline-translator.davidv.dev/samples_ogg/el/rapunzelina_low.opus"+ },+ "tts-piper-en-gb-alan-medium": {+ "feature": "tts",+ "engine": "piper",+ "auxRole": "sidecar",+ "language": "en",+ "locale": "en_GB",+ "region": "GB",+ "voice": "alan",+ "quality": "medium",+ "numSpeakers": 1,+ "aliases": [],+ "files": [+ {+ "name": "en_GB-alan-medium.mnn",+ "sizeBytes": 16864416,+ "installPath": "bin/piper/en/en_GB/alan/medium/en_GB-alan-medium.mnn",+ "url": "https://offline-translator.davidv.dev/tts/1/en/en_GB/alan/medium/en_GB-alan-medium.mnn",+ "role": "model",+ "priority": 0+ },+ {+ "name": "en_GB-alan-medium.onnx.json",+ "sizeBytes": 4888,+ "installPath": "bin/piper/en/en_GB/alan/medium/en_GB-alan-medium.onnx.json",+ "url": "https://offline-translator.davidv.dev/tts/1/en/en_GB/alan/medium/en_GB-alan-medium.onnx.json",+ "role": "sidecar",+ "priority": 0+ }+ ],+ "dependsOn": [+ "tts-espeak-dict-en"+ ],+ "sampleUrl": "https://offline-translator.davidv.dev/samples_ogg/en/alan_medium.opus"+ },+ "tts-piper-en-gb-alba-medium": {+ "feature": "tts",+ "engine": "piper",+ "auxRole": "sidecar",+ "language": "en",+ "locale": "en_GB",+ "region": "GB",+ "voice": "alba",+ "quality": "medium",+ "numSpeakers": 1,+ "aliases": [],+ "files": [+ {+ "name": "en_GB-alba-medium.mnn",+ "sizeBytes": 16864416,+ "installPath": "bin/piper/en/en_GB/alba/medium/en_GB-alba-medium.mnn",+ "url": "https://offline-translator.davidv.dev/tts/1/en/en_GB/alba/medium/en_GB-alba-medium.mnn",+ "role": "model",+ "priority": 0+ },+ {+ "name": "en_GB-alba-medium.onnx.json",+ "sizeBytes": 4888,+ "installPath": "bin/piper/en/en_GB/alba/medium/en_GB-alba-medium.onnx.json",+ "url": "https://offline-translator.davidv.dev/tts/1/en/en_GB/alba/medium/en_GB-alba-medium.onnx.json",+ "role": "sidecar",+ "priority": 0+ }+ ],+ "dependsOn": [+ "tts-espeak-dict-en"+ ],+ "sampleUrl": "https://offline-translator.davidv.dev/samples_ogg/en/alba_medium.opus"+ },+ "tts-piper-en-gb-jenny-dioco-medium": {+ "feature": "tts",+ "engine": "piper",+ "auxRole": "sidecar",+ "language": "en",+ "locale": "en_GB",+ "region": "GB",+ "voice": "jenny_dioco",+ "quality": "medium",+ "numSpeakers": 1,+ "aliases": [],+ "files": [+ {+ "name": "en_GB-jenny_dioco-medium.mnn",+ "sizeBytes": 16864416,+ "installPath": "bin/piper/en/en_GB/jenny_dioco/medium/en_GB-jenny_dioco-medium.mnn",+ "url": "https://offline-translator.davidv.dev/tts/1/en/en_GB/jenny_dioco/medium/en_GB-jenny_dioco-medium.mnn",+ "role": "model",+ "priority": 0+ },+ {+ "name": "en_GB-jenny_dioco-medium.onnx.json",+ "sizeBytes": 4895,+ "installPath": "bin/piper/en/en_GB/jenny_dioco/medium/en_GB-jenny_dioco-medium.onnx.json",+ "url": "https://offline-translator.davidv.dev/tts/1/en/en_GB/jenny_dioco/medium/en_GB-jenny_dioco-medium.onnx.json",+ "role": "sidecar",+ "priority": 0+ }+ ],+ "dependsOn": [+ "tts-espeak-dict-en"+ ],+ "sampleUrl": "https://offline-translator.davidv.dev/samples_ogg/en/jenny_dioco_medium.opus"+ },+ "tts-piper-en-gb-northern-english-male-medium": {+ "feature": "tts",+ "engine": "piper",+ "auxRole": "sidecar",+ "language": "en",+ "locale": "en_GB",+ "region": "GB",+ "voice": "northern_english_male",+ "quality": "medium",+ "numSpeakers": 1,+ "aliases": [],+ "files": [+ {+ "name": "en_GB-northern_english_male-medium.mnn",+ "sizeBytes": 16864416,+ "installPath": "bin/piper/en/en_GB/northern_english_male/medium/en_GB-northern_english_male-medium.mnn",+ "url": "https://offline-translator.davidv.dev/tts/1/en/en_GB/northern_english_male/medium/en_GB-northern_english_male-medium.mnn",+ "role": "model",+ "priority": 0+ },+ {+ "name": "en_GB-northern_english_male-medium.onnx.json",+ "sizeBytes": 4847,+ "installPath": "bin/piper/en/en_GB/northern_english_male/medium/en_GB-northern_english_male-medium.onnx.json",+ "url": "https://offline-translator.davidv.dev/tts/1/en/en_GB/northern_english_male/medium/en_GB-northern_english_male-medium.onnx.json",+ "role": "sidecar",+ "priority": 0+ }+ ],+ "dependsOn": [+ "tts-espeak-dict-en"+ ],+ "sampleUrl": "https://offline-translator.davidv.dev/samples_ogg/en/northern_english_male_medium.opus"+ },+ "tts-piper-en-us-amy-medium": {+ "feature": "tts",+ "engine": "piper",+ "auxRole": "sidecar",+ "language": "en",+ "locale": "en_US",+ "region": "US",+ "voice": "amy",+ "quality": "medium",+ "numSpeakers": 1,+ "aliases": [],+ "files": [+ {+ "name": "en_US-amy-medium.mnn",+ "sizeBytes": 16864416,+ "installPath": "bin/piper/en/en_US/amy/medium/en_US-amy-medium.mnn",+ "url": "https://offline-translator.davidv.dev/tts/1/en/en_US/amy/medium/en_US-amy-medium.mnn",+ "role": "model",+ "priority": 0+ },+ {+ "name": "en_US-amy-medium.onnx.json",+ "sizeBytes": 4882,+ "installPath": "bin/piper/en/en_US/amy/medium/en_US-amy-medium.onnx.json",+ "url": "https://offline-translator.davidv.dev/tts/1/en/en_US/amy/medium/en_US-amy-medium.onnx.json",+ "role": "sidecar",+ "priority": 0+ }+ ],+ "dependsOn": [+ "tts-espeak-dict-en"+ ],+ "sampleUrl": "https://offline-translator.davidv.dev/samples_ogg/en/amy_medium.opus"+ },+ "tts-piper-en-us-hfc-female-medium": {+ "feature": "tts",+ "engine": "piper",+ "auxRole": "sidecar",+ "language": "en",+ "locale": "en_US",+ "region": "US",+ "voice": "hfc_female",+ "quality": "medium",+ "numSpeakers": 1,+ "aliases": [],+ "files": [+ {+ "name": "en_US-hfc_female-medium.mnn",+ "sizeBytes": 16864416,+ "installPath": "bin/piper/en/en_US/hfc_female/medium/en_US-hfc_female-medium.mnn",+ "url": "https://offline-translator.davidv.dev/tts/1/en/en_US/hfc_female/medium/en_US-hfc_female-medium.mnn",+ "role": "model",+ "priority": 0+ },+ {+ "name": "en_US-hfc_female-medium.onnx.json",+ "sizeBytes": 5033,+ "installPath": "bin/piper/en/en_US/hfc_female/medium/en_US-hfc_female-medium.onnx.json",+ "url": "https://offline-translator.davidv.dev/tts/1/en/en_US/hfc_female/medium/en_US-hfc_female-medium.onnx.json",+ "role": "sidecar",+ "priority": 0+ }+ ],+ "dependsOn": [+ "tts-espeak-dict-en"+ ],+ "sampleUrl": "https://offline-translator.davidv.dev/samples_ogg/en/hfc_female_medium.opus"+ },+ "tts-piper-en-us-hfc-male-medium": {+ "feature": "tts",+ "engine": "piper",+ "auxRole": "sidecar",+ "language": "en",+ "locale": "en_US",+ "region": "US",+ "voice": "hfc_male",+ "quality": "medium",+ "numSpeakers": 1,+ "aliases": [],+ "files": [+ {+ "name": "en_US-hfc_male-medium.mnn",+ "sizeBytes": 16864416,+ "installPath": "bin/piper/en/en_US/hfc_male/medium/en_US-hfc_male-medium.mnn",+ "url": "https://offline-translator.davidv.dev/tts/1/en/en_US/hfc_male/medium/en_US-hfc_male-medium.mnn",+ "role": "model",+ "priority": 0+ },+ {+ "name": "en_US-hfc_male-medium.onnx.json",+ "sizeBytes": 5033,+ "installPath": "bin/piper/en/en_US/hfc_male/medium/en_US-hfc_male-medium.onnx.json",+ "url": "https://offline-translator.davidv.dev/tts/1/en/en_US/hfc_male/medium/en_US-hfc_male-medium.onnx.json",+ "role": "sidecar",+ "priority": 0+ }+ ],+ "dependsOn": [+ "tts-espeak-dict-en"+ ],+ "sampleUrl": "https://offline-translator.davidv.dev/samples_ogg/en/hfc_male_medium.opus"+ },+ "tts-piper-en-us-joe-medium": {+ "feature": "tts",+ "engine": "piper",+ "auxRole": "sidecar",+ "language": "en",+ "locale": "en_US",+ "region": "US",+ "voice": "joe",+ "quality": "medium",+ "numSpeakers": 1,+ "aliases": [],+ "files": [+ {+ "name": "en_US-joe-medium.mnn",+ "sizeBytes": 16864416,+ "installPath": "bin/piper/en/en_US/joe/medium/en_US-joe-medium.mnn",+ "url": "https://offline-translator.davidv.dev/tts/1/en/en_US/joe/medium/en_US-joe-medium.mnn",+ "role": "model",+ "priority": 0+ },+ {+ "name": "en_US-joe-medium.onnx.json",+ "sizeBytes": 4794,+ "installPath": "bin/piper/en/en_US/joe/medium/en_US-joe-medium.onnx.json",+ "url": "https://offline-translator.davidv.dev/tts/1/en/en_US/joe/medium/en_US-joe-medium.onnx.json",+ "role": "sidecar",+ "priority": 0+ }+ ],+ "dependsOn": [+ "tts-espeak-dict-en"+ ],+ "sampleUrl": "https://offline-translator.davidv.dev/samples_ogg/en/joe_medium.opus"+ },+ "tts-piper-es-ar-daniela-high": {+ "feature": "tts",+ "engine": "piper",+ "auxRole": "sidecar",+ "language": "es",+ "locale": "es_AR",+ "region": "AR",+ "voice": "daniela",+ "quality": "high",+ "numSpeakers": 1,+ "aliases": [],+ "files": [+ {+ "name": "es_AR-daniela-high.mnn",+ "sizeBytes": 29766028,+ "installPath": "bin/piper/es/es_AR/daniela/high/es_AR-daniela-high.mnn",+ "url": "https://offline-translator.davidv.dev/tts/1/es/es_AR/daniela/high/es_AR-daniela-high.mnn",+ "role": "model",+ "priority": 0+ },+ {+ "name": "es_AR-daniela-high.onnx.json",+ "sizeBytes": 7248,+ "installPath": "bin/piper/es/es_AR/daniela/high/es_AR-daniela-high.onnx.json",+ "url": "https://offline-translator.davidv.dev/tts/1/es/es_AR/daniela/high/es_AR-daniela-high.onnx.json",+ "role": "sidecar",+ "priority": 0+ }+ ],+ "dependsOn": [+ "tts-espeak-dict-es"+ ],+ "sampleUrl": "https://offline-translator.davidv.dev/samples_ogg/es/daniela_high.opus"+ },+ "tts-piper-es-es-davefx-medium": {+ "feature": "tts",+ "engine": "piper",+ "auxRole": "sidecar",+ "language": "es",+ "locale": "es_ES",+ "region": "ES",+ "voice": "davefx",+ "quality": "medium",+ "numSpeakers": 1,+ "aliases": [],+ "files": [+ {+ "name": "es_ES-davefx-medium.mnn",+ "sizeBytes": 16864416,+ "installPath": "bin/piper/es/es_ES/davefx/medium/es_ES-davefx-medium.mnn",+ "url": "https://offline-translator.davidv.dev/tts/1/es/es_ES/davefx/medium/es_ES-davefx-medium.mnn",+ "role": "model",+ "priority": 0+ },+ {+ "name": "es_ES-davefx-medium.onnx.json",+ "sizeBytes": 4817,+ "installPath": "bin/piper/es/es_ES/davefx/medium/es_ES-davefx-medium.onnx.json",+ "url": "https://offline-translator.davidv.dev/tts/1/es/es_ES/davefx/medium/es_ES-davefx-medium.onnx.json",+ "role": "sidecar",+ "priority": 0+ }+ ],+ "dependsOn": [+ "tts-espeak-dict-es"+ ],+ "sampleUrl": "https://offline-translator.davidv.dev/samples_ogg/es/davefx_medium.opus"+ },+ "tts-piper-es-es-sharvard-medium": {+ "feature": "tts",+ "engine": "piper",+ "auxRole": "sidecar",+ "language": "es",+ "locale": "es_ES",+ "region": "ES",+ "voice": "sharvard",+ "quality": "medium",+ "numSpeakers": 2,+ "defaultSpeakerId": 0,+ "aliases": [],+ "files": [+ {+ "name": "es_ES-sharvard-medium.mnn",+ "sizeBytes": 20322068,+ "installPath": "bin/piper/es/es_ES/sharvard/medium/es_ES-sharvard-medium.mnn",+ "url": "https://offline-translator.davidv.dev/tts/1/es/es_ES/sharvard/medium/es_ES-sharvard-medium.mnn",+ "role": "model",+ "priority": 0+ },+ {+ "name": "es_ES-sharvard-medium.onnx.json",+ "sizeBytes": 4903,+ "installPath": "bin/piper/es/es_ES/sharvard/medium/es_ES-sharvard-medium.onnx.json",+ "url": "https://offline-translator.davidv.dev/tts/1/es/es_ES/sharvard/medium/es_ES-sharvard-medium.onnx.json",+ "role": "sidecar",+ "priority": 0+ }+ ],+ "dependsOn": [+ "tts-espeak-dict-es"+ ],+ "sampleUrl": "https://offline-translator.davidv.dev/samples_ogg/es/sharvard_medium.opus"+ },+ "tts-piper-es-es-carlfm-x-low": {+ "feature": "tts",+ "engine": "piper",+ "auxRole": "sidecar",+ "language": "es",+ "locale": "es_ES",+ "region": "ES",+ "voice": "carlfm",+ "quality": "x_low",+ "numSpeakers": 1,+ "aliases": [+ "es-carlfm-x-low"+ ],+ "files": [+ {+ "name": "es_ES-carlfm-x_low.mnn",+ "sizeBytes": 5944328,+ "installPath": "bin/piper/es/es_ES/carlfm/x_low/es_ES-carlfm-x_low.mnn",+ "url": "https://offline-translator.davidv.dev/tts/1/es/es_ES/carlfm/x_low/es_ES-carlfm-x_low.mnn",+ "role": "model",+ "priority": 0+ },+ {+ "name": "es_ES-carlfm-x_low.onnx.json",+ "sizeBytes": 4159,+ "installPath": "bin/piper/es/es_ES/carlfm/x_low/es_ES-carlfm-x_low.onnx.json",+ "url": "https://offline-translator.davidv.dev/tts/1/es/es_ES/carlfm/x_low/es_ES-carlfm-x_low.onnx.json",+ "role": "sidecar",+ "priority": 0+ }+ ],+ "dependsOn": [+ "tts-espeak-dict-es"+ ],+ "sampleUrl": "https://offline-translator.davidv.dev/samples_ogg/es/carlfm_x_low.opus"+ },+ "tts-piper-es-mx-ald-medium": {+ "feature": "tts",+ "engine": "piper",+ "auxRole": "sidecar",+ "language": "es",+ "locale": "es_MX",+ "region": "MX",+ "voice": "ald",+ "quality": "medium",+ "numSpeakers": 1,+ "aliases": [],+ "files": [+ {+ "name": "es_MX-ald-medium.mnn",+ "sizeBytes": 16864416,+ "installPath": "bin/piper/es/es_MX/ald/medium/es_MX-ald-medium.mnn",+ "url": "https://offline-translator.davidv.dev/tts/1/es/es_MX/ald/medium/es_MX-ald-medium.mnn",+ "role": "model",+ "priority": 0+ },+ {+ "name": "es_MX-ald-medium.onnx.json",+ "sizeBytes": 4878,+ "installPath": "bin/piper/es/es_MX/ald/medium/es_MX-ald-medium.onnx.json",+ "url": "https://offline-translator.davidv.dev/tts/1/es/es_MX/ald/medium/es_MX-ald-medium.onnx.json",+ "role": "sidecar",+ "priority": 0+ }+ ],+ "dependsOn": [+ "tts-espeak-dict-es"+ ],+ "sampleUrl": "https://offline-translator.davidv.dev/samples_ogg/es/ald_medium.opus"+ },+ "tts-piper-es-mx-claude-high": {+ "feature": "tts",+ "engine": "piper",+ "auxRole": "sidecar",+ "language": "es",+ "locale": "es_MX",+ "region": "MX",+ "voice": "claude",+ "quality": "high",+ "numSpeakers": 1,+ "aliases": [],+ "files": [+ {+ "name": "es_MX-claude-high.mnn",+ "sizeBytes": 16852376,+ "installPath": "bin/piper/es/es_MX/claude/high/es_MX-claude-high.mnn",+ "url": "https://offline-translator.davidv.dev/tts/1/es/es_MX/claude/high/es_MX-claude-high.mnn",+ "role": "model",+ "priority": 0+ },+ {+ "name": "es_MX-claude-high.onnx.json",+ "sizeBytes": 4963,+ "installPath": "bin/piper/es/es_MX/claude/high/es_MX-claude-high.onnx.json",+ "url": "https://offline-translator.davidv.dev/tts/1/es/es_MX/claude/high/es_MX-claude-high.onnx.json",+ "role": "sidecar",+ "priority": 0+ }+ ],+ "dependsOn": [+ "tts-espeak-dict-es"+ ],+ "sampleUrl": "https://offline-translator.davidv.dev/samples_ogg/es/claude_high.opus"+ },+ "tts-coqui_vits-et-ee-cv-coqui-vits": {+ "feature": "tts",+ "engine": "coqui_vits",+ "auxRole": "config",+ "language": "et",+ "locale": "et_EE",+ "region": "EE",+ "voice": "cv",+ "quality": "medium",+ "numSpeakers": 1,+ "aliases": [],+ "files": [+ {+ "name": "model.mnn",+ "sizeBytes": 18881564,+ "installPath": "bin/coqui_vits/et/et_EE/cv/medium/model.mnn",+ "url": "https://offline-translator.davidv.dev/tts/1/et/et_EE/cv/medium/model.mnn",+ "role": "model",+ "priority": 0+ },+ {+ "name": "config.json",+ "sizeBytes": 8277,+ "installPath": "bin/coqui_vits/et/et_EE/cv/medium/config.json",+ "url": "https://offline-translator.davidv.dev/tts/1/et/et_EE/cv/medium/config.json",+ "role": "config",+ "priority": 0+ },+ {+ "name": "language_ids.json",+ "sizeBytes": 15,+ "installPath": "bin/coqui_vits/et/et_EE/cv/medium/language_ids.json",+ "url": "https://offline-translator.davidv.dev/tts/1/et/et_EE/cv/medium/language_ids.json",+ "role": "languageIds",+ "priority": 0+ },+ {+ "name": "speaker_ids.json",+ "sizeBytes": 19,+ "installPath": "bin/coqui_vits/et/et_EE/cv/medium/speaker_ids.json",+ "url": "https://offline-translator.davidv.dev/tts/1/et/et_EE/cv/medium/speaker_ids.json",+ "role": "speakerIds",+ "priority": 0+ },+ {+ "name": "tokens.txt",+ "sizeBytes": 1522,+ "installPath": "bin/coqui_vits/et/et_EE/cv/medium/tokens.txt",+ "url": "https://offline-translator.davidv.dev/tts/1/et/et_EE/cv/medium/tokens.txt",+ "role": "tokens",+ "priority": 0+ }+ ],+ "dependsOn": [],+ "sampleUrl": "https://offline-translator.davidv.dev/samples_ogg/et/cv_medium.opus"+ },+ "tts-piper-eu-es-antton-medium": {+ "feature": "tts",+ "engine": "piper",+ "auxRole": "sidecar",+ "language": "eu",+ "locale": "eu_ES",+ "region": "ES",+ "voice": "antton",+ "quality": "medium",+ "numSpeakers": 1,+ "aliases": [],+ "files": [+ {+ "name": "eu_ES-antton-medium.mnn",+ "sizeBytes": 16981524,+ "installPath": "bin/piper/eu/eu_ES/antton/medium/eu_ES-antton-medium.mnn",+ "url": "https://offline-translator.davidv.dev/tts/1/eu/eu_ES/antton/medium/eu_ES-antton-medium.mnn",+ "role": "model",+ "priority": 0+ },+ {+ "name": "eu_ES-antton-medium.onnx.json",+ "sizeBytes": 5076,+ "installPath": "bin/piper/eu/eu_ES/antton/medium/eu_ES-antton-medium.onnx.json",+ "url": "https://offline-translator.davidv.dev/tts/1/eu/eu_ES/antton/medium/eu_ES-antton-medium.onnx.json",+ "role": "sidecar",+ "priority": 0+ }+ ],+ "dependsOn": [+ "tts-espeak-dict-eu"+ ],+ "sampleUrl": "https://offline-translator.davidv.dev/samples_ogg/eu/antton_medium.opus"+ },+ "tts-piper-eu-es-maider-medium": {+ "feature": "tts",+ "engine": "piper",+ "auxRole": "sidecar",+ "language": "eu",+ "locale": "eu_ES",+ "region": "ES",+ "voice": "maider",+ "quality": "medium",+ "numSpeakers": 1,+ "aliases": [],+ "files": [+ {+ "name": "eu_ES-maider-medium.mnn",+ "sizeBytes": 16981524,+ "installPath": "bin/piper/eu/eu_ES/maider/medium/eu_ES-maider-medium.mnn",+ "url": "https://offline-translator.davidv.dev/tts/1/eu/eu_ES/maider/medium/eu_ES-maider-medium.mnn",+ "role": "model",+ "priority": 0+ },+ {+ "name": "eu_ES-maider-medium.onnx.json",+ "sizeBytes": 5076,+ "installPath": "bin/piper/eu/eu_ES/maider/medium/eu_ES-maider-medium.onnx.json",+ "url": "https://offline-translator.davidv.dev/tts/1/eu/eu_ES/maider/medium/eu_ES-maider-medium.onnx.json",+ "role": "sidecar",+ "priority": 0+ }+ ],+ "dependsOn": [+ "tts-espeak-dict-eu"+ ],+ "sampleUrl": "https://offline-translator.davidv.dev/samples_ogg/eu/maider_medium.opus"+ },+ "tts-piper-fa-ir-gyro-medium": {+ "feature": "tts",+ "engine": "piper",+ "auxRole": "sidecar",+ "language": "fa",+ "locale": "fa_IR",+ "region": "IR",+ "voice": "gyro",+ "quality": "medium",+ "numSpeakers": 1,+ "aliases": [],+ "files": [+ {+ "name": "fa_IR-gyro-medium.mnn",+ "sizeBytes": 16852376,+ "installPath": "bin/piper/fa/fa_IR/gyro/medium/fa_IR-gyro-medium.mnn",+ "url": "https://offline-translator.davidv.dev/tts/1/fa/fa_IR/gyro/medium/fa_IR-gyro-medium.mnn",+ "role": "model",+ "priority": 0+ },+ {+ "name": "fa_IR-gyro-medium.onnx.json",+ "sizeBytes": 7210,+ "installPath": "bin/piper/fa/fa_IR/gyro/medium/fa_IR-gyro-medium.onnx.json",+ "url": "https://offline-translator.davidv.dev/tts/1/fa/fa_IR/gyro/medium/fa_IR-gyro-medium.onnx.json",+ "role": "sidecar",+ "priority": 0+ }+ ],+ "dependsOn": [+ "tts-espeak-dict-fa"+ ],+ "sampleUrl": "https://offline-translator.davidv.dev/samples_ogg/fa/gyro_medium.opus"+ },+ "tts-piper-fa-ir-reza-ibrahim-medium": {+ "feature": "tts",+ "engine": "piper",+ "auxRole": "sidecar",+ "language": "fa",+ "locale": "fa_IR",+ "region": "IR",+ "voice": "reza_ibrahim",+ "quality": "medium",+ "numSpeakers": 1,+ "aliases": [],+ "files": [+ {+ "name": "fa_IR-reza_ibrahim-medium.mnn",+ "sizeBytes": 16974228,+ "installPath": "bin/piper/fa/fa_IR/reza_ibrahim/medium/fa_IR-reza_ibrahim-medium.mnn",+ "url": "https://offline-translator.davidv.dev/tts/1/fa/fa_IR/reza_ibrahim/medium/fa_IR-reza_ibrahim-medium.mnn",+ "role": "model",+ "priority": 0+ },+ {+ "name": "fa_IR-reza_ibrahim-medium.onnx.json",+ "sizeBytes": 4967,+ "installPath": "bin/piper/fa/fa_IR/reza_ibrahim/medium/fa_IR-reza_ibrahim-medium.onnx.json",+ "url": "https://offline-translator.davidv.dev/tts/1/fa/fa_IR/reza_ibrahim/medium/fa_IR-reza_ibrahim-medium.onnx.json",+ "role": "sidecar",+ "priority": 0+ }+ ],+ "dependsOn": [+ "tts-espeak-dict-fa"+ ],+ "sampleUrl": "https://offline-translator.davidv.dev/samples_ogg/fa/reza_ibrahim_medium.opus"+ },+ "tts-piper-fa-ir-ganji-medium": {+ "feature": "tts",+ "engine": "piper",+ "auxRole": "sidecar",+ "language": "fa",+ "locale": "fa_IR",+ "region": "IR",+ "voice": "ganji",+ "quality": "medium",+ "numSpeakers": 1,+ "aliases": [],+ "files": [+ {+ "name": "fa_IR-ganji-medium.mnn",+ "sizeBytes": 16977372,+ "installPath": "bin/piper/fa/fa_IR/ganji/medium/fa_IR-ganji-medium.mnn",+ "url": "https://offline-translator.davidv.dev/tts/1/fa/fa_IR/ganji/medium/fa_IR-ganji-medium.mnn",+ "role": "model",+ "priority": 0+ },+ {+ "name": "fa_IR-ganji-medium.onnx.json",+ "sizeBytes": 4958,+ "installPath": "bin/piper/fa/fa_IR/ganji/medium/fa_IR-ganji-medium.onnx.json",+ "url": "https://offline-translator.davidv.dev/tts/1/fa/fa_IR/ganji/medium/fa_IR-ganji-medium.onnx.json",+ "role": "sidecar",+ "priority": 0+ }+ ],+ "dependsOn": [+ "tts-espeak-dict-fa"+ ],+ "sampleUrl": "https://offline-translator.davidv.dev/samples_ogg/fa/ganji_medium.opus"+ },+ "tts-piper-fa-ir-ganji-adabi-medium": {+ "feature": "tts",+ "engine": "piper",+ "auxRole": "sidecar",+ "language": "fa",+ "locale": "fa_IR",+ "region": "IR",+ "voice": "ganji_adabi",+ "quality": "medium",+ "numSpeakers": 1,+ "aliases": [],+ "files": [+ {+ "name": "fa_IR-ganji_adabi-medium.mnn",+ "sizeBytes": 16977372,+ "installPath": "bin/piper/fa/fa_IR/ganji_adabi/medium/fa_IR-ganji_adabi-medium.mnn",+ "url": "https://offline-translator.davidv.dev/tts/1/fa/fa_IR/ganji_adabi/medium/fa_IR-ganji_adabi-medium.mnn",+ "role": "model",+ "priority": 0+ },+ {+ "name": "fa_IR-ganji_adabi-medium.onnx.json",+ "sizeBytes": 4964,+ "installPath": "bin/piper/fa/fa_IR/ganji_adabi/medium/fa_IR-ganji_adabi-medium.onnx.json",+ "url": "https://offline-translator.davidv.dev/tts/1/fa/fa_IR/ganji_adabi/medium/fa_IR-ganji_adabi-medium.onnx.json",+ "role": "sidecar",+ "priority": 0+ }+ ],+ "dependsOn": [+ "tts-espeak-dict-fa"+ ],+ "sampleUrl": "https://offline-translator.davidv.dev/samples_ogg/fa/ganji_adabi_medium.opus"+ },+ "tts-piper-fi-fi-harri-medium": {+ "feature": "tts",+ "engine": "piper",+ "auxRole": "sidecar",+ "language": "fi",+ "locale": "fi_FI",+ "region": "FI",+ "voice": "harri",+ "quality": "medium",+ "numSpeakers": 1,+ "aliases": [],+ "files": [+ {+ "name": "fi_FI-harri-medium.mnn",+ "sizeBytes": 16864416,+ "installPath": "bin/piper/fi/fi_FI/harri/medium/fi_FI-harri-medium.mnn",+ "url": "https://offline-translator.davidv.dev/tts/1/fi/fi_FI/harri/medium/fi_FI-harri-medium.mnn",+ "role": "model",+ "priority": 0+ },+ {+ "name": "fi_FI-harri-medium.onnx.json",+ "sizeBytes": 4873,+ "installPath": "bin/piper/fi/fi_FI/harri/medium/fi_FI-harri-medium.onnx.json",+ "url": "https://offline-translator.davidv.dev/tts/1/fi/fi_FI/harri/medium/fi_FI-harri-medium.onnx.json",+ "role": "sidecar",+ "priority": 0+ }+ ],+ "dependsOn": [+ "tts-espeak-dict-fi"+ ],+ "sampleUrl": "https://offline-translator.davidv.dev/samples_ogg/fi/harri_medium.opus"+ },+ "tts-piper-fi-fi-harri-low": {+ "feature": "tts",+ "engine": "piper",+ "auxRole": "sidecar",+ "language": "fi",+ "locale": "fi_FI",+ "region": "FI",+ "voice": "harri",+ "quality": "low",+ "numSpeakers": 1,+ "aliases": [+ "fi-harri-low"+ ],+ "files": [+ {+ "name": "fi_FI-harri-low.mnn",+ "sizeBytes": 16767648,+ "installPath": "bin/piper/fi/fi_FI/harri/low/fi_FI-harri-low.mnn",+ "url": "https://offline-translator.davidv.dev/tts/1/fi/fi_FI/harri/low/fi_FI-harri-low.mnn",+ "role": "model",+ "priority": 0+ },+ {+ "name": "fi_FI-harri-low.onnx.json",+ "sizeBytes": 4155,+ "installPath": "bin/piper/fi/fi_FI/harri/low/fi_FI-harri-low.onnx.json",+ "url": "https://offline-translator.davidv.dev/tts/1/fi/fi_FI/harri/low/fi_FI-harri-low.onnx.json",+ "role": "sidecar",+ "priority": 0+ }+ ],+ "dependsOn": [+ "tts-espeak-dict-fi"+ ],+ "sampleUrl": "https://offline-translator.davidv.dev/samples_ogg/fi/harri_low.opus"+ },+ "tts-piper-fr-fr-siwis-medium": {+ "feature": "tts",+ "engine": "piper",+ "auxRole": "sidecar",+ "language": "fr",+ "locale": "fr_FR",+ "region": "FR",+ "voice": "siwis",+ "quality": "medium",+ "numSpeakers": 1,+ "aliases": [+ "fr-siwis-medium"+ ],+ "files": [+ {+ "name": "fr_FR-siwis-medium.mnn",+ "sizeBytes": 16864416,+ "installPath": "bin/piper/fr/fr_FR/siwis/medium/fr_FR-siwis-medium.mnn",+ "url": "https://offline-translator.davidv.dev/tts/1/fr/fr_FR/siwis/medium/fr_FR-siwis-medium.mnn",+ "role": "model",+ "priority": 0+ },+ {+ "name": "fr_FR-siwis-medium.onnx.json",+ "sizeBytes": 4875,+ "installPath": "bin/piper/fr/fr_FR/siwis/medium/fr_FR-siwis-medium.onnx.json",+ "url": "https://offline-translator.davidv.dev/tts/1/fr/fr_FR/siwis/medium/fr_FR-siwis-medium.onnx.json",+ "role": "sidecar",+ "priority": 0+ }+ ],+ "dependsOn": [+ "tts-espeak-dict-fr"+ ],+ "sampleUrl": "https://offline-translator.davidv.dev/samples_ogg/fr/siwis_medium.opus"+ },+ "tts-piper-fr-fr-tom-medium": {+ "feature": "tts",+ "engine": "piper",+ "auxRole": "sidecar",+ "language": "fr",+ "locale": "fr_FR",+ "region": "FR",+ "voice": "tom",+ "quality": "medium",+ "numSpeakers": 1,+ "aliases": [],+ "files": [+ {+ "name": "fr_FR-tom-medium.mnn",+ "sizeBytes": 16974228,+ "installPath": "bin/piper/fr/fr_FR/tom/medium/fr_FR-tom-medium.mnn",+ "url": "https://offline-translator.davidv.dev/tts/1/fr/fr_FR/tom/medium/fr_FR-tom-medium.mnn",+ "role": "model",+ "priority": 0+ },+ {+ "name": "fr_FR-tom-medium.onnx.json",+ "sizeBytes": 4959,+ "installPath": "bin/piper/fr/fr_FR/tom/medium/fr_FR-tom-medium.onnx.json",+ "url": "https://offline-translator.davidv.dev/tts/1/fr/fr_FR/tom/medium/fr_FR-tom-medium.onnx.json",+ "role": "sidecar",+ "priority": 0+ }+ ],+ "dependsOn": [+ "tts-espeak-dict-fr"+ ],+ "sampleUrl": "https://offline-translator.davidv.dev/samples_ogg/fr/tom_medium.opus"+ },+ "tts-piper-fr-fr-upmc-medium": {+ "feature": "tts",+ "engine": "piper",+ "auxRole": "sidecar",+ "language": "fr",+ "locale": "fr_FR",+ "region": "FR",+ "voice": "upmc",+ "quality": "medium",+ "numSpeakers": 2,+ "defaultSpeakerId": 0,+ "aliases": [],+ "files": [+ {+ "name": "fr_FR-upmc-medium.mnn",+ "sizeBytes": 20322068,+ "installPath": "bin/piper/fr/fr_FR/upmc/medium/fr_FR-upmc-medium.mnn",+ "url": "https://offline-translator.davidv.dev/tts/1/fr/fr_FR/upmc/medium/fr_FR-upmc-medium.mnn",+ "role": "model",+ "priority": 0+ },+ {+ "name": "fr_FR-upmc-medium.onnx.json",+ "sizeBytes": 4996,+ "installPath": "bin/piper/fr/fr_FR/upmc/medium/fr_FR-upmc-medium.onnx.json",+ "url": "https://offline-translator.davidv.dev/tts/1/fr/fr_FR/upmc/medium/fr_FR-upmc-medium.onnx.json",+ "role": "sidecar",+ "priority": 0+ }+ ],+ "dependsOn": [+ "tts-espeak-dict-fr"+ ],+ "sampleUrl": "https://offline-translator.davidv.dev/samples_ogg/fr/upmc_medium.opus"+ },+ "tts-piper-fr-fr-mls-medium": {+ "feature": "tts",+ "engine": "piper",+ "auxRole": "sidecar",+ "language": "fr",+ "locale": "fr_FR",+ "region": "FR",+ "voice": "mls",+ "quality": "medium",+ "numSpeakers": 125,+ "defaultSpeakerId": 0,+ "aliases": [],+ "files": [+ {+ "name": "fr_FR-mls-medium.mnn",+ "sizeBytes": 20475220,+ "installPath": "bin/piper/fr/fr_FR/mls/medium/fr_FR-mls-medium.mnn",+ "url": "https://offline-translator.davidv.dev/tts/1/fr/fr_FR/mls/medium/fr_FR-mls-medium.mnn",+ "role": "model",+ "priority": 0+ },+ {+ "name": "fr_FR-mls-medium.onnx.json",+ "sizeBytes": 7036,+ "installPath": "bin/piper/fr/fr_FR/mls/medium/fr_FR-mls-medium.onnx.json",+ "url": "https://offline-translator.davidv.dev/tts/1/fr/fr_FR/mls/medium/fr_FR-mls-medium.onnx.json",+ "role": "sidecar",+ "priority": 0+ }+ ],+ "dependsOn": [+ "tts-espeak-dict-fr"+ ],+ "sampleUrl": "https://offline-translator.davidv.dev/samples_ogg/fr/mls_medium.opus"+ },+ "tts-cotovia_vits-gl-es-sabela-cotovia-vits": {+ "feature": "tts",+ "engine": "cotovia_vits",+ "auxRole": "lexicon",+ "language": "gl",+ "locale": "gl_ES",+ "region": "ES",+ "voice": "sabela",+ "quality": "medium",+ "numSpeakers": 1,+ "aliases": [],+ "files": [+ {+ "name": "vits.mnn",+ "sizeBytes": 16091140,+ "installPath": "bin/cotovia_vits/gl/gl_ES/sabela/medium/vits.mnn",+ "url": "https://offline-translator.davidv.dev/tts/1/gl/gl_ES/sabela/medium/vits.mnn",+ "role": "model",+ "priority": 0+ }+ ],+ "dependsOn": [+ "tts-cotovia-lexicon-gl"+ ],+ "sampleUrl": "https://offline-translator.davidv.dev/samples_ogg/gl/sabela_medium.opus"+ },+ "tts-cotovia_vits-gl-es-brais-cotovia-vits": {+ "feature": "tts",+ "engine": "cotovia_vits",+ "auxRole": "lexicon",+ "language": "gl",+ "locale": "gl_ES",+ "region": "ES",+ "voice": "brais",+ "quality": "medium",+ "numSpeakers": 1,+ "aliases": [],+ "files": [+ {+ "name": "vits.mnn",+ "sizeBytes": 16091140,+ "installPath": "bin/cotovia_vits/gl/gl_ES/brais/medium/vits.mnn",+ "url": "https://offline-translator.davidv.dev/tts/1/gl/gl_ES/brais/medium/vits.mnn",+ "role": "model",+ "priority": 0+ }+ ],+ "dependsOn": [+ "tts-cotovia-lexicon-gl"+ ],+ "sampleUrl": "https://offline-translator.davidv.dev/samples_ogg/gl/brais_medium.opus"+ },+ "tts-cotovia_vits-gl-es-iago-cotovia-vits": {+ "feature": "tts",+ "engine": "cotovia_vits",+ "auxRole": "lexicon",+ "language": "gl",+ "locale": "gl_ES",+ "region": "ES",+ "voice": "iago",+ "quality": "medium",+ "numSpeakers": 1,+ "aliases": [],+ "files": [+ {+ "name": "vits.mnn",+ "sizeBytes": 16091140,+ "installPath": "bin/cotovia_vits/gl/gl_ES/iago/medium/vits.mnn",+ "url": "https://offline-translator.davidv.dev/tts/1/gl/gl_ES/iago/medium/vits.mnn",+ "role": "model",+ "priority": 0+ }+ ],+ "dependsOn": [+ "tts-cotovia-lexicon-gl"+ ],+ "sampleUrl": "https://offline-translator.davidv.dev/samples_ogg/gl/iago_medium.opus"+ },+ "tts-cotovia_vits-gl-es-icia-cotovia-vits": {+ "feature": "tts",+ "engine": "cotovia_vits",+ "auxRole": "lexicon",+ "language": "gl",+ "locale": "gl_ES",+ "region": "ES",+ "voice": "icia",+ "quality": "medium",+ "numSpeakers": 1,+ "aliases": [],+ "files": [+ {+ "name": "vits.mnn",+ "sizeBytes": 16091140,+ "installPath": "bin/cotovia_vits/gl/gl_ES/icia/medium/vits.mnn",+ "url": "https://offline-translator.davidv.dev/tts/1/gl/gl_ES/icia/medium/vits.mnn",+ "role": "model",+ "priority": 0+ }+ ],+ "dependsOn": [+ "tts-cotovia-lexicon-gl"+ ],+ "sampleUrl": "https://offline-translator.davidv.dev/samples_ogg/gl/icia_medium.opus"+ },+ "tts-cotovia_vits-gl-es-paulo-cotovia-vits": {+ "feature": "tts",+ "engine": "cotovia_vits",+ "auxRole": "lexicon",+ "language": "gl",+ "locale": "gl_ES",+ "region": "ES",+ "voice": "paulo",+ "quality": "medium",+ "numSpeakers": 1,+ "aliases": [],+ "files": [+ {+ "name": "vits.mnn",+ "sizeBytes": 16091140,+ "installPath": "bin/cotovia_vits/gl/gl_ES/paulo/medium/vits.mnn",+ "url": "https://offline-translator.davidv.dev/tts/1/gl/gl_ES/paulo/medium/vits.mnn",+ "role": "model",+ "priority": 0+ }+ ],+ "dependsOn": [+ "tts-cotovia-lexicon-gl"+ ],+ "sampleUrl": "https://offline-translator.davidv.dev/samples_ogg/gl/paulo_medium.opus"+ },+ "tts-mms-gu-in-standard-mms": {+ "feature": "tts",+ "engine": "mms",+ "auxRole": "tokens",+ "language": "gu",+ "locale": "gu_IN",+ "region": "IN",+ "voice": "standard",+ "quality": "medium",+ "numSpeakers": 1,+ "aliases": [],+ "files": [+ {+ "name": "model.mnn",+ "sizeBytes": 29606244,+ "installPath": "bin/mms/gu/gu_IN/standard/medium/model.mnn",+ "url": "https://offline-translator.davidv.dev/tts/1/gu/gu_IN/standard/medium/model.mnn",+ "role": "model",+ "priority": 0+ },+ {+ "name": "tokens.txt",+ "sizeBytes": 402,+ "installPath": "bin/mms/gu/gu_IN/standard/medium/tokens.txt",+ "url": "https://offline-translator.davidv.dev/tts/1/gu/gu_IN/standard/medium/tokens.txt",+ "role": "tokens",+ "priority": 0+ }+ ],+ "dependsOn": [],+ "sampleUrl": "https://offline-translator.davidv.dev/samples_ogg/gu/standard_medium.opus"+ },+ "tts-mms-he-il-standard-mms": {+ "feature": "tts",+ "engine": "mms",+ "auxRole": "tokens",+ "language": "he",+ "locale": "he_IL",+ "region": "IL",+ "voice": "standard",+ "quality": "medium",+ "numSpeakers": 1,+ "aliases": [],+ "files": [+ {+ "name": "model.mnn",+ "sizeBytes": 29584740,+ "installPath": "bin/mms/he/he_IL/standard/medium/model.mnn",+ "url": "https://offline-translator.davidv.dev/tts/1/he/he_IL/standard/medium/model.mnn",+ "role": "model",+ "priority": 0+ },+ {+ "name": "tokens.txt",+ "sizeBytes": 179,+ "installPath": "bin/mms/he/he_IL/standard/medium/tokens.txt",+ "url": "https://offline-translator.davidv.dev/tts/1/he/he_IL/standard/medium/tokens.txt",+ "role": "tokens",+ "priority": 0+ }+ ],+ "dependsOn": [],+ "sampleUrl": "https://offline-translator.davidv.dev/samples_ogg/he/standard_medium.opus"+ },+ "tts-piper-hi-in-rohan-medium": {+ "feature": "tts",+ "engine": "piper",+ "auxRole": "sidecar",+ "language": "hi",+ "locale": "hi_IN",+ "region": "IN",+ "voice": "rohan",+ "quality": "medium",+ "numSpeakers": 1,+ "aliases": [],+ "files": [+ {+ "name": "hi_IN-rohan-medium.mnn",+ "sizeBytes": 16763672,+ "installPath": "bin/piper/hi/hi_IN/rohan/medium/hi_IN-rohan-medium.mnn",+ "url": "https://offline-translator.davidv.dev/tts/1/hi/hi_IN/rohan/medium/hi_IN-rohan-medium.mnn",+ "role": "model",+ "priority": 0+ },+ {+ "name": "hi_IN-rohan-medium.onnx.json",+ "sizeBytes": 5041,+ "installPath": "bin/piper/hi/hi_IN/rohan/medium/hi_IN-rohan-medium.onnx.json",+ "url": "https://offline-translator.davidv.dev/tts/1/hi/hi_IN/rohan/medium/hi_IN-rohan-medium.onnx.json",+ "role": "sidecar",+ "priority": 0+ }+ ],+ "dependsOn": [+ "tts-espeak-dict-hi"+ ],+ "sampleUrl": "https://offline-translator.davidv.dev/samples_ogg/hi/rohan_medium.opus"+ },+ "tts-piper-hi-in-pratham-medium": {+ "feature": "tts",+ "engine": "piper",+ "auxRole": "sidecar",+ "language": "hi",+ "locale": "hi_IN",+ "region": "IN",+ "voice": "pratham",+ "quality": "medium",+ "numSpeakers": 1,+ "aliases": [],+ "files": [+ {+ "name": "hi_IN-pratham-medium.mnn",+ "sizeBytes": 16977372,+ "installPath": "bin/piper/hi/hi_IN/pratham/medium/hi_IN-pratham-medium.mnn",+ "url": "https://offline-translator.davidv.dev/tts/1/hi/hi_IN/pratham/medium/hi_IN-pratham-medium.mnn",+ "role": "model",+ "priority": 0+ },+ {+ "name": "hi_IN-pratham-medium.onnx.json",+ "sizeBytes": 4970,+ "installPath": "bin/piper/hi/hi_IN/pratham/medium/hi_IN-pratham-medium.onnx.json",+ "url": "https://offline-translator.davidv.dev/tts/1/hi/hi_IN/pratham/medium/hi_IN-pratham-medium.onnx.json",+ "role": "sidecar",+ "priority": 0+ }+ ],+ "dependsOn": [+ "tts-espeak-dict-hi"+ ],+ "sampleUrl": "https://offline-translator.davidv.dev/samples_ogg/hi/pratham_medium.opus"+ },+ "tts-piper-hi-in-priyamvada-medium": {+ "feature": "tts",+ "engine": "piper",+ "auxRole": "sidecar",+ "language": "hi",+ "locale": "hi_IN",+ "region": "IN",+ "voice": "priyamvada",+ "quality": "medium",+ "numSpeakers": 1,+ "aliases": [],+ "files": [+ {+ "name": "hi_IN-priyamvada-medium.mnn",+ "sizeBytes": 16977372,+ "installPath": "bin/piper/hi/hi_IN/priyamvada/medium/hi_IN-priyamvada-medium.mnn",+ "url": "https://offline-translator.davidv.dev/tts/1/hi/hi_IN/priyamvada/medium/hi_IN-priyamvada-medium.mnn",+ "role": "model",+ "priority": 0+ },+ {+ "name": "hi_IN-priyamvada-medium.onnx.json",+ "sizeBytes": 4973,+ "installPath": "bin/piper/hi/hi_IN/priyamvada/medium/hi_IN-priyamvada-medium.onnx.json",+ "url": "https://offline-translator.davidv.dev/tts/1/hi/hi_IN/priyamvada/medium/hi_IN-priyamvada-medium.onnx.json",+ "role": "sidecar",+ "priority": 0+ }+ ],+ "dependsOn": [+ "tts-espeak-dict-hi"+ ],+ "sampleUrl": "https://offline-translator.davidv.dev/samples_ogg/hi/priyamvada_medium.opus"+ },+ "tts-coqui_vits-hr-hr-cv-coqui-vits": {+ "feature": "tts",+ "engine": "coqui_vits",+ "auxRole": "config",+ "language": "hr",+ "locale": "hr_HR",+ "region": "HR",+ "voice": "cv",+ "quality": "medium",+ "numSpeakers": 1,+ "aliases": [],+ "files": [+ {+ "name": "model.mnn",+ "sizeBytes": 18894620,+ "installPath": "bin/coqui_vits/hr/hr_HR/cv/medium/model.mnn",+ "url": "https://offline-translator.davidv.dev/tts/1/hr/hr_HR/cv/medium/model.mnn",+ "role": "model",+ "priority": 0+ },+ {+ "name": "config.json",+ "sizeBytes": 8448,+ "installPath": "bin/coqui_vits/hr/hr_HR/cv/medium/config.json",+ "url": "https://offline-translator.davidv.dev/tts/1/hr/hr_HR/cv/medium/config.json",+ "role": "config",+ "priority": 0+ },+ {+ "name": "language_ids.json",+ "sizeBytes": 29,+ "installPath": "bin/coqui_vits/hr/hr_HR/cv/medium/language_ids.json",+ "url": "https://offline-translator.davidv.dev/tts/1/hr/hr_HR/cv/medium/language_ids.json",+ "role": "languageIds",+ "priority": 0+ },+ {+ "name": "speaker_ids.json",+ "sizeBytes": 19,+ "installPath": "bin/coqui_vits/hr/hr_HR/cv/medium/speaker_ids.json",+ "url": "https://offline-translator.davidv.dev/tts/1/hr/hr_HR/cv/medium/speaker_ids.json",+ "role": "speakerIds",+ "priority": 0+ },+ {+ "name": "tokens.txt",+ "sizeBytes": 1760,+ "installPath": "bin/coqui_vits/hr/hr_HR/cv/medium/tokens.txt",+ "url": "https://offline-translator.davidv.dev/tts/1/hr/hr_HR/cv/medium/tokens.txt",+ "role": "tokens",+ "priority": 0+ }+ ],+ "dependsOn": [],+ "sampleUrl": "https://offline-translator.davidv.dev/samples_ogg/hr/cv_medium.opus"+ },+ "tts-piper-hu-hu-anna-medium": {+ "feature": "tts",+ "engine": "piper",+ "auxRole": "sidecar",+ "language": "hu",+ "locale": "hu_HU",+ "region": "HU",+ "voice": "anna",+ "quality": "medium",+ "numSpeakers": 1,+ "aliases": [],+ "files": [+ {+ "name": "hu_HU-anna-medium.mnn",+ "sizeBytes": 16864416,+ "installPath": "bin/piper/hu/hu_HU/anna/medium/hu_HU-anna-medium.mnn",+ "url": "https://offline-translator.davidv.dev/tts/1/hu/hu_HU/anna/medium/hu_HU-anna-medium.mnn",+ "role": "model",+ "priority": 0+ },+ {+ "name": "hu_HU-anna-medium.onnx.json",+ "sizeBytes": 5018,+ "installPath": "bin/piper/hu/hu_HU/anna/medium/hu_HU-anna-medium.onnx.json",+ "url": "https://offline-translator.davidv.dev/tts/1/hu/hu_HU/anna/medium/hu_HU-anna-medium.onnx.json",+ "role": "sidecar",+ "priority": 0+ }+ ],+ "dependsOn": [+ "tts-espeak-dict-hu"+ ],+ "sampleUrl": "https://offline-translator.davidv.dev/samples_ogg/hu/anna_medium.opus"+ },+ "tts-piper-hu-hu-berta-medium": {+ "feature": "tts",+ "engine": "piper",+ "auxRole": "sidecar",+ "language": "hu",+ "locale": "hu_HU",+ "region": "HU",+ "voice": "berta",+ "quality": "medium",+ "numSpeakers": 1,+ "aliases": [],+ "files": [+ {+ "name": "hu_HU-berta-medium.mnn",+ "sizeBytes": 16864416,+ "installPath": "bin/piper/hu/hu_HU/berta/medium/hu_HU-berta-medium.mnn",+ "url": "https://offline-translator.davidv.dev/tts/1/hu/hu_HU/berta/medium/hu_HU-berta-medium.mnn",+ "role": "model",+ "priority": 0+ },+ {+ "name": "hu_HU-berta-medium.onnx.json",+ "sizeBytes": 4961,+ "installPath": "bin/piper/hu/hu_HU/berta/medium/hu_HU-berta-medium.onnx.json",+ "url": "https://offline-translator.davidv.dev/tts/1/hu/hu_HU/berta/medium/hu_HU-berta-medium.onnx.json",+ "role": "sidecar",+ "priority": 0+ }+ ],+ "dependsOn": [+ "tts-espeak-dict-hu"+ ],+ "sampleUrl": "https://offline-translator.davidv.dev/samples_ogg/hu/berta_medium.opus"+ },+ "tts-piper-hu-hu-imre-medium": {+ "feature": "tts",+ "engine": "piper",+ "auxRole": "sidecar",+ "language": "hu",+ "locale": "hu_HU",+ "region": "HU",+ "voice": "imre",+ "quality": "medium",+ "numSpeakers": 1,+ "aliases": [],+ "files": [+ {+ "name": "hu_HU-imre-medium.mnn",+ "sizeBytes": 16864416,+ "installPath": "bin/piper/hu/hu_HU/imre/medium/hu_HU-imre-medium.mnn",+ "url": "https://offline-translator.davidv.dev/tts/1/hu/hu_HU/imre/medium/hu_HU-imre-medium.mnn",+ "role": "model",+ "priority": 0+ },+ {+ "name": "hu_HU-imre-medium.onnx.json",+ "sizeBytes": 5019,+ "installPath": "bin/piper/hu/hu_HU/imre/medium/hu_HU-imre-medium.onnx.json",+ "url": "https://offline-translator.davidv.dev/tts/1/hu/hu_HU/imre/medium/hu_HU-imre-medium.onnx.json",+ "role": "sidecar",+ "priority": 0+ }+ ],+ "dependsOn": [+ "tts-espeak-dict-hu"+ ],+ "sampleUrl": "https://offline-translator.davidv.dev/samples_ogg/hu/imre_medium.opus"+ },+ "tts-piper-id-id-news-tts-medium": {+ "feature": "tts",+ "engine": "piper",+ "auxRole": "sidecar",+ "language": "id",+ "locale": "id_ID",+ "region": "ID",+ "voice": "news_tts",+ "quality": "medium",+ "numSpeakers": 1,+ "aliases": [],+ "files": [+ {+ "name": "id_ID-news_tts-medium.mnn",+ "sizeBytes": 16763672,+ "installPath": "bin/piper/id/id_ID/news_tts/medium/id_ID-news_tts-medium.mnn",+ "url": "https://offline-translator.davidv.dev/tts/1/id/id_ID/news_tts/medium/id_ID-news_tts-medium.mnn",+ "role": "model",+ "priority": 0+ },+ {+ "name": "id_ID-news_tts-medium.onnx.json",+ "sizeBytes": 5050,+ "installPath": "bin/piper/id/id_ID/news_tts/medium/id_ID-news_tts-medium.onnx.json",+ "url": "https://offline-translator.davidv.dev/tts/1/id/id_ID/news_tts/medium/id_ID-news_tts-medium.onnx.json",+ "role": "sidecar",+ "priority": 0+ }+ ],+ "dependsOn": [+ "tts-espeak-dict-id"+ ],+ "sampleUrl": "https://offline-translator.davidv.dev/samples_ogg/id/news_tts_medium.opus"+ },+ "tts-piper-is-is-bui-medium": {+ "feature": "tts",+ "engine": "piper",+ "auxRole": "sidecar",+ "language": "is",+ "locale": "is_IS",+ "region": "IS",+ "voice": "bui",+ "quality": "medium",+ "numSpeakers": 1,+ "aliases": [+ "is-bui-medium"+ ],+ "files": [+ {+ "name": "is_IS-bui-medium.mnn",+ "sizeBytes": 16755608,+ "installPath": "bin/piper/is/is_IS/bui/medium/is_IS-bui-medium.mnn",+ "url": "https://offline-translator.davidv.dev/tts/1/is/is_IS/bui/medium/is_IS-bui-medium.mnn",+ "role": "model",+ "priority": 0+ },+ {+ "name": "is_IS-bui-medium.onnx.json",+ "sizeBytes": 4162,+ "installPath": "bin/piper/is/is_IS/bui/medium/is_IS-bui-medium.onnx.json",+ "url": "https://offline-translator.davidv.dev/tts/1/is/is_IS/bui/medium/is_IS-bui-medium.onnx.json",+ "role": "sidecar",+ "priority": 0+ }+ ],+ "dependsOn": [+ "tts-espeak-dict-is"+ ],+ "sampleUrl": "https://offline-translator.davidv.dev/samples_ogg/is/bui_medium.opus"+ },+ "tts-piper-is-is-salka-medium": {+ "feature": "tts",+ "engine": "piper",+ "auxRole": "sidecar",+ "language": "is",+ "locale": "is_IS",+ "region": "IS",+ "voice": "salka",+ "quality": "medium",+ "numSpeakers": 1,+ "aliases": [+ "is-salka-medium"+ ],+ "files": [+ {+ "name": "is_IS-salka-medium.mnn",+ "sizeBytes": 16755608,+ "installPath": "bin/piper/is/is_IS/salka/medium/is_IS-salka-medium.mnn",+ "url": "https://offline-translator.davidv.dev/tts/1/is/is_IS/salka/medium/is_IS-salka-medium.mnn",+ "role": "model",+ "priority": 0+ },+ {+ "name": "is_IS-salka-medium.onnx.json",+ "sizeBytes": 4164,+ "installPath": "bin/piper/is/is_IS/salka/medium/is_IS-salka-medium.onnx.json",+ "url": "https://offline-translator.davidv.dev/tts/1/is/is_IS/salka/medium/is_IS-salka-medium.onnx.json",+ "role": "sidecar",+ "priority": 0+ }+ ],+ "dependsOn": [+ "tts-espeak-dict-is"+ ],+ "sampleUrl": "https://offline-translator.davidv.dev/samples_ogg/is/salka_medium.opus"+ },+ "tts-piper-is-is-steinn-medium": {+ "feature": "tts",+ "engine": "piper",+ "auxRole": "sidecar",+ "language": "is",+ "locale": "is_IS",+ "region": "IS",+ "voice": "steinn",+ "quality": "medium",+ "numSpeakers": 1,+ "aliases": [+ "is-steinn-medium"+ ],+ "files": [+ {+ "name": "is_IS-steinn-medium.mnn",+ "sizeBytes": 16755608,+ "installPath": "bin/piper/is/is_IS/steinn/medium/is_IS-steinn-medium.mnn",+ "url": "https://offline-translator.davidv.dev/tts/1/is/is_IS/steinn/medium/is_IS-steinn-medium.mnn",+ "role": "model",+ "priority": 0+ },+ {+ "name": "is_IS-steinn-medium.onnx.json",+ "sizeBytes": 4165,+ "installPath": "bin/piper/is/is_IS/steinn/medium/is_IS-steinn-medium.onnx.json",+ "url": "https://offline-translator.davidv.dev/tts/1/is/is_IS/steinn/medium/is_IS-steinn-medium.onnx.json",+ "role": "sidecar",+ "priority": 0+ }+ ],+ "dependsOn": [+ "tts-espeak-dict-is"+ ],+ "sampleUrl": "https://offline-translator.davidv.dev/samples_ogg/is/steinn_medium.opus"+ },+ "tts-piper-is-is-ugla-medium": {+ "feature": "tts",+ "engine": "piper",+ "auxRole": "sidecar",+ "language": "is",+ "locale": "is_IS",+ "region": "IS",+ "voice": "ugla",+ "quality": "medium",+ "numSpeakers": 1,+ "aliases": [+ "is-ugla-medium"+ ],+ "files": [+ {+ "name": "is_IS-ugla-medium.mnn",+ "sizeBytes": 16755608,+ "installPath": "bin/piper/is/is_IS/ugla/medium/is_IS-ugla-medium.mnn",+ "url": "https://offline-translator.davidv.dev/tts/1/is/is_IS/ugla/medium/is_IS-ugla-medium.mnn",+ "role": "model",+ "priority": 0+ },+ {+ "name": "is_IS-ugla-medium.onnx.json",+ "sizeBytes": 4163,+ "installPath": "bin/piper/is/is_IS/ugla/medium/is_IS-ugla-medium.onnx.json",+ "url": "https://offline-translator.davidv.dev/tts/1/is/is_IS/ugla/medium/is_IS-ugla-medium.onnx.json",+ "role": "sidecar",+ "priority": 0+ }+ ],+ "dependsOn": [+ "tts-espeak-dict-is"+ ],+ "sampleUrl": "https://offline-translator.davidv.dev/samples_ogg/is/ugla_medium.opus"+ },+ "tts-piper-it-it-paola-medium": {+ "feature": "tts",+ "engine": "piper",+ "auxRole": "sidecar",+ "language": "it",+ "locale": "it_IT",+ "region": "IT",+ "voice": "paola",+ "quality": "medium",+ "numSpeakers": 1,+ "aliases": [],+ "files": [+ {+ "name": "it_IT-paola-medium.mnn",+ "sizeBytes": 16974228,+ "installPath": "bin/piper/it/it_IT/paola/medium/it_IT-paola-medium.mnn",+ "url": "https://offline-translator.davidv.dev/tts/1/it/it_IT/paola/medium/it_IT-paola-medium.mnn",+ "role": "model",+ "priority": 0+ },+ {+ "name": "it_IT-paola-medium.onnx.json",+ "sizeBytes": 7099,+ "installPath": "bin/piper/it/it_IT/paola/medium/it_IT-paola-medium.onnx.json",+ "url": "https://offline-translator.davidv.dev/tts/1/it/it_IT/paola/medium/it_IT-paola-medium.onnx.json",+ "role": "sidecar",+ "priority": 0+ }+ ],+ "dependsOn": [+ "tts-espeak-dict-it"+ ],+ "sampleUrl": "https://offline-translator.davidv.dev/samples_ogg/it/paola_medium.opus"+ },+ "tts-piper-it-it-riccardo-x-low": {+ "feature": "tts",+ "engine": "piper",+ "auxRole": "sidecar",+ "language": "it",+ "locale": "it_IT",+ "region": "IT",+ "voice": "riccardo",+ "quality": "x_low",+ "numSpeakers": 1,+ "aliases": [+ "it-riccardo_fasol-x-low"+ ],+ "files": [+ {+ "name": "it_IT-riccardo-x_low.mnn",+ "sizeBytes": 5944328,+ "installPath": "bin/piper/it/it_IT/riccardo/x_low/it_IT-riccardo-x_low.mnn",+ "url": "https://offline-translator.davidv.dev/tts/1/it/it_IT/riccardo/x_low/it_IT-riccardo-x_low.mnn",+ "role": "model",+ "priority": 0+ },+ {+ "name": "it_IT-riccardo-x_low.onnx.json",+ "sizeBytes": 4161,+ "installPath": "bin/piper/it/it_IT/riccardo/x_low/it_IT-riccardo-x_low.onnx.json",+ "url": "https://offline-translator.davidv.dev/tts/1/it/it_IT/riccardo/x_low/it_IT-riccardo-x_low.onnx.json",+ "role": "sidecar",+ "priority": 0+ }+ ],+ "dependsOn": [+ "tts-espeak-dict-it"+ ],+ "sampleUrl": "https://offline-translator.davidv.dev/samples_ogg/it/riccardo_x_low.opus"+ },+ "tts-kokoro_mnn-ja-jp-jf-alpha-kokoro-mnn-v1.0": {+ "feature": "tts",+ "engine": "kokoro_mnn",+ "auxRole": "voices",+ "language": "ja",+ "locale": "ja_JP",+ "region": "JP",+ "voice": "jf_alpha",+ "quality": "high",+ "numSpeakers": 1,+ "aliases": [],+ "files": [],+ "dependsOn": [+ "tts-espeak-dict-ja",+ "tts-kokoro-mnn-v1.0-core",+ "support-ja-mucab"+ ],+ "sampleUrl": "https://offline-translator.davidv.dev/samples_ogg/ja/jf_alpha_high.opus"+ },+ "tts-piper-ka-ge-natia-medium": {+ "feature": "tts",+ "engine": "piper",+ "auxRole": "sidecar",+ "language": "ka",+ "locale": "ka_GE",+ "region": "GE",+ "voice": "natia",+ "quality": "medium",+ "numSpeakers": 1,+ "aliases": [],+ "files": [+ {+ "name": "ka_GE-natia-medium.mnn",+ "sizeBytes": 16864416,+ "installPath": "bin/piper/ka/ka_GE/natia/medium/ka_GE-natia-medium.mnn",+ "url": "https://offline-translator.davidv.dev/tts/1/ka/ka_GE/natia/medium/ka_GE-natia-medium.mnn",+ "role": "model",+ "priority": 0+ },+ {+ "name": "ka_GE-natia-medium.onnx.json",+ "sizeBytes": 4842,+ "installPath": "bin/piper/ka/ka_GE/natia/medium/ka_GE-natia-medium.onnx.json",+ "url": "https://offline-translator.davidv.dev/tts/1/ka/ka_GE/natia/medium/ka_GE-natia-medium.onnx.json",+ "role": "sidecar",+ "priority": 0+ }+ ],+ "dependsOn": [+ "tts-espeak-dict-ka"+ ],+ "sampleUrl": "https://offline-translator.davidv.dev/samples_ogg/ka/natia_medium.opus"+ },+ "tts-mms-kn-in-standard-mms": {+ "feature": "tts",+ "engine": "mms",+ "auxRole": "tokens",+ "language": "kn",+ "locale": "kn_IN",+ "region": "IN",+ "voice": "standard",+ "quality": "medium",+ "numSpeakers": 1,+ "aliases": [],+ "files": [+ {+ "name": "model.mnn",+ "sizeBytes": 29617764,+ "installPath": "bin/mms/kn/kn_IN/standard/medium/model.mnn",+ "url": "https://offline-translator.davidv.dev/tts/1/kn/kn_IN/standard/medium/model.mnn",+ "role": "model",+ "priority": 0+ },+ {+ "name": "tokens.txt",+ "sizeBytes": 487,+ "installPath": "bin/mms/kn/kn_IN/standard/medium/tokens.txt",+ "url": "https://offline-translator.davidv.dev/tts/1/kn/kn_IN/standard/medium/tokens.txt",+ "role": "tokens",+ "priority": 0+ }+ ],+ "dependsOn": [],+ "sampleUrl": "https://offline-translator.davidv.dev/samples_ogg/kn/standard_medium.opus"+ },+ "tts-mimic3-ko-ko-kss-low": {+ "feature": "tts",+ "engine": "mimic3",+ "auxRole": "sidecar",+ "language": "ko",+ "locale": "ko_KO",+ "region": "KR",+ "voice": "kss",+ "quality": "low",+ "numSpeakers": 1,+ "aliases": [],+ "files": [+ {+ "name": "ko_KO-kss_low.mnn",+ "sizeBytes": 16616908,+ "installPath": "bin/piper/ko/ko_KO/kss/low/ko_KO-kss_low.mnn",+ "url": "https://offline-translator.davidv.dev/tts/1/ko/ko_KO/kss/low/ko_KO-kss_low.mnn",+ "role": "model",+ "priority": 0+ },+ {+ "name": "ko_KO-kss_low.onnx.json",+ "sizeBytes": 3411,+ "installPath": "bin/piper/ko/ko_KO/kss/low/ko_KO-kss_low.onnx.json",+ "url": "https://offline-translator.davidv.dev/tts/1/ko/ko_KO/kss/low/ko_KO-kss_low.onnx.json",+ "role": "sidecar",+ "priority": 0+ },+ {+ "name": "tokens.txt",+ "sizeBytes": 260,+ "installPath": "bin/piper/ko/ko_KO/kss/low/tokens.txt",+ "url": "https://offline-translator.davidv.dev/tts/1/ko/ko_KO/kss/low/tokens.txt",+ "role": "tokens",+ "priority": 0+ }+ ],+ "dependsOn": [+ "tts-espeak-dict-ko"+ ],+ "sampleUrl": "https://offline-translator.davidv.dev/samples_ogg/ko/kss_low.opus"+ },+ "tts-kokoro_mnn-ko-kr-jf-alpha-kokoro-mnn-v1.0": {+ "feature": "tts",+ "engine": "kokoro_mnn",+ "auxRole": "voices",+ "language": "ko",+ "locale": "ko_KR",+ "region": "KR",+ "voice": "jf_alpha",+ "quality": "high",+ "numSpeakers": 1,+ "aliases": [],+ "files": [],+ "dependsOn": [+ "tts-espeak-dict-ko",+ "tts-kokoro-mnn-v1.0-core"+ ],+ "sampleUrl": "https://offline-translator.davidv.dev/samples_ogg/ko/jf_alpha_high.opus"+ },+ "tts-coqui_vits-lt-lt-cv-coqui-vits": {+ "feature": "tts",+ "engine": "coqui_vits",+ "auxRole": "config",+ "language": "lt",+ "locale": "lt_LT",+ "region": "LT",+ "voice": "cv",+ "quality": "medium",+ "numSpeakers": 1,+ "aliases": [],+ "files": [+ {+ "name": "model.mnn",+ "sizeBytes": 18883868,+ "installPath": "bin/coqui_vits/lt/lt_LT/cv/medium/model.mnn",+ "url": "https://offline-translator.davidv.dev/tts/1/lt/lt_LT/cv/medium/model.mnn",+ "role": "model",+ "priority": 0+ },+ {+ "name": "config.json",+ "sizeBytes": 8272,+ "installPath": "bin/coqui_vits/lt/lt_LT/cv/medium/config.json",+ "url": "https://offline-translator.davidv.dev/tts/1/lt/lt_LT/cv/medium/config.json",+ "role": "config",+ "priority": 0+ },+ {+ "name": "language_ids.json",+ "sizeBytes": 15,+ "installPath": "bin/coqui_vits/lt/lt_LT/cv/medium/language_ids.json",+ "url": "https://offline-translator.davidv.dev/tts/1/lt/lt_LT/cv/medium/language_ids.json",+ "role": "languageIds",+ "priority": 0+ },+ {+ "name": "speaker_ids.json",+ "sizeBytes": 19,+ "installPath": "bin/coqui_vits/lt/lt_LT/cv/medium/speaker_ids.json",+ "url": "https://offline-translator.davidv.dev/tts/1/lt/lt_LT/cv/medium/speaker_ids.json",+ "role": "speakerIds",+ "priority": 0+ },+ {+ "name": "tokens.txt",+ "sizeBytes": 1564,+ "installPath": "bin/coqui_vits/lt/lt_LT/cv/medium/tokens.txt",+ "url": "https://offline-translator.davidv.dev/tts/1/lt/lt_LT/cv/medium/tokens.txt",+ "role": "tokens",+ "priority": 0+ }+ ],+ "dependsOn": [],+ "sampleUrl": "https://offline-translator.davidv.dev/samples_ogg/lt/cv_medium.opus"+ },+ "tts-piper-lv-lv-aivars-medium": {+ "feature": "tts",+ "engine": "piper",+ "auxRole": "sidecar",+ "language": "lv",+ "locale": "lv_LV",+ "region": "LV",+ "voice": "aivars",+ "quality": "medium",+ "numSpeakers": 1,+ "aliases": [],+ "files": [+ {+ "name": "lv_LV-aivars-medium.mnn",+ "sizeBytes": 16974228,+ "installPath": "bin/piper/lv/lv_LV/aivars/medium/lv_LV-aivars-medium.mnn",+ "url": "https://offline-translator.davidv.dev/tts/1/lv/lv_LV/aivars/medium/lv_LV-aivars-medium.mnn",+ "role": "model",+ "priority": 0+ },+ {+ "name": "lv_LV-aivars-medium.onnx.json",+ "sizeBytes": 7242,+ "installPath": "bin/piper/lv/lv_LV/aivars/medium/lv_LV-aivars-medium.onnx.json",+ "url": "https://offline-translator.davidv.dev/tts/1/lv/lv_LV/aivars/medium/lv_LV-aivars-medium.onnx.json",+ "role": "sidecar",+ "priority": 0+ }+ ],+ "dependsOn": [+ "tts-espeak-dict-lv"+ ],+ "sampleUrl": "https://offline-translator.davidv.dev/samples_ogg/lv/aivars_medium.opus"+ },+ "tts-piper-ml-in-arjun-medium": {+ "feature": "tts",+ "engine": "piper",+ "auxRole": "sidecar",+ "language": "ml",+ "locale": "ml_IN",+ "region": "IN",+ "voice": "arjun",+ "quality": "medium",+ "numSpeakers": 1,+ "aliases": [],+ "files": [+ {+ "name": "ml_IN-arjun-medium.mnn",+ "sizeBytes": 16763672,+ "installPath": "bin/piper/ml/ml_IN/arjun/medium/ml_IN-arjun-medium.mnn",+ "url": "https://offline-translator.davidv.dev/tts/1/ml/ml_IN/arjun/medium/ml_IN-arjun-medium.mnn",+ "role": "model",+ "priority": 0+ },+ {+ "name": "ml_IN-arjun-medium.onnx.json",+ "sizeBytes": 5044,+ "installPath": "bin/piper/ml/ml_IN/arjun/medium/ml_IN-arjun-medium.onnx.json",+ "url": "https://offline-translator.davidv.dev/tts/1/ml/ml_IN/arjun/medium/ml_IN-arjun-medium.onnx.json",+ "role": "sidecar",+ "priority": 0+ }+ ],+ "dependsOn": [+ "tts-espeak-dict-ml"+ ],+ "sampleUrl": "https://offline-translator.davidv.dev/samples_ogg/ml/arjun_medium.opus"+ },+ "tts-piper-ml-in-meera-medium": {+ "feature": "tts",+ "engine": "piper",+ "auxRole": "sidecar",+ "language": "ml",+ "locale": "ml_IN",+ "region": "IN",+ "voice": "meera",+ "quality": "medium",+ "numSpeakers": 1,+ "aliases": [],+ "files": [+ {+ "name": "ml_IN-meera-medium.mnn",+ "sizeBytes": 16763672,+ "installPath": "bin/piper/ml/ml_IN/meera/medium/ml_IN-meera-medium.mnn",+ "url": "https://offline-translator.davidv.dev/tts/1/ml/ml_IN/meera/medium/ml_IN-meera-medium.mnn",+ "role": "model",+ "priority": 0+ },+ {+ "name": "ml_IN-meera-medium.onnx.json",+ "sizeBytes": 5045,+ "installPath": "bin/piper/ml/ml_IN/meera/medium/ml_IN-meera-medium.onnx.json",+ "url": "https://offline-translator.davidv.dev/tts/1/ml/ml_IN/meera/medium/ml_IN-meera-medium.onnx.json",+ "role": "sidecar",+ "priority": 0+ }+ ],+ "dependsOn": [+ "tts-espeak-dict-ml"+ ],+ "sampleUrl": "https://offline-translator.davidv.dev/samples_ogg/ml/meera_medium.opus"+ },+ "tts-mms-mr-in-standard-mms": {+ "feature": "tts",+ "engine": "mms",+ "auxRole": "tokens",+ "language": "mr",+ "locale": "mr_IN",+ "region": "IN",+ "voice": "standard",+ "quality": "medium",+ "numSpeakers": 1,+ "aliases": [],+ "files": [+ {+ "name": "model.mnn",+ "sizeBytes": 29616228,+ "installPath": "bin/mms/mr/mr_IN/standard/medium/model.mnn",+ "url": "https://offline-translator.davidv.dev/tts/1/mr/mr_IN/standard/medium/model.mnn",+ "role": "model",+ "priority": 0+ },+ {+ "name": "tokens.txt",+ "sizeBytes": 490,+ "installPath": "bin/mms/mr/mr_IN/standard/medium/tokens.txt",+ "url": "https://offline-translator.davidv.dev/tts/1/mr/mr_IN/standard/medium/tokens.txt",+ "role": "tokens",+ "priority": 0+ }+ ],+ "dependsOn": [],+ "sampleUrl": "https://offline-translator.davidv.dev/samples_ogg/mr/standard_medium.opus"+ },+ "tts-mms-ms-my-standard-mms": {+ "feature": "tts",+ "engine": "mms",+ "auxRole": "tokens",+ "language": "ms",+ "locale": "ms_MY",+ "region": "MY",+ "voice": "standard",+ "quality": "medium",+ "numSpeakers": 1,+ "aliases": [],+ "files": [+ {+ "name": "model.mnn",+ "sizeBytes": 29586276,+ "installPath": "bin/mms/ms/ms_MY/standard/medium/model.mnn",+ "url": "https://offline-translator.davidv.dev/tts/1/ms/ms_MY/standard/medium/model.mnn",+ "role": "model",+ "priority": 0+ },+ {+ "name": "tokens.txt",+ "sizeBytes": 275,+ "installPath": "bin/mms/ms/ms_MY/standard/medium/tokens.txt",+ "url": "https://offline-translator.davidv.dev/tts/1/ms/ms_MY/standard/medium/tokens.txt",+ "role": "tokens",+ "priority": 0+ }+ ],+ "dependsOn": [],+ "sampleUrl": "https://offline-translator.davidv.dev/samples_ogg/ms/standard_medium.opus"+ },+ "tts-piper-nl-be-rdh-medium": {+ "feature": "tts",+ "engine": "piper",+ "auxRole": "sidecar",+ "language": "nl",+ "locale": "nl_BE",+ "region": "BE",+ "voice": "rdh",+ "quality": "medium",+ "numSpeakers": 1,+ "aliases": [+ "nl-rdh-medium"+ ],+ "files": [+ {+ "name": "nl_BE-rdh-medium.mnn",+ "sizeBytes": 16767648,+ "installPath": "bin/piper/nl/nl_BE/rdh/medium/nl_BE-rdh-medium.mnn",+ "url": "https://offline-translator.davidv.dev/tts/1/nl/nl_BE/rdh/medium/nl_BE-rdh-medium.mnn",+ "role": "model",+ "priority": 0+ },+ {+ "name": "nl_BE-rdh-medium.onnx.json",+ "sizeBytes": 4159,+ "installPath": "bin/piper/nl/nl_BE/rdh/medium/nl_BE-rdh-medium.onnx.json",+ "url": "https://offline-translator.davidv.dev/tts/1/nl/nl_BE/rdh/medium/nl_BE-rdh-medium.onnx.json",+ "role": "sidecar",+ "priority": 0+ }+ ],+ "dependsOn": [+ "tts-espeak-dict-nl"+ ],+ "sampleUrl": "https://offline-translator.davidv.dev/samples_ogg/nl/rdh_medium.opus"+ },+ "tts-piper-nl-be-nathalie-medium": {+ "feature": "tts",+ "engine": "piper",+ "auxRole": "sidecar",+ "language": "nl",+ "locale": "nl_BE",+ "region": "BE",+ "voice": "nathalie",+ "quality": "medium",+ "numSpeakers": 1,+ "aliases": [],+ "files": [+ {+ "name": "nl_BE-nathalie-medium.mnn",+ "sizeBytes": 16864416,+ "installPath": "bin/piper/nl/nl_BE/nathalie/medium/nl_BE-nathalie-medium.mnn",+ "url": "https://offline-translator.davidv.dev/tts/1/nl/nl_BE/nathalie/medium/nl_BE-nathalie-medium.mnn",+ "role": "model",+ "priority": 0+ },+ {+ "name": "nl_BE-nathalie-medium.onnx.json",+ "sizeBytes": 4879,+ "installPath": "bin/piper/nl/nl_BE/nathalie/medium/nl_BE-nathalie-medium.onnx.json",+ "url": "https://offline-translator.davidv.dev/tts/1/nl/nl_BE/nathalie/medium/nl_BE-nathalie-medium.onnx.json",+ "role": "sidecar",+ "priority": 0+ }+ ],+ "dependsOn": [+ "tts-espeak-dict-nl"+ ],+ "sampleUrl": "https://offline-translator.davidv.dev/samples_ogg/nl/nathalie_medium.opus"+ },+ "tts-piper-nl-be-nathalie-x-low": {+ "feature": "tts",+ "engine": "piper",+ "auxRole": "sidecar",+ "language": "nl",+ "locale": "nl_BE",+ "region": "BE",+ "voice": "nathalie",+ "quality": "x_low",+ "numSpeakers": 1,+ "aliases": [+ "nl-nathalie-x-low"+ ],+ "files": [+ {+ "name": "nl_BE-nathalie-x_low.mnn",+ "sizeBytes": 5915616,+ "installPath": "bin/piper/nl/nl_BE/nathalie/x_low/nl_BE-nathalie-x_low.mnn",+ "url": "https://offline-translator.davidv.dev/tts/1/nl/nl_BE/nathalie/x_low/nl_BE-nathalie-x_low.mnn",+ "role": "model",+ "priority": 0+ },+ {+ "name": "nl_BE-nathalie-x_low.onnx.json",+ "sizeBytes": 4163,+ "installPath": "bin/piper/nl/nl_BE/nathalie/x_low/nl_BE-nathalie-x_low.onnx.json",+ "url": "https://offline-translator.davidv.dev/tts/1/nl/nl_BE/nathalie/x_low/nl_BE-nathalie-x_low.onnx.json",+ "role": "sidecar",+ "priority": 0+ }+ ],+ "dependsOn": [+ "tts-espeak-dict-nl"+ ],+ "sampleUrl": "https://offline-translator.davidv.dev/samples_ogg/nl/nathalie_x_low.opus"+ },+ "tts-piper-nl-be-rdh-x-low": {+ "feature": "tts",+ "engine": "piper",+ "auxRole": "sidecar",+ "language": "nl",+ "locale": "nl_BE",+ "region": "BE",+ "voice": "rdh",+ "quality": "x_low",+ "numSpeakers": 1,+ "aliases": [+ "nl-rdh-x-low"+ ],+ "files": [+ {+ "name": "nl_BE-rdh-x_low.mnn",+ "sizeBytes": 5915616,+ "installPath": "bin/piper/nl/nl_BE/rdh/x_low/nl_BE-rdh-x_low.mnn",+ "url": "https://offline-translator.davidv.dev/tts/1/nl/nl_BE/rdh/x_low/nl_BE-rdh-x_low.mnn",+ "role": "model",+ "priority": 0+ },+ {+ "name": "nl_BE-rdh-x_low.onnx.json",+ "sizeBytes": 4158,+ "installPath": "bin/piper/nl/nl_BE/rdh/x_low/nl_BE-rdh-x_low.onnx.json",+ "url": "https://offline-translator.davidv.dev/tts/1/nl/nl_BE/rdh/x_low/nl_BE-rdh-x_low.onnx.json",+ "role": "sidecar",+ "priority": 0+ }+ ],+ "dependsOn": [+ "tts-espeak-dict-nl"+ ],+ "sampleUrl": "https://offline-translator.davidv.dev/samples_ogg/nl/rdh_x_low.opus"+ },+ "tts-piper-nl-nl-ronnie-medium": {+ "feature": "tts",+ "engine": "piper",+ "auxRole": "sidecar",+ "language": "nl",+ "locale": "nl_NL",+ "region": "NL",+ "voice": "ronnie",+ "quality": "medium",+ "numSpeakers": 1,+ "aliases": [],+ "files": [+ {+ "name": "nl_NL-ronnie-medium.mnn",+ "sizeBytes": 16763672,+ "installPath": "bin/piper/nl/nl_NL/ronnie/medium/nl_NL-ronnie-medium.mnn",+ "url": "https://offline-translator.davidv.dev/tts/1/nl/nl_NL/ronnie/medium/nl_NL-ronnie-medium.mnn",+ "role": "model",+ "priority": 0+ },+ {+ "name": "nl_NL-ronnie-medium.onnx.json",+ "sizeBytes": 5040,+ "installPath": "bin/piper/nl/nl_NL/ronnie/medium/nl_NL-ronnie-medium.onnx.json",+ "url": "https://offline-translator.davidv.dev/tts/1/nl/nl_NL/ronnie/medium/nl_NL-ronnie-medium.onnx.json",+ "role": "sidecar",+ "priority": 0+ }+ ],+ "dependsOn": [+ "tts-espeak-dict-nl"+ ],+ "sampleUrl": "https://offline-translator.davidv.dev/samples_ogg/nl/ronnie_medium.opus"+ },+ "tts-piper-nl-nl-pim-medium": {+ "feature": "tts",+ "engine": "piper",+ "auxRole": "sidecar",+ "language": "nl",+ "locale": "nl_NL",+ "region": "NL",+ "voice": "pim",+ "quality": "medium",+ "numSpeakers": 1,+ "aliases": [],+ "files": [+ {+ "name": "nl_NL-pim-medium.mnn",+ "sizeBytes": 16977372,+ "installPath": "bin/piper/nl/nl_NL/pim/medium/nl_NL-pim-medium.mnn",+ "url": "https://offline-translator.davidv.dev/tts/1/nl/nl_NL/pim/medium/nl_NL-pim-medium.mnn",+ "role": "model",+ "priority": 0+ },+ {+ "name": "nl_NL-pim-medium.onnx.json",+ "sizeBytes": 5037,+ "installPath": "bin/piper/nl/nl_NL/pim/medium/nl_NL-pim-medium.onnx.json",+ "url": "https://offline-translator.davidv.dev/tts/1/nl/nl_NL/pim/medium/nl_NL-pim-medium.onnx.json",+ "role": "sidecar",+ "priority": 0+ }+ ],+ "dependsOn": [+ "tts-espeak-dict-nl"+ ],+ "sampleUrl": "https://offline-translator.davidv.dev/samples_ogg/nl/pim_medium.opus"+ },+ "tts-piper-nl-nl-alex-medium": {+ "feature": "tts",+ "engine": "piper",+ "auxRole": "sidecar",+ "language": "nl",+ "locale": "nl_NL",+ "region": "NL",+ "voice": "alex",+ "quality": "medium",+ "numSpeakers": 1,+ "aliases": [],+ "files": [+ {+ "name": "nl_NL-alex-medium.mnn",+ "sizeBytes": 16981524,+ "installPath": "bin/piper/nl/nl_NL/alex/medium/nl_NL-alex-medium.mnn",+ "url": "https://offline-translator.davidv.dev/tts/1/nl/nl_NL/alex/medium/nl_NL-alex-medium.mnn",+ "role": "model",+ "priority": 0+ },+ {+ "name": "nl_NL-alex-medium.onnx.json",+ "sizeBytes": 4965,+ "installPath": "bin/piper/nl/nl_NL/alex/medium/nl_NL-alex-medium.onnx.json",+ "url": "https://offline-translator.davidv.dev/tts/1/nl/nl_NL/alex/medium/nl_NL-alex-medium.onnx.json",+ "role": "sidecar",+ "priority": 0+ }+ ],+ "dependsOn": [+ "tts-espeak-dict-nl"+ ],+ "sampleUrl": "https://offline-translator.davidv.dev/samples_ogg/nl/alex_medium.opus"+ },+ "tts-piper-no-no-talesyntese-medium": {+ "feature": "tts",+ "engine": "piper",+ "auxRole": "sidecar",+ "language": "no",+ "locale": "no_NO",+ "region": "NO",+ "voice": "talesyntese",+ "quality": "medium",+ "numSpeakers": 1,+ "aliases": [+ "no-talesyntese-medium"+ ],+ "files": [+ {+ "name": "no_NO-talesyntese-medium.mnn",+ "sizeBytes": 16864416,+ "installPath": "bin/piper/no/no_NO/talesyntese/medium/no_NO-talesyntese-medium.mnn",+ "url": "https://offline-translator.davidv.dev/tts/1/no/no_NO/talesyntese/medium/no_NO-talesyntese-medium.mnn",+ "role": "model",+ "priority": 0+ },+ {+ "name": "no_NO-talesyntese-medium.onnx.json",+ "sizeBytes": 4880,+ "installPath": "bin/piper/no/no_NO/talesyntese/medium/no_NO-talesyntese-medium.onnx.json",+ "url": "https://offline-translator.davidv.dev/tts/1/no/no_NO/talesyntese/medium/no_NO-talesyntese-medium.onnx.json",+ "role": "sidecar",+ "priority": 0+ }+ ],+ "dependsOn": [+ "tts-espeak-dict-no"+ ],+ "sampleUrl": "https://offline-translator.davidv.dev/samples_ogg/no/talesyntese_medium.opus"+ },+ "tts-piper-pl-pl-darkman-medium": {+ "feature": "tts",+ "engine": "piper",+ "auxRole": "sidecar",+ "language": "pl",+ "locale": "pl_PL",+ "region": "PL",+ "voice": "darkman",+ "quality": "medium",+ "numSpeakers": 1,+ "aliases": [],+ "files": [+ {+ "name": "pl_PL-darkman-medium.mnn",+ "sizeBytes": 16864416,+ "installPath": "bin/piper/pl/pl_PL/darkman/medium/pl_PL-darkman-medium.mnn",+ "url": "https://offline-translator.davidv.dev/tts/1/pl/pl_PL/darkman/medium/pl_PL-darkman-medium.mnn",+ "role": "model",+ "priority": 0+ },+ {+ "name": "pl_PL-darkman-medium.onnx.json",+ "sizeBytes": 4816,+ "installPath": "bin/piper/pl/pl_PL/darkman/medium/pl_PL-darkman-medium.onnx.json",+ "url": "https://offline-translator.davidv.dev/tts/1/pl/pl_PL/darkman/medium/pl_PL-darkman-medium.onnx.json",+ "role": "sidecar",+ "priority": 0+ }+ ],+ "dependsOn": [+ "tts-espeak-dict-pl"+ ],+ "sampleUrl": "https://offline-translator.davidv.dev/samples_ogg/pl/darkman_medium.opus"+ },+ "tts-piper-pl-pl-gosia-medium": {+ "feature": "tts",+ "engine": "piper",+ "auxRole": "sidecar",+ "language": "pl",+ "locale": "pl_PL",+ "region": "PL",+ "voice": "gosia",+ "quality": "medium",+ "numSpeakers": 1,+ "aliases": [],+ "files": [+ {+ "name": "pl_PL-gosia-medium.mnn",+ "sizeBytes": 16864416,+ "installPath": "bin/piper/pl/pl_PL/gosia/medium/pl_PL-gosia-medium.mnn",+ "url": "https://offline-translator.davidv.dev/tts/1/pl/pl_PL/gosia/medium/pl_PL-gosia-medium.mnn",+ "role": "model",+ "priority": 0+ },+ {+ "name": "pl_PL-gosia-medium.onnx.json",+ "sizeBytes": 4814,+ "installPath": "bin/piper/pl/pl_PL/gosia/medium/pl_PL-gosia-medium.onnx.json",+ "url": "https://offline-translator.davidv.dev/tts/1/pl/pl_PL/gosia/medium/pl_PL-gosia-medium.onnx.json",+ "role": "sidecar",+ "priority": 0+ }+ ],+ "dependsOn": [+ "tts-espeak-dict-pl"+ ],+ "sampleUrl": "https://offline-translator.davidv.dev/samples_ogg/pl/gosia_medium.opus"+ },+ "tts-piper-pl-pl-mc-speech-medium": {+ "feature": "tts",+ "engine": "piper",+ "auxRole": "sidecar",+ "language": "pl",+ "locale": "pl_PL",+ "region": "PL",+ "voice": "mc_speech",+ "quality": "medium",+ "numSpeakers": 1,+ "aliases": [],+ "files": [+ {+ "name": "pl_PL-mc_speech-medium.mnn",+ "sizeBytes": 16864416,+ "installPath": "bin/piper/pl/pl_PL/mc_speech/medium/pl_PL-mc_speech-medium.mnn",+ "url": "https://offline-translator.davidv.dev/tts/1/pl/pl_PL/mc_speech/medium/pl_PL-mc_speech-medium.mnn",+ "role": "model",+ "priority": 0+ },+ {+ "name": "pl_PL-mc_speech-medium.onnx.json",+ "sizeBytes": 4961,+ "installPath": "bin/piper/pl/pl_PL/mc_speech/medium/pl_PL-mc_speech-medium.onnx.json",+ "url": "https://offline-translator.davidv.dev/tts/1/pl/pl_PL/mc_speech/medium/pl_PL-mc_speech-medium.onnx.json",+ "role": "sidecar",+ "priority": 0+ }+ ],+ "dependsOn": [+ "tts-espeak-dict-pl"+ ],+ "sampleUrl": "https://offline-translator.davidv.dev/samples_ogg/pl/mc_speech_medium.opus"+ },+ "tts-piper-pl-pl-jarvis-wg-glos-medium": {+ "feature": "tts",+ "engine": "piper",+ "auxRole": "sidecar",+ "language": "pl",+ "locale": "pl_PL",+ "region": "PL",+ "voice": "jarvis_wg_glos",+ "quality": "medium",+ "numSpeakers": 1,+ "aliases": [],+ "files": [+ {+ "name": "pl_PL-jarvis_wg_glos-medium.mnn",+ "sizeBytes": 16977372,+ "installPath": "bin/piper/pl/pl_PL/jarvis_wg_glos/medium/pl_PL-jarvis_wg_glos-medium.mnn",+ "url": "https://offline-translator.davidv.dev/tts/1/pl/pl_PL/jarvis_wg_glos/medium/pl_PL-jarvis_wg_glos-medium.mnn",+ "role": "model",+ "priority": 0+ },+ {+ "name": "pl_PL-jarvis_wg_glos-medium.onnx.json",+ "sizeBytes": 7104,+ "installPath": "bin/piper/pl/pl_PL/jarvis_wg_glos/medium/pl_PL-jarvis_wg_glos-medium.onnx.json",+ "url": "https://offline-translator.davidv.dev/tts/1/pl/pl_PL/jarvis_wg_glos/medium/pl_PL-jarvis_wg_glos-medium.onnx.json",+ "role": "sidecar",+ "priority": 0+ }+ ],+ "dependsOn": [+ "tts-espeak-dict-pl"+ ],+ "sampleUrl": "https://offline-translator.davidv.dev/samples_ogg/pl/jarvis_wg_glos_medium.opus"+ },+ "tts-piper-pt-br-cadu-medium": {+ "feature": "tts",+ "engine": "piper",+ "auxRole": "sidecar",+ "language": "pt",+ "locale": "pt_BR",+ "region": "BR",+ "voice": "cadu",+ "quality": "medium",+ "numSpeakers": 1,+ "aliases": [],+ "files": [+ {+ "name": "pt_BR-cadu-medium.mnn",+ "sizeBytes": 16763672,+ "installPath": "bin/piper/pt/pt_BR/cadu/medium/pt_BR-cadu-medium.mnn",+ "url": "https://offline-translator.davidv.dev/tts/1/pt/pt_BR/cadu/medium/pt_BR-cadu-medium.mnn",+ "role": "model",+ "priority": 0+ },+ {+ "name": "pt_BR-cadu-medium.onnx.json",+ "sizeBytes": 5040,+ "installPath": "bin/piper/pt/pt_BR/cadu/medium/pt_BR-cadu-medium.onnx.json",+ "url": "https://offline-translator.davidv.dev/tts/1/pt/pt_BR/cadu/medium/pt_BR-cadu-medium.onnx.json",+ "role": "sidecar",+ "priority": 0+ }+ ],+ "dependsOn": [+ "tts-espeak-dict-pt"+ ],+ "sampleUrl": "https://offline-translator.davidv.dev/samples_ogg/pt/cadu_medium.opus"+ },+ "tts-piper-pt-br-jeff-medium": {+ "feature": "tts",+ "engine": "piper",+ "auxRole": "sidecar",+ "language": "pt",+ "locale": "pt_BR",+ "region": "BR",+ "voice": "jeff",+ "quality": "medium",+ "numSpeakers": 1,+ "aliases": [],+ "files": [+ {+ "name": "pt_BR-jeff-medium.mnn",+ "sizeBytes": 16763672,+ "installPath": "bin/piper/pt/pt_BR/jeff/medium/pt_BR-jeff-medium.mnn",+ "url": "https://offline-translator.davidv.dev/tts/1/pt/pt_BR/jeff/medium/pt_BR-jeff-medium.mnn",+ "role": "model",+ "priority": 0+ },+ {+ "name": "pt_BR-jeff-medium.onnx.json",+ "sizeBytes": 5041,+ "installPath": "bin/piper/pt/pt_BR/jeff/medium/pt_BR-jeff-medium.onnx.json",+ "url": "https://offline-translator.davidv.dev/tts/1/pt/pt_BR/jeff/medium/pt_BR-jeff-medium.onnx.json",+ "role": "sidecar",+ "priority": 0+ }+ ],+ "dependsOn": [+ "tts-espeak-dict-pt"+ ],+ "sampleUrl": "https://offline-translator.davidv.dev/samples_ogg/pt/jeff_medium.opus"+ },+ "tts-piper-pt-br-faber-medium": {+ "feature": "tts",+ "engine": "piper",+ "auxRole": "sidecar",+ "language": "pt",+ "locale": "pt_BR",+ "region": "BR",+ "voice": "faber",+ "quality": "medium",+ "numSpeakers": 1,+ "aliases": [],+ "files": [+ {+ "name": "pt_BR-faber-medium.mnn",+ "sizeBytes": 16864416,+ "installPath": "bin/piper/pt/pt_BR/faber/medium/pt_BR-faber-medium.mnn",+ "url": "https://offline-translator.davidv.dev/tts/1/pt/pt_BR/faber/medium/pt_BR-faber-medium.mnn",+ "role": "model",+ "priority": 0+ },+ {+ "name": "pt_BR-faber-medium.onnx.json",+ "sizeBytes": 4855,+ "installPath": "bin/piper/pt/pt_BR/faber/medium/pt_BR-faber-medium.onnx.json",+ "url": "https://offline-translator.davidv.dev/tts/1/pt/pt_BR/faber/medium/pt_BR-faber-medium.onnx.json",+ "role": "sidecar",+ "priority": 0+ }+ ],+ "dependsOn": [+ "tts-espeak-dict-pt"+ ],+ "sampleUrl": "https://offline-translator.davidv.dev/samples_ogg/pt/faber_medium.opus"+ },+ "tts-piper-pt-br-edresson-low": {+ "feature": "tts",+ "engine": "piper",+ "auxRole": "sidecar",+ "language": "pt",+ "locale": "pt_BR",+ "region": "BR",+ "voice": "edresson",+ "quality": "low",+ "numSpeakers": 1,+ "aliases": [+ "pt-br-edresson-low"+ ],+ "files": [+ {+ "name": "pt_BR-edresson-low.mnn",+ "sizeBytes": 16767648,+ "installPath": "bin/piper/pt/pt_BR/edresson/low/pt_BR-edresson-low.mnn",+ "url": "https://offline-translator.davidv.dev/tts/1/pt/pt_BR/edresson/low/pt_BR-edresson-low.mnn",+ "role": "model",+ "priority": 0+ },+ {+ "name": "pt_BR-edresson-low.onnx.json",+ "sizeBytes": 4168,+ "installPath": "bin/piper/pt/pt_BR/edresson/low/pt_BR-edresson-low.onnx.json",+ "url": "https://offline-translator.davidv.dev/tts/1/pt/pt_BR/edresson/low/pt_BR-edresson-low.onnx.json",+ "role": "sidecar",+ "priority": 0+ }+ ],+ "dependsOn": [+ "tts-espeak-dict-pt"+ ],+ "sampleUrl": "https://offline-translator.davidv.dev/samples_ogg/pt/edresson_low.opus"+ },+ "tts-piper-pt-pt-tugão-medium": {+ "feature": "tts",+ "engine": "piper",+ "auxRole": "sidecar",+ "language": "pt",+ "locale": "pt_PT",+ "region": "PT",+ "voice": "tugão",+ "quality": "medium",+ "numSpeakers": 1,+ "aliases": [],+ "files": [+ {+ "name": "pt_PT-tugão-medium.mnn",+ "sizeBytes": 16864416,+ "installPath": "bin/piper/pt/pt_PT/tug-o/medium/pt_PT-tugão-medium.mnn",+ "url": "https://offline-translator.davidv.dev/tts/1/pt/pt_PT/tug-o/medium/pt_PT-tugão-medium.mnn",+ "role": "model",+ "priority": 0+ },+ {+ "name": "pt_PT-tugão-medium.onnx.json",+ "sizeBytes": 5026,+ "installPath": "bin/piper/pt/pt_PT/tug-o/medium/pt_PT-tugão-medium.onnx.json",+ "url": "https://offline-translator.davidv.dev/tts/1/pt/pt_PT/tug-o/medium/pt_PT-tugão-medium.onnx.json",+ "role": "sidecar",+ "priority": 0+ }+ ],+ "dependsOn": [+ "tts-espeak-dict-pt"+ ],+ "sampleUrl": "https://offline-translator.davidv.dev/samples_ogg/pt/tugão_medium.opus"+ },+ "tts-piper-ro-ro-mihai-medium": {+ "feature": "tts",+ "engine": "piper",+ "auxRole": "sidecar",+ "language": "ro",+ "locale": "ro_RO",+ "region": "RO",+ "voice": "mihai",+ "quality": "medium",+ "numSpeakers": 1,+ "aliases": [],+ "files": [+ {+ "name": "ro_RO-mihai-medium.mnn",+ "sizeBytes": 16864416,+ "installPath": "bin/piper/ro/ro_RO/mihai/medium/ro_RO-mihai-medium.mnn",+ "url": "https://offline-translator.davidv.dev/tts/1/ro/ro_RO/mihai/medium/ro_RO-mihai-medium.mnn",+ "role": "model",+ "priority": 0+ },+ {+ "name": "ro_RO-mihai-medium.onnx.json",+ "sizeBytes": 4877,+ "installPath": "bin/piper/ro/ro_RO/mihai/medium/ro_RO-mihai-medium.onnx.json",+ "url": "https://offline-translator.davidv.dev/tts/1/ro/ro_RO/mihai/medium/ro_RO-mihai-medium.onnx.json",+ "role": "sidecar",+ "priority": 0+ }+ ],+ "dependsOn": [+ "tts-espeak-dict-ro"+ ],+ "sampleUrl": "https://offline-translator.davidv.dev/samples_ogg/ro/mihai_medium.opus"+ },+ "tts-piper-ru-ru-denis-medium": {+ "feature": "tts",+ "engine": "piper",+ "auxRole": "sidecar",+ "language": "ru",+ "locale": "ru_RU",+ "region": "RU",+ "voice": "denis",+ "quality": "medium",+ "numSpeakers": 1,+ "aliases": [],+ "files": [+ {+ "name": "ru_RU-denis-medium.mnn",+ "sizeBytes": 16864416,+ "installPath": "bin/piper/ru/ru_RU/denis/medium/ru_RU-denis-medium.mnn",+ "url": "https://offline-translator.davidv.dev/tts/1/ru/ru_RU/denis/medium/ru_RU-denis-medium.mnn",+ "role": "model",+ "priority": 0+ },+ {+ "name": "ru_RU-denis-medium.onnx.json",+ "sizeBytes": 4823,+ "installPath": "bin/piper/ru/ru_RU/denis/medium/ru_RU-denis-medium.onnx.json",+ "url": "https://offline-translator.davidv.dev/tts/1/ru/ru_RU/denis/medium/ru_RU-denis-medium.onnx.json",+ "role": "sidecar",+ "priority": 0+ }+ ],+ "dependsOn": [+ "tts-espeak-dict-ru"+ ],+ "sampleUrl": "https://offline-translator.davidv.dev/samples_ogg/ru/denis_medium.opus"+ },+ "tts-piper-ru-ru-dmitri-medium": {+ "feature": "tts",+ "engine": "piper",+ "auxRole": "sidecar",+ "language": "ru",+ "locale": "ru_RU",+ "region": "RU",+ "voice": "dmitri",+ "quality": "medium",+ "numSpeakers": 1,+ "aliases": [],+ "files": [+ {+ "name": "ru_RU-dmitri-medium.mnn",+ "sizeBytes": 16864416,+ "installPath": "bin/piper/ru/ru_RU/dmitri/medium/ru_RU-dmitri-medium.mnn",+ "url": "https://offline-translator.davidv.dev/tts/1/ru/ru_RU/dmitri/medium/ru_RU-dmitri-medium.mnn",+ "role": "model",+ "priority": 0+ },+ {+ "name": "ru_RU-dmitri-medium.onnx.json",+ "sizeBytes": 4824,+ "installPath": "bin/piper/ru/ru_RU/dmitri/medium/ru_RU-dmitri-medium.onnx.json",+ "url": "https://offline-translator.davidv.dev/tts/1/ru/ru_RU/dmitri/medium/ru_RU-dmitri-medium.onnx.json",+ "role": "sidecar",+ "priority": 0+ }+ ],+ "dependsOn": [+ "tts-espeak-dict-ru"+ ],+ "sampleUrl": "https://offline-translator.davidv.dev/samples_ogg/ru/dmitri_medium.opus"+ },+ "tts-piper-ru-ru-irina-medium": {+ "feature": "tts",+ "engine": "piper",+ "auxRole": "sidecar",+ "language": "ru",+ "locale": "ru_RU",+ "region": "RU",+ "voice": "irina",+ "quality": "medium",+ "numSpeakers": 1,+ "aliases": [+ "ru-irinia-medium"+ ],+ "files": [+ {+ "name": "ru_RU-irina-medium.mnn",+ "sizeBytes": 16864416,+ "installPath": "bin/piper/ru/ru_RU/irina/medium/ru_RU-irina-medium.mnn",+ "url": "https://offline-translator.davidv.dev/tts/1/ru/ru_RU/irina/medium/ru_RU-irina-medium.mnn",+ "role": "model",+ "priority": 0+ },+ {+ "name": "ru_RU-irina-medium.onnx.json",+ "sizeBytes": 4765,+ "installPath": "bin/piper/ru/ru_RU/irina/medium/ru_RU-irina-medium.onnx.json",+ "url": "https://offline-translator.davidv.dev/tts/1/ru/ru_RU/irina/medium/ru_RU-irina-medium.onnx.json",+ "role": "sidecar",+ "priority": 0+ }+ ],+ "dependsOn": [+ "tts-espeak-dict-ru"+ ],+ "sampleUrl": "https://offline-translator.davidv.dev/samples_ogg/ru/irina_medium.opus"+ },+ "tts-piper-ru-ru-ruslan-medium": {+ "feature": "tts",+ "engine": "piper",+ "auxRole": "sidecar",+ "language": "ru",+ "locale": "ru_RU",+ "region": "RU",+ "voice": "ruslan",+ "quality": "medium",+ "numSpeakers": 1,+ "aliases": [],+ "files": [+ {+ "name": "ru_RU-ruslan-medium.mnn",+ "sizeBytes": 16864416,+ "installPath": "bin/piper/ru/ru_RU/ruslan/medium/ru_RU-ruslan-medium.mnn",+ "url": "https://offline-translator.davidv.dev/tts/1/ru/ru_RU/ruslan/medium/ru_RU-ruslan-medium.mnn",+ "role": "model",+ "priority": 0+ },+ {+ "name": "ru_RU-ruslan-medium.onnx.json",+ "sizeBytes": 4882,+ "installPath": "bin/piper/ru/ru_RU/ruslan/medium/ru_RU-ruslan-medium.onnx.json",+ "url": "https://offline-translator.davidv.dev/tts/1/ru/ru_RU/ruslan/medium/ru_RU-ruslan-medium.onnx.json",+ "role": "sidecar",+ "priority": 0+ }+ ],+ "dependsOn": [+ "tts-espeak-dict-ru"+ ],+ "sampleUrl": "https://offline-translator.davidv.dev/samples_ogg/ru/ruslan_medium.opus"+ },+ "tts-piper-sk-sk-lili-medium": {+ "feature": "tts",+ "engine": "piper",+ "auxRole": "sidecar",+ "language": "sk",+ "locale": "sk_SK",+ "region": "SK",+ "voice": "lili",+ "quality": "medium",+ "numSpeakers": 1,+ "aliases": [],+ "files": [+ {+ "name": "sk_SK-lili-medium.mnn",+ "sizeBytes": 16864416,+ "installPath": "bin/piper/sk/sk_SK/lili/medium/sk_SK-lili-medium.mnn",+ "url": "https://offline-translator.davidv.dev/tts/1/sk/sk_SK/lili/medium/sk_SK-lili-medium.mnn",+ "role": "model",+ "priority": 0+ },+ {+ "name": "sk_SK-lili-medium.onnx.json",+ "sizeBytes": 4963,+ "installPath": "bin/piper/sk/sk_SK/lili/medium/sk_SK-lili-medium.onnx.json",+ "url": "https://offline-translator.davidv.dev/tts/1/sk/sk_SK/lili/medium/sk_SK-lili-medium.onnx.json",+ "role": "sidecar",+ "priority": 0+ }+ ],+ "dependsOn": [+ "tts-espeak-dict-sk"+ ],+ "sampleUrl": "https://offline-translator.davidv.dev/samples_ogg/sk/lili_medium.opus"+ },+ "tts-piper-sl-si-artur-medium": {+ "feature": "tts",+ "engine": "piper",+ "auxRole": "sidecar",+ "language": "sl",+ "locale": "sl_SI",+ "region": "SI",+ "voice": "artur",+ "quality": "medium",+ "numSpeakers": 1,+ "aliases": [],+ "files": [+ {+ "name": "sl_SI-artur-medium.mnn",+ "sizeBytes": 16862912,+ "installPath": "bin/piper/sl/sl_SI/artur/medium/sl_SI-artur-medium.mnn",+ "url": "https://offline-translator.davidv.dev/tts/1/sl/sl_SI/artur/medium/sl_SI-artur-medium.mnn",+ "role": "model",+ "priority": 0+ },+ {+ "name": "sl_SI-artur-medium.onnx.json",+ "sizeBytes": 4970,+ "installPath": "bin/piper/sl/sl_SI/artur/medium/sl_SI-artur-medium.onnx.json",+ "url": "https://offline-translator.davidv.dev/tts/1/sl/sl_SI/artur/medium/sl_SI-artur-medium.onnx.json",+ "role": "sidecar",+ "priority": 0+ }+ ],+ "dependsOn": [+ "tts-espeak-dict-sl"+ ],+ "sampleUrl": "https://offline-translator.davidv.dev/samples_ogg/sl/artur_medium.opus"+ },+ "tts-piper-sq-al-edon-medium": {+ "feature": "tts",+ "engine": "piper",+ "auxRole": "sidecar",+ "language": "sq",+ "locale": "sq_AL",+ "region": "AL",+ "voice": "edon",+ "quality": "medium",+ "numSpeakers": 1,+ "aliases": [],+ "files": [+ {+ "name": "sq_AL-edon-medium.mnn",+ "sizeBytes": 16974228,+ "installPath": "bin/piper/sq/sq_AL/edon/medium/sq_AL-edon-medium.mnn",+ "url": "https://offline-translator.davidv.dev/tts/1/sq/sq_AL/edon/medium/sq_AL-edon-medium.mnn",+ "role": "model",+ "priority": 0+ },+ {+ "name": "sq_AL-edon-medium.onnx.json",+ "sizeBytes": 4961,+ "installPath": "bin/piper/sq/sq_AL/edon/medium/sq_AL-edon-medium.onnx.json",+ "url": "https://offline-translator.davidv.dev/tts/1/sq/sq_AL/edon/medium/sq_AL-edon-medium.onnx.json",+ "role": "sidecar",+ "priority": 0+ }+ ],+ "dependsOn": [+ "tts-espeak-dict-sq"+ ],+ "sampleUrl": "https://offline-translator.davidv.dev/samples_ogg/sq/edon_medium.opus"+ },+ "tts-piper-sr-rs-serbski-institut-medium": {+ "feature": "tts",+ "engine": "piper",+ "auxRole": "sidecar",+ "language": "sr",+ "locale": "sr_RS",+ "region": "RS",+ "voice": "serbski_institut",+ "quality": "medium",+ "numSpeakers": 2,+ "defaultSpeakerId": 0,+ "aliases": [],+ "files": [+ {+ "name": "sr_RS-serbski_institut-medium.mnn",+ "sizeBytes": 20322068,+ "installPath": "bin/piper/sr/sr_RS/serbski_institut/medium/sr_RS-serbski_institut-medium.mnn",+ "url": "https://offline-translator.davidv.dev/tts/1/sr/sr_RS/serbski_institut/medium/sr_RS-serbski_institut-medium.mnn",+ "role": "model",+ "priority": 0+ },+ {+ "name": "sr_RS-serbski_institut-medium.onnx.json",+ "sizeBytes": 4999,+ "installPath": "bin/piper/sr/sr_RS/serbski_institut/medium/sr_RS-serbski_institut-medium.onnx.json",+ "url": "https://offline-translator.davidv.dev/tts/1/sr/sr_RS/serbski_institut/medium/sr_RS-serbski_institut-medium.onnx.json",+ "role": "sidecar",+ "priority": 0+ }+ ],+ "dependsOn": [+ "tts-espeak-dict-sr"+ ],+ "sampleUrl": "https://offline-translator.davidv.dev/samples_ogg/sr/serbski_institut_medium.opus"+ },+ "tts-piper-sv-se-nst-medium": {+ "feature": "tts",+ "engine": "piper",+ "auxRole": "sidecar",+ "language": "sv",+ "locale": "sv_SE",+ "region": "SE",+ "voice": "nst",+ "quality": "medium",+ "numSpeakers": 1,+ "aliases": [],+ "files": [+ {+ "name": "sv_SE-nst-medium.mnn",+ "sizeBytes": 16767648,+ "installPath": "bin/piper/sv/sv_SE/nst/medium/sv_SE-nst-medium.mnn",+ "url": "https://offline-translator.davidv.dev/tts/1/sv/sv_SE/nst/medium/sv_SE-nst-medium.mnn",+ "role": "model",+ "priority": 0+ },+ {+ "name": "sv_SE-nst-medium.onnx.json",+ "sizeBytes": 4157,+ "installPath": "bin/piper/sv/sv_SE/nst/medium/sv_SE-nst-medium.onnx.json",+ "url": "https://offline-translator.davidv.dev/tts/1/sv/sv_SE/nst/medium/sv_SE-nst-medium.onnx.json",+ "role": "sidecar",+ "priority": 0+ }+ ],+ "dependsOn": [+ "tts-espeak-dict-sv"+ ],+ "sampleUrl": "https://offline-translator.davidv.dev/samples_ogg/sv/nst_medium.opus"+ },+ "tts-piper-sv-se-alma-medium": {+ "feature": "tts",+ "engine": "piper",+ "auxRole": "sidecar",+ "language": "sv",+ "locale": "sv_SE",+ "region": "SE",+ "voice": "alma",+ "quality": "medium",+ "numSpeakers": 1,+ "aliases": [],+ "files": [+ {+ "name": "sv_SE-alma-medium.mnn",+ "sizeBytes": 16884756,+ "installPath": "bin/piper/sv/sv_SE/alma/medium/sv_SE-alma-medium.mnn",+ "url": "https://offline-translator.davidv.dev/tts/1/sv/sv_SE/alma/medium/sv_SE-alma-medium.mnn",+ "role": "model",+ "priority": 0+ },+ {+ "name": "sv_SE-alma-medium.onnx.json",+ "sizeBytes": 6059,+ "installPath": "bin/piper/sv/sv_SE/alma/medium/sv_SE-alma-medium.onnx.json",+ "url": "https://offline-translator.davidv.dev/tts/1/sv/sv_SE/alma/medium/sv_SE-alma-medium.onnx.json",+ "role": "sidecar",+ "priority": 0+ }+ ],+ "dependsOn": [+ "tts-espeak-dict-sv"+ ],+ "sampleUrl": "https://offline-translator.davidv.dev/samples_ogg/sv/alma_medium.opus"+ },+ "tts-piper-sv-se-lisa-medium": {+ "feature": "tts",+ "engine": "piper",+ "auxRole": "sidecar",+ "language": "sv",+ "locale": "sv_SE",+ "region": "SE",+ "voice": "lisa",+ "quality": "medium",+ "numSpeakers": 1,+ "aliases": [],+ "files": [+ {+ "name": "sv_SE-lisa-medium.mnn",+ "sizeBytes": 16974228,+ "installPath": "bin/piper/sv/sv_SE/lisa/medium/sv_SE-lisa-medium.mnn",+ "url": "https://offline-translator.davidv.dev/tts/1/sv/sv_SE/lisa/medium/sv_SE-lisa-medium.mnn",+ "role": "model",+ "priority": 0+ },+ {+ "name": "sv_SE-lisa-medium.onnx.json",+ "sizeBytes": 7239,+ "installPath": "bin/piper/sv/sv_SE/lisa/medium/sv_SE-lisa-medium.onnx.json",+ "url": "https://offline-translator.davidv.dev/tts/1/sv/sv_SE/lisa/medium/sv_SE-lisa-medium.onnx.json",+ "role": "sidecar",+ "priority": 0+ }+ ],+ "dependsOn": [+ "tts-espeak-dict-sv"+ ],+ "sampleUrl": "https://offline-translator.davidv.dev/samples_ogg/sv/lisa_medium.opus"+ },+ "tts-piper-sw-cd-lanfrica-medium": {+ "feature": "tts",+ "engine": "piper",+ "auxRole": "sidecar",+ "language": "sw",+ "locale": "sw_CD",+ "region": "CD",+ "voice": "lanfrica",+ "quality": "medium",+ "numSpeakers": 1,+ "aliases": [],+ "files": [+ {+ "name": "sw_CD-lanfrica-medium.mnn",+ "sizeBytes": 16864428,+ "installPath": "bin/piper/sw/sw_CD/lanfrica/medium/sw_CD-lanfrica-medium.mnn",+ "url": "https://offline-translator.davidv.dev/tts/1/sw/sw_CD/lanfrica/medium/sw_CD-lanfrica-medium.mnn",+ "role": "model",+ "priority": 0+ },+ {+ "name": "sw_CD-lanfrica-medium.onnx.json",+ "sizeBytes": 4905,+ "installPath": "bin/piper/sw/sw_CD/lanfrica/medium/sw_CD-lanfrica-medium.onnx.json",+ "url": "https://offline-translator.davidv.dev/tts/1/sw/sw_CD/lanfrica/medium/sw_CD-lanfrica-medium.onnx.json",+ "role": "sidecar",+ "priority": 0+ }+ ],+ "dependsOn": [+ "tts-espeak-dict-sw"+ ],+ "sampleUrl": "https://offline-translator.davidv.dev/samples_ogg/sw/lanfrica_medium.opus"+ },+ "tts-mms-ta-in-standard-mms": {+ "feature": "tts",+ "engine": "mms",+ "auxRole": "tokens",+ "language": "ta",+ "locale": "ta_IN",+ "region": "IN",+ "voice": "standard",+ "quality": "medium",+ "numSpeakers": 1,+ "aliases": [],+ "files": [+ {+ "name": "model.mnn",+ "sizeBytes": 29604708,+ "installPath": "bin/mms/ta/ta_IN/standard/medium/model.mnn",+ "url": "https://offline-translator.davidv.dev/tts/1/ta/ta_IN/standard/medium/model.mnn",+ "role": "model",+ "priority": 0+ },+ {+ "name": "tokens.txt",+ "sizeBytes": 375,+ "installPath": "bin/mms/ta/ta_IN/standard/medium/tokens.txt",+ "url": "https://offline-translator.davidv.dev/tts/1/ta/ta_IN/standard/medium/tokens.txt",+ "role": "tokens",+ "priority": 0+ }+ ],+ "dependsOn": [],+ "sampleUrl": "https://offline-translator.davidv.dev/samples_ogg/ta/standard_medium.opus"+ },+ "tts-piper-te-in-maya-medium": {+ "feature": "tts",+ "engine": "piper",+ "auxRole": "sidecar",+ "language": "te",+ "locale": "te_IN",+ "region": "IN",+ "voice": "maya",+ "quality": "medium",+ "numSpeakers": 1,+ "aliases": [],+ "files": [+ {+ "name": "te_IN-maya-medium.mnn",+ "sizeBytes": 16763672,+ "installPath": "bin/piper/te/te_IN/maya/medium/te_IN-maya-medium.mnn",+ "url": "https://offline-translator.davidv.dev/tts/1/te/te_IN/maya/medium/te_IN-maya-medium.mnn",+ "role": "model",+ "priority": 0+ },+ {+ "name": "te_IN-maya-medium.onnx.json",+ "sizeBytes": 5040,+ "installPath": "bin/piper/te/te_IN/maya/medium/te_IN-maya-medium.onnx.json",+ "url": "https://offline-translator.davidv.dev/tts/1/te/te_IN/maya/medium/te_IN-maya-medium.onnx.json",+ "role": "sidecar",+ "priority": 0+ }+ ],+ "dependsOn": [+ "tts-espeak-dict-te"+ ],+ "sampleUrl": "https://offline-translator.davidv.dev/samples_ogg/te/maya_medium.opus"+ },+ "tts-piper-te-in-padmavathi-medium": {+ "feature": "tts",+ "engine": "piper",+ "auxRole": "sidecar",+ "language": "te",+ "locale": "te_IN",+ "region": "IN",+ "voice": "padmavathi",+ "quality": "medium",+ "numSpeakers": 1,+ "aliases": [],+ "files": [+ {+ "name": "te_IN-padmavathi-medium.mnn",+ "sizeBytes": 16977372,+ "installPath": "bin/piper/te/te_IN/padmavathi/medium/te_IN-padmavathi-medium.mnn",+ "url": "https://offline-translator.davidv.dev/tts/1/te/te_IN/padmavathi/medium/te_IN-padmavathi-medium.mnn",+ "role": "model",+ "priority": 0+ },+ {+ "name": "te_IN-padmavathi-medium.onnx.json",+ "sizeBytes": 4974,+ "installPath": "bin/piper/te/te_IN/padmavathi/medium/te_IN-padmavathi-medium.onnx.json",+ "url": "https://offline-translator.davidv.dev/tts/1/te/te_IN/padmavathi/medium/te_IN-padmavathi-medium.onnx.json",+ "role": "sidecar",+ "priority": 0+ }+ ],+ "dependsOn": [+ "tts-espeak-dict-te"+ ],+ "sampleUrl": "https://offline-translator.davidv.dev/samples_ogg/te/padmavathi_medium.opus"+ },+ "tts-piper-te-in-venkatesh-medium": {+ "feature": "tts",+ "engine": "piper",+ "auxRole": "sidecar",+ "language": "te",+ "locale": "te_IN",+ "region": "IN",+ "voice": "venkatesh",+ "quality": "medium",+ "numSpeakers": 1,+ "aliases": [],+ "files": [+ {+ "name": "te_IN-venkatesh-medium.mnn",+ "sizeBytes": 16977372,+ "installPath": "bin/piper/te/te_IN/venkatesh/medium/te_IN-venkatesh-medium.mnn",+ "url": "https://offline-translator.davidv.dev/tts/1/te/te_IN/venkatesh/medium/te_IN-venkatesh-medium.mnn",+ "role": "model",+ "priority": 0+ },+ {+ "name": "te_IN-venkatesh-medium.onnx.json",+ "sizeBytes": 4973,+ "installPath": "bin/piper/te/te_IN/venkatesh/medium/te_IN-venkatesh-medium.onnx.json",+ "url": "https://offline-translator.davidv.dev/tts/1/te/te_IN/venkatesh/medium/te_IN-venkatesh-medium.onnx.json",+ "role": "sidecar",+ "priority": 0+ }+ ],+ "dependsOn": [+ "tts-espeak-dict-te"+ ],+ "sampleUrl": "https://offline-translator.davidv.dev/samples_ogg/te/venkatesh_medium.opus"+ },+ "tts-mms-th-th-standard-mms": {+ "feature": "tts",+ "engine": "mms",+ "auxRole": "tokens",+ "language": "th",+ "locale": "th_TH",+ "region": "TH",+ "voice": "standard",+ "quality": "medium",+ "numSpeakers": 1,+ "aliases": [],+ "files": [+ {+ "name": "model.mnn",+ "sizeBytes": 29614692,+ "installPath": "bin/mms/th/th_TH/standard/medium/model.mnn",+ "url": "https://offline-translator.davidv.dev/tts/1/th/th_TH/standard/medium/model.mnn",+ "role": "model",+ "priority": 0+ },+ {+ "name": "tokens.txt",+ "sizeBytes": 473,+ "installPath": "bin/mms/th/th_TH/standard/medium/tokens.txt",+ "url": "https://offline-translator.davidv.dev/tts/1/th/th_TH/standard/medium/tokens.txt",+ "role": "tokens",+ "priority": 0+ }+ ],+ "dependsOn": [],+ "sampleUrl": "https://offline-translator.davidv.dev/samples_ogg/th/standard_medium.opus"+ },+ "tts-mms-tl-ph-standard-mms": {+ "feature": "tts",+ "engine": "mms",+ "auxRole": "tokens",+ "language": "tl",+ "locale": "tl_PH",+ "region": "PH",+ "voice": "standard",+ "quality": "medium",+ "numSpeakers": 1,+ "aliases": [],+ "files": [+ {+ "name": "model.mnn",+ "sizeBytes": 29593188,+ "installPath": "bin/mms/tl/tl_PH/standard/medium/model.mnn",+ "url": "https://offline-translator.davidv.dev/tts/1/tl/tl_PH/standard/medium/model.mnn",+ "role": "model",+ "priority": 0+ },+ {+ "name": "tokens.txt",+ "sizeBytes": 337,+ "installPath": "bin/mms/tl/tl_PH/standard/medium/tokens.txt",+ "url": "https://offline-translator.davidv.dev/tts/1/tl/tl_PH/standard/medium/tokens.txt",+ "role": "tokens",+ "priority": 0+ }+ ],+ "dependsOn": [],+ "sampleUrl": "https://offline-translator.davidv.dev/samples_ogg/tl/standard_medium.opus"+ },+ "tts-piper-tr-tr-dfki-medium": {+ "feature": "tts",+ "engine": "piper",+ "auxRole": "sidecar",+ "language": "tr",+ "locale": "tr_TR",+ "region": "TR",+ "voice": "dfki",+ "quality": "medium",+ "numSpeakers": 1,+ "aliases": [],+ "files": [+ {+ "name": "tr_TR-dfki-medium.mnn",+ "sizeBytes": 16864416,+ "installPath": "bin/piper/tr/tr_TR/dfki/medium/tr_TR-dfki-medium.mnn",+ "url": "https://offline-translator.davidv.dev/tts/1/tr/tr_TR/dfki/medium/tr_TR-dfki-medium.mnn",+ "role": "model",+ "priority": 0+ },+ {+ "name": "tr_TR-dfki-medium.onnx.json",+ "sizeBytes": 4960,+ "installPath": "bin/piper/tr/tr_TR/dfki/medium/tr_TR-dfki-medium.onnx.json",+ "url": "https://offline-translator.davidv.dev/tts/1/tr/tr_TR/dfki/medium/tr_TR-dfki-medium.onnx.json",+ "role": "sidecar",+ "priority": 0+ }+ ],+ "dependsOn": [+ "tts-espeak-dict-tr"+ ],+ "sampleUrl": "https://offline-translator.davidv.dev/samples_ogg/tr/dfki_medium.opus"+ },+ "tts-mms-ug-cn-standard-mms": {+ "feature": "tts",+ "engine": "mms",+ "auxRole": "tokens",+ "language": "ug",+ "locale": "ug_CN",+ "region": "CN",+ "voice": "standard",+ "quality": "medium",+ "numSpeakers": 1,+ "aliases": [],+ "files": [+ {+ "name": "model.mnn",+ "sizeBytes": 29736804,+ "installPath": "bin/mms/ug/ug_CN/standard/medium/model.mnn",+ "url": "https://offline-translator.davidv.dev/tts/1/ug/ug_CN/standard/medium/model.mnn",+ "role": "model",+ "priority": 0+ },+ {+ "name": "tokens.txt",+ "sizeBytes": 227,+ "installPath": "bin/mms/ug/ug_CN/standard/medium/tokens.txt",+ "url": "https://offline-translator.davidv.dev/tts/1/ug/ug_CN/standard/medium/tokens.txt",+ "role": "tokens",+ "priority": 0+ }+ ],+ "dependsOn": [],+ "sampleUrl": "https://offline-translator.davidv.dev/samples_ogg/ug/standard_medium.opus"+ },+ "tts-piper-uk-ua-ukrainian-tts-medium": {+ "feature": "tts",+ "engine": "piper",+ "auxRole": "sidecar",+ "language": "uk",+ "locale": "uk_UA",+ "region": "UA",+ "voice": "ukrainian_tts",+ "quality": "medium",+ "numSpeakers": 3,+ "defaultSpeakerId": 0,+ "aliases": [],+ "files": [+ {+ "name": "uk_UA-ukrainian_tts-medium.mnn",+ "sizeBytes": 20324116,+ "installPath": "bin/piper/uk/uk_UA/ukrainian_tts/medium/uk_UA-ukrainian_tts-medium.mnn",+ "url": "https://offline-translator.davidv.dev/tts/1/uk/uk_UA/ukrainian_tts/medium/uk_UA-ukrainian_tts-medium.mnn",+ "role": "model",+ "priority": 0+ },+ {+ "name": "uk_UA-ukrainian_tts-medium.onnx.json",+ "sizeBytes": 2002,+ "installPath": "bin/piper/uk/uk_UA/ukrainian_tts/medium/uk_UA-ukrainian_tts-medium.onnx.json",+ "url": "https://offline-translator.davidv.dev/tts/1/uk/uk_UA/ukrainian_tts/medium/uk_UA-ukrainian_tts-medium.onnx.json",+ "role": "sidecar",+ "priority": 0+ }+ ],+ "dependsOn": [+ "tts-espeak-dict-uk"+ ],+ "sampleUrl": "https://offline-translator.davidv.dev/samples_ogg/uk/ukrainian_tts_medium.opus"+ },+ "tts-piper-uk-ua-lada-x-low": {+ "feature": "tts",+ "engine": "piper",+ "auxRole": "sidecar",+ "language": "uk",+ "locale": "uk_UA",+ "region": "UA",+ "voice": "lada",+ "quality": "x_low",+ "numSpeakers": 1,+ "aliases": [+ "uk-lada-x-low"+ ],+ "files": [+ {+ "name": "uk_UA-lada-x_low.mnn",+ "sizeBytes": 5915616,+ "installPath": "bin/piper/uk/uk_UA/lada/x_low/uk_UA-lada-x_low.mnn",+ "url": "https://offline-translator.davidv.dev/tts/1/uk/uk_UA/lada/x_low/uk_UA-lada-x_low.mnn",+ "role": "model",+ "priority": 0+ },+ {+ "name": "uk_UA-lada-x_low.onnx.json",+ "sizeBytes": 4186,+ "installPath": "bin/piper/uk/uk_UA/lada/x_low/uk_UA-lada-x_low.onnx.json",+ "url": "https://offline-translator.davidv.dev/tts/1/uk/uk_UA/lada/x_low/uk_UA-lada-x_low.onnx.json",+ "role": "sidecar",+ "priority": 0+ }+ ],+ "dependsOn": [+ "tts-espeak-dict-uk"+ ],+ "sampleUrl": "https://offline-translator.davidv.dev/samples_ogg/uk/lada_x_low.opus"+ },+ "tts-piper-ur-pk-fasih-medium": {+ "feature": "tts",+ "engine": "piper",+ "auxRole": "sidecar",+ "language": "ur",+ "locale": "ur_PK",+ "region": "PK",+ "voice": "fasih",+ "quality": "medium",+ "numSpeakers": 1,+ "aliases": [],+ "files": [+ {+ "name": "ur_PK-fasih-medium.mnn",+ "sizeBytes": 16981908,+ "installPath": "bin/piper/ur/ur_PK/fasih/medium/ur_PK-fasih-medium.mnn",+ "url": "https://offline-translator.davidv.dev/tts/1/ur/ur_PK/fasih/medium/ur_PK-fasih-medium.mnn",+ "role": "model",+ "priority": 0+ },+ {+ "name": "ur_PK-fasih-medium.onnx.json",+ "sizeBytes": 3146,+ "installPath": "bin/piper/ur/ur_PK/fasih/medium/ur_PK-fasih-medium.onnx.json",+ "url": "https://offline-translator.davidv.dev/tts/1/ur/ur_PK/fasih/medium/ur_PK-fasih-medium.onnx.json",+ "role": "sidecar",+ "priority": 0+ }+ ],+ "dependsOn": [+ "tts-espeak-dict-ur"+ ],+ "sampleUrl": "https://offline-translator.davidv.dev/samples_ogg/ur/fasih_medium.opus"+ },+ "tts-piper-vi-vn-vais1000-medium": {+ "feature": "tts",+ "engine": "piper",+ "auxRole": "sidecar",+ "language": "vi",+ "locale": "vi_VN",+ "region": "VN",+ "voice": "vais1000",+ "quality": "medium",+ "numSpeakers": 1,+ "aliases": [],+ "files": [+ {+ "name": "vi_VN-vais1000-medium.mnn",+ "sizeBytes": 16864416,+ "installPath": "bin/piper/vi/vi_VN/vais1000/medium/vi_VN-vais1000-medium.mnn",+ "url": "https://offline-translator.davidv.dev/tts/1/vi/vi_VN/vais1000/medium/vi_VN-vais1000-medium.mnn",+ "role": "model",+ "priority": 0+ },+ {+ "name": "vi_VN-vais1000-medium.onnx.json",+ "sizeBytes": 4860,+ "installPath": "bin/piper/vi/vi_VN/vais1000/medium/vi_VN-vais1000-medium.onnx.json",+ "url": "https://offline-translator.davidv.dev/tts/1/vi/vi_VN/vais1000/medium/vi_VN-vais1000-medium.onnx.json",+ "role": "sidecar",+ "priority": 0+ }+ ],+ "dependsOn": [+ "tts-espeak-dict-vi"+ ],+ "sampleUrl": "https://offline-translator.davidv.dev/samples_ogg/vi/vais1000_medium.opus"+ },+ "tts-piper-vi-vn-25hours-single-low": {+ "feature": "tts",+ "engine": "piper",+ "auxRole": "sidecar",+ "language": "vi",+ "locale": "vi_VN",+ "region": "VN",+ "voice": "25hours_single",+ "quality": "low",+ "numSpeakers": 1,+ "aliases": [+ "vi-25hours-single-low"+ ],+ "files": [+ {+ "name": "vi_VN-25hours_single-low.mnn",+ "sizeBytes": 16767648,+ "installPath": "bin/piper/vi/vi_VN/25hours_single/low/vi_VN-25hours_single-low.mnn",+ "url": "https://offline-translator.davidv.dev/tts/1/vi/vi_VN/25hours_single/low/vi_VN-25hours_single-low.mnn",+ "role": "model",+ "priority": 0+ },+ {+ "name": "vi_VN-25hours_single-low.onnx.json",+ "sizeBytes": 4176,+ "installPath": "bin/piper/vi/vi_VN/25hours_single/low/vi_VN-25hours_single-low.onnx.json",+ "url": "https://offline-translator.davidv.dev/tts/1/vi/vi_VN/25hours_single/low/vi_VN-25hours_single-low.onnx.json",+ "role": "sidecar",+ "priority": 0+ }+ ],+ "dependsOn": [+ "tts-espeak-dict-vi"+ ],+ "sampleUrl": "https://offline-translator.davidv.dev/samples_ogg/vi/25hours_single_low.opus"+ },+ "tts-piper-vi-vn-vivos-x-low": {+ "feature": "tts",+ "engine": "piper",+ "auxRole": "sidecar",+ "language": "vi",+ "locale": "vi_VN",+ "region": "VN",+ "voice": "vivos",+ "quality": "x_low",+ "numSpeakers": 65,+ "defaultSpeakerId": 0,+ "aliases": [+ "vi-vivos-x-low"+ ],+ "files": [+ {+ "name": "vi_VN-vivos-x_low.mnn",+ "sizeBytes": 7842356,+ "installPath": "bin/piper/vi/vi_VN/vivos/x_low/vi_VN-vivos-x_low.mnn",+ "url": "https://offline-translator.davidv.dev/tts/1/vi/vi_VN/vivos/x_low/vi_VN-vivos-x_low.mnn",+ "role": "model",+ "priority": 0+ },+ {+ "name": "vi_VN-vivos-x_low.onnx.json",+ "sizeBytes": 5592,+ "installPath": "bin/piper/vi/vi_VN/vivos/x_low/vi_VN-vivos-x_low.onnx.json",+ "url": "https://offline-translator.davidv.dev/tts/1/vi/vi_VN/vivos/x_low/vi_VN-vivos-x_low.onnx.json",+ "role": "sidecar",+ "priority": 0+ }+ ],+ "dependsOn": [+ "tts-espeak-dict-vi"+ ],+ "sampleUrl": "https://offline-translator.davidv.dev/samples_ogg/vi/vivos_x_low.opus"+ },+ "tts-piper-zh-cn-huayan-medium": {+ "feature": "tts",+ "engine": "piper",+ "auxRole": "sidecar",+ "language": "zh",+ "locale": "zh_CN",+ "region": "CN",+ "voice": "huayan",+ "quality": "medium",+ "numSpeakers": 1,+ "aliases": [],+ "files": [+ {+ "name": "zh_CN-huayan-medium.mnn",+ "sizeBytes": 16864416,+ "installPath": "bin/piper/zh/zh_CN/huayan/medium/zh_CN-huayan-medium.mnn",+ "url": "https://offline-translator.davidv.dev/tts/1/zh/zh_CN/huayan/medium/zh_CN-huayan-medium.mnn",+ "role": "model",+ "priority": 0+ },+ {+ "name": "zh_CN-huayan-medium.onnx.json",+ "sizeBytes": 4822,+ "installPath": "bin/piper/zh/zh_CN/huayan/medium/zh_CN-huayan-medium.onnx.json",+ "url": "https://offline-translator.davidv.dev/tts/1/zh/zh_CN/huayan/medium/zh_CN-huayan-medium.onnx.json",+ "role": "sidecar",+ "priority": 0+ }+ ],+ "dependsOn": [+ "tts-espeak-dict-cmn"+ ],+ "sampleUrl": "https://offline-translator.davidv.dev/samples_ogg/zh/huayan_medium.opus"+ },+ "tts-piper-zh-cn-huayan-x-low": {+ "feature": "tts",+ "engine": "piper",+ "auxRole": "sidecar",+ "language": "zh",+ "locale": "zh_CN",+ "region": "CN",+ "voice": "huayan",+ "quality": "x_low",+ "numSpeakers": 1,+ "aliases": [+ "zh-cn-huayan-x-low"+ ],+ "files": [+ {+ "name": "zh_CN-huayan-x_low.mnn",+ "sizeBytes": 5915616,+ "installPath": "bin/piper/zh/zh_CN/huayan/x_low/zh_CN-huayan-x_low.mnn",+ "url": "https://offline-translator.davidv.dev/tts/1/zh/zh_CN/huayan/x_low/zh_CN-huayan-x_low.mnn",+ "role": "model",+ "priority": 0+ },+ {+ "name": "zh_CN-huayan-x_low.onnx.json",+ "sizeBytes": 4164,+ "installPath": "bin/piper/zh/zh_CN/huayan/x_low/zh_CN-huayan-x_low.onnx.json",+ "url": "https://offline-translator.davidv.dev/tts/1/zh/zh_CN/huayan/x_low/zh_CN-huayan-x_low.onnx.json",+ "role": "sidecar",+ "priority": 0+ }+ ],+ "dependsOn": [+ "tts-espeak-dict-cmn"+ ],+ "sampleUrl": "https://offline-translator.davidv.dev/samples_ogg/zh/huayan_x_low.opus"+ },+ "tts-sherpa_vits-zh-hk-cantonese-medium": {+ "feature": "tts",+ "engine": "sherpa_vits",+ "auxRole": "config",+ "language": "zh_hant",+ "locale": "zh_HK",+ "region": "HK",+ "voice": "Cantonese",+ "quality": "medium",+ "numSpeakers": 1,+ "aliases": [],+ "files": [+ {+ "name": "vits-cantonese-hf-xiaomaiiwn.mnn",+ "sizeBytes": 29632328,+ "installPath": "bin/sherpa_vits/zh_hant/zh_HK/cantonese/medium/vits-cantonese-hf-xiaomaiiwn.mnn",+ "url": "https://offline-translator.davidv.dev/tts/1/zh_hant/zh_HK/cantonese/medium/vits-cantonese-hf-xiaomaiiwn.mnn",+ "role": "model",+ "priority": 0+ },+ {+ "name": "config.json",+ "sizeBytes": 2746,+ "installPath": "bin/sherpa_vits/zh_hant/zh_HK/cantonese/medium/config.json",+ "url": "https://offline-translator.davidv.dev/tts/1/zh_hant/zh_HK/cantonese/medium/config.json",+ "role": "config",+ "priority": 0+ },+ {+ "name": "lexicon.txt",+ "sizeBytes": 294061,+ "installPath": "bin/sherpa_vits/zh_hant/zh_HK/cantonese/medium/lexicon.txt",+ "url": "https://offline-translator.davidv.dev/tts/1/zh_hant/zh_HK/cantonese/medium/lexicon.txt",+ "role": "lexicon",+ "priority": 0+ },+ {+ "name": "tokens.txt",+ "sizeBytes": 529,+ "installPath": "bin/sherpa_vits/zh_hant/zh_HK/cantonese/medium/tokens.txt",+ "url": "https://offline-translator.davidv.dev/tts/1/zh_hant/zh_HK/cantonese/medium/tokens.txt",+ "role": "tokens",+ "priority": 0+ },+ {+ "name": "rule.fst",+ "sizeBytes": 64482,+ "installPath": "bin/sherpa_vits/zh_hant/zh_HK/cantonese/medium/rule.fst",+ "url": "https://offline-translator.davidv.dev/tts/1/zh_hant/zh_HK/cantonese/medium/rule.fst",+ "role": "ruleFst",+ "priority": 0+ }+ ],+ "dependsOn": [],+ "sampleUrl": "https://offline-translator.davidv.dev/samples_ogg/zh_hant/Cantonese_medium.opus"+ },+ "tts-piper-zh-tw-mandarin-traditional-medium": {+ "feature": "tts",+ "engine": "piper",+ "auxRole": "sidecar",+ "language": "zh_hant",+ "locale": "zh_TW",+ "region": "TW",+ "voice": "Mandarin (Traditional)",+ "quality": "medium",+ "numSpeakers": 1,+ "aliases": [],+ "files": [+ {+ "name": "yt-chinese_female.mnn",+ "sizeBytes": 16981524,+ "installPath": "bin/piper/zh_hant/zh_TW/mandarin-traditional/medium/yt-chinese_female.mnn",+ "url": "https://offline-translator.davidv.dev/tts/1/zh_hant/zh_TW/mandarin-traditional/medium/yt-chinese_female.mnn",+ "role": "model",+ "priority": 0+ },+ {+ "name": "yt-chinese_female.onnx.json",+ "sizeBytes": 7176,+ "installPath": "bin/piper/zh_hant/zh_TW/mandarin-traditional/medium/yt-chinese_female.onnx.json",+ "url": "https://offline-translator.davidv.dev/tts/1/zh_hant/zh_TW/mandarin-traditional/medium/yt-chinese_female.onnx.json",+ "role": "sidecar",+ "priority": 0+ }+ ],+ "dependsOn": [+ "tts-espeak-dict-cmn"+ ],+ "sampleUrl": "https://offline-translator.davidv.dev/samples_ogg/zh_hant/Mandarin_Traditional_medium.opus"+ },+ "support-doc_detect-v1": {+ "feature": "support",+ "kind": "doc_detect",+ "files": [+ {+ "name": "docaligner_lcnet050.mnn",+ "sizeBytes": 1760380,+ "installPath": "ocr/docrec/docaligner_lcnet050.mnn",+ "url": "https://offline-translator.davidv.dev/support/1/docaligner_lcnet050.mnn",+ "role": "model",+ "priority": 0+ }+ ],+ "dependsOn": []+ },+ "ocr-ppocr-detector": {+ "feature": "ocr",+ "engine": "ppocr",+ "role": "detector",+ "files": [+ {+ "name": "PP-OCRv5_mobile_det_int8.mnn",+ "sizeBytes": 1324660,+ "installPath": "ppocr/PP-OCRv5/PP-OCRv5_mobile_det_int8.mnn",+ "url": "https://offline-translator.davidv.dev/ocr/1/PP-OCRv5/PP-OCRv5_mobile_det_int8.mnn",+ "role": "detector",+ "priority": 0+ },+ {+ "name": "PP-OCRv6_tiny_det_half_int8.mnn",+ "sizeBytes": 543128,+ "installPath": "ppocr/PP-OCRv6/PP-OCRv6_tiny_det_half_int8.mnn",+ "url": "https://offline-translator.davidv.dev/ocr/1/PP-OCRv6/PP-OCRv6_tiny_det_half_int8.mnn",+ "role": "detector",+ "priority": 1+ },+ {+ "name": "PP-OCRv6_tiny_det_int8.mnn",+ "sizeBytes": 543176,+ "installPath": "ppocr/PP-OCRv6/PP-OCRv6_tiny_det_int8.mnn",+ "url": "https://offline-translator.davidv.dev/ocr/1/PP-OCRv6/PP-OCRv6_tiny_det_int8.mnn",+ "role": "detector",+ "priority": 2+ },+ {+ "name": "PULC_int8.mnn",+ "sizeBytes": 1799836,+ "installPath": "ppocr/PP-OCRv5/PULC_int8.mnn",+ "url": "https://offline-translator.davidv.dev/ocr/1/PP-OCRv5/PULC_int8.mnn",+ "role": "scriptClassifier",+ "priority": 0+ },+ {+ "name": "textline_ori_x0_25_wq8.mnn",+ "sizeBytes": 309284,+ "installPath": "ppocr/PP-OCRv5/textline_ori_x0_25_wq8.mnn",+ "url": "https://offline-translator.davidv.dev/ocr/1/PP-OCRv5/textline_ori_x0_25_wq8.mnn",+ "role": "textlineOrientation",+ "priority": 0+ },+ {+ "name": "ink_bold_int8.mnn",+ "sizeBytes": 1973784,+ "installPath": "ppocr/PP-OCRv6/ink_bold_int8.mnn",+ "url": "https://offline-translator.davidv.dev/ocr/1/PP-OCRv6/ink_bold_int8.mnn",+ "role": "ink",+ "priority": 0,+ "optional": true+ },+ {+ "name": "ink_bold_line_int8.mnn",+ "sizeBytes": 1980300,+ "installPath": "ppocr/PP-OCRv6/ink_bold_line_int8.mnn",+ "url": "https://offline-translator.davidv.dev/ocr/1/PP-OCRv6/ink_bold_line_int8.mnn",+ "role": "ink",+ "priority": 1,+ "optional": true+ },+ {+ "name": "ink_color_int8.mnn",+ "sizeBytes": 1980972,+ "installPath": "ppocr/PP-OCRv6/ink_color_int8.mnn",+ "url": "https://offline-translator.davidv.dev/ocr/1/PP-OCRv6/ink_color_int8.mnn",+ "role": "ink",+ "priority": 2,+ "optional": true+ }+ ],+ "dependsOn": []+ },+ "ocr-ppocr-arabic": {+ "feature": "ocr",+ "engine": "ppocr",+ "role": "recognizer",+ "script": "arabic",+ "files": [+ {+ "name": "arabic_PP-OCRv5_mobile_rec_infer_int8.mnn",+ "sizeBytes": 2178136,+ "installPath": "ppocr/PP-OCRv5/arabic_PP-OCRv5_mobile_rec_infer_int8.mnn",+ "url": "https://offline-translator.davidv.dev/ocr/1/PP-OCRv5/arabic_PP-OCRv5_mobile_rec_infer_int8.mnn",+ "role": "recognizer",+ "priority": 0+ },+ {+ "name": "arabic_PP-OCRv5_keys.txt",+ "sizeBytes": 2369,+ "installPath": "ppocr/PP-OCRv5/arabic_PP-OCRv5_keys.txt",+ "url": "https://offline-translator.davidv.dev/ocr/1/PP-OCRv5/arabic_PP-OCRv5_keys.txt",+ "role": "keys",+ "priority": 0+ }+ ],+ "dependsOn": [+ "ocr-ppocr-detector",+ "ocr-ppocr-latin"+ ]+ },+ "ocr-ppocr-cyrillic": {+ "feature": "ocr",+ "engine": "ppocr",+ "role": "recognizer",+ "script": "cyrillic",+ "files": [+ {+ "name": "cyrillic_PP-OCRv5_mobile_rec_infer_int8.mnn",+ "sizeBytes": 2191732,+ "installPath": "ppocr/PP-OCRv5/cyrillic_PP-OCRv5_mobile_rec_infer_int8.mnn",+ "url": "https://offline-translator.davidv.dev/ocr/1/PP-OCRv5/cyrillic_PP-OCRv5_mobile_rec_infer_int8.mnn",+ "role": "recognizer",+ "priority": 0+ },+ {+ "name": "cyrillic_PP-OCRv5_keys.txt",+ "sizeBytes": 2781,+ "installPath": "ppocr/PP-OCRv5/cyrillic_PP-OCRv5_keys.txt",+ "url": "https://offline-translator.davidv.dev/ocr/1/PP-OCRv5/cyrillic_PP-OCRv5_keys.txt",+ "role": "keys",+ "priority": 0+ }+ ],+ "dependsOn": [+ "ocr-ppocr-detector",+ "ocr-ppocr-latin"+ ]+ },+ "ocr-ppocr-devanagari": {+ "feature": "ocr",+ "engine": "ppocr",+ "role": "recognizer",+ "script": "devanagari",+ "files": [+ {+ "name": "devanagari_PP-OCRv5_mobile_rec_infer_int8.mnn",+ "sizeBytes": 2154508,+ "installPath": "ppocr/PP-OCRv5/devanagari_PP-OCRv5_mobile_rec_infer_int8.mnn",+ "url": "https://offline-translator.davidv.dev/ocr/1/PP-OCRv5/devanagari_PP-OCRv5_mobile_rec_infer_int8.mnn",+ "role": "recognizer",+ "priority": 0+ },+ {+ "name": "devanagari_PP-OCRv5_keys.txt",+ "sizeBytes": 1943,+ "installPath": "ppocr/PP-OCRv5/devanagari_PP-OCRv5_keys.txt",+ "url": "https://offline-translator.davidv.dev/ocr/1/PP-OCRv5/devanagari_PP-OCRv5_keys.txt",+ "role": "keys",+ "priority": 0+ }+ ],+ "dependsOn": [+ "ocr-ppocr-detector",+ "ocr-ppocr-latin"+ ]+ },+ "ocr-ppocr-el": {+ "feature": "ocr",+ "engine": "ppocr",+ "role": "recognizer",+ "script": "el",+ "files": [+ {+ "name": "el_PP-OCRv5_mobile_rec_infer_int8.mnn",+ "sizeBytes": 2126260,+ "installPath": "ppocr/PP-OCRv5/el_PP-OCRv5_mobile_rec_infer_int8.mnn",+ "url": "https://offline-translator.davidv.dev/ocr/1/PP-OCRv5/el_PP-OCRv5_mobile_rec_infer_int8.mnn",+ "role": "recognizer",+ "priority": 0+ },+ {+ "name": "el_PP-OCRv5_keys.txt",+ "sizeBytes": 1103,+ "installPath": "ppocr/PP-OCRv5/el_PP-OCRv5_keys.txt",+ "url": "https://offline-translator.davidv.dev/ocr/1/PP-OCRv5/el_PP-OCRv5_keys.txt",+ "role": "keys",+ "priority": 0+ }+ ],+ "dependsOn": [+ "ocr-ppocr-detector",+ "ocr-ppocr-latin"+ ]+ },+ "ocr-ppocr-eslav": {+ "feature": "ocr",+ "engine": "ppocr",+ "role": "recognizer",+ "script": "eslav",+ "files": [+ {+ "name": "eslav_PP-OCRv5_mobile_rec_infer_int8.mnn",+ "sizeBytes": 2147776,+ "installPath": "ppocr/PP-OCRv5/eslav_PP-OCRv5_mobile_rec_infer_int8.mnn",+ "url": "https://offline-translator.davidv.dev/ocr/1/PP-OCRv5/eslav_PP-OCRv5_mobile_rec_infer_int8.mnn",+ "role": "recognizer",+ "priority": 0+ },+ {+ "name": "eslav_PP-OCRv5_keys.txt",+ "sizeBytes": 1663,+ "installPath": "ppocr/PP-OCRv5/eslav_PP-OCRv5_keys.txt",+ "url": "https://offline-translator.davidv.dev/ocr/1/PP-OCRv5/eslav_PP-OCRv5_keys.txt",+ "role": "keys",+ "priority": 0+ }+ ],+ "dependsOn": [+ "ocr-ppocr-detector",+ "ocr-ppocr-latin"+ ]+ },+ "ocr-ppocr-georgian": {+ "feature": "ocr",+ "engine": "ppocr",+ "role": "recognizer",+ "script": "georgian",+ "files": [+ {+ "name": "georgian_rec_int8.mnn",+ "sizeBytes": 3242772,+ "installPath": "ppocr/PP-OCRv6/georgian_rec_int8.mnn",+ "url": "https://offline-translator.davidv.dev/ocr/1/PP-OCRv6/georgian_rec_int8.mnn",+ "role": "recognizer",+ "priority": 0+ },+ {+ "name": "georgian_keys.txt",+ "sizeBytes": 456,+ "installPath": "ppocr/PP-OCRv6/georgian_keys.txt",+ "url": "https://offline-translator.davidv.dev/ocr/1/PP-OCRv6/georgian_keys.txt",+ "role": "keys",+ "priority": 0+ }+ ],+ "dependsOn": [+ "ocr-ppocr-detector",+ "ocr-ppocr-latin"+ ]+ },+ "ocr-ppocr-hebrew": {+ "feature": "ocr",+ "engine": "ppocr",+ "role": "recognizer",+ "script": "hebrew",+ "files": [+ {+ "name": "hebrew_rec_int8.mnn",+ "sizeBytes": 3237360,+ "installPath": "ppocr/PP-OCRv6/hebrew_rec_int8.mnn",+ "url": "https://offline-translator.davidv.dev/ocr/1/PP-OCRv6/hebrew_rec_int8.mnn",+ "role": "recognizer",+ "priority": 0+ },+ {+ "name": "hebrew_keys.txt",+ "sizeBytes": 262,+ "installPath": "ppocr/PP-OCRv6/hebrew_keys.txt",+ "url": "https://offline-translator.davidv.dev/ocr/1/PP-OCRv6/hebrew_keys.txt",+ "role": "keys",+ "priority": 0+ }+ ],+ "dependsOn": [+ "ocr-ppocr-detector",+ "ocr-ppocr-latin"+ ]+ },+ "ocr-ppocr-indic": {+ "feature": "ocr",+ "engine": "ppocr",+ "role": "recognizer",+ "script": "indic",+ "files": [+ {+ "name": "indic_r2e10_int8.mnn",+ "sizeBytes": 3277620,+ "installPath": "ppocr/PP-OCRv6/indic_r2e10_int8.mnn",+ "url": "https://offline-translator.davidv.dev/ocr/1/PP-OCRv6/indic_r2e10_int8.mnn",+ "role": "recognizer",+ "priority": 0+ },+ {+ "name": "indic_keys.txt",+ "sizeBytes": 1513,+ "installPath": "ppocr/PP-OCRv6/indic_keys.txt",+ "url": "https://offline-translator.davidv.dev/ocr/1/PP-OCRv6/indic_keys.txt",+ "role": "keys",+ "priority": 0+ }+ ],+ "dependsOn": [+ "ocr-ppocr-detector",+ "ocr-ppocr-latin"+ ]+ },+ "ocr-ppocr-korean": {+ "feature": "ocr",+ "engine": "ppocr",+ "role": "recognizer",+ "script": "korean",+ "files": [+ {+ "name": "korean_PP-OCRv5_mobile_rec_infer_int8.mnn",+ "sizeBytes": 3656272,+ "installPath": "ppocr/PP-OCRv5/korean_PP-OCRv5_mobile_rec_infer_int8.mnn",+ "url": "https://offline-translator.davidv.dev/ocr/1/PP-OCRv5/korean_PP-OCRv5_mobile_rec_infer_int8.mnn",+ "role": "recognizer",+ "priority": 0+ },+ {+ "name": "korean_PP-OCRv5_keys.txt",+ "sizeBytes": 47451,+ "installPath": "ppocr/PP-OCRv5/korean_PP-OCRv5_keys.txt",+ "url": "https://offline-translator.davidv.dev/ocr/1/PP-OCRv5/korean_PP-OCRv5_keys.txt",+ "role": "keys",+ "priority": 0+ }+ ],+ "dependsOn": [+ "ocr-ppocr-detector",+ "ocr-ppocr-latin"+ ]+ },+ "ocr-ppocr-latin": {+ "feature": "ocr",+ "engine": "ppocr",+ "role": "recognizer",+ "script": "latin",+ "files": [+ {+ "name": "latin_PP-OCRv5_mobile_rec_infer_int8.mnn",+ "sizeBytes": 2189884,+ "installPath": "ppocr/PP-OCRv5/latin_PP-OCRv5_mobile_rec_infer_int8.mnn",+ "url": "https://offline-translator.davidv.dev/ocr/1/PP-OCRv5/latin_PP-OCRv5_mobile_rec_infer_int8.mnn",+ "role": "recognizer",+ "priority": 0+ },+ {+ "name": "latin_PP-OCRv5_keys.txt",+ "sizeBytes": 2616,+ "installPath": "ppocr/PP-OCRv5/latin_PP-OCRv5_keys.txt",+ "url": "https://offline-translator.davidv.dev/ocr/1/PP-OCRv5/latin_PP-OCRv5_keys.txt",+ "role": "keys",+ "priority": 0+ },+ {+ "name": "PP-OCRv6_tiny_rec_int8.mnn",+ "sizeBytes": 1262568,+ "installPath": "ppocr/PP-OCRv6/PP-OCRv6_tiny_rec_int8.mnn",+ "url": "https://offline-translator.davidv.dev/ocr/1/PP-OCRv6/PP-OCRv6_tiny_rec_int8.mnn",+ "role": "recognizer",+ "priority": 1+ },+ {+ "name": "PP-OCRv6_tiny_keys.txt",+ "sizeBytes": 27156,+ "installPath": "ppocr/PP-OCRv6/PP-OCRv6_tiny_keys.txt",+ "url": "https://offline-translator.davidv.dev/ocr/1/PP-OCRv6/PP-OCRv6_tiny_keys.txt",+ "role": "keys",+ "priority": 1+ }+ ],+ "dependsOn": [+ "ocr-ppocr-detector"+ ]+ },+ "ocr-ppocr-ta": {+ "feature": "ocr",+ "engine": "ppocr",+ "role": "recognizer",+ "script": "ta",+ "files": [+ {+ "name": "ta_PP-OCRv5_mobile_rec_infer_int8.mnn",+ "sizeBytes": 2147248,+ "installPath": "ppocr/PP-OCRv5/ta_PP-OCRv5_mobile_rec_infer_int8.mnn",+ "url": "https://offline-translator.davidv.dev/ocr/1/PP-OCRv5/ta_PP-OCRv5_mobile_rec_infer_int8.mnn",+ "role": "recognizer",+ "priority": 0+ },+ {+ "name": "ta_PP-OCRv5_keys.txt",+ "sizeBytes": 1723,+ "installPath": "ppocr/PP-OCRv5/ta_PP-OCRv5_keys.txt",+ "url": "https://offline-translator.davidv.dev/ocr/1/PP-OCRv5/ta_PP-OCRv5_keys.txt",+ "role": "keys",+ "priority": 0+ }+ ],+ "dependsOn": [+ "ocr-ppocr-detector",+ "ocr-ppocr-latin"+ ]+ },+ "ocr-ppocr-te": {+ "feature": "ocr",+ "engine": "ppocr",+ "role": "recognizer",+ "script": "te",+ "files": [+ {+ "name": "te_PP-OCRv5_mobile_rec_infer_int8.mnn",+ "sizeBytes": 2150812,+ "installPath": "ppocr/PP-OCRv5/te_PP-OCRv5_mobile_rec_infer_int8.mnn",+ "url": "https://offline-translator.davidv.dev/ocr/1/PP-OCRv5/te_PP-OCRv5_mobile_rec_infer_int8.mnn",+ "role": "recognizer",+ "priority": 0+ },+ {+ "name": "te_PP-OCRv5_keys.txt",+ "sizeBytes": 1831,+ "installPath": "ppocr/PP-OCRv5/te_PP-OCRv5_keys.txt",+ "url": "https://offline-translator.davidv.dev/ocr/1/PP-OCRv5/te_PP-OCRv5_keys.txt",+ "role": "keys",+ "priority": 0+ }+ ],+ "dependsOn": [+ "ocr-ppocr-detector",+ "ocr-ppocr-latin"+ ]+ },+ "ocr-ppocr-th": {+ "feature": "ocr",+ "engine": "ppocr",+ "role": "recognizer",+ "script": "th",+ "files": [+ {+ "name": "th_PP-OCRv5_mobile_rec_infer_int8.mnn",+ "sizeBytes": 2148700,+ "installPath": "ppocr/PP-OCRv5/th_PP-OCRv5_mobile_rec_infer_int8.mnn",+ "url": "https://offline-translator.davidv.dev/ocr/1/PP-OCRv5/th_PP-OCRv5_mobile_rec_infer_int8.mnn",+ "role": "recognizer",+ "priority": 0+ },+ {+ "name": "th_PP-OCRv5_keys.txt",+ "sizeBytes": 1767,+ "installPath": "ppocr/PP-OCRv5/th_PP-OCRv5_keys.txt",+ "url": "https://offline-translator.davidv.dev/ocr/1/PP-OCRv5/th_PP-OCRv5_keys.txt",+ "role": "keys",+ "priority": 0+ }+ ],+ "dependsOn": [+ "ocr-ppocr-detector",+ "ocr-ppocr-latin"+ ]+ },+ "ocr-ppocr-cj": {+ "feature": "ocr",+ "engine": "ppocr",+ "role": "recognizer",+ "script": "cj",+ "files": [+ {+ "name": "PP-OCRv5_mobile_rec_int8.mnn",+ "sizeBytes": 4506088,+ "installPath": "ppocr/PP-OCRv5/PP-OCRv5_mobile_rec_int8.mnn",+ "url": "https://offline-translator.davidv.dev/ocr/1/PP-OCRv5/PP-OCRv5_mobile_rec_int8.mnn",+ "role": "recognizer",+ "priority": 0+ },+ {+ "name": "cj_PP-OCRv5_keys.txt",+ "sizeBytes": 74012,+ "installPath": "ppocr/PP-OCRv5/cj_PP-OCRv5_keys.txt",+ "url": "https://offline-translator.davidv.dev/ocr/1/PP-OCRv5/cj_PP-OCRv5_keys.txt",+ "role": "keys",+ "priority": 0+ },+ {+ "name": "PP-OCRv6_small_rec_int8.mnn",+ "sizeBytes": 5691768,+ "installPath": "ppocr/PP-OCRv6/PP-OCRv6_small_rec_int8.mnn",+ "url": "https://offline-translator.davidv.dev/ocr/1/PP-OCRv6/PP-OCRv6_small_rec_int8.mnn",+ "role": "recognizer",+ "priority": 1+ },+ {+ "name": "PP-OCRv6_small_keys.txt",+ "sizeBytes": 74947,+ "installPath": "ppocr/PP-OCRv6/PP-OCRv6_small_keys.txt",+ "url": "https://offline-translator.davidv.dev/ocr/1/PP-OCRv6/PP-OCRv6_small_keys.txt",+ "role": "keys",+ "priority": 1+ }+ ],+ "dependsOn": [+ "ocr-ppocr-detector",+ "ocr-ppocr-latin"+ ]+ },+ "support-adblock-lists-v1": {+ "feature": "support",+ "kind": "adblock",+ "files": [+ {+ "name": "adblock-lists-v1.zip",+ "sizeBytes": 2124783,+ "installPath": "adblock/adblock-lists-v1.zip",+ "url": "https://offline-translator.davidv.dev/support/1/adblock/adblock-lists-v1.zip",+ "archiveFormat": "zip",+ "extractTo": ".",+ "deleteAfterExtract": true,+ "installMarkerPath": "adblock/.install-info.json",+ "installMarkerVersion": 1,+ "role": "filterList",+ "priority": 0+ }+ ],+ "dependsOn": [],+ "metadata": {+ "version": 1,+ "lists": [+ {+ "packId": "support-adblock-adguard-mobile",+ "listId": "adguard-mobile",+ "description": "AdGuard Mobile Ads — mobile-specific ad slots and tracker patterns."+ },+ {+ "packId": "support-adblock-easylist",+ "listId": "easylist",+ "description": "EasyList — primary advertising filter list."+ },+ {+ "packId": "support-adblock-easyprivacy",+ "listId": "easyprivacy",+ "description": "EasyPrivacy — tracking and analytics filter list."+ },+ {+ "packId": "support-adblock-fanboy-annoyance",+ "listId": "fanboy-annoyance",+ "description": "Fanboy's Annoyances — cookie banners, social widgets, sticky video."+ },+ {+ "packId": "support-adblock-ublock-filters",+ "listId": "ublock-filters",+ "description": "uBlock Origin filters — cosmetic supplement to EasyList."+ },+ {+ "packId": "support-adblock-ublock-unbreak",+ "listId": "ublock-unbreak",+ "description": "uBlock Origin unbreak — exceptions to fix sites broken by other lists."+ }+ ]+ }+ }+ },+ "migrations": [+ {+ "onnx": "bin/piper/ar/ar_JO/kareem/medium/ar_JO-kareem-medium.onnx",+ "mnn": "bin/piper/ar/ar_JO/kareem/medium/ar_JO-kareem-medium.mnn",+ "quantBits": 8,+ "onnxBytes": 63201294,+ "mnnBytes": 16864416,+ "feature": "tts"+ },+ {+ "onnx": "bin/piper/ar/ar_JO/kareem/low/ar_JO-kareem-low.onnx",+ "mnn": "bin/piper/ar/ar_JO/kareem/low/ar_JO-kareem-low.mnn",+ "quantBits": 8,+ "onnxBytes": 63201294,+ "mnnBytes": 16864416,+ "feature": "tts"+ },+ {+ "onnx": "bin/mms/az/az_AZ/north_latin/medium/model.onnx",+ "mnn": "bin/mms/az/az_AZ/north_latin/medium/model.mnn",+ "quantBits": 8,+ "onnxBytes": 114020024,+ "mnnBytes": 29592420,+ "feature": "tts"+ },+ {+ "onnx": "bin/piper/bg/bg_BG/dimitar/medium/bg_BG-dimitar-medium.onnx",+ "mnn": "bin/piper/bg/bg_BG/dimitar/medium/bg_BG-dimitar-medium.mnn",+ "quantBits": 8,+ "onnxBytes": 63221984,+ "mnnBytes": 16845408,+ "feature": "tts"+ },+ {+ "onnx": "bin/mms/bn/bn_IN/standard/medium/model.onnx",+ "mnn": "bin/mms/bn/bn_IN/standard/medium/model.mnn",+ "quantBits": 8,+ "onnxBytes": 114044600,+ "mnnBytes": 29616996,+ "feature": "tts"+ },+ {+ "onnx": "bin/coqui_vits/bs/bs_BA/cv/medium/model.onnx",+ "mnn": "bin/coqui_vits/bs/bs_BA/cv/medium/model.mnn",+ "quantBits": 8,+ "onnxBytes": 71043321,+ "mnnBytes": 18894620,+ "feature": "tts"+ },+ {+ "onnx": "bin/piper/ca/ca_ES/upc_ona/medium/ca_ES-upc_ona-medium.onnx",+ "mnn": "bin/piper/ca/ca_ES/upc_ona/medium/ca_ES-upc_ona-medium.mnn",+ "quantBits": 8,+ "onnxBytes": 63201294,+ "mnnBytes": 16864416,+ "feature": "tts"+ },+ {+ "onnx": "bin/piper/ca/ca_ES/upc_ona/x_low/ca_ES-upc_ona-x_low.onnx",+ "mnn": "bin/piper/ca/ca_ES/upc_ona/x_low/ca_ES-upc_ona-x_low.mnn",+ "quantBits": 8,+ "onnxBytes": 20628813,+ "mnnBytes": 5915616,+ "feature": "tts"+ },+ {+ "onnx": "bin/piper/ca/ca_ES/upc_pau/x_low/ca_ES-upc_pau-x_low.onnx",+ "mnn": "bin/piper/ca/ca_ES/upc_pau/x_low/ca_ES-upc_pau-x_low.mnn",+ "quantBits": 8,+ "onnxBytes": 28130791,+ "mnnBytes": 5944328,+ "feature": "tts"+ },+ {+ "onnx": "bin/piper/cs/cs_CZ/jirka/medium/cs_CZ-jirka-medium.onnx",+ "mnn": "bin/piper/cs/cs_CZ/jirka/medium/cs_CZ-jirka-medium.mnn",+ "quantBits": 8,+ "onnxBytes": 63201294,+ "mnnBytes": 16864416,+ "feature": "tts"+ },+ {+ "onnx": "bin/piper/cs/cs_CZ/jirka/low/cs_CZ-jirka-low.onnx",+ "mnn": "bin/piper/cs/cs_CZ/jirka/low/cs_CZ-jirka-low.mnn",+ "quantBits": 8,+ "onnxBytes": 63201294,+ "mnnBytes": 16864416,+ "feature": "tts"+ },+ {+ "onnx": "bin/piper/da/da_DK/talesyntese/medium/da_DK-talesyntese-medium.onnx",+ "mnn": "bin/piper/da/da_DK/talesyntese/medium/da_DK-talesyntese-medium.mnn",+ "quantBits": 8,+ "onnxBytes": 63201294,+ "mnnBytes": 16864416,+ "feature": "tts"+ },+ {+ "onnx": "bin/piper/de/de_DE/thorsten/medium/de_DE-thorsten-medium.onnx",+ "mnn": "bin/piper/de/de_DE/thorsten/medium/de_DE-thorsten-medium.mnn",+ "quantBits": 8,+ "onnxBytes": 63201294,+ "mnnBytes": 16864416,+ "feature": "tts"+ },+ {+ "onnx": "bin/piper/de/de_DE/glados/medium/de_DE-glados-medium.onnx",+ "mnn": "bin/piper/de/de_DE/glados/medium/de_DE-glados-medium.mnn",+ "quantBits": 8,+ "onnxBytes": 63153773,+ "mnnBytes": 16848916,+ "feature": "tts"+ },+ {+ "onnx": "bin/piper/de/de_DE/thorsten_emotional/medium/de_DE-thorsten_emotional-medium.onnx",+ "mnn": "bin/piper/de/de_DE/thorsten_emotional/medium/de_DE-thorsten_emotional-medium.mnn",+ "quantBits": 8,+ "onnxBytes": 76745905,+ "mnnBytes": 20334452,+ "feature": "tts"+ },+ {+ "onnx": "bin/piper/de/de_DE/karlsson/low/de_DE-karlsson-low.onnx",+ "mnn": "bin/piper/de/de_DE/karlsson/low/de_DE-karlsson-low.mnn",+ "quantBits": 8,+ "onnxBytes": 63104526,+ "mnnBytes": 16767648,+ "feature": "tts"+ },+ {+ "onnx": "bin/piper/el/el_GR/rapunzelina/medium/el_GR-rapunzelina-medium.onnx",+ "mnn": "bin/piper/el/el_GR/rapunzelina/medium/el_GR-rapunzelina-medium.mnn",+ "quantBits": 8,+ "onnxBytes": 62950044,+ "mnnBytes": 16763672,+ "feature": "tts"+ },+ {+ "onnx": "bin/piper/el/el_GR/rapunzelina/low/el_GR-rapunzelina-low.onnx",+ "mnn": "bin/piper/el/el_GR/rapunzelina/low/el_GR-rapunzelina-low.mnn",+ "quantBits": 8,+ "onnxBytes": 63104526,+ "mnnBytes": 16767648,+ "feature": "tts"+ },+ {+ "onnx": "bin/piper/en/en_GB/alan/medium/en_GB-alan-medium.onnx",+ "mnn": "bin/piper/en/en_GB/alan/medium/en_GB-alan-medium.mnn",+ "quantBits": 8,+ "onnxBytes": 63201294,+ "mnnBytes": 16864416,+ "feature": "tts"+ },+ {+ "onnx": "bin/piper/en/en_GB/alba/medium/en_GB-alba-medium.onnx",+ "mnn": "bin/piper/en/en_GB/alba/medium/en_GB-alba-medium.mnn",+ "quantBits": 8,+ "onnxBytes": 63201294,+ "mnnBytes": 16864416,+ "feature": "tts"+ },+ {+ "onnx": "bin/piper/en/en_GB/jenny_dioco/medium/en_GB-jenny_dioco-medium.onnx",+ "mnn": "bin/piper/en/en_GB/jenny_dioco/medium/en_GB-jenny_dioco-medium.mnn",+ "quantBits": 8,+ "onnxBytes": 63201294,+ "mnnBytes": 16864416,+ "feature": "tts"+ },+ {+ "onnx": "bin/piper/en/en_GB/northern_english_male/medium/en_GB-northern_english_male-medium.onnx",+ "mnn": "bin/piper/en/en_GB/northern_english_male/medium/en_GB-northern_english_male-medium.mnn",+ "quantBits": 8,+ "onnxBytes": 63201294,+ "mnnBytes": 16864416,+ "feature": "tts"+ },+ {+ "onnx": "bin/piper/en/en_US/amy/medium/en_US-amy-medium.onnx",+ "mnn": "bin/piper/en/en_US/amy/medium/en_US-amy-medium.mnn",+ "quantBits": 8,+ "onnxBytes": 63201294,+ "mnnBytes": 16864416,+ "feature": "tts"+ },+ {+ "onnx": "bin/piper/en/en_US/hfc_female/medium/en_US-hfc_female-medium.onnx",+ "mnn": "bin/piper/en/en_US/hfc_female/medium/en_US-hfc_female-medium.mnn",+ "quantBits": 8,+ "onnxBytes": 63201294,+ "mnnBytes": 16864416,+ "feature": "tts"+ },+ {+ "onnx": "bin/piper/en/en_US/hfc_male/medium/en_US-hfc_male-medium.onnx",+ "mnn": "bin/piper/en/en_US/hfc_male/medium/en_US-hfc_male-medium.mnn",+ "quantBits": 8,+ "onnxBytes": 63201294,+ "mnnBytes": 16864416,+ "feature": "tts"+ },+ {+ "onnx": "bin/piper/en/en_US/joe/medium/en_US-joe-medium.onnx",+ "mnn": "bin/piper/en/en_US/joe/medium/en_US-joe-medium.mnn",+ "quantBits": 8,+ "onnxBytes": 63201294,+ "mnnBytes": 16864416,+ "feature": "tts"+ },+ {+ "onnx": "bin/piper/es/es_AR/daniela/high/es_AR-daniela-high.onnx",+ "mnn": "bin/piper/es/es_AR/daniela/high/es_AR-daniela-high.mnn",+ "quantBits": 8,+ "onnxBytes": 114199011,+ "mnnBytes": 29766028,+ "feature": "tts"+ },+ {+ "onnx": "bin/piper/es/es_ES/davefx/medium/es_ES-davefx-medium.onnx",+ "mnn": "bin/piper/es/es_ES/davefx/medium/es_ES-davefx-medium.mnn",+ "quantBits": 8,+ "onnxBytes": 63201294,+ "mnnBytes": 16864416,+ "feature": "tts"+ },+ {+ "onnx": "bin/piper/es/es_ES/sharvard/medium/es_ES-sharvard-medium.onnx",+ "mnn": "bin/piper/es/es_ES/sharvard/medium/es_ES-sharvard-medium.mnn",+ "quantBits": 8,+ "onnxBytes": 76733615,+ "mnnBytes": 20322068,+ "feature": "tts"+ },+ {+ "onnx": "bin/piper/es/es_ES/carlfm/x_low/es_ES-carlfm-x_low.onnx",+ "mnn": "bin/piper/es/es_ES/carlfm/x_low/es_ES-carlfm-x_low.mnn",+ "quantBits": 8,+ "onnxBytes": 28130791,+ "mnnBytes": 5944328,+ "feature": "tts"+ },+ {+ "onnx": "bin/piper/es/es_MX/ald/medium/es_MX-ald-medium.onnx",+ "mnn": "bin/piper/es/es_MX/ald/medium/es_MX-ald-medium.mnn",+ "quantBits": 8,+ "onnxBytes": 63201294,+ "mnnBytes": 16864416,+ "feature": "tts"+ },+ {+ "onnx": "bin/piper/es/es_MX/claude/high/es_MX-claude-high.onnx",+ "mnn": "bin/piper/es/es_MX/claude/high/es_MX-claude-high.mnn",+ "quantBits": 8,+ "onnxBytes": 63122309,+ "mnnBytes": 16852376,+ "feature": "tts"+ },+ {+ "onnx": "bin/coqui_vits/et/et_EE/cv/medium/model.onnx",+ "mnn": "bin/coqui_vits/et/et_EE/cv/medium/model.mnn",+ "quantBits": 8,+ "onnxBytes": 71030265,+ "mnnBytes": 18881564,+ "feature": "tts"+ },+ {+ "onnx": "bin/piper/eu/eu_ES/antton/medium/eu_ES-antton-medium.onnx",+ "mnn": "bin/piper/eu/eu_ES/antton/medium/eu_ES-antton-medium.mnn",+ "quantBits": 8,+ "onnxBytes": 63531379,+ "mnnBytes": 16981524,+ "feature": "tts"+ },+ {+ "onnx": "bin/piper/eu/eu_ES/maider/medium/eu_ES-maider-medium.onnx",+ "mnn": "bin/piper/eu/eu_ES/maider/medium/eu_ES-maider-medium.mnn",+ "quantBits": 8,+ "onnxBytes": 63531379,+ "mnnBytes": 16981524,+ "feature": "tts"+ },+ {+ "onnx": "bin/piper/fa/fa_IR/gyro/medium/fa_IR-gyro-medium.onnx",+ "mnn": "bin/piper/fa/fa_IR/gyro/medium/fa_IR-gyro-medium.mnn",+ "quantBits": 8,+ "onnxBytes": 63122309,+ "mnnBytes": 16852376,+ "feature": "tts"+ },+ {+ "onnx": "bin/piper/fa/fa_IR/reza_ibrahim/medium/fa_IR-reza_ibrahim-medium.onnx",+ "mnn": "bin/piper/fa/fa_IR/reza_ibrahim/medium/fa_IR-reza_ibrahim-medium.mnn",+ "quantBits": 8,+ "onnxBytes": 63511038,+ "mnnBytes": 16974228,+ "feature": "tts"+ },+ {+ "onnx": "bin/piper/fa/fa_IR/ganji/medium/fa_IR-ganji-medium.onnx",+ "mnn": "bin/piper/fa/fa_IR/ganji/medium/fa_IR-ganji-medium.mnn",+ "quantBits": 8,+ "onnxBytes": 63516050,+ "mnnBytes": 16977372,+ "feature": "tts"+ },+ {+ "onnx": "bin/piper/fa/fa_IR/ganji_adabi/medium/fa_IR-ganji_adabi-medium.onnx",+ "mnn": "bin/piper/fa/fa_IR/ganji_adabi/medium/fa_IR-ganji_adabi-medium.mnn",+ "quantBits": 8,+ "onnxBytes": 63516050,+ "mnnBytes": 16977372,+ "feature": "tts"+ },+ {+ "onnx": "bin/piper/fi/fi_FI/harri/medium/fi_FI-harri-medium.onnx",+ "mnn": "bin/piper/fi/fi_FI/harri/medium/fi_FI-harri-medium.mnn",+ "quantBits": 8,+ "onnxBytes": 63201294,+ "mnnBytes": 16864416,+ "feature": "tts"+ },+ {+ "onnx": "bin/piper/fi/fi_FI/harri/low/fi_FI-harri-low.onnx",+ "mnn": "bin/piper/fi/fi_FI/harri/low/fi_FI-harri-low.mnn",+ "quantBits": 8,+ "onnxBytes": 69795191,+ "mnnBytes": 16767648,+ "feature": "tts"+ },+ {+ "onnx": "bin/piper/fr/fr_FR/siwis/medium/fr_FR-siwis-medium.onnx",+ "mnn": "bin/piper/fr/fr_FR/siwis/medium/fr_FR-siwis-medium.mnn",+ "quantBits": 8,+ "onnxBytes": 63201294,+ "mnnBytes": 16864416,+ "feature": "tts"+ },+ {+ "onnx": "bin/piper/fr/fr_FR/tom/medium/fr_FR-tom-medium.onnx",+ "mnn": "bin/piper/fr/fr_FR/tom/medium/fr_FR-tom-medium.mnn",+ "quantBits": 8,+ "onnxBytes": 63511038,+ "mnnBytes": 16974228,+ "feature": "tts"+ },+ {+ "onnx": "bin/piper/fr/fr_FR/upmc/medium/fr_FR-upmc-medium.onnx",+ "mnn": "bin/piper/fr/fr_FR/upmc/medium/fr_FR-upmc-medium.mnn",+ "quantBits": 8,+ "onnxBytes": 76733615,+ "mnnBytes": 20322068,+ "feature": "tts"+ },+ {+ "onnx": "bin/piper/fr/fr_FR/mls/medium/fr_FR-mls-medium.onnx",+ "mnn": "bin/piper/fr/fr_FR/mls/medium/fr_FR-mls-medium.mnn",+ "quantBits": 8,+ "onnxBytes": 76733750,+ "mnnBytes": 20475220,+ "feature": "tts"+ },+ {+ "onnx": "bin/cotovia_vits/gl/gl_ES/sabela/medium/vits.onnx",+ "mnn": "bin/cotovia_vits/gl/gl_ES/sabela/medium/vits.mnn",+ "quantBits": 8,+ "onnxBytes": 60333923,+ "mnnBytes": 16091140,+ "feature": "tts"+ },+ {+ "onnx": "bin/cotovia_vits/gl/gl_ES/brais/medium/vits.onnx",+ "mnn": "bin/cotovia_vits/gl/gl_ES/brais/medium/vits.mnn",+ "quantBits": 8,+ "onnxBytes": 60333923,+ "mnnBytes": 16091140,+ "feature": "tts"+ },+ {+ "onnx": "bin/cotovia_vits/gl/gl_ES/iago/medium/vits.onnx",+ "mnn": "bin/cotovia_vits/gl/gl_ES/iago/medium/vits.mnn",+ "quantBits": 8,+ "onnxBytes": 60333923,+ "mnnBytes": 16091140,+ "feature": "tts"+ },+ {+ "onnx": "bin/cotovia_vits/gl/gl_ES/icia/medium/vits.onnx",+ "mnn": "bin/cotovia_vits/gl/gl_ES/icia/medium/vits.mnn",+ "quantBits": 8,+ "onnxBytes": 60333923,+ "mnnBytes": 16091140,+ "feature": "tts"+ },+ {+ "onnx": "bin/cotovia_vits/gl/gl_ES/paulo/medium/vits.onnx",+ "mnn": "bin/cotovia_vits/gl/gl_ES/paulo/medium/vits.mnn",+ "quantBits": 8,+ "onnxBytes": 60333923,+ "mnnBytes": 16091140,+ "feature": "tts"+ },+ {+ "onnx": "bin/mms/gu/gu_IN/standard/medium/model.onnx",+ "mnn": "bin/mms/gu/gu_IN/standard/medium/model.mnn",+ "quantBits": 8,+ "onnxBytes": 114033848,+ "mnnBytes": 29606244,+ "feature": "tts"+ },+ {+ "onnx": "bin/mms/he/he_IL/standard/medium/model.onnx",+ "mnn": "bin/mms/he/he_IL/standard/medium/model.mnn",+ "quantBits": 8,+ "onnxBytes": 114012344,+ "mnnBytes": 29584740,+ "feature": "tts"+ },+ {+ "onnx": "bin/piper/hi/hi_IN/rohan/medium/hi_IN-rohan-medium.onnx",+ "mnn": "bin/piper/hi/hi_IN/rohan/medium/hi_IN-rohan-medium.mnn",+ "quantBits": 8,+ "onnxBytes": 62950044,+ "mnnBytes": 16763672,+ "feature": "tts"+ },+ {+ "onnx": "bin/piper/hi/hi_IN/pratham/medium/hi_IN-pratham-medium.onnx",+ "mnn": "bin/piper/hi/hi_IN/pratham/medium/hi_IN-pratham-medium.mnn",+ "quantBits": 8,+ "onnxBytes": 63516050,+ "mnnBytes": 16977372,+ "feature": "tts"+ },+ {+ "onnx": "bin/piper/hi/hi_IN/priyamvada/medium/hi_IN-priyamvada-medium.onnx",+ "mnn": "bin/piper/hi/hi_IN/priyamvada/medium/hi_IN-priyamvada-medium.mnn",+ "quantBits": 8,+ "onnxBytes": 63516050,+ "mnnBytes": 16977372,+ "feature": "tts"+ },+ {+ "onnx": "bin/coqui_vits/hr/hr_HR/cv/medium/model.onnx",+ "mnn": "bin/coqui_vits/hr/hr_HR/cv/medium/model.mnn",+ "quantBits": 8,+ "onnxBytes": 71043321,+ "mnnBytes": 18894620,+ "feature": "tts"+ },+ {+ "onnx": "bin/piper/hu/hu_HU/anna/medium/hu_HU-anna-medium.onnx",+ "mnn": "bin/piper/hu/hu_HU/anna/medium/hu_HU-anna-medium.mnn",+ "quantBits": 8,+ "onnxBytes": 63201294,+ "mnnBytes": 16864416,+ "feature": "tts"+ },+ {+ "onnx": "bin/piper/hu/hu_HU/berta/medium/hu_HU-berta-medium.onnx",+ "mnn": "bin/piper/hu/hu_HU/berta/medium/hu_HU-berta-medium.mnn",+ "quantBits": 8,+ "onnxBytes": 63201294,+ "mnnBytes": 16864416,+ "feature": "tts"+ },+ {+ "onnx": "bin/piper/hu/hu_HU/imre/medium/hu_HU-imre-medium.onnx",+ "mnn": "bin/piper/hu/hu_HU/imre/medium/hu_HU-imre-medium.mnn",+ "quantBits": 8,+ "onnxBytes": 63201294,+ "mnnBytes": 16864416,+ "feature": "tts"+ },+ {+ "onnx": "bin/piper/id/id_ID/news_tts/medium/id_ID-news_tts-medium.onnx",+ "mnn": "bin/piper/id/id_ID/news_tts/medium/id_ID-news_tts-medium.mnn",+ "quantBits": 8,+ "onnxBytes": 62950044,+ "mnnBytes": 16763672,+ "feature": "tts"+ },+ {+ "onnx": "bin/piper/is/is_IS/bui/medium/is_IS-bui-medium.onnx",+ "mnn": "bin/piper/is/is_IS/bui/medium/is_IS-bui-medium.mnn",+ "quantBits": 8,+ "onnxBytes": 76495465,+ "mnnBytes": 16755608,+ "feature": "tts"+ },+ {+ "onnx": "bin/piper/is/is_IS/salka/medium/is_IS-salka-medium.onnx",+ "mnn": "bin/piper/is/is_IS/salka/medium/is_IS-salka-medium.mnn",+ "quantBits": 8,+ "onnxBytes": 76495465,+ "mnnBytes": 16755608,+ "feature": "tts"+ },+ {+ "onnx": "bin/piper/is/is_IS/steinn/medium/is_IS-steinn-medium.onnx",+ "mnn": "bin/piper/is/is_IS/steinn/medium/is_IS-steinn-medium.mnn",+ "quantBits": 8,+ "onnxBytes": 76495465,+ "mnnBytes": 16755608,+ "feature": "tts"+ },+ {+ "onnx": "bin/piper/is/is_IS/ugla/medium/is_IS-ugla-medium.onnx",+ "mnn": "bin/piper/is/is_IS/ugla/medium/is_IS-ugla-medium.mnn",+ "quantBits": 8,+ "onnxBytes": 76495465,+ "mnnBytes": 16755608,+ "feature": "tts"+ },+ {+ "onnx": "bin/piper/it/it_IT/paola/medium/it_IT-paola-medium.onnx",+ "mnn": "bin/piper/it/it_IT/paola/medium/it_IT-paola-medium.mnn",+ "quantBits": 8,+ "onnxBytes": 63511038,+ "mnnBytes": 16974228,+ "feature": "tts"+ },+ {+ "onnx": "bin/piper/it/it_IT/riccardo/x_low/it_IT-riccardo-x_low.onnx",+ "mnn": "bin/piper/it/it_IT/riccardo/x_low/it_IT-riccardo-x_low.mnn",+ "quantBits": 8,+ "onnxBytes": 28130791,+ "mnnBytes": 5944328,+ "feature": "tts"+ },+ {+ "onnx": "bin/piper/ka/ka_GE/natia/medium/ka_GE-natia-medium.onnx",+ "mnn": "bin/piper/ka/ka_GE/natia/medium/ka_GE-natia-medium.mnn",+ "quantBits": 8,+ "onnxBytes": 0,+ "mnnBytes": 16864416,+ "feature": "tts"+ },+ {+ "onnx": "bin/mms/kn/kn_IN/standard/medium/model.onnx",+ "mnn": "bin/mms/kn/kn_IN/standard/medium/model.mnn",+ "quantBits": 8,+ "onnxBytes": 114045368,+ "mnnBytes": 29617764,+ "feature": "tts"+ },+ {+ "onnx": "bin/piper/ko/ko_KO/kss/low/ko_KO-kss_low.onnx",+ "mnn": "bin/piper/ko/ko_KO/kss/low/ko_KO-kss_low.mnn",+ "quantBits": 8,+ "onnxBytes": 62793110,+ "mnnBytes": 16616908,+ "feature": "tts"+ },+ {+ "onnx": "bin/coqui_vits/lt/lt_LT/cv/medium/model.onnx",+ "mnn": "bin/coqui_vits/lt/lt_LT/cv/medium/model.mnn",+ "quantBits": 8,+ "onnxBytes": 71032571,+ "mnnBytes": 18883868,+ "feature": "tts"+ },+ {+ "onnx": "bin/piper/lv/lv_LV/aivars/medium/lv_LV-aivars-medium.onnx",+ "mnn": "bin/piper/lv/lv_LV/aivars/medium/lv_LV-aivars-medium.mnn",+ "quantBits": 8,+ "onnxBytes": 63511038,+ "mnnBytes": 16974228,+ "feature": "tts"+ },+ {+ "onnx": "bin/piper/ml/ml_IN/arjun/medium/ml_IN-arjun-medium.onnx",+ "mnn": "bin/piper/ml/ml_IN/arjun/medium/ml_IN-arjun-medium.mnn",+ "quantBits": 8,+ "onnxBytes": 62950044,+ "mnnBytes": 16763672,+ "feature": "tts"+ },+ {+ "onnx": "bin/piper/ml/ml_IN/meera/medium/ml_IN-meera-medium.onnx",+ "mnn": "bin/piper/ml/ml_IN/meera/medium/ml_IN-meera-medium.mnn",+ "quantBits": 8,+ "onnxBytes": 62950044,+ "mnnBytes": 16763672,+ "feature": "tts"+ },+ {+ "onnx": "bin/mms/mr/mr_IN/standard/medium/model.onnx",+ "mnn": "bin/mms/mr/mr_IN/standard/medium/model.mnn",+ "quantBits": 8,+ "onnxBytes": 114043832,+ "mnnBytes": 29616228,+ "feature": "tts"+ },+ {+ "onnx": "bin/mms/ms/ms_MY/standard/medium/model.onnx",+ "mnn": "bin/mms/ms/ms_MY/standard/medium/model.mnn",+ "quantBits": 8,+ "onnxBytes": 114013880,+ "mnnBytes": 29586276,+ "feature": "tts"+ },+ {+ "onnx": "bin/piper/nl/nl_BE/rdh/medium/nl_BE-rdh-medium.onnx",+ "mnn": "bin/piper/nl/nl_BE/rdh/medium/nl_BE-rdh-medium.mnn",+ "quantBits": 8,+ "onnxBytes": 63104526,+ "mnnBytes": 16767648,+ "feature": "tts"+ },+ {+ "onnx": "bin/piper/nl/nl_BE/nathalie/medium/nl_BE-nathalie-medium.onnx",+ "mnn": "bin/piper/nl/nl_BE/nathalie/medium/nl_BE-nathalie-medium.mnn",+ "quantBits": 8,+ "onnxBytes": 63201294,+ "mnnBytes": 16864416,+ "feature": "tts"+ },+ {+ "onnx": "bin/piper/nl/nl_BE/nathalie/x_low/nl_BE-nathalie-x_low.onnx",+ "mnn": "bin/piper/nl/nl_BE/nathalie/x_low/nl_BE-nathalie-x_low.mnn",+ "quantBits": 8,+ "onnxBytes": 20628813,+ "mnnBytes": 5915616,+ "feature": "tts"+ },+ {+ "onnx": "bin/piper/nl/nl_BE/rdh/x_low/nl_BE-rdh-x_low.onnx",+ "mnn": "bin/piper/nl/nl_BE/rdh/x_low/nl_BE-rdh-x_low.mnn",+ "quantBits": 8,+ "onnxBytes": 20628813,+ "mnnBytes": 5915616,+ "feature": "tts"+ },+ {+ "onnx": "bin/piper/nl/nl_NL/ronnie/medium/nl_NL-ronnie-medium.onnx",+ "mnn": "bin/piper/nl/nl_NL/ronnie/medium/nl_NL-ronnie-medium.mnn",+ "quantBits": 8,+ "onnxBytes": 62950044,+ "mnnBytes": 16763672,+ "feature": "tts"+ },+ {+ "onnx": "bin/piper/nl/nl_NL/pim/medium/nl_NL-pim-medium.onnx",+ "mnn": "bin/piper/nl/nl_NL/pim/medium/nl_NL-pim-medium.mnn",+ "quantBits": 8,+ "onnxBytes": 63516050,+ "mnnBytes": 16977372,+ "feature": "tts"+ },+ {+ "onnx": "bin/piper/nl/nl_NL/alex/medium/nl_NL-alex-medium.onnx",+ "mnn": "bin/piper/nl/nl_NL/alex/medium/nl_NL-alex-medium.mnn",+ "quantBits": 8,+ "onnxBytes": 63531476,+ "mnnBytes": 16981524,+ "feature": "tts"+ },+ {+ "onnx": "bin/piper/no/no_NO/talesyntese/medium/no_NO-talesyntese-medium.onnx",+ "mnn": "bin/piper/no/no_NO/talesyntese/medium/no_NO-talesyntese-medium.mnn",+ "quantBits": 8,+ "onnxBytes": 63201294,+ "mnnBytes": 16864416,+ "feature": "tts"+ },+ {+ "onnx": "bin/piper/pl/pl_PL/darkman/medium/pl_PL-darkman-medium.onnx",+ "mnn": "bin/piper/pl/pl_PL/darkman/medium/pl_PL-darkman-medium.mnn",+ "quantBits": 8,+ "onnxBytes": 63201294,+ "mnnBytes": 16864416,+ "feature": "tts"+ },+ {+ "onnx": "bin/piper/pl/pl_PL/gosia/medium/pl_PL-gosia-medium.onnx",+ "mnn": "bin/piper/pl/pl_PL/gosia/medium/pl_PL-gosia-medium.mnn",+ "quantBits": 8,+ "onnxBytes": 63201294,+ "mnnBytes": 16864416,+ "feature": "tts"+ },+ {+ "onnx": "bin/piper/pl/pl_PL/mc_speech/medium/pl_PL-mc_speech-medium.onnx",+ "mnn": "bin/piper/pl/pl_PL/mc_speech/medium/pl_PL-mc_speech-medium.mnn",+ "quantBits": 8,+ "onnxBytes": 63201294,+ "mnnBytes": 16864416,+ "feature": "tts"+ },+ {+ "onnx": "bin/piper/pl/pl_PL/jarvis_wg_glos/medium/pl_PL-jarvis_wg_glos-medium.onnx",+ "mnn": "bin/piper/pl/pl_PL/jarvis_wg_glos/medium/pl_PL-jarvis_wg_glos-medium.mnn",+ "quantBits": 8,+ "onnxBytes": 63516050,+ "mnnBytes": 16977372,+ "feature": "tts"+ },+ {+ "onnx": "bin/piper/pt/pt_BR/cadu/medium/pt_BR-cadu-medium.onnx",+ "mnn": "bin/piper/pt/pt_BR/cadu/medium/pt_BR-cadu-medium.mnn",+ "quantBits": 8,+ "onnxBytes": 62950044,+ "mnnBytes": 16763672,+ "feature": "tts"+ },+ {+ "onnx": "bin/piper/pt/pt_BR/jeff/medium/pt_BR-jeff-medium.onnx",+ "mnn": "bin/piper/pt/pt_BR/jeff/medium/pt_BR-jeff-medium.mnn",+ "quantBits": 8,+ "onnxBytes": 62950044,+ "mnnBytes": 16763672,+ "feature": "tts"+ },+ {+ "onnx": "bin/piper/pt/pt_BR/faber/medium/pt_BR-faber-medium.onnx",+ "mnn": "bin/piper/pt/pt_BR/faber/medium/pt_BR-faber-medium.mnn",+ "quantBits": 8,+ "onnxBytes": 63201294,+ "mnnBytes": 16864416,+ "feature": "tts"+ },+ {+ "onnx": "bin/piper/pt/pt_BR/edresson/low/pt_BR-edresson-low.onnx",+ "mnn": "bin/piper/pt/pt_BR/edresson/low/pt_BR-edresson-low.mnn",+ "quantBits": 8,+ "onnxBytes": 63104526,+ "mnnBytes": 16767648,+ "feature": "tts"+ },+ {+ "onnx": "bin/piper/pt/pt_PT/tug-o/medium/pt_PT-tugão-medium.onnx",+ "mnn": "bin/piper/pt/pt_PT/tug-o/medium/pt_PT-tugão-medium.mnn",+ "quantBits": 8,+ "onnxBytes": 63201294,+ "mnnBytes": 16864416,+ "feature": "tts"+ },+ {+ "onnx": "bin/piper/ro/ro_RO/mihai/medium/ro_RO-mihai-medium.onnx",+ "mnn": "bin/piper/ro/ro_RO/mihai/medium/ro_RO-mihai-medium.mnn",+ "quantBits": 8,+ "onnxBytes": 63201294,+ "mnnBytes": 16864416,+ "feature": "tts"+ },+ {+ "onnx": "bin/piper/ru/ru_RU/denis/medium/ru_RU-denis-medium.onnx",+ "mnn": "bin/piper/ru/ru_RU/denis/medium/ru_RU-denis-medium.mnn",+ "quantBits": 8,+ "onnxBytes": 63201294,+ "mnnBytes": 16864416,+ "feature": "tts"+ },+ {+ "onnx": "bin/piper/ru/ru_RU/dmitri/medium/ru_RU-dmitri-medium.onnx",+ "mnn": "bin/piper/ru/ru_RU/dmitri/medium/ru_RU-dmitri-medium.mnn",+ "quantBits": 8,+ "onnxBytes": 63201294,+ "mnnBytes": 16864416,+ "feature": "tts"+ },+ {+ "onnx": "bin/piper/ru/ru_RU/irina/medium/ru_RU-irina-medium.onnx",+ "mnn": "bin/piper/ru/ru_RU/irina/medium/ru_RU-irina-medium.mnn",+ "quantBits": 8,+ "onnxBytes": 63201294,+ "mnnBytes": 16864416,+ "feature": "tts"+ },+ {+ "onnx": "bin/piper/ru/ru_RU/ruslan/medium/ru_RU-ruslan-medium.onnx",+ "mnn": "bin/piper/ru/ru_RU/ruslan/medium/ru_RU-ruslan-medium.mnn",+ "quantBits": 8,+ "onnxBytes": 63201294,+ "mnnBytes": 16864416,+ "feature": "tts"+ },+ {+ "onnx": "bin/piper/sk/sk_SK/lili/medium/sk_SK-lili-medium.onnx",+ "mnn": "bin/piper/sk/sk_SK/lili/medium/sk_SK-lili-medium.mnn",+ "quantBits": 8,+ "onnxBytes": 63201294,+ "mnnBytes": 16864416,+ "feature": "tts"+ },+ {+ "onnx": "bin/piper/sl/sl_SI/artur/medium/sl_SI-artur-medium.onnx",+ "mnn": "bin/piper/sl/sl_SI/artur/medium/sl_SI-artur-medium.mnn",+ "quantBits": 8,+ "onnxBytes": 63200492,+ "mnnBytes": 16862912,+ "feature": "tts"+ },+ {+ "onnx": "bin/piper/sq/sq_AL/edon/medium/sq_AL-edon-medium.onnx",+ "mnn": "bin/piper/sq/sq_AL/edon/medium/sq_AL-edon-medium.mnn",+ "quantBits": 8,+ "onnxBytes": 63511038,+ "mnnBytes": 16974228,+ "feature": "tts"+ },+ {+ "onnx": "bin/piper/sr/sr_RS/serbski_institut/medium/sr_RS-serbski_institut-medium.onnx",+ "mnn": "bin/piper/sr/sr_RS/serbski_institut/medium/sr_RS-serbski_institut-medium.mnn",+ "quantBits": 8,+ "onnxBytes": 76733615,+ "mnnBytes": 20322068,+ "feature": "tts"+ },+ {+ "onnx": "bin/piper/sv/sv_SE/nst/medium/sv_SE-nst-medium.onnx",+ "mnn": "bin/piper/sv/sv_SE/nst/medium/sv_SE-nst-medium.mnn",+ "quantBits": 8,+ "onnxBytes": 63104526,+ "mnnBytes": 16767648,+ "feature": "tts"+ },+ {+ "onnx": "bin/piper/sv/sv_SE/alma/medium/sv_SE-alma-medium.onnx",+ "mnn": "bin/piper/sv/sv_SE/alma/medium/sv_SE-alma-medium.mnn",+ "quantBits": 8,+ "onnxBytes": 63434611,+ "mnnBytes": 16884756,+ "feature": "tts"+ },+ {+ "onnx": "bin/piper/sv/sv_SE/lisa/medium/sv_SE-lisa-medium.onnx",+ "mnn": "bin/piper/sv/sv_SE/lisa/medium/sv_SE-lisa-medium.mnn",+ "quantBits": 8,+ "onnxBytes": 63511038,+ "mnnBytes": 16974228,+ "feature": "tts"+ },+ {+ "onnx": "bin/piper/sw/sw_CD/lanfrica/medium/sw_CD-lanfrica-medium.onnx",+ "mnn": "bin/piper/sw/sw_CD/lanfrica/medium/sw_CD-lanfrica-medium.mnn",+ "quantBits": 8,+ "onnxBytes": 63201294,+ "mnnBytes": 16864428,+ "feature": "tts"+ },+ {+ "onnx": "bin/mms/ta/ta_IN/standard/medium/model.onnx",+ "mnn": "bin/mms/ta/ta_IN/standard/medium/model.mnn",+ "quantBits": 8,+ "onnxBytes": 114032312,+ "mnnBytes": 29604708,+ "feature": "tts"+ },+ {+ "onnx": "bin/piper/te/te_IN/maya/medium/te_IN-maya-medium.onnx",+ "mnn": "bin/piper/te/te_IN/maya/medium/te_IN-maya-medium.mnn",+ "quantBits": 8,+ "onnxBytes": 62950044,+ "mnnBytes": 16763672,+ "feature": "tts"+ },+ {+ "onnx": "bin/piper/te/te_IN/padmavathi/medium/te_IN-padmavathi-medium.onnx",+ "mnn": "bin/piper/te/te_IN/padmavathi/medium/te_IN-padmavathi-medium.mnn",+ "quantBits": 8,+ "onnxBytes": 63516050,+ "mnnBytes": 16977372,+ "feature": "tts"+ },+ {+ "onnx": "bin/piper/te/te_IN/venkatesh/medium/te_IN-venkatesh-medium.onnx",+ "mnn": "bin/piper/te/te_IN/venkatesh/medium/te_IN-venkatesh-medium.mnn",+ "quantBits": 8,+ "onnxBytes": 63516050,+ "mnnBytes": 16977372,+ "feature": "tts"+ },+ {+ "onnx": "bin/mms/th/th_TH/standard/medium/model.onnx",+ "mnn": "bin/mms/th/th_TH/standard/medium/model.mnn",+ "quantBits": 8,+ "onnxBytes": 114042296,+ "mnnBytes": 29614692,+ "feature": "tts"+ },+ {+ "onnx": "bin/mms/tl/tl_PH/standard/medium/model.onnx",+ "mnn": "bin/mms/tl/tl_PH/standard/medium/model.mnn",+ "quantBits": 8,+ "onnxBytes": 114020792,+ "mnnBytes": 29593188,+ "feature": "tts"+ },+ {+ "onnx": "bin/piper/tr/tr_TR/dfki/medium/tr_TR-dfki-medium.onnx",+ "mnn": "bin/piper/tr/tr_TR/dfki/medium/tr_TR-dfki-medium.mnn",+ "quantBits": 8,+ "onnxBytes": 63201294,+ "mnnBytes": 16864416,+ "feature": "tts"+ },+ {+ "onnx": "bin/piper/uk/uk_UA/ukrainian_tts/medium/uk_UA-ukrainian_tts-medium.onnx",+ "mnn": "bin/piper/uk/uk_UA/ukrainian_tts/medium/uk_UA-ukrainian_tts-medium.mnn",+ "quantBits": 8,+ "onnxBytes": 76735663,+ "mnnBytes": 20324116,+ "feature": "tts"+ },+ {+ "onnx": "bin/piper/uk/uk_UA/lada/x_low/uk_UA-lada-x_low.onnx",+ "mnn": "bin/piper/uk/uk_UA/lada/x_low/uk_UA-lada-x_low.mnn",+ "quantBits": 8,+ "onnxBytes": 20628813,+ "mnnBytes": 5915616,+ "feature": "tts"+ },+ {+ "onnx": "bin/piper/ur/ur_PK/fasih/medium/ur_PK-fasih-medium.onnx",+ "mnn": "bin/piper/ur/ur_PK/fasih/medium/ur_PK-fasih-medium.mnn",+ "quantBits": 8,+ "onnxBytes": 63532015,+ "mnnBytes": 16981908,+ "feature": "tts"+ },+ {+ "onnx": "bin/piper/vi/vi_VN/vais1000/medium/vi_VN-vais1000-medium.onnx",+ "mnn": "bin/piper/vi/vi_VN/vais1000/medium/vi_VN-vais1000-medium.mnn",+ "quantBits": 8,+ "onnxBytes": 63201294,+ "mnnBytes": 16864416,+ "feature": "tts"+ },+ {+ "onnx": "bin/piper/vi/vi_VN/25hours_single/low/vi_VN-25hours_single-low.onnx",+ "mnn": "bin/piper/vi/vi_VN/25hours_single/low/vi_VN-25hours_single-low.mnn",+ "quantBits": 8,+ "onnxBytes": 63104526,+ "mnnBytes": 16767648,+ "feature": "tts"+ },+ {+ "onnx": "bin/piper/vi/vi_VN/vivos/x_low/vi_VN-vivos-x_low.onnx",+ "mnn": "bin/piper/vi/vi_VN/vivos/x_low/vi_VN-vivos-x_low.mnn",+ "quantBits": 8,+ "onnxBytes": 27789413,+ "mnnBytes": 7842356,+ "feature": "tts"+ },+ {+ "onnx": "bin/piper/zh/zh_CN/huayan/medium/zh_CN-huayan-medium.onnx",+ "mnn": "bin/piper/zh/zh_CN/huayan/medium/zh_CN-huayan-medium.mnn",+ "quantBits": 8,+ "onnxBytes": 63201294,+ "mnnBytes": 16864416,+ "feature": "tts"+ },+ {+ "onnx": "bin/piper/zh/zh_CN/huayan/x_low/zh_CN-huayan-x_low.onnx",+ "mnn": "bin/piper/zh/zh_CN/huayan/x_low/zh_CN-huayan-x_low.mnn",+ "quantBits": 8,+ "onnxBytes": 20628813,+ "mnnBytes": 5915616,+ "feature": "tts"+ },+ {+ "onnx": "bin/sherpa_vits/zh_hant/zh_HK/cantonese/medium/vits-cantonese-hf-xiaomaiiwn.onnx",+ "mnn": "bin/sherpa_vits/zh_hant/zh_HK/cantonese/medium/vits-cantonese-hf-xiaomaiiwn.mnn",+ "quantBits": 8,+ "onnxBytes": 114059955,+ "mnnBytes": 29632328,+ "feature": "tts"+ },+ {+ "onnx": "bin/piper/zh_hant/zh_TW/mandarin-traditional/medium/yt-chinese_female.onnx",+ "mnn": "bin/piper/zh_hant/zh_TW/mandarin-traditional/medium/yt-chinese_female.mnn",+ "quantBits": 8,+ "onnxBytes": 63531476,+ "mnnBytes": 16981524,+ "feature": "tts"+ },+ {+ "onnx": "ocr/docrec/docaligner_lcnet050.onnx",+ "mnn": "ocr/docrec/docaligner_lcnet050.mnn",+ "quantBits": 8,+ "onnxBytes": 4911217,+ "mnnBytes": 1760380,+ "feature": "doc_detect"+ }+ ]+}diff --git a/OCR-translation/src/main/assets/reader-mode.js b/OCR-translation/src/main/assets/reader-mode.jsnew file mode 100644index 0000000..7422a2e--- /dev/null+++ b/OCR-translation/src/main/assets/reader-mode.js@@ -0,0 +1,136 @@+(function () {+ function ensureReadability() {+ if (typeof Readability === 'function') return true;+ try {+ (0, eval)(window.__translatorReadabilityScript || '');+ return typeof Readability === 'function';+ } catch (e) {+ console.warn('[reader-mode] failed to load Readability', e);+ return false;+ }+ }++ function escapeHtml(value) {+ return String(value || '').replace(/[&<>"']/g, function (ch) {+ return {+ '&': '&',+ '<': '<',+ '>': '>',+ '"': '"',+ "'": '''+ }[ch];+ });+ }++ function sanitizeArticleHtml(html) {+ var container = document.createElement('template');+ container.innerHTML = html || '';+ var blocked = container.content.querySelectorAll(+ 'script, style, iframe, object, embed, form, input, button, textarea, select, link, meta'+ );+ for (var i = 0; i < blocked.length; i++) blocked[i].remove();++ var walker = document.createTreeWalker(container.content, NodeFilter.SHOW_ELEMENT);+ var node;+ while ((node = walker.nextNode())) {+ var attrs = Array.prototype.slice.call(node.attributes || []);+ for (var j = 0; j < attrs.length; j++) {+ var name = attrs[j].name;+ var lowerName = name.toLowerCase();+ var value = attrs[j].value || '';+ if (lowerName.indexOf('on') === 0 || lowerName === 'srcdoc') {+ node.removeAttribute(name);+ continue;+ }+ if (+ (lowerName === 'href' || lowerName === 'src' || lowerName === 'xlink:href') &&+ /^\s*javascript:/i.test(value)+ ) {+ node.removeAttribute(name);+ }+ }+ }+ return container.innerHTML;+ }++ function buildReaderDocument(article) {+ var title = escapeHtml(article.title || document.title || 'Reader mode');+ var byline = article.byline ? '<p class="reader-byline">' + escapeHtml(article.byline) + '</p>' : '';+ var siteName = article.siteName ? '<p class="reader-site">' + escapeHtml(article.siteName) + '</p>' : '';+ var content = sanitizeArticleHtml(article.content);+ var lang = escapeHtml(article.lang || document.documentElement.lang || '');+ var dir = escapeHtml(article.dir || document.dir || 'auto');+ return (+ '<!doctype html><html lang="' ++ lang ++ '" dir="' ++ dir ++ '">' ++ '<head><meta charset="utf-8">' ++ '<meta name="viewport" content="width=device-width, initial-scale=1">' ++ '<title>' ++ title ++ '</title>' ++ '<style>' ++ ':root{color-scheme:light dark}' ++ 'body{margin:0;background:#f6f0e4;color:#211f1a;font:19px/1.68 Georgia,"Times New Roman",serif}' ++ 'main{box-sizing:border-box;max-width:min(760px,calc(100vw - 32px));margin:0 auto;padding:72px 0 40px}' ++ '.reader-site{margin:0 0 10px;color:#746c5b;font:600 13px/1.2 sans-serif;letter-spacing:.08em;text-transform:uppercase}' ++ 'h1{margin:0 0 10px;color:#171510;font:700 34px/1.14 Georgia,"Times New Roman",serif}' ++ '.reader-byline{margin:0 0 28px;color:#746c5b;font:15px/1.4 sans-serif}' ++ 'p,li,blockquote{color:inherit}' ++ 'a{color:#7b4a1f}' ++ 'img,video,figure,pre,table{max-width:100%;height:auto}' ++ 'img,video{border-radius:10px}' ++ 'pre{overflow:auto}' ++ 'figcaption{color:#746c5b;font:14px/1.4 sans-serif}' ++ '@media (prefers-color-scheme:dark){body{background:#191714;color:#eee5d5}h1{color:#fff7e8}.reader-site,.reader-byline,figcaption{color:#a99f8d}a{color:#e0a15c}}' ++ '</style></head><body><main>' ++ siteName ++ '<h1>' ++ title ++ '</h1>' ++ byline ++ content ++ '</main></body></html>'+ );+ }++ if (!ensureReadability()) return window.__translatorReaderModeProbe ? false : null;++ function buildSourceClone() {+ if (window.__translator && typeof window.__translator.cloneDocumentWithSource === 'function') {+ return window.__translator.cloneDocumentWithSource();+ }+ return document.cloneNode(true);+ }++ function parseArticle() {+ var clone = buildSourceClone();+ return new Readability(clone, {+ classesToPreserve: [+ 'caption',+ 'emoji',+ 'hidden',+ 'invisible',+ 'sr-only',+ 'visually-hidden',+ 'visuallyhidden',+ 'wp-caption',+ 'wp-caption-text',+ 'wp-smiley'+ ]+ }).parse();+ }++ try {+ var article = parseArticle();+ if (!article || !article.content || article.length < 500) {+ return window.__translatorReaderModeProbe ? false : null;+ }+ return window.__translatorReaderModeProbe ? true : buildReaderDocument(article);+ } catch (e) {+ console.warn('[reader-mode] failed', e);+ return window.__translatorReaderModeProbe ? false : null;+ }+})();diff --git a/OCR-translation/src/main/assets/translator.js b/OCR-translation/src/main/assets/translator.jsnew file mode 100644index 0000000..7e59043--- /dev/null+++ b/OCR-translation/src/main/assets/translator.js@@ -0,0 +1,726 @@+(function () {+ if (window.__translator) return;++ const nonce = Math.random().toString(36).slice(2) + Date.now().toString(36);+ const bridgeName = typeof __translatorBridgeName === 'string' ? __translatorBridgeName : null;+ const bridgeToken = typeof __translatorBridgeToken === 'string' ? __translatorBridgeToken : null;+ const bridge = bridgeName ? window[bridgeName] : null;+ if (!bridge || !bridgeToken) return;+ const pending = new Map();+ let nextId = 1;+ let translationEpoch = 0;++ // Wire format: length-prefixed records. `<len>:<text><len>:<text>...`+ // where `len` is the UTF-16 code-unit count of the text (matches JS+ // String.length and Kotlin String.length). Robust to any content,+ // cheaper than JSON because no per-char escaping.+ function encodeWire(items) {+ let s = '';+ for (let i = 0; i < items.length; i++) {+ const t = items[i];+ s += t.length + ':' + t;+ }+ return s;+ }++ function decodeWire(s) {+ const items = [];+ let i = 0;+ while (i < s.length) {+ const colon = s.indexOf(':', i);+ if (colon < 0) return null;+ const len = parseInt(s.slice(i, colon), 10);+ if (!Number.isFinite(len) || len < 0) return null;+ const start = colon + 1;+ const end = start + len;+ if (end > s.length) return null;+ items.push(s.slice(start, end));+ i = end;+ }+ return items;+ }++ function send(method, payload) {+ return new Promise((resolve, reject) => {+ const id = nextId++;+ pending.set(id, { resolve, reject });+ try {+ bridge[method](id, encodeWire(payload), bridgeToken, nonce);+ } catch (e) {+ pending.delete(id);+ reject(e);+ }+ });+ }++ const rawPending = new Map();+ let nextRawId = 1;++ function sendRaw(method, payload) {+ return new Promise((resolve, reject) => {+ const id = nextRawId++;+ rawPending.set(id, { resolve, reject });+ try {+ bridge[method](id, payload, bridgeToken, nonce);+ } catch (e) {+ rawPending.delete(id);+ reject(e);+ }+ });+ }++ const BLOCK_TAGS = new Set([+ 'P', 'LI', 'H1', 'H2', 'H3', 'H4', 'H5', 'H6',+ 'TD', 'TH', 'FIGCAPTION', 'DT', 'DD', 'BLOCKQUOTE',+ 'SUMMARY', 'CAPTION', 'LEGEND',+ ]);+ const STRUCTURAL_TAGS = new Set([+ 'DIV', 'SECTION', 'ARTICLE', 'ASIDE', 'HEADER', 'FOOTER',+ 'NAV', 'MAIN', 'FIGURE', 'DETAILS', 'FORM', 'ADDRESS',+ ]);+ const SKIP_TAGS = new Set([+ 'SCRIPT', 'STYLE', 'NOSCRIPT', 'TEMPLATE', 'IFRAME',+ 'TEXTAREA', 'SVG', 'CANVAS', 'OBJECT', 'EMBED',+ ]);++ const BATCH_MAX = 50;+ const DRAIN_INTERVAL_MS = 25;+ const INTERSECTION_MARGIN = '500px 0px';++ const GENERIC_ATTRS = [+ 'title', 'placeholder', 'alt',+ 'aria-label', 'aria-description', 'aria-placeholder',+ 'aria-roledescription', 'aria-valuetext', 'aria-braillelabel',+ ];+ const ATTR_SELECTOR = GENERIC_ATTRS.map(a => `[${a}]`).join(',');++ const OBSERVER_OPTS = {+ childList: true,+ subtree: true,+ characterData: true,+ };++ function isBlockLike(el) {+ if (el.getAttribute && el.getAttribute('role') === 'heading') return true;+ return BLOCK_TAGS.has(el.tagName) || STRUCTURAL_TAGS.has(el.tagName);+ }++ function isSkippedBySelf(el) {+ if (SKIP_TAGS.has(el.tagName)) return true;+ if (el.getAttribute && el.getAttribute('translate') === 'no') return true;+ if (el.classList && el.classList.contains('notranslate')) return true;+ if (el.hasAttribute && el.hasAttribute('contenteditable')) return true;+ return false;+ }++ function isSkippedByAncestor(el) {+ for (let n = el; n; n = n.parentElement) {+ if (n.nodeType !== 1) continue;+ if (isSkippedBySelf(n)) return true;+ }+ return false;+ }++ function hasTranslatedAncestor(el) {+ for (let n = el; n; n = n.parentElement) {+ if (n.nodeType !== 1) continue;+ if (n.hasAttribute && n.hasAttribute('data-xlated')) return true;+ }+ return false;+ }++ function hasMeaningfulText(el) {+ const t = el.textContent;+ return !!t && t.trim().length > 0;+ }++ function collectUnits(root, units) {+ const kids = root.children;+ for (let i = 0; i < kids.length; i++) {+ walk(kids[i], units);+ }+ }++ // Single bottom-up pass: returns whether this subtree contains any+ // block-like element so the caller can decide if it should itself be a+ // leaf unit. Pushes leaf units into `target` as it goes. Inside skipped+ // subtrees `target` is null — we still recurse to report block-like-ness+ // (preserving the original semantic where skipped descendants prevent an+ // ancestor from becoming a leaf), but we don't collect anything.+ function walk(el, units) {+ if (el.hasAttribute('data-xlated')) return true;+ const skipped = isSkippedBySelf(el);+ const target = skipped ? null : units;+ if (!skipped && el.shadowRoot) collectUnits(el.shadowRoot, units);+ let childHasBlockLike = false;+ const kids = el.children;+ for (let i = 0; i < kids.length; i++) {+ if (walk(kids[i], target)) childHasBlockLike = true;+ }+ const myselfBlockLike = isBlockLike(el);+ if (target && myselfBlockLike && !childHasBlockLike && hasMeaningfulText(el)) {+ target.push(el);+ }+ return myselfBlockLike || childHasBlockLike;+ }++ const queued = new Set();+ const translatedUnits = new WeakMap();+ const translatedUnitList = new Set();+ const retryCount = new WeakMap();+ const MAX_RETRIES = 3;++ function bumpRetry(el) {+ const n = (retryCount.get(el) || 0) + 1;+ retryCount.set(el, n);+ return n <= MAX_RETRIES;+ }++ function reWalkDirty(el) {+ if (!el || !el.isConnected) return;+ if (isSkippedByAncestor(el)) return;+ if (!bumpRetry(el)) return;+ const newUnits = [];+ walk(el, newUnits);+ observeUnits(newUnits);+ observeAttrCandidates(el);+ }++ const io = new IntersectionObserver(+ (entries) => {+ for (const e of entries) {+ if (e.isIntersecting) enqueue(e.target);+ }+ },+ { rootMargin: INTERSECTION_MARGIN },+ );++ function enqueue(el) {+ if (queued.has(el)) return;+ if (!el.isConnected) return;+ if (el.hasAttribute('data-xlated')) {+ io.unobserve(el);+ return;+ }+ queued.add(el);+ scheduleDrain();+ }++ function observeUnits(units) {+ for (const u of units) io.observe(u);+ }++ let drainScheduled = false;+ let lastDrain = 0;++ function scheduleDrain() {+ if (drainScheduled) return;+ drainScheduled = true;+ requestAnimationFrame(maybeDrain);+ }++ function maybeDrain() {+ drainScheduled = false;+ if (queued.size === 0 && attrQueued.size === 0) return;+ const now = performance.now();+ const wait = lastDrain + DRAIN_INTERVAL_MS - now;+ if (wait > 0) {+ setTimeout(scheduleDrain, wait);+ return;+ }+ lastDrain = now;+ if (queued.size > 0) {+ const batch = Array.from(queued);+ queued.clear();+ for (const el of batch) io.unobserve(el);+ processUnits(batch);+ }+ if (attrQueued.size > 0) {+ drainAttrQueue();+ }+ }++ let observer = null;++ function pauseObserver() {+ if (observer) observer.disconnect();+ }++ function resumeObserver() {+ if (observer) observer.observe(document.body, OBSERVER_OPTS);+ }++ function isResetError(e) {+ return e && e.name === 'TranslatorReset';+ }++ function closestTranslatedUnit(node) {+ let el = node && node.nodeType === 1 ? node : node && node.parentElement;+ for (let n = el; n; n = n.parentElement) {+ if (n.hasAttribute && n.hasAttribute('data-xlated')) return n;+ }+ return null;+ }++ function rememberTranslatedUnit(el, sourceHtml, sourceText, translatedHtml) {+ translatedUnits.set(el, {+ sourceHtml,+ sourceText,+ translatedHtml,+ translatedText: el.textContent,+ });+ translatedUnitList.add(el);+ }++ function forgetTranslatedUnit(el) {+ translatedUnits.delete(el);+ translatedUnitList.delete(el);+ if (el.hasAttribute && el.hasAttribute('data-xlated')) {+ el.removeAttribute('data-xlated');+ }+ }++ function restoreTranslatedUnit(el, state) {+ pauseObserver();+ try {+ if (!el.isConnected) return;+ if (el.innerHTML !== state.translatedHtml) {+ el.innerHTML = state.translatedHtml;+ }+ el.setAttribute('data-xlated', '1');+ } finally {+ resumeObserver();+ }+ }++ function reconcileTranslatedUnit(el) {+ const state = translatedUnits.get(el);+ if (!state) {+ forgetTranslatedUnit(el);+ return 'changed';+ }+ if (!el.isConnected) {+ translatedUnits.delete(el);+ return 'ignored';+ }+ if (el.innerHTML === state.translatedHtml || el.textContent === state.translatedText) {+ return 'translated';+ }+ if (el.textContent === state.sourceText) {+ restoreTranslatedUnit(el, state);+ return 'restored';+ }+ forgetTranslatedUnit(el);+ return 'changed';+ }++ function resetTranslations() {+ translationEpoch++;+ for (const entry of pending.values()) {+ const err = new Error('translation reset');+ err.name = 'TranslatorReset';+ entry.reject(err);+ }+ pending.clear();+ for (const entry of rawPending.values()) {+ const err = new Error('translation reset');+ err.name = 'TranslatorReset';+ entry.reject(err);+ }+ rawPending.clear();+ pauseObserver();+ try {+ queued.clear();+ attrQueued.clear();+ for (const el of Array.from(translatedUnitList)) {+ const state = translatedUnits.get(el);+ translatedUnits.delete(el);+ translatedUnitList.delete(el);+ if (!state || !el.isConnected) continue;+ if (el.hasAttribute && el.hasAttribute('data-xlated')) {+ el.removeAttribute('data-xlated');+ }+ if (el.innerHTML === state.translatedHtml || el.textContent === state.translatedText) {+ el.innerHTML = state.sourceHtml;+ }+ }+ } finally {+ resumeObserver();+ }+ scan();+ return true;+ }++ function restoreSourceInClone(liveEl, cloneEl) {+ if (!liveEl || !cloneEl) return;+ if (liveEl.hasAttribute && liveEl.hasAttribute('data-xlated')) {+ const state = translatedUnits.get(liveEl);+ if (state) {+ cloneEl.innerHTML = state.sourceHtml;+ if (cloneEl.removeAttribute) cloneEl.removeAttribute('data-xlated');+ return;+ }+ }+ const liveKids = liveEl.children;+ const cloneKids = cloneEl.children;+ if (!liveKids || !cloneKids) return;+ const n = Math.min(liveKids.length, cloneKids.length);+ for (let i = 0; i < n; i++) {+ restoreSourceInClone(liveKids[i], cloneKids[i]);+ }+ }++ function cloneDocumentWithSource() {+ const clone = document.cloneNode(true);+ const liveRoot = document.documentElement;+ const cloneRoot = clone.documentElement;+ if (liveRoot && cloneRoot) restoreSourceInClone(liveRoot, cloneRoot);+ return clone;+ }++ function writeBack(units, translated, fragments, snapshots) {+ const stale = [];+ pauseObserver();+ try {+ for (let i = 0; i < units.length; i++) {+ const el = units[i];+ const out = translated[i];+ if (out == null) continue;+ if (!el.isConnected) continue;+ if (el.textContent !== snapshots[i]) {+ stale.push(el);+ continue;+ }+ el.innerHTML = out;+ el.setAttribute('data-xlated', '1');+ rememberTranslatedUnit(el, fragments[i], snapshots[i], out);+ }+ } finally {+ resumeObserver();+ }+ for (const el of stale) reWalkDirty(el);+ }++ const attrQueued = new Map();++ const attrIo = new IntersectionObserver(+ (entries) => {+ for (const e of entries) {+ if (e.isIntersecting) enqueueAttr(e.target);+ }+ },+ { rootMargin: INTERSECTION_MARGIN },+ );++ function translatableAttrsOf(el) {+ const result = [];+ for (const a of GENERIC_ATTRS) {+ if (el.hasAttribute(a)) result.push(a);+ }+ if (el.tagName === 'INPUT') {+ const t = (el.getAttribute('type') || '').toLowerCase();+ if ((t === 'button' || t === 'reset') && el.hasAttribute('value')) {+ result.push('value');+ }+ } else if (el.tagName === 'OPTION' || el.tagName === 'OPTGROUP' || el.tagName === 'TRACK') {+ if (el.hasAttribute('label')) result.push('label');+ }+ return result;+ }++ function enqueueAttr(el) {+ if (attrQueued.has(el)) return;+ if (!el.isConnected) return;+ if (el.hasAttribute('data-xlated-attr')) {+ attrIo.unobserve(el);+ return;+ }+ const attrs = translatableAttrsOf(el);+ if (attrs.length === 0) {+ attrIo.unobserve(el);+ return;+ }+ const snapshot = new Map();+ for (const a of attrs) snapshot.set(a, el.getAttribute(a));+ attrQueued.set(el, snapshot);+ scheduleDrain();+ }++ function observeAttrCandidates(root) {+ const scope =+ root.nodeType === 1 && root.matches && root.matches(ATTR_SELECTOR)+ ? [root]+ : [];+ if (root.querySelectorAll) {+ for (const el of root.querySelectorAll(ATTR_SELECTOR)) scope.push(el);+ for (const el of root.querySelectorAll('input[type=button],input[type=reset],option,optgroup,track')) {+ if (translatableAttrsOf(el).length > 0) scope.push(el);+ }+ }+ for (const el of scope) {+ if (isSkippedByAncestor(el)) continue;+ if (hasTranslatedAncestor(el)) continue;+ attrIo.observe(el);+ }+ }++ function translateMetaAttributes() {+ if (!document.head) return;+ const metas = Array.from(+ document.head.querySelectorAll('meta[name="description"],meta[name="keywords"]'),+ ).filter(m => m.hasAttribute('content') && !m.hasAttribute('data-xlated-attr'));+ if (metas.length === 0) return;+ const texts = metas.map(m => m.getAttribute('content'));+ const epoch = translationEpoch;+ send('translateTexts', texts)+ .then((translated) => {+ if (epoch !== translationEpoch) return;+ for (let i = 0; i < metas.length; i++) {+ const out = translated[i];+ if (out == null) continue;+ const m = metas[i];+ if (!m.isConnected) continue;+ if (m.getAttribute('content') !== texts[i]) continue;+ m.setAttribute('content', out);+ m.setAttribute('data-xlated-attr', '1');+ }+ })+ .catch((e) => {+ if (isResetError(e)) return;+ console.warn('[translator] meta batch failed', e);+ });+ }++ async function drainAttrQueue() {+ if (attrQueued.size === 0) return;+ const entries = Array.from(attrQueued.entries());+ attrQueued.clear();+ for (const [el] of entries) attrIo.unobserve(el);++ const records = [];+ for (const [el, snapshot] of entries) {+ if (!el.isConnected) continue;+ for (const [attr, text] of snapshot) {+ if (el.getAttribute(attr) !== text) continue;+ if (!text || text.trim().length === 0) continue;+ records.push({ el, attr, text });+ }+ }+ if (records.length === 0) return;++ for (let i = 0; i < records.length; i += BATCH_MAX) {+ const batch = records.slice(i, i + BATCH_MAX);+ const texts = batch.map(r => r.text);+ const epoch = translationEpoch;+ let translated;+ try {+ translated = await send('translateTexts', texts);+ } catch (e) {+ if (isResetError(e)) continue;+ console.warn('[translator] attr batch failed', e);+ continue;+ }+ if (epoch !== translationEpoch) continue;+ const staleAttr = [];+ pauseObserver();+ try {+ for (let j = 0; j < batch.length; j++) {+ const r = batch[j];+ const out = translated[j];+ if (out == null) continue;+ if (!r.el.isConnected) continue;+ if (r.el.getAttribute(r.attr) !== r.text) {+ staleAttr.push(r.el);+ continue;+ }+ r.el.setAttribute(r.attr, out);+ r.el.setAttribute('data-xlated-attr', '1');+ }+ } finally {+ resumeObserver();+ }+ for (const el of staleAttr) {+ if (el.isConnected) attrIo.observe(el);+ }+ }+ }++ async function processUnits(units) {+ for (let i = 0; i < units.length; i += BATCH_MAX) {+ const batchUnits = units.slice(i, i + BATCH_MAX);+ const batchFragments = batchUnits.map(u => u.innerHTML);+ const batchSnapshots = batchUnits.map(u => u.textContent);+ const epoch = translationEpoch;+ let translated;+ try {+ translated = await send('translateHtmlFragments', batchFragments);+ } catch (e) {+ if (isResetError(e)) continue;+ console.warn('[translator] batch failed', e);+ continue;+ }+ if (epoch !== translationEpoch) continue;+ writeBack(batchUnits, translated, batchFragments, batchSnapshots);+ }+ }++ function handleMutations(muts) {+ const touched = new Set();+ const translatedTouched = new Set();+ for (const m of muts) {+ const translatedUnit = closestTranslatedUnit(m.target);+ if (translatedUnit) translatedTouched.add(translatedUnit);+ if (m.type === 'childList') {+ for (const node of m.addedNodes) {+ if (node.nodeType === 1) touched.add(node);+ }+ } else if (m.type === 'characterData') {+ const p = m.target.parentElement;+ if (p) touched.add(p);+ }+ }+ const newUnits = [];+ for (const el of translatedTouched) {+ if (reconcileTranslatedUnit(el) !== 'changed') continue;+ if (!el.isConnected) continue;+ if (isSkippedByAncestor(el)) continue;+ if (!bumpRetry(el)) continue;+ walk(el, newUnits);+ observeAttrCandidates(el);+ }+ if (touched.size === 0 && newUnits.length === 0) return;+ for (const node of touched) {+ if (!node.isConnected) continue;+ if (isSkippedByAncestor(node)) continue;+ if (hasTranslatedAncestor(node)) continue;+ walk(node, newUnits);+ observeAttrCandidates(node);+ }+ observeUnits(newUnits);+ }++ function scan() {+ if (isSkippedByAncestor(document.documentElement)) return;+ const units = [];+ collectUnits(document.body, units);+ observeUnits(units);+ observeAttrCandidates(document.body);+ translateMetaAttributes();++ if (!observer) {+ observer = new MutationObserver(handleMutations);+ observer.observe(document.body, OBSERVER_OPTS);+ }+ }++ let lastTouchedImg = null;++ function trackTouchedImg(target) {+ if (!target || !target.closest) return;+ const img = target.closest('img');+ if (img) lastTouchedImg = img;+ }++ document.addEventListener('touchstart', (e) => trackTouchedImg(e.target), { capture: true, passive: true });+ document.addEventListener('mousedown', (e) => trackTouchedImg(e.target), { capture: true, passive: true });++ async function translateTouchedImage() {+ const img = lastTouchedImg;+ console.log('[translator] translateTouchedImage img=', img && img.src);+ if (!img || !img.isConnected) {+ console.warn('[translator] no touched image');+ return false;+ }+ const w = img.naturalWidth;+ const h = img.naturalHeight;+ if (!w || !h) {+ console.warn('[translator] image has no natural dimensions');+ return false;+ }+ let dataUri;+ try {+ const c = document.createElement('canvas');+ c.width = w;+ c.height = h;+ c.getContext('2d').drawImage(img, 0, 0);+ dataUri = c.toDataURL('image/jpeg', 0.92);+ } catch (e) {+ console.warn('[translator] image canvas tainted, cannot translate cross-origin image', e);+ return false;+ }+ console.log('[translator] sending image dataUri len=', dataUri.length);+ let translated;+ try {+ translated = await sendRaw('translateImage', dataUri);+ } catch (e) {+ if (isResetError(e)) return false;+ console.warn('[translator] image translate failed', e);+ return false;+ }+ console.log('[translator] image translate result len=', translated && translated.length);+ if (!translated || !img.isConnected) return false;+ pauseObserver();+ try {+ if (img.hasAttribute('srcset')) img.removeAttribute('srcset');+ const picture = img.parentElement && img.parentElement.tagName === 'PICTURE' ? img.parentElement : null;+ if (picture) {+ for (const s of picture.querySelectorAll('source')) s.remove();+ }+ img.src = translated;+ img.setAttribute('data-img-xlated', '1');+ } finally {+ resumeObserver();+ }+ return true;+ }++ window.__translator = {+ reset: resetTranslations,+ cloneDocumentWithSource,+ translateTouchedImage,+ resolve(id, results, callerNonce) {+ if (callerNonce !== nonce) return;+ const entry = pending.get(id);+ if (!entry) return;+ pending.delete(id);+ const parsed =+ typeof results === 'string' ? (decodeWire(results) || []) : results;+ entry.resolve(parsed);+ },+ resolveRaw(id, result, callerNonce) {+ if (callerNonce !== nonce) return;+ const entry = rawPending.get(id);+ if (!entry) return;+ rawPending.delete(id);+ entry.resolve(result);+ },+ };++ function hookSpaNavigation() {+ const origPush = history.pushState;+ const origReplace = history.replaceState;+ const emit = () => window.dispatchEvent(new Event('__translator:urlchange'));+ history.pushState = function () {+ origPush.apply(this, arguments);+ emit();+ };+ history.replaceState = function () {+ origReplace.apply(this, arguments);+ emit();+ };+ window.addEventListener('popstate', emit);+ window.addEventListener('__translator:urlchange', () => scan());+ }++ if (document.readyState === 'loading') {+ document.addEventListener('DOMContentLoaded', () => {+ scan();+ hookSpaNavigation();+ }, { once: true });+ } else {+ scan();+ hookSpaNavigation();+ }++ console.log('[translator] content script ready');+})();diff --git a/OCR-translation/src/main/bindings/.cargo/config.toml b/OCR-translation/src/main/bindings/.cargo/config.tomlnew file mode 100644index 0000000..3abf1ff--- /dev/null+++ b/OCR-translation/src/main/bindings/.cargo/config.toml@@ -0,0 +1,5 @@+[build]+rustflags = [+ "--remap-path-prefix=/home/vagrant/.cargo=/",+ "--remap-path-prefix=/usr/local/cargo=/",+]\ No newline at end of filediff --git a/OCR-translation/src/main/bindings/.gitignore b/OCR-translation/src/main/bindings/.gitignorenew file mode 100644index 0000000..152b5b5--- /dev/null+++ b/OCR-translation/src/main/bindings/.gitignore@@ -0,0 +1,2 @@+jniLibs/+target/diff --git a/OCR-translation/src/main/bindings/Cargo.lock b/OCR-translation/src/main/bindings/Cargo.locknew file mode 100644index 0000000..de74d5e--- /dev/null+++ b/OCR-translation/src/main/bindings/Cargo.lock@@ -0,0 +1,4140 @@+# This file is automatically @generated by Cargo.+# It is not intended for manual editing.+version = 4++[[package]]+name = "ab_glyph"+version = "0.2.32"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "01c0457472c38ea5bd1c3b5ada5e368271cb550be7a4ca4a0b4634e9913f6cc2"+dependencies = [+ "ab_glyph_rasterizer",+ "owned_ttf_parser",+]++[[package]]+name = "ab_glyph_rasterizer"+version = "0.1.10"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "366ffbaa4442f4684d91e2cd7c5ea7c4ed8add41959a31447066e279e432b618"++[[package]]+name = "adblock"+version = "0.12.6"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "4844c456026028b3a22f3bc0b0e0b2485809591673e2d70930a4ada7c4d3a90d"+dependencies = [+ "addr",+ "arrayvec",+ "base64 0.22.1",+ "bitflags 2.13.1",+ "flatbuffers",+ "idna",+ "itertools 0.14.0",+ "memchr 2.8.3",+ "percent-encoding",+ "precomputed-hash",+ "regex 1.13.1",+ "rustc-hash 1.1.0",+ "seahash",+ "serde",+ "serde_json",+ "thiserror 1.0.69",+ "url",+]++[[package]]+name = "addr"+version = "0.15.6"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "a93b8a41dbe230ad5087cc721f8d41611de654542180586b315d9f4cf6b72bef"+dependencies = [+ "psl",+ "psl-types",+]++[[package]]+name = "adler2"+version = "2.0.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa"++[[package]]+name = "aes"+version = "0.8.4"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "b169f7a6d4742236a0a00c541b845991d0ac43e546831af1249753ab4c3aa3a0"+dependencies = [+ "cfg-if",+ "cipher",+ "cpufeatures 0.2.17",+]++[[package]]+name = "aho-corasick"+version = "0.5.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "ca972c2ea5f742bfce5687b9aef75506a764f61d37f8f649047846a9686ddb66"+dependencies = [+ "memchr 0.1.11",+]++[[package]]+name = "aho-corasick"+version = "1.1.5"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "c982642fa9e8606056828ee9a8505737230110bb1099153c79efe865c59d12ba"+dependencies = [+ "memchr 2.8.3",+]++[[package]]+name = "android_log-sys"+version = "0.3.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "84521a3cf562bc62942e294181d9eef17eb38ceb8c68677bc49f144e4c3d4f8d"++[[package]]+name = "android_logger"+version = "0.14.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "05b07e8e73d720a1f2e4b6014766e6039fd2e96a4fa44e2a78d0e1fa2ff49826"+dependencies = [+ "android_log-sys",+ "env_filter",+ "log",+]++[[package]]+name = "android_system_properties"+version = "0.1.6"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "ae221649c9976a6f6c56ae1facf410f3ddb33cc661c4b7b61020a912d4237fbc"+dependencies = [+ "libc",+]++[[package]]+name = "anyhow"+version = "1.0.104"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "330a5ed07fa54e4702c9d6c4174f74427fc0ef6e214bbd677ae50a5099946470"++[[package]]+name = "approx"+version = "0.5.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "cab112f0a86d568ea0e627cc1d6be74a1e9cd55214684db5561995f6dad897c6"+dependencies = [+ "num-traits",+]++[[package]]+name = "arbitrary"+version = "1.4.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "c3d036a3c4ab069c7b410a2ce876bd74808d2d0888a82667669f8e783a898bf1"+dependencies = [+ "derive_arbitrary",+]++[[package]]+name = "arrayvec"+version = "0.7.8"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "d3fb67a6e08acf24fdeccbac2cb6ac4305825bd1f117462e0e6f2f193345ad56"++[[package]]+name = "ascii"+version = "1.1.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "d92bec98840b8f03a5ff5413de5293bfcd8bf96467cf5452609f939ec6f5de16"++[[package]]+name = "autocfg"+version = "1.5.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "f2032f911046de80f0a198e0901378627c33f59ea0ac00e363d481118bd70a53"++[[package]]+name = "base64"+version = "0.13.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8"++[[package]]+name = "base64"+version = "0.22.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6"++[[package]]+name = "bimap"+version = "0.6.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "230c5f1ca6a325a32553f8640d31ac9b49f2411e901e427570154868b46da4f7"++[[package]]+name = "bindgen"+version = "0.69.5"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "271383c67ccabffb7381723dea0672a673f292304fcb45c01cc648c7a8d58088"+dependencies = [+ "bitflags 2.13.1",+ "cexpr",+ "clang-sys",+ "itertools 0.12.1",+ "lazy_static",+ "lazycell",+ "log",+ "prettyplease",+ "proc-macro2",+ "quote",+ "regex 1.13.1",+ "rustc-hash 1.1.0",+ "shlex 1.3.0",+ "syn 2.0.119",+ "which",+]++[[package]]+name = "bindgen"+version = "0.72.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "993776b509cfb49c750f11b8f07a46fa23e0a1386ffc01fb1e7d343efc387895"+dependencies = [+ "bitflags 2.13.1",+ "cexpr",+ "clang-sys",+ "itertools 0.13.0",+ "proc-macro2",+ "quote",+ "regex 1.13.1",+ "rustc-hash 2.1.3",+ "shlex 1.3.0",+ "syn 2.0.119",+]++[[package]]+name = "bindings"+version = "0.1.0"+dependencies = [+ "adblock",+ "android_logger",+ "jni",+ "log",+ "markup5ever",+ "serde_json",+ "thiserror 2.0.20",+ "translator",+ "uniffi",+ "xml5ever",+]++[[package]]+name = "bitflags"+version = "1.3.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"++[[package]]+name = "bitflags"+version = "2.13.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "b588b76d00fde79687d7646a9b5bdf3cc0f655e0bbd080335a95d7e96f3587da"+dependencies = [+ "serde_core",+]++[[package]]+name = "block-buffer"+version = "0.10.4"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71"+dependencies = [+ "generic-array 0.14.7",+]++[[package]]+name = "block-padding"+version = "0.3.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "a8894febbff9f758034a5b8e12d87918f56dfc64a8e1fe757d65e29041538d93"+dependencies = [+ "generic-array 0.14.7",+]++[[package]]+name = "buf_redux"+version = "0.8.4"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "b953a6887648bb07a535631f2bc00fbdb2a2216f135552cb3f534ed136b9c07f"+dependencies = [+ "memchr 2.8.3",+ "safemem",+]++[[package]]+name = "bumpalo"+version = "3.20.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "72f5acc6cb2ba439de613abc23857ec3d78374d8ed5ac84e9d11336e87da8649"++[[package]]+name = "bytecount"+version = "0.6.9"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "175812e0be2bccb6abe50bb8d566126198344f707e304f45c648fd8f2cc0365e"++[[package]]+name = "bytemuck"+version = "1.25.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "95832e849adfb21180ccb6826a99da14e5d266ae5c2e668e1602cf234f153797"++[[package]]+name = "byteorder"+version = "1.5.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b"++[[package]]+name = "byteorder-lite"+version = "0.1.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "8f1fe948ff07f4bd06c30984e69f5b4899c516a3ef74f34df92a2df2ab535495"++[[package]]+name = "bytes"+version = "1.12.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "fc652a48c352aef3ea3aed32080501cf3ef6ed5da78602a020c991775b0aff04"++[[package]]+name = "camino"+version = "1.2.5"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "bb1307f12aa967b5a58416e87b3653360e0fd614a016b6e970db08fecbb1b80d"++[[package]]+name = "cbc"+version = "0.1.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "26b52a9543ae338f279b96b0b9fed9c8093744685043739079ce85cd58f289a6"+dependencies = [+ "cipher",+]++[[package]]+name = "cc"+version = "1.4.4"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "0ad534f4357a5264cce5019c989cf66a4f0dc4e0d1b1d15f8aacec0ff7360273"+dependencies = [+ "find-msvc-tools",+ "jobserver",+ "libc",+ "shlex 2.0.1",+]++[[package]]+name = "cesu8"+version = "1.1.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "6d43a04d8753f35258c91f8ec639f792891f748a1edbd759cf1dcea3382ad83c"++[[package]]+name = "cexpr"+version = "0.6.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "6fac387a98bb7c37292057cffc56d62ecb629900026402633ae9160df93a8766"+dependencies = [+ "nom 7.1.3",+]++[[package]]+name = "cfg-if"+version = "1.0.4"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801"++[[package]]+name = "chacha20"+version = "0.10.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "65c35e4b699c7e15ccbe7ee35c005e4fc0a278d22238a2857e6ce2dadeda1b06"+dependencies = [+ "cfg-if",+ "cpufeatures 0.3.1",+ "rand_core 0.10.1",+]++[[package]]+name = "chrono"+version = "0.4.45"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "1aa79e62e7697b8e29b513a68abacf485adcd1fe8284a4316c5ae868e6633327"+dependencies = [+ "iana-time-zone",+ "num-traits",+ "windows-link",+]++[[package]]+name = "chunked_transfer"+version = "1.5.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "6e4de3bc4ea267985becf712dc6d9eed8b04c953b3fcfb339ebc87acd9804901"++[[package]]+name = "cipher"+version = "0.4.4"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad"+dependencies = [+ "crypto-common",+ "inout",+]++[[package]]+name = "clang-sys"+version = "1.9.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "157a8ba7b480713b56f4c09fd13fc3e0a22a5dfab8097ba61cbc5feef950788a"+dependencies = [+ "glob",+ "libc",+ "libloading",+]++[[package]]+name = "cld2"+version = "1.0.2"+source = "git+https://github.com/DavidVentura/rust-cld2#2bca970e413453717e000a1e878bedf2d3d45e75"+dependencies = [+ "cld2-sys",+ "libc",+]++[[package]]+name = "cld2-sys"+version = "1.0.2"+source = "git+https://github.com/DavidVentura/rust-cld2#2bca970e413453717e000a1e878bedf2d3d45e75"+dependencies = [+ "cc",+ "libc",+ "regex 0.1.80",+ "toml 0.1.30",+]++[[package]]+name = "cmake"+version = "0.1.58"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "c0f78a02292a74a88ac736019ab962ece0bc380e3f977bf72e376c5d78ff0678"+dependencies = [+ "cc",+]++[[package]]+name = "combine"+version = "4.6.8"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "cfc320937d09e6de266b31b9afb480f197d7a861be86be7cb2ea7e5d1bfffc5e"+dependencies = [+ "bytes",+ "memchr 2.8.3",+]++[[package]]+name = "core-foundation"+version = "0.9.4"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f"+dependencies = [+ "core-foundation-sys",+ "libc",+]++[[package]]+name = "core-foundation-sys"+version = "0.8.7"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b"++[[package]]+name = "core-graphics"+version = "0.23.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "c07782be35f9e1140080c6b96f0d44b739e2278479f64e02fdab4e32dfd8b081"+dependencies = [+ "bitflags 1.3.2",+ "core-foundation",+ "core-graphics-types",+ "foreign-types",+ "libc",+]++[[package]]+name = "core-graphics-types"+version = "0.1.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "45390e6114f68f718cc7a830514a96f903cccd70d02a8f6d9f643ac4ba45afaf"+dependencies = [+ "bitflags 1.3.2",+ "core-foundation",+ "libc",+]++[[package]]+name = "core-text"+version = "20.1.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "c9d2790b5c08465d49f8dc05c8bcae9fea467855947db39b0f8145c091aaced5"+dependencies = [+ "core-foundation",+ "core-graphics",+ "foreign-types",+ "libc",+]++[[package]]+name = "core_maths"+version = "0.1.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "77745e017f5edba1a9c1d854f6f3a52dac8a12dd5af5d2f54aecf61e43d80d30"+dependencies = [+ "libm",+]++[[package]]+name = "cpufeatures"+version = "0.2.17"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "59ed5838eebb26a2bb2e58f6d5b5316989ae9d08bab10e0e6d103e656d1b0280"+dependencies = [+ "libc",+]++[[package]]+name = "cpufeatures"+version = "0.3.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "5ca28b0ae3115b884660db4118d803791fd6756b6e88f39c0f3f7859060d7566"+dependencies = [+ "libc",+]++[[package]]+name = "crc32fast"+version = "1.5.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "8498c871161e1742aaa9d52551b2d6ebdd4c3d45a3be423e3728f33b955be550"+dependencies = [+ "cfg-if",+]++[[package]]+name = "crossbeam-deque"+version = "0.8.7"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "5181e0de7b61eb03a81e347d6dd8797bae9da5146707b51077e2d71a54ec0ceb"+dependencies = [+ "crossbeam-epoch",+ "crossbeam-utils",+]++[[package]]+name = "crossbeam-epoch"+version = "0.9.20"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "2d6914041f254d6e9176c01941b21115dcfb7089e55135a35411081bd106ef3f"+dependencies = [+ "crossbeam-utils",+]++[[package]]+name = "crossbeam-utils"+version = "0.8.22"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "61803da095bee82a81bb1a452ecc25d3b2f1416d1897eb86430c6159ef717c17"++[[package]]+name = "crypto-common"+version = "0.1.7"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "78c8292055d1c1df0cce5d180393dc8cce0abec0a7102adb6c7b1eef6016d60a"+dependencies = [+ "generic-array 0.14.7",+ "typenum",+]++[[package]]+name = "deranged"+version = "0.5.8"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "7cd812cc2bc1d69d4764bd80df88b4317eaef9e773c75226407d9bc0876b211c"++[[package]]+name = "derive_arbitrary"+version = "1.4.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "1e567bd82dcff979e4b03460c307b3cdc9e96fde3d73bed1496d2bc75d9dd62a"+dependencies = [+ "proc-macro2",+ "quote",+ "syn 2.0.119",+]++[[package]]+name = "digest"+version = "0.10.7"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292"+dependencies = [+ "block-buffer",+ "crypto-common",+]++[[package]]+name = "dirs"+version = "6.0.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "c3e8aa94d75141228480295a7d0e7feb620b1a5ad9f12bc40be62411e38cce4e"+dependencies = [+ "dirs-sys",+]++[[package]]+name = "dirs-sys"+version = "0.5.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "e01a3366d27ee9890022452ee61b2b63a67e6f13f58900b651ff5665f0bb1fab"+dependencies = [+ "libc",+ "option-ext",+ "redox_users",+ "windows-sys 0.61.2",+]++[[package]]+name = "displaydoc"+version = "0.2.7"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "c6232dd377dcc64799954cbd3a9bb882e9cdc1308ccd87b1c098f1fb2eaf82a8"+dependencies = [+ "proc-macro2",+ "quote",+ "syn 3.0.4",+]++[[package]]+name = "dlib"+version = "0.5.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "ab8ecd87370524b461f8557c119c405552c396ed91fc0a8eec68679eab26f94a"+dependencies = [+ "libloading",+]++[[package]]+name = "document-features"+version = "0.2.12"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "d4b8a88685455ed29a21542a33abd9cb6510b6b129abadabdcef0f4c55bc8f61"+dependencies = [+ "litrs",+]++[[package]]+name = "dwrote"+version = "0.11.5"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "9e1b35532432acc8b19ceed096e35dfa088d3ea037fe4f3c085f1f97f33b4d02"+dependencies = [+ "lazy_static",+ "libc",+ "winapi 0.3.9",+ "wio",+]++[[package]]+name = "ecb"+version = "0.1.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "1a8bfa975b1aec2145850fcaa1c6fe269a16578c44705a532ae3edc92b8881c7"+dependencies = [+ "cipher",+]++[[package]]+name = "either"+version = "1.18.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "252afb9ae5eaa683babdc6a068b3f5726eb19e05070c731f9b2a23a7c3e8ed34"++[[package]]+name = "encoding_rs"+version = "0.8.35"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "75030f3c4f45dafd7586dd6780965a8c7e8e285a5ecb86713e63a79c5b2766f3"+dependencies = [+ "cfg-if",+]++[[package]]+name = "env_filter"+version = "0.1.4"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "1bf3c259d255ca70051b30e2e95b5446cdb8949ac4cd22c0d7fd634d89f568e2"+dependencies = [+ "log",+]++[[package]]+name = "equivalent"+version = "1.0.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f"++[[package]]+name = "errno"+version = "0.3.14"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb"+dependencies = [+ "libc",+ "windows-sys 0.61.2",+]++[[package]]+name = "espeak-rs"+version = "0.1.9"+source = "git+https://github.com/DavidVentura/piper-rs#764f7452a7e68d730c0aa32ce8b958dc639683e0"+dependencies = [+ "espeak-rs-sys",+]++[[package]]+name = "espeak-rs-sys"+version = "0.1.9"+source = "git+https://github.com/DavidVentura/piper-rs#764f7452a7e68d730c0aa32ce8b958dc639683e0"+dependencies = [+ "bindgen 0.69.5",+ "cmake",+ "glob",+]++[[package]]+name = "fast_image_resize"+version = "5.5.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "fbc7fe45cf92b43817ff62a3723e862b85bd1d06288f63007f7645d1d2f7a060"+dependencies = [+ "cfg-if",+ "document-features",+ "num-traits",+ "thiserror 2.0.20",+]++[[package]]+name = "fastrand"+version = "2.5.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "da7c62ceae207dd37ea5b845da6a0696c799f85e97da1ab5b7910be3c1c80223"++[[package]]+name = "fax"+version = "0.2.7"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "caf1079563223d5d59d83c85886a56e586cfd5c1a26292e971a0fa266531ac5a"++[[package]]+name = "fdeflate"+version = "0.3.7"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "1e6853b52649d4ac5c0bd02320cddc5ba956bdb407c4b75a2c6b75bf51500f8c"+dependencies = [+ "simd-adler32",+]++[[package]]+name = "filetime"+version = "0.2.29"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "5c287a33c7f0a620c38e641e7f60827713987b3c0f26e8ddc9462cc69cf75759"+dependencies = [+ "cfg-if",+ "libc",+]++[[package]]+name = "find-msvc-tools"+version = "0.1.11"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "d45db016d36b838f563236e9193d0ee6ce38f3f68b6c94e914b4929c96bbb890"++[[package]]+name = "fixed_decimal"+version = "0.7.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "79c3c892f121fff406e5dd6b28c1b30096b95111c30701a899d4f2b18da6d1bd"+dependencies = [+ "displaydoc",+ "smallvec",+ "writeable",+]++[[package]]+name = "flatbuffers"+version = "25.12.19"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "35f6839d7b3b98adde531effaf34f0c2badc6f4735d26fe74709d8e513a96ef3"+dependencies = [+ "bitflags 2.13.1",+ "rustc_version",+]++[[package]]+name = "flate2"+version = "1.1.10"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "6e634e2e0ebac1ee034020da1ca582e17ffe4e0f5e985823721e168928136dcb"+dependencies = [+ "crc32fast",+ "miniz_oxide 0.9.1",+ "zlib-rs",+]++[[package]]+name = "float-ord"+version = "0.3.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "8ce81f49ae8a0482e4c55ea62ebbd7e5a686af544c00b9d090bba3ff9be97b3d"++[[package]]+name = "font-kit"+version = "0.14.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "2c7e611d49285d4c4b2e1727b72cf05353558885cc5252f93707b845dfcaf3d3"+dependencies = [+ "bitflags 2.13.1",+ "byteorder",+ "core-foundation",+ "core-graphics",+ "core-text",+ "dirs",+ "dwrote",+ "float-ord",+ "freetype-sys",+ "lazy_static",+ "libc",+ "log",+ "pathfinder_geometry",+ "pathfinder_simd",+ "walkdir",+ "winapi 0.3.9",+ "yeslogic-fontconfig-sys",+]++[[package]]+name = "foreign-types"+version = "0.5.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "d737d9aa519fb7b749cbc3b962edcf310a8dd1f4b67c91c4f83975dbdd17d965"+dependencies = [+ "foreign-types-macros",+ "foreign-types-shared",+]++[[package]]+name = "foreign-types-macros"+version = "0.2.4"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "ea5190182e6915eb873ddbc16e23b711b6eb1f9c00a0d0a3a91b5f6228475225"+dependencies = [+ "proc-macro2",+ "quote",+ "syn 3.0.4",+]++[[package]]+name = "foreign-types-shared"+version = "0.3.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "aa9a19cbb55df58761df49b23516a86d432839add4af60fc256da840f66ed35b"++[[package]]+name = "form_urlencoded"+version = "1.2.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "cb4cb245038516f5f85277875cdaa4f7d2c9a0fa0468de06ed190163b1581fcf"+dependencies = [+ "percent-encoding",+]++[[package]]+name = "freetype-sys"+version = "0.20.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "0e7edc5b9669349acfda99533e9e0bcf26a51862ab43b08ee7745c55d28eb134"+dependencies = [+ "cc",+ "libc",+ "pkg-config",+]++[[package]]+name = "fs-err"+version = "2.11.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "88a41f105fe1d5b6b34b2055e3dc59bb79b46b48b2040b9e6c7b4b5de097aa41"+dependencies = [+ "autocfg",+]++[[package]]+name = "fst"+version = "0.4.7"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "7ab85b9b05e3978cc9a9cf8fea7f01b494e1a09ed3037e16ba39edc7a29eb61a"++[[package]]+name = "futures-core"+version = "0.3.34"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "92d699e522242e69e3003b94ecc1f960f3a5e015aa7c5d7486e65ad01dd94f5e"++[[package]]+name = "futures-task"+version = "0.3.34"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "cd417de3d1d015fc3bfd2b1ea46dfc7bab72ef86f1cc7cc9c78e728b34a6d1fd"++[[package]]+name = "futures-util"+version = "0.3.34"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "0d50a92467f8ba5dd6e3ee5d4bd04d73ab2e4e1c44474a0674821dfce14b79bc"+dependencies = [+ "futures-core",+ "futures-task",+ "pin-project-lite",+ "slab",+]++[[package]]+name = "generic-array"+version = "0.14.7"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a"+dependencies = [+ "typenum",+ "version_check",+]++[[package]]+name = "generic-array"+version = "1.4.5"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "337d46834ee672ab3e48caca2cb0c78cc174fb12b3a68d0d88f99a0519a5e36e"+dependencies = [+ "rustversion",+ "typenum",+]++[[package]]+name = "getrandom"+version = "0.2.17"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "ff2abc00be7fca6ebc474524697ae276ad847ad0a6b3faa4bcb027e9a4614ad0"+dependencies = [+ "cfg-if",+ "js-sys",+ "libc",+ "wasi",+ "wasm-bindgen",+]++[[package]]+name = "getrandom"+version = "0.3.4"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "899def5c37c4fd7b2664648c28120ecec138e4d395b459e5ca34f9cce2dd77fd"+dependencies = [+ "cfg-if",+ "libc",+ "r-efi 5.3.0",+ "wasip2",+]++[[package]]+name = "getrandom"+version = "0.4.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "300e883d756b2e4ec94e02791f39b04b522276138852cfc41d9fb7e904106099"+dependencies = [+ "cfg-if",+ "libc",+ "r-efi 6.0.0",+ "rand_core 0.10.1",+]++[[package]]+name = "glob"+version = "0.3.4"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "e4eba85ea1d0a966a983acd07deee566e67395d2d96b6fb39e62b5a833f1eb0b"++[[package]]+name = "glow"+version = "0.17.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "29038e1c483364cc6bb3cf78feee1816002e127c331a1eec55a4d202b9e1adb5"+dependencies = [+ "js-sys",+ "slotmap",+ "wasm-bindgen",+ "web-sys",+]++[[package]]+name = "hashbrown"+version = "0.17.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "ed5909b6e89a2db4456e54cd5f673791d7eca6732202bbf2a9cc504fe2f9b84a"++[[package]]+name = "heck"+version = "0.5.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"++[[package]]+name = "hermit-abi"+version = "0.5.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "e17592d60ebacc7d5e169f4663c5f84f9161cc90328abcfe8456f41e4dfcb284"++[[package]]+name = "home"+version = "0.5.12"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "cc627f471c528ff0c4a49e1d5e60450c8f6461dd6d10ba9dcd3a61d3dff7728d"+dependencies = [+ "windows-sys 0.61.2",+]++[[package]]+name = "html5ever"+version = "0.38.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "1054432bae2f14e0061e33d23402fbaa67a921d319d56adc6bcf887ddad1cbc2"+dependencies = [+ "log",+ "markup5ever",+]++[[package]]+name = "httparse"+version = "1.10.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "6dbf3de79e51f3d586ab4cb9d5c3e2c14aa28ed23d180cf89b4df0454a69cc87"++[[package]]+name = "httpdate"+version = "1.0.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9"++[[package]]+name = "iana-time-zone"+version = "0.1.65"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "e31bc9ad994ba00e440a8aa5c9ef0ec67d5cb5e5cb0cc7f8b744a35b389cc470"+dependencies = [+ "android_system_properties",+ "core-foundation-sys",+ "iana-time-zone-haiku",+ "js-sys",+ "log",+ "wasm-bindgen",+ "windows-core",+]++[[package]]+name = "iana-time-zone-haiku"+version = "0.1.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f"+dependencies = [+ "cc",+]++[[package]]+name = "icu_casemap"+version = "2.1.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "d4ca9983e8bf51223c2f89014fa4eaa9e9b336c47f3af0d000538f86f841fba1"+dependencies = [+ "icu_casemap_data",+ "icu_collections",+ "icu_locale_core",+ "icu_properties",+ "icu_provider",+ "potential_utf",+ "writeable",+ "zerovec",+]++[[package]]+name = "icu_casemap_data"+version = "2.1.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "98d4663d0f99b301033a19e0acf94e9d2fa4b107638580165e5a6ccc49ad1450"++[[package]]+name = "icu_collections"+version = "2.1.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "4c6b649701667bbe825c3b7e6388cb521c23d88644678e83c0c4d0a621a34b43"+dependencies = [+ "displaydoc",+ "potential_utf",+ "serde",+ "yoke",+ "zerofrom",+ "zerovec",+]++[[package]]+name = "icu_decimal"+version = "2.1.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "a38c52231bc348f9b982c1868a2af3195199623007ba2c7650f432038f5b3e8e"+dependencies = [+ "fixed_decimal",+ "icu_decimal_data",+ "icu_locale",+ "icu_locale_core",+ "icu_provider",+ "writeable",+ "zerovec",+]++[[package]]+name = "icu_decimal_data"+version = "2.1.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "2905b4044eab2dd848fe84199f9195567b63ab3a93094711501363f63546fef7"++[[package]]+name = "icu_experimental"+version = "0.4.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "f4ffa4d60b9cb8b024082afaf9e94d853184e483ec69322c74dc437bf8a882a5"+dependencies = [+ "displaydoc",+ "either",+ "fixed_decimal",+ "icu_casemap",+ "icu_collections",+ "icu_decimal",+ "icu_experimental_data",+ "icu_list",+ "icu_locale",+ "icu_locale_core",+ "icu_normalizer",+ "icu_pattern",+ "icu_plurals",+ "icu_properties",+ "icu_provider",+ "litemap",+ "num-bigint",+ "num-rational",+ "num-traits",+ "potential_utf",+ "smallvec",+ "tinystr",+ "writeable",+ "zerotrie",+ "zerovec",+]++[[package]]+name = "icu_experimental_data"+version = "0.4.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "a0bce39e12480e91c7ddb748218050c459e241f491d130ea6ee92c3e5cd254f7"++[[package]]+name = "icu_list"+version = "2.1.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "d3a0b7b126e2fc42777d3c348611553d540bd3683caa39b387c5dd1036bb21a8"+dependencies = [+ "icu_list_data",+ "icu_locale",+ "icu_provider",+ "regex-automata",+ "writeable",+ "zerovec",+]++[[package]]+name = "icu_list_data"+version = "2.1.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "51044c242fe2a882cc0a464314bbdb9f441556a1cb238fb527fc47355ec2827b"++[[package]]+name = "icu_locale"+version = "2.1.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "532b11722e350ab6bf916ba6eb0efe3ee54b932666afec989465f9243fe6dd60"+dependencies = [+ "icu_collections",+ "icu_locale_core",+ "icu_locale_data",+ "icu_provider",+ "potential_utf",+ "tinystr",+ "zerovec",+]++[[package]]+name = "icu_locale_core"+version = "2.3.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "d56e28588da92eee5c3201a6eff33fabdd49b62269c8938d4ff050ce4d900deb"+dependencies = [+ "displaydoc",+ "litemap",+ "serde",+ "tinystr",+ "writeable",+ "zerovec",+]++[[package]]+name = "icu_locale_data"+version = "2.1.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "1c5f1d16b4c3a2642d3a719f18f6b06070ab0aef246a6418130c955ae08aa831"++[[package]]+name = "icu_normalizer"+version = "2.1.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "5f6c8828b67bf8908d82127b2054ea1b4427ff0230ee9141c54251934ab1b599"+dependencies = [+ "icu_collections",+ "icu_normalizer_data",+ "icu_properties",+ "icu_provider",+ "smallvec",+ "zerovec",+]++[[package]]+name = "icu_normalizer_data"+version = "2.1.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "7aedcccd01fc5fe81e6b489c15b247b8b0690feb23304303a9e560f37efc560a"++[[package]]+name = "icu_pattern"+version = "0.4.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "1c4c568054ffe735398a9f4c55aec37ad7c768844553cc0978f09cc9b933a1fb"+dependencies = [+ "displaydoc",+ "either",+ "serde",+ "writeable",+ "yoke",+ "zerovec",+]++[[package]]+name = "icu_plurals"+version = "2.1.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "4f9cfe49f5b1d1163cc58db451562339916a9ca5cbcaae83924d41a0bf839474"+dependencies = [+ "fixed_decimal",+ "icu_locale",+ "icu_plurals_data",+ "icu_provider",+ "zerovec",+]++[[package]]+name = "icu_plurals_data"+version = "2.1.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "f018a98dccf7f0eb02ba06ac0ff67d102d8ded80734724305e924de304e12ff0"++[[package]]+name = "icu_properties"+version = "2.1.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "020bfc02fe870ec3a66d93e677ccca0562506e5872c650f893269e08615d74ec"+dependencies = [+ "icu_collections",+ "icu_locale_core",+ "icu_properties_data",+ "icu_provider",+ "serde",+ "zerotrie",+ "zerovec",+]++[[package]]+name = "icu_properties_data"+version = "2.1.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "616c294cf8d725c6afcd8f55abc17c56464ef6211f9ed59cccffe534129c77af"++[[package]]+name = "icu_provider"+version = "2.3.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "d27bbb9d3abbefac45d55f647c9de1d44aafcd1186eb91879afef17c396c3e73"+dependencies = [+ "displaydoc",+ "icu_locale_core",+ "serde",+ "stable_deref_trait",+ "writeable",+ "yoke",+ "zerofrom",+ "zerotrie",+ "zerovec",+]++[[package]]+name = "idna"+version = "1.1.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "3b0875f23caa03898994f6ddc501886a45c7d3d62d04d2d90788d47be1b1e4de"+dependencies = [+ "idna_adapter",+ "smallvec",+ "utf8_iter",+]++[[package]]+name = "idna_adapter"+version = "1.2.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "3acae9609540aa318d1bc588455225fb2085b9ed0c4f6bd0d9d5bcd86f1a0344"+dependencies = [+ "icu_normalizer",+ "icu_properties",+]++[[package]]+name = "image"+version = "0.25.10"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "85ab80394333c02fe689eaf900ab500fbd0c2213da414687ebf995a65d5a6104"+dependencies = [+ "bytemuck",+ "byteorder-lite",+ "moxcms",+ "num-traits",+ "png",+ "zune-core",+ "zune-jpeg",+]++[[package]]+name = "imageproc"+version = "0.25.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "602b4e8a4cc3e98372b766cd184ab532999bc0e839b7469e759511ccabc65d77"+dependencies = [+ "ab_glyph",+ "approx",+ "getrandom 0.2.17",+ "image",+ "itertools 0.12.1",+ "nalgebra",+ "num",+ "rand 0.8.8",+ "rand_distr",+]++[[package]]+name = "indexmap"+version = "2.14.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "07aa2048142242915a31d35844fb311e0e53fcca590c3a0a40dcf1b841fa09eb"+dependencies = [+ "equivalent",+ "hashbrown",+]++[[package]]+name = "inout"+version = "0.1.4"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "879f10e63c20629ecabbb64a8010319738c66a5cd0c29b02d63d272b03751d01"+dependencies = [+ "block-padding",+ "generic-array 0.14.7",+]++[[package]]+name = "itertools"+version = "0.12.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "ba291022dbbd398a455acf126c1e341954079855bc60dfdda641363bd6922569"+dependencies = [+ "either",+]++[[package]]+name = "itertools"+version = "0.13.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "413ee7dfc52ee1a4949ceeb7dbc8a33f2d6c088194d9f922fb8318faf1f01186"+dependencies = [+ "either",+]++[[package]]+name = "itertools"+version = "0.14.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "2b192c782037fadd9cfa75548310488aabdbf3d2da73885b31bd0abd03351285"+dependencies = [+ "either",+]++[[package]]+name = "itoa"+version = "1.0.18"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "8f42a60cbdf9a97f5d2305f08a87dc4e09308d1276d28c869c684d7777685682"++[[package]]+name = "jni"+version = "0.21.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "1a87aa2bb7d2af34197c04845522473242e1aa17c12f4935d5856491a7fb8c97"+dependencies = [+ "cesu8",+ "cfg-if",+ "combine",+ "jni-sys 0.3.1",+ "log",+ "thiserror 1.0.69",+ "walkdir",+ "windows-sys 0.45.0",+]++[[package]]+name = "jni-sys"+version = "0.3.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "41a652e1f9b6e0275df1f15b32661cf0d4b78d4d87ddec5e0c3c20f097433258"+dependencies = [+ "jni-sys 0.4.1",+]++[[package]]+name = "jni-sys"+version = "0.4.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "c6377a88cb3910bee9b0fa88d4f42e1d2da8e79915598f65fb0c7ee14c878af2"+dependencies = [+ "jni-sys-macros",+]++[[package]]+name = "jni-sys-macros"+version = "0.4.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "38c0b942f458fe50cdac086d2f946512305e5631e720728f2a61aabcd47a6264"+dependencies = [+ "quote",+ "syn 2.0.119",+]++[[package]]+name = "jobserver"+version = "0.1.35"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "1c00acbd29eabad4a2392fa0e921c874934dbbf4194312ad20f04a0ed67a3cb3"+dependencies = [+ "getrandom 0.4.3",+ "libc",+]++[[package]]+name = "js-sys"+version = "0.3.104"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "0e0c1080212aad755ea003d18543e8768dd432c48819efd73a7bf1e39b7a5a3a"+dependencies = [+ "cfg-if",+ "futures-util",+ "wasm-bindgen",+]++[[package]]+name = "kernel32-sys"+version = "0.2.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d"+dependencies = [+ "winapi 0.2.8",+ "winapi-build",+]++[[package]]+name = "lazy_static"+version = "1.5.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe"++[[package]]+name = "lazycell"+version = "1.3.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55"++[[package]]+name = "libc"+version = "0.2.189"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "3eaf3ede3fee6db1a4c2ee091bf8a8b4dccdc6d17f656fb07896ee72867612f2"++[[package]]+name = "libloading"+version = "0.8.9"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "d7c4b02199fee7c5d21a5ae7d8cfa79a6ef5bb2fc834d6e9058e89c825efdc55"+dependencies = [+ "cfg-if",+ "windows-link",+]++[[package]]+name = "libm"+version = "0.2.16"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "b6d2cec3eae94f9f509c767b45932f1ada8350c4bdb85af2fcab4a3c14807981"++[[package]]+name = "libredox"+version = "0.1.21"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "d7955dfc218a8afb29dfeffd540e3a6e96baeb94fe7138228dd7cc6937fbbf96"+dependencies = [+ "libc",+]++[[package]]+name = "linux-raw-sys"+version = "0.4.15"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "d26c52dbd32dccf2d10cac7725f8eae5296885fb5703b261f7d0a0739ec807ab"++[[package]]+name = "linux-raw-sys"+version = "0.12.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "32a66949e030da00e8c7d4434b251670a91556f4144941d37452769c25d58a53"++[[package]]+name = "litemap"+version = "0.8.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "47d9d19d1d6efa0109d2f65ff4c85cddd50bd572e5a00127ab10987290bcefae"++[[package]]+name = "litrs"+version = "1.0.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "11d3d7f243d5c5a8b9bb5d6dd2b1602c0cb0b9db1621bafc7ed66e35ff9fe092"++[[package]]+name = "lock_api"+version = "0.4.14"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "224399e74b87b5f3557511d98dff8b14089b3dadafcab6bb93eab67d3aace965"+dependencies = [+ "scopeguard",+]++[[package]]+name = "log"+version = "0.4.34"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "f9f8bd3e56ce4dfc153cf470fffbfa98c7620958b312ca5c3a4b8d5181fd13c6"++[[package]]+name = "lopdf"+version = "0.40.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "73fdcbab5b237a03984f83b1394dc534e0b1960675c7f3ec4d04dccc9032b56d"+dependencies = [+ "aes",+ "bitflags 2.13.1",+ "cbc",+ "ecb",+ "encoding_rs",+ "flate2",+ "getrandom 0.4.3",+ "indexmap",+ "itoa",+ "log",+ "md-5",+ "nom 8.0.0",+ "nom_locate",+ "rand 0.10.2",+ "rangemap",+ "sha2",+ "stringprep",+ "thiserror 2.0.20",+ "ttf-parser",+ "weezl",+]++[[package]]+name = "markup5ever"+version = "0.38.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "8983d30f2915feeaaab2d6babdd6bc7e9ed1a00b66b5e6d74df19aa9c0e91862"+dependencies = [+ "log",+ "tendril",+ "web_atoms",+]++[[package]]+name = "markup5ever_rcdom"+version = "0.38.0+unofficial"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "333171ccdf66e915257740d44e38ea5b1b19ce7b45d33cc35cb6f118fbd981ff"+dependencies = [+ "html5ever",+ "markup5ever",+ "tendril",+ "xml5ever",+]++[[package]]+name = "matrixmultiply"+version = "0.3.11"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "3f607c237553f086e7043417a51df26b2eb899d3caff94e6a67592ff992fedc7"+dependencies = [+ "autocfg",+ "rawpointer",+]++[[package]]+name = "md-5"+version = "0.10.6"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "d89e7ee0cfbedfc4da3340218492196241d89eefb6dab27de5df917a6d2e78cf"+dependencies = [+ "cfg-if",+ "digest",+]++[[package]]+name = "memchr"+version = "0.1.11"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "d8b629fb514376c675b98c1421e80b151d3817ac42d7c667717d282761418d20"+dependencies = [+ "libc",+]++[[package]]+name = "memchr"+version = "2.8.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "cf8baf1c55e62ffcace7a9f06f4bd9cd3f0c4beb022d3b367256b91b87513d98"++[[package]]+name = "mime"+version = "0.3.17"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a"++[[package]]+name = "mime_guess"+version = "2.0.5"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "f7c44f8e672c00fe5308fa235f821cb4198414e1c77935c1ab6948d3fd78550e"+dependencies = [+ "mime",+ "unicase",+]++[[package]]+name = "minimal-lexical"+version = "0.2.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a"++[[package]]+name = "miniz_oxide"+version = "0.8.9"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "1fa76a2c86f704bdb222d66965fb3d63269ce38518b83cb0575fca855ebb6316"+dependencies = [+ "adler2",+ "simd-adler32",+]++[[package]]+name = "miniz_oxide"+version = "0.9.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "b63fbc4a50860e98e7b2aa7804ded1db5cbc3aff9193adaff57a6931bf7c4b4c"+dependencies = [+ "adler2",+ "simd-adler32",+]++[[package]]+name = "mnn-sys"+version = "0.1.0"+source = "git+https://github.com/DavidVentura/mnn-sys#9c0d4527d5755de37affc5dd1517cf10073844ad"+dependencies = [+ "bindgen 0.69.5",+ "cc",+ "cmake",+ "ndarray",+]++[[package]]+name = "moxcms"+version = "0.8.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "bb85c154ba489f01b25c0d36ae69a87e4a1c73a72631fc6c0eb6dde34a73e44b"+dependencies = [+ "num-traits",+ "pxfm",+]++[[package]]+name = "mucab"+version = "0.1.0"+source = "git+https://github.com/DavidVentura/mucab#fa6e863562bb8b7cf77d5a4156d42e86bd728f62"+dependencies = [+ "encoding_rs",+ "glob",+ "regex 1.13.1",+ "zeekstd",+]++[[package]]+name = "multipart"+version = "0.18.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "00dec633863867f29cb39df64a397cdf4a6354708ddd7759f70c7fb51c5f9182"+dependencies = [+ "buf_redux",+ "httparse",+ "log",+ "mime",+ "mime_guess",+ "quick-error",+ "rand 0.8.8",+ "safemem",+ "tempfile",+ "twoway",+]++[[package]]+name = "mupdf"+version = "0.6.0"+source = "git+https://github.com/DavidVentura/mupdf-rs#b68ee1f1c943ec79c74df448dd487a92ff56dcdd"+dependencies = [+ "bitflags 2.13.1",+ "font-kit",+ "mupdf-sys",+ "once_cell",+ "percent-encoding",+ "zerocopy",+]++[[package]]+name = "mupdf-sys"+version = "0.6.0"+source = "git+https://github.com/DavidVentura/mupdf-rs#b68ee1f1c943ec79c74df448dd487a92ff56dcdd"+dependencies = [+ "bindgen 0.72.1",+ "cc",+ "pkg-config",+ "regex 1.13.1",+ "zerocopy",+]++[[package]]+name = "nalgebra"+version = "0.32.6"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "7b5c17de023a86f59ed79891b2e5d5a94c705dbe904a5b5c9c952ea6221b03e4"+dependencies = [+ "approx",+ "matrixmultiply",+ "num-complex",+ "num-rational",+ "num-traits",+ "simba",+ "typenum",+]++[[package]]+name = "ndarray"+version = "0.16.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "882ed72dce9365842bf196bdeedf5055305f11fc8c03dee7bb0194a6cad34841"+dependencies = [+ "matrixmultiply",+ "num-complex",+ "num-integer",+ "num-traits",+ "portable-atomic",+ "portable-atomic-util",+ "rawpointer",+]++[[package]]+name = "ndarray-npy"+version = "0.9.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "7b313788c468c49141a9d9b6131fc15f403e6ef4e8446a0b2e18f664ddb278a9"+dependencies = [+ "byteorder",+ "ndarray",+ "num-complex",+ "num-traits",+ "py_literal",+ "zip",+]++[[package]]+name = "new_debug_unreachable"+version = "1.0.6"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "650eef8c711430f1a879fdd01d4745a7deea475becfb90269c06775983bbf086"++[[package]]+name = "nom"+version = "7.1.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a"+dependencies = [+ "memchr 2.8.3",+ "minimal-lexical",+]++[[package]]+name = "nom"+version = "8.0.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "df9761775871bdef83bee530e60050f7e54b1105350d6884eb0fb4f46c2f9405"+dependencies = [+ "memchr 2.8.3",+]++[[package]]+name = "nom_locate"+version = "5.0.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "0b577e2d69827c4740cba2b52efaad1c4cc7c73042860b199710b3575c68438d"+dependencies = [+ "bytecount",+ "memchr 2.8.3",+ "nom 8.0.0",+]++[[package]]+name = "num"+version = "0.4.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "35bd024e8b2ff75562e5f34e7f4905839deb4b22955ef5e73d2fea1b9813cb23"+dependencies = [+ "num-bigint",+ "num-complex",+ "num-integer",+ "num-iter",+ "num-rational",+ "num-traits",+]++[[package]]+name = "num-bigint"+version = "0.4.8"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "c89e69e7e0f03bea5ef08013795c25018e101932225a656383bd384495ecc367"+dependencies = [+ "num-integer",+ "num-traits",+]++[[package]]+name = "num-complex"+version = "0.4.6"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "73f88a1307638156682bada9d7604135552957b7818057dcef22705b4d509495"+dependencies = [+ "num-traits",+]++[[package]]+name = "num-conv"+version = "0.2.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "521739c6d2bac4aa25192232afe6841231376b2b26d4d9fae5ecf8ca5772e441"++[[package]]+name = "num-integer"+version = "0.1.47"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "7ce2d95d4b3734dc35aa2f45e1aa22cd416814592a4f9d9205e11affd5b8e10b"+dependencies = [+ "num-traits",+]++[[package]]+name = "num-iter"+version = "0.1.46"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "c92800bd69a1eac91786bcfe9da64a897eb72911b8dc3095decbd07429e8048b"+dependencies = [+ "num-integer",+ "num-traits",+]++[[package]]+name = "num-rational"+version = "0.4.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "f83d14da390562dca69fc84082e73e548e1ad308d24accdedd2720017cb37824"+dependencies = [+ "num-bigint",+ "num-integer",+ "num-traits",+]++[[package]]+name = "num-traits"+version = "0.2.19"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841"+dependencies = [+ "autocfg",+ "libm",+]++[[package]]+name = "num_cpus"+version = "1.17.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "91df4bbde75afed763b708b7eee1e8e7651e02d97f6d5dd763e89367e957b23b"+dependencies = [+ "hermit-abi",+ "libc",+]++[[package]]+name = "num_threads"+version = "0.1.7"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "5c7398b9c8b70908f6371f47ed36737907c87c52af34c268fed0bf0ceb92ead9"+dependencies = [+ "libc",+]++[[package]]+name = "once_cell"+version = "1.21.4"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50"++[[package]]+name = "option-ext"+version = "0.2.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d"++[[package]]+name = "ordered-float"+version = "5.4.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "c860fd3227ca4ac3cc032e2cd20cba3f02ccdf4b610538f8ee6584d56bb62e96"+dependencies = [+ "num-traits",+]++[[package]]+name = "owned_ttf_parser"+version = "0.25.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "36820e9051aca1014ddc75770aab4d68bc1e9e632f0f5627c4086bc216fb583b"+dependencies = [+ "ttf-parser",+]++[[package]]+name = "parking_lot"+version = "0.12.5"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "93857453250e3077bd71ff98b6a65ea6621a19bb0f559a85248955ac12c45a1a"+dependencies = [+ "lock_api",+ "parking_lot_core",+]++[[package]]+name = "parking_lot_core"+version = "0.9.12"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "2621685985a2ebf1c516881c026032ac7deafcda1a2c9b7850dc81e3dfcb64c1"+dependencies = [+ "cfg-if",+ "libc",+ "redox_syscall",+ "smallvec",+ "windows-link",+]++[[package]]+name = "paste"+version = "1.0.15"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a"++[[package]]+name = "pathfinder_geometry"+version = "0.5.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "0b7b7e7b4ea703700ce73ebf128e1450eb69c3a8329199ffbfb9b2a0418e5ad3"+dependencies = [+ "log",+ "pathfinder_simd",+]++[[package]]+name = "pathfinder_simd"+version = "0.5.6"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "4500030c302e4af1d423f36f3b958d1aecb6c04184356ed5a833bf6b60435777"+dependencies = [+ "rustc_version",+]++[[package]]+name = "percent-encoding"+version = "2.3.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220"++[[package]]+name = "pest"+version = "2.9.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "5a07a60cc7a4d00c91f95c685609d1d2f79050e6804b70ebedd7650f0b839bcf"+dependencies = [+ "memchr 2.8.3",+ "ucd-trie",+]++[[package]]+name = "pest_derive"+version = "2.9.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "b3a83744a5c8455b8b3e0dc5031362780a347c878bdd11584d1a8984228cc88d"+dependencies = [+ "pest",+ "pest_generator",+]++[[package]]+name = "pest_generator"+version = "2.9.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "e0cd3451aa3de60d4b9a1e736885e4dea6b31617598026f12256ad566d63304a"+dependencies = [+ "pest",+ "pest_meta",+ "proc-macro2",+ "quote",+ "syn 2.0.119",+]++[[package]]+name = "pest_meta"+version = "2.9.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "e04d3a0849e241d7dfce834c83b1c5edc8622009e8dd51a12ba1927c32f05496"+dependencies = [+ "pest",+]++[[package]]+name = "phf"+version = "0.13.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "c1562dc717473dbaa4c1f85a36410e03c047b2e7df7f45ee938fbef64ae7fadf"+dependencies = [+ "phf_shared",+ "serde",+]++[[package]]+name = "phf_codegen"+version = "0.13.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "49aa7f9d80421bca176ca8dbfebe668cc7a2684708594ec9f3c0db0805d5d6e1"+dependencies = [+ "phf_generator",+ "phf_shared",+]++[[package]]+name = "phf_generator"+version = "0.13.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "135ace3a761e564ec88c03a77317a7c6b80bb7f7135ef2544dbe054243b89737"+dependencies = [+ "fastrand",+ "phf_shared",+]++[[package]]+name = "phf_shared"+version = "0.13.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "e57fef6bc5981e38c2ce2d63bfa546861309f875b8a75f092d1d54ae2d64f266"+dependencies = [+ "siphasher",+]++[[package]]+name = "pin-project-lite"+version = "0.2.17"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "a89322df9ebe1c1578d689c92318e070967d1042b512afbe49518723f4e6d5cd"++[[package]]+name = "piper-rs"+version = "0.1.9"+source = "git+https://github.com/DavidVentura/piper-rs#764f7452a7e68d730c0aa32ce8b958dc639683e0"+dependencies = [+ "espeak-rs",+ "fst",+ "log",+ "mnn-sys",+ "mucab",+ "ndarray",+ "ndarray-npy",+ "rustfst",+ "serde",+ "serde_json",+ "unicode-normalization",+ "zeekstd",+]++[[package]]+name = "pkg-config"+version = "0.3.34"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "f6b464fbc74e149a392436b17d523f769e057cb6877f6a5c4618bc6f11800548"++[[package]]+name = "png"+version = "0.18.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "60769b8b31b2a9f263dae2776c37b1b28ae246943cf719eb6946a1db05128a61"+dependencies = [+ "bitflags 2.13.1",+ "crc32fast",+ "fdeflate",+ "flate2",+ "miniz_oxide 0.8.9",+]++[[package]]+name = "portable-atomic"+version = "1.15.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "05c8b63e8d9609db387f0324918f81d68fe27748f084ef092fb35954d0539a85"++[[package]]+name = "portable-atomic-util"+version = "0.2.7"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "c2a106d1259c23fac8e543272398ae0e3c0b8d33c88ed73d0cc71b0f1d902618"+dependencies = [+ "portable-atomic",+]++[[package]]+name = "potential_utf"+version = "0.1.6"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "d83eb9bc6d8e5cf568e7a1101d60ee05e81ed50ea106026f3d18deeb046d7661"+dependencies = [+ "serde_core",+ "writeable",+ "zerovec",+]++[[package]]+name = "powerfmt"+version = "0.2.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391"++[[package]]+name = "ppv-lite86"+version = "0.2.21"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9"+dependencies = [+ "zerocopy",+]++[[package]]+name = "precomputed-hash"+version = "0.1.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "925383efa346730478fb4838dbe9137d2a47675ad789c546d150a6e1dd4ab31c"++[[package]]+name = "prettyplease"+version = "0.2.37"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "479ca8adacdd7ce8f1fb39ce9ecccbfe93a3f1344b3d0d97f20bc0196208f62b"+dependencies = [+ "proc-macro2",+ "syn 2.0.119",+]++[[package]]+name = "proc-macro2"+version = "1.0.107"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "985e7ec9bb745e6ce6535b544d84d6cd6f7ad8bd711c398938ae983b91a766d9"+dependencies = [+ "unicode-ident",+]++[[package]]+name = "psl"+version = "2.1.226"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "7bc88482eea924ca3a2f56a547454169af58deef35567965eb4fc2392a834841"+dependencies = [+ "psl-types",+]++[[package]]+name = "psl-types"+version = "2.0.11"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "33cb294fe86a74cbcf50d4445b37da762029549ebeea341421c7c70370f86cac"++[[package]]+name = "pxfm"+version = "0.1.30"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "d55d956fa96f5ec02be2e13af0e20391a5aa83d6a074e3ad368959d0fab299ea"++[[package]]+name = "py_literal"+version = "0.4.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "102df7a3d46db9d3891f178dcc826dc270a6746277a9ae6436f8d29fd490a8e1"+dependencies = [+ "num-bigint",+ "num-complex",+ "num-traits",+ "pest",+ "pest_derive",+]++[[package]]+name = "quick-error"+version = "1.2.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0"++[[package]]+name = "quote"+version = "1.0.47"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "1fbf4db142a473a8d80c26bbf18454ed458bf8d26c8219c331daecfdbd079001"+dependencies = [+ "proc-macro2",+]++[[package]]+name = "r-efi"+version = "5.3.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f"++[[package]]+name = "r-efi"+version = "6.0.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "f8dcc9c7d52a811697d2151c701e0d08956f92b0e24136cf4cf27b57a6a0d9bf"++[[package]]+name = "rand"+version = "0.8.8"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "e058c7de0b26af77780c769414d6257830bb240f3c38477dbc2c16e5f54d6d4c"+dependencies = [+ "libc",+ "rand_chacha 0.3.1",+ "rand_core 0.6.4",+]++[[package]]+name = "rand"+version = "0.9.5"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "b9ef1d0d795eb7d84685bca4f72f3649f064e6641543d3a8c415898726a57b41"+dependencies = [+ "rand_chacha 0.9.0",+ "rand_core 0.9.5",+]++[[package]]+name = "rand"+version = "0.10.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "c7f5fa3a058cd35567ef9bfa5e75732bee0f9e4c55fa90477bef2dfcdbc4be80"+dependencies = [+ "chacha20",+ "getrandom 0.4.3",+ "rand_core 0.10.1",+]++[[package]]+name = "rand_chacha"+version = "0.3.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88"+dependencies = [+ "ppv-lite86",+ "rand_core 0.6.4",+]++[[package]]+name = "rand_chacha"+version = "0.9.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "d3022b5f1df60f26e1ffddd6c66e8aa15de382ae63b3a0c1bfc0e4d3e3f325cb"+dependencies = [+ "ppv-lite86",+ "rand_core 0.9.5",+]++[[package]]+name = "rand_core"+version = "0.6.4"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c"+dependencies = [+ "getrandom 0.2.17",+]++[[package]]+name = "rand_core"+version = "0.9.5"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "76afc826de14238e6e8c374ddcc1fa19e374fd8dd986b0d2af0d02377261d83c"+dependencies = [+ "getrandom 0.3.4",+]++[[package]]+name = "rand_core"+version = "0.10.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "63b8176103e19a2643978565ca18b50549f6101881c443590420e4dc998a3c69"++[[package]]+name = "rand_distr"+version = "0.4.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "32cb0b9bc82b0a0876c2dd994a7e7a2683d3e7390ca40e6886785ef0c7e3ee31"+dependencies = [+ "num-traits",+ "rand 0.8.8",+]++[[package]]+name = "rangemap"+version = "1.8.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "a611d15b50743feb4c76b7d03edcb0e64f399c26961e4efe6975bc398be6aa3d"++[[package]]+name = "rawpointer"+version = "0.2.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "60a357793950651c4ed0f3f52338f53b2f809f32d83a07f72909fa13e4c6c1e3"++[[package]]+name = "rayon"+version = "1.12.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "fb39b166781f92d482534ef4b4b1b2568f42613b53e5b6c160e24cfbfa30926d"+dependencies = [+ "either",+ "rayon-core",+]++[[package]]+name = "rayon-core"+version = "1.13.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "22e18b0f0062d30d4230b2e85ff77fdfe4326feb054b9783a3460d8435c8ab91"+dependencies = [+ "crossbeam-deque",+ "crossbeam-utils",+]++[[package]]+name = "redox_syscall"+version = "0.5.18"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "ed2bf2547551a7053d6fdfafda3f938979645c44812fbfcda098faae3f1a362d"+dependencies = [+ "bitflags 2.13.1",+]++[[package]]+name = "redox_users"+version = "0.5.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "a4e608c6638b9c18977b00b475ac1f28d14e84b27d8d42f70e0bf1e3dec127ac"+dependencies = [+ "getrandom 0.2.17",+ "libredox",+ "thiserror 2.0.20",+]++[[package]]+name = "regex"+version = "0.1.80"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "4fd4ace6a8cf7860714a2c2280d6c1f7e6a413486c13298bbc86fd3da019402f"+dependencies = [+ "aho-corasick 0.5.3",+ "memchr 0.1.11",+ "regex-syntax 0.3.9",+ "thread_local",+ "utf8-ranges",+]++[[package]]+name = "regex"+version = "1.13.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "f020237b6c8eed93db2e2cb53c00c60a8e1bc73da7d073199a1180401450218d"+dependencies = [+ "aho-corasick 1.1.5",+ "memchr 2.8.3",+ "regex-automata",+ "regex-syntax 0.8.11",+]++[[package]]+name = "regex-automata"+version = "0.4.18"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "ad8553b9b26413251cbf30e620595c7a41b3887f03da04579c0e6b0d6a06b4b2"+dependencies = [+ "aho-corasick 1.1.5",+ "memchr 2.8.3",+ "regex-syntax 0.8.11",+]++[[package]]+name = "regex-syntax"+version = "0.3.9"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "f9ec002c35e86791825ed294b50008eea9ddfc8def4420124fbc6b08db834957"++[[package]]+name = "regex-syntax"+version = "0.8.11"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "d6f6ff9a378485b298a5286656da665ba74413d36db0979633275d2e708145d4"++[[package]]+name = "rouille"+version = "3.6.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "3716fbf57fc1084d7a706adf4e445298d123e4a44294c4e8213caf1b85fcc921"+dependencies = [+ "base64 0.13.1",+ "chrono",+ "filetime",+ "multipart",+ "percent-encoding",+ "rand 0.8.8",+ "serde",+ "serde_derive",+ "serde_json",+ "sha1_smol",+ "threadpool",+ "time",+ "tiny_http",+ "url",+]++[[package]]+name = "rustc-hash"+version = "1.1.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2"++[[package]]+name = "rustc-hash"+version = "2.1.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "6b1e7f9a428571be2dc5bc0505c13fb6bf936822b894ec87abf8a08a4e51742d"++[[package]]+name = "rustc-serialize"+version = "0.3.25"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "fe834bc780604f4674073badbad26d7219cadfb4a2275802db12cbae17498401"++[[package]]+name = "rustc_version"+version = "0.4.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92"+dependencies = [+ "semver",+]++[[package]]+name = "rustfst"+version = "1.3.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "3096239ad3664245480c50bf34a6ed45af5f40c0f6258d4b28a4c8082813a519"+dependencies = [+ "anyhow",+ "bimap",+ "bitflags 2.13.1",+ "generic-array 1.4.5",+ "itertools 0.14.0",+ "nom 7.1.3",+ "num-traits",+ "ordered-float",+ "rand 0.9.5",+ "rand_chacha 0.9.0",+ "serde",+ "superslice",+]++[[package]]+name = "rustix"+version = "0.38.44"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "fdb5bc1ae2baa591800df16c9ca78619bf65c0488b41b96ccec5d11220d8c154"+dependencies = [+ "bitflags 2.13.1",+ "errno",+ "libc",+ "linux-raw-sys 0.4.15",+ "windows-sys 0.59.0",+]++[[package]]+name = "rustix"+version = "1.1.4"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "b6fe4565b9518b83ef4f91bb47ce29620ca828bd32cb7e408f0062e9930ba190"+dependencies = [+ "bitflags 2.13.1",+ "errno",+ "libc",+ "linux-raw-sys 0.12.1",+ "windows-sys 0.61.2",+]++[[package]]+name = "rustversion"+version = "1.0.23"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "cf54715a573b99ac80df0bc206da022bcd442c974952c7b9720069370852e21f"++[[package]]+name = "rustybuzz"+version = "0.20.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "fd3c7c96f8a08ee34eff8857b11b49b07d71d1c3f4e88f8a88d4c9e9f90b1702"+dependencies = [+ "bitflags 2.13.1",+ "bytemuck",+ "core_maths",+ "log",+ "smallvec",+ "ttf-parser",+ "unicode-bidi-mirroring",+ "unicode-ccc",+ "unicode-properties",+ "unicode-script",+]++[[package]]+name = "safe_arch"+version = "0.7.4"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "96b02de82ddbe1b636e6170c21be622223aea188ef2e139be0a5b219ec215323"+dependencies = [+ "bytemuck",+]++[[package]]+name = "safemem"+version = "0.3.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "ef703b7cb59335eae2eb93ceb664c0eb7ea6bf567079d843e09420219668e072"++[[package]]+name = "same-file"+version = "1.0.6"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502"+dependencies = [+ "winapi-util",+]++[[package]]+name = "scopeguard"+version = "1.2.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49"++[[package]]+name = "seahash"+version = "4.1.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "1c107b6f4780854c8b126e228ea8869f4d7b71260f962fefb57b996b8959ba6b"++[[package]]+name = "semver"+version = "1.0.28"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "8a7852d02fc848982e0c167ef163aaff9cd91dc640ba85e263cb1ce46fae51cd"++[[package]]+name = "serde"+version = "1.0.229"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "4148590afebada386688f18773da617792bf2ef03ffc1e4cbd2b1d45b023e0ba"+dependencies = [+ "serde_core",+ "serde_derive",+]++[[package]]+name = "serde_core"+version = "1.0.229"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "67dca2c9c51e58a4791a4b1ed58308b39c64224d349a935ab5039aa360942a48"+dependencies = [+ "serde_derive",+]++[[package]]+name = "serde_derive"+version = "1.0.229"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "e7a5d71263a5a7d47b41f6b3f06ba276f10cc18b0931f1799f710578e2309348"+dependencies = [+ "proc-macro2",+ "quote",+ "syn 3.0.4",+]++[[package]]+name = "serde_json"+version = "1.0.151"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "c841b55ecdae098c80dcae9cf767f6f8a0c2cdb3416bbef72181df4d0fe73f14"+dependencies = [+ "itoa",+ "memchr 2.8.3",+ "serde",+ "serde_core",+ "zmij",+]++[[package]]+name = "serde_spanned"+version = "1.1.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "6662b5879511e06e8999a8a235d848113e942c9124f211511b16466ee2995f26"+dependencies = [+ "serde_core",+]++[[package]]+name = "sha1_smol"+version = "1.0.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "bbfa15b3dddfee50a0fff136974b3e1bde555604ba463834a7eb7deb6417705d"++[[package]]+name = "sha2"+version = "0.10.9"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283"+dependencies = [+ "cfg-if",+ "cpufeatures 0.2.17",+ "digest",+]++[[package]]+name = "shlex"+version = "1.3.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64"++[[package]]+name = "shlex"+version = "2.0.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "f8fadd59c855ef2080decdef8ff161eb6661b86933c9d82e5ba29dc602a55aba"++[[package]]+name = "simba"+version = "0.8.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "061507c94fc6ab4ba1c9a0305018408e312e17c041eb63bef8aa726fa33aceae"+dependencies = [+ "approx",+ "num-complex",+ "num-traits",+ "paste",+ "wide",+]++[[package]]+name = "simd-adler32"+version = "0.3.10"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "3a219298ac11a56ea9a6d2120044824d6f01aeb034955e7af7bc16858527deea"++[[package]]+name = "siphasher"+version = "1.0.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "8ee5873ec9cce0195efcb7a4e9507a04cd49aec9c83d0389df45b1ef7ba2e649"++[[package]]+name = "slab"+version = "0.4.12"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "0c790de23124f9ab44544d7ac05d60440adc586479ce501c1d6d7da3cd8c9cf5"++[[package]]+name = "slimt-sys"+version = "0.1.0"+source = "git+https://github.com/DavidVentura/slimt-sys#1cef6a655b713aef25695eba8451d10ac1c4f21a"+dependencies = [+ "cmake",+]++[[package]]+name = "slotmap"+version = "1.1.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "bdd58c3c93c3d278ca835519292445cb4b0d4dc59ccfdf7ceadaab3f8aeb4038"+dependencies = [+ "version_check",+]++[[package]]+name = "smallvec"+version = "1.15.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "8ed6a63f02c8539c91a8685a86f4099661ba3da017932f6ebbea6de3f0fa7c90"++[[package]]+name = "stable_deref_trait"+version = "1.2.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596"++[[package]]+name = "static_assertions"+version = "1.1.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f"++[[package]]+name = "string_cache"+version = "0.9.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "a18596f8c785a729f2819c0f6a7eae6ebeebdfffbfe4214ae6b087f690e31901"+dependencies = [+ "new_debug_unreachable",+ "parking_lot",+ "phf_shared",+ "precomputed-hash",+ "serde",+]++[[package]]+name = "string_cache_codegen"+version = "0.6.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "585635e46db231059f76c5849798146164652513eb9e8ab2685939dd90f29b69"+dependencies = [+ "phf_generator",+ "phf_shared",+ "proc-macro2",+ "quote",+]++[[package]]+name = "stringprep"+version = "0.1.5"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "7b4df3d392d81bd458a8a621b8bffbd2302a12ffe288a9d931670948749463b1"+dependencies = [+ "unicode-bidi",+ "unicode-normalization",+ "unicode-properties",+]++[[package]]+name = "subsetter"+version = "0.2.6"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "38803281d1c23166c5ebcb455439a5d2afe711cc909cf88af72448c297756ad6"+dependencies = [+ "rustc-hash 2.1.3",+]++[[package]]+name = "superslice"+version = "1.0.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "ab16ced94dbd8a46c82fd81e3ed9a8727dac2977ea869d217bcc4ea1f122e81f"++[[package]]+name = "syn"+version = "2.0.119"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "872831b642d1a07999a962a351ed35b955ea2cfc8f3862091e2a240a84f17297"+dependencies = [+ "proc-macro2",+ "quote",+ "unicode-ident",+]++[[package]]+name = "syn"+version = "3.0.4"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "e6275cddf4610d1775e6d1fe9469b2e77d0f39fd98fb7450901b821e0c53649f"+dependencies = [+ "proc-macro2",+ "quote",+ "unicode-ident",+]++[[package]]+name = "synstructure"+version = "0.13.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "728a70f3dbaf5bab7f0c4b1ac8d7ae5ea60a4b5549c8a5914361c99147a709d2"+dependencies = [+ "proc-macro2",+ "quote",+ "syn 2.0.119",+]++[[package]]+name = "tarkka"+version = "0.1.0"+source = "git+https://github.com/DavidVentura/tarkka#29806be27b180c3089d6a66c0520d2859fad3b06"+dependencies = [+ "itertools 0.14.0",+ "tarkka_derive",+ "zeekstd",+ "zstd-sys",+]++[[package]]+name = "tarkka_derive"+version = "0.1.0"+source = "git+https://github.com/DavidVentura/tarkka#29806be27b180c3089d6a66c0520d2859fad3b06"+dependencies = [+ "proc-macro2",+ "quote",+ "syn 2.0.119",+]++[[package]]+name = "tempfile"+version = "3.27.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "32497e9a4c7b38532efcdebeef879707aa9f794296a4f0244f6f69e9bc8574bd"+dependencies = [+ "fastrand",+ "getrandom 0.3.4",+ "once_cell",+ "rustix 1.1.4",+ "windows-sys 0.61.2",+]++[[package]]+name = "tendril"+version = "0.5.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "5fed54709c5b3a53d09bb1c113ea4f5ceafd1e772ddcb0030a82e1d56c087b08"+dependencies = [+ "new_debug_unreachable",+]++[[package]]+name = "thiserror"+version = "1.0.69"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52"+dependencies = [+ "thiserror-impl 1.0.69",+]++[[package]]+name = "thiserror"+version = "2.0.20"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "ec86235f5fcc2a73650310756d2ac5b138a5780bbbdfae3eeccec992c435ba4f"+dependencies = [+ "thiserror-impl 2.0.20",+]++[[package]]+name = "thiserror-impl"+version = "1.0.69"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1"+dependencies = [+ "proc-macro2",+ "quote",+ "syn 2.0.119",+]++[[package]]+name = "thiserror-impl"+version = "2.0.20"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "bc04cd3e1236dd4a98afca4569f2deb3f120e5422a4023be2cb683f8486292af"+dependencies = [+ "proc-macro2",+ "quote",+ "syn 3.0.4",+]++[[package]]+name = "thread-id"+version = "2.0.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "a9539db560102d1cef46b8b78ce737ff0bb64e7e18d35b2a5688f7d097d0ff03"+dependencies = [+ "kernel32-sys",+ "libc",+]++[[package]]+name = "thread_local"+version = "0.2.7"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "8576dbbfcaef9641452d5cf0df9b0e7eeab7694956dd33bb61515fb8f18cfdd5"+dependencies = [+ "thread-id",+]++[[package]]+name = "threadpool"+version = "1.8.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "d050e60b33d41c19108b32cea32164033a9013fe3b46cbd4457559bfbf77afaa"+dependencies = [+ "num_cpus",+]++[[package]]+name = "time"+version = "0.3.55"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "cdb87b95ec50ddfa440816d227a17b2ccbdda963a316a727fda0fc4334f7d134"+dependencies = [+ "deranged",+ "libc",+ "num-conv",+ "num_threads",+ "powerfmt",+ "serde_core",+ "time-core",+]++[[package]]+name = "time-core"+version = "0.1.9"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "9e1c906769ad99c88eaa54e728060edef082f8e358ff32030cb7c7d315e81109"++[[package]]+name = "tiny_http"+version = "0.12.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "389915df6413a2e74fb181895f933386023c71110878cd0825588928e64cdc82"+dependencies = [+ "ascii",+ "chunked_transfer",+ "httpdate",+ "log",+]++[[package]]+name = "tinystr"+version = "0.8.4"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "b1e27c91459209c2986af3dcf603a5a74a4368754ce37414f59acc971167f643"+dependencies = [+ "displaydoc",+ "serde_core",+ "zerovec",+]++[[package]]+name = "tinyvec"+version = "1.12.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "bb4ebadaa0af04fab11ae01eb5f9fdb5f9c5b875506e210e71c07873528baa7f"+dependencies = [+ "tinyvec_macros",+]++[[package]]+name = "tinyvec_macros"+version = "0.1.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20"++[[package]]+name = "toml"+version = "0.1.30"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "0590d72182e50e879c4da3b11c6488dae18fccb1ae0c7a3eda18e16795844796"+dependencies = [+ "rustc-serialize",+]++[[package]]+name = "toml"+version = "0.9.12+spec-1.1.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "cf92845e79fc2e2def6a5d828f0801e29a2f8acc037becc5ab08595c7d5e9863"+dependencies = [+ "indexmap",+ "serde_core",+ "serde_spanned",+ "toml_datetime",+ "toml_parser",+ "toml_writer",+ "winnow 0.7.15",+]++[[package]]+name = "toml_datetime"+version = "0.7.5+spec-1.1.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "92e1cfed4a3038bc5a127e35a2d360f145e1f4b971b551a2ba5fd7aedf7e1347"+dependencies = [+ "serde_core",+]++[[package]]+name = "toml_parser"+version = "1.1.3+spec-1.1.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "1d38ac1cf9b95face32296c0a3ede1fdc270627c9d9c02a7274dd6d960dc4d56"+dependencies = [+ "winnow 1.0.4",+]++[[package]]+name = "toml_writer"+version = "1.1.2+spec-1.1.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "7d56353a2a665ad0f41a421187180aab746c8c325620617ad883a99a1cbe66d2"++[[package]]+name = "translator"+version = "0.1.0"+source = "git+https://github.com/DavidVentura/translator-rs.git#8eae563208050babfb19ee4f990ee0d8080997e7"+dependencies = [+ "image",+ "imageproc",+ "log",+ "lopdf",+ "mupdf",+ "ndarray",+ "piper-rs",+ "rand 0.8.8",+ "rayon",+ "regex 1.13.1",+ "rouille",+ "rustybuzz",+ "serde",+ "serde_json",+ "subsetter",+ "translator-align",+ "translator-core",+ "translator-dictionary",+ "translator-doc",+ "translator-gpu",+ "translator-live",+ "translator-mucab",+ "translator-ocr",+ "translator-pdf",+ "translator-raster",+ "translator-render",+ "translator-tracker",+ "translator-translate",+ "translator-transliterate",+ "translator-tts",+ "ttf-parser",+ "unicode-bidi",+ "unicode-script",+ "uniffi",+]++[[package]]+name = "translator-align"+version = "0.1.0"+source = "git+https://github.com/DavidVentura/translator-rs.git#8eae563208050babfb19ee4f990ee0d8080997e7"+dependencies = [+ "log",+ "mnn-sys",+ "translator-core",+ "uniffi",+]++[[package]]+name = "translator-core"+version = "0.1.0"+source = "git+https://github.com/DavidVentura/translator-rs.git#8eae563208050babfb19ee4f990ee0d8080997e7"+dependencies = [+ "log",+ "serde",+ "serde_json",+ "unicode-script",+ "uniffi",+]++[[package]]+name = "translator-dictionary"+version = "0.1.0"+source = "git+https://github.com/DavidVentura/translator-rs.git#8eae563208050babfb19ee4f990ee0d8080997e7"+dependencies = [+ "tarkka",+ "translator-core",+]++[[package]]+name = "translator-doc"+version = "0.1.0"+source = "git+https://github.com/DavidVentura/translator-rs.git#8eae563208050babfb19ee4f990ee0d8080997e7"+dependencies = [+ "log",+ "markup5ever",+ "markup5ever_rcdom",+ "translator-core",+ "translator-translate",+ "ttf-parser",+ "xml5ever",+ "zip",+]++[[package]]+name = "translator-gpu"+version = "0.1.0"+source = "git+https://github.com/DavidVentura/translator-rs.git#8eae563208050babfb19ee4f990ee0d8080997e7"+dependencies = [+ "glow",+ "log",+ "translator-core",+ "translator-live",+ "translator-raster",+ "translator-render",+]++[[package]]+name = "translator-live"+version = "0.1.0"+source = "git+https://github.com/DavidVentura/translator-rs.git#8eae563208050babfb19ee4f990ee0d8080997e7"+dependencies = [+ "image",+ "log",+ "translator-core",+ "translator-ocr",+ "translator-raster",+ "translator-render",+ "translator-tracker",+ "translator-translate",+]++[[package]]+name = "translator-mucab"+version = "0.1.0"+source = "git+https://github.com/DavidVentura/translator-rs.git#8eae563208050babfb19ee4f990ee0d8080997e7"+dependencies = [+ "mucab",+]++[[package]]+name = "translator-ocr"+version = "0.1.0"+source = "git+https://github.com/DavidVentura/translator-rs.git#8eae563208050babfb19ee4f990ee0d8080997e7"+dependencies = [+ "image",+ "imageproc",+ "libc",+ "log",+ "mnn-sys",+ "rayon",+ "translator-core",+ "translator-raster",+ "translator-translate",+]++[[package]]+name = "translator-pdf"+version = "0.1.0"+source = "git+https://github.com/DavidVentura/translator-rs.git#8eae563208050babfb19ee4f990ee0d8080997e7"+dependencies = [+ "fax",+ "image",+ "log",+ "lopdf",+ "mupdf",+ "rustybuzz",+ "subsetter",+ "translator-core",+ "translator-render",+ "translator-translate",+]++[[package]]+name = "translator-raster"+version = "0.1.0"+source = "git+https://github.com/DavidVentura/translator-rs.git#8eae563208050babfb19ee4f990ee0d8080997e7"+dependencies = [+ "fast_image_resize",+ "image",+ "log",+ "rayon",+ "translator-core",+]++[[package]]+name = "translator-render"+version = "0.1.0"+source = "git+https://github.com/DavidVentura/translator-rs.git#8eae563208050babfb19ee4f990ee0d8080997e7"+dependencies = [+ "rustybuzz",+ "translator-core",+ "ttf-parser",+ "unicode-bidi",+ "unicode-linebreak",+ "unicode-script",+ "uniffi",+ "zeno",+]++[[package]]+name = "translator-tracker"+version = "0.1.0"+source = "git+https://github.com/DavidVentura/translator-rs.git#8eae563208050babfb19ee4f990ee0d8080997e7"+dependencies = [+ "image",+ "log",+ "rayon",+ "translator-core",+ "translator-render",+]++[[package]]+name = "translator-translate"+version = "0.1.0"+source = "git+https://github.com/DavidVentura/translator-rs.git#8eae563208050babfb19ee4f990ee0d8080997e7"+dependencies = [+ "cld2",+ "html5ever",+ "log",+ "markup5ever",+ "markup5ever_rcdom",+ "regex 1.13.1",+ "serde",+ "serde_json",+ "slimt-sys",+ "translator-core",+ "uniffi",+]++[[package]]+name = "translator-transliterate"+version = "0.1.0"+source = "git+https://github.com/DavidVentura/translator-rs.git#8eae563208050babfb19ee4f990ee0d8080997e7"+dependencies = [+ "icu_experimental",+ "icu_locale_core",+ "translator-core",+ "translator-mucab",+ "unicode-script",+]++[[package]]+name = "translator-tts"+version = "0.1.0"+source = "git+https://github.com/DavidVentura/translator-rs.git#8eae563208050babfb19ee4f990ee0d8080997e7"+dependencies = [+ "log",+ "piper-rs",+ "translator-core",+ "translator-transliterate",+]++[[package]]+name = "ttf-parser"+version = "0.25.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "d2df906b07856748fa3f6e0ad0cbaa047052d4a7dd609e231c4f72cee8c36f31"+dependencies = [+ "core_maths",+]++[[package]]+name = "twoway"+version = "0.1.8"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "59b11b2b5241ba34be09c3cc85a36e56e48f9888862e19cedf23336d35316ed1"+dependencies = [+ "memchr 2.8.3",+]++[[package]]+name = "typenum"+version = "1.20.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "b6f5e870be6c3b371b77fe0ee0bafb859fa4964b4404c27de1d380043c4dda20"++[[package]]+name = "ucd-trie"+version = "0.1.7"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "2896d95c02a80c6d6a5d6e953d479f5ddf2dfdb6a244441010e373ac0fb88971"++[[package]]+name = "unicase"+version = "2.9.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "dbc4bc3a9f746d862c45cb89d705aa10f187bb96c76001afab07a0d35ce60142"++[[package]]+name = "unicode-bidi"+version = "0.3.18"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "5c1cb5db39152898a79168971543b1cb5020dff7fe43c8dc468b0885f5e29df5"++[[package]]+name = "unicode-bidi-mirroring"+version = "0.4.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "5dfa6e8c60bb66d49db113e0125ee8711b7647b5579dc7f5f19c42357ed039fe"++[[package]]+name = "unicode-ccc"+version = "0.4.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "ce61d488bcdc9bc8b5d1772c404828b17fc481c0a582b5581e95fb233aef503e"++[[package]]+name = "unicode-ident"+version = "1.0.24"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75"++[[package]]+name = "unicode-linebreak"+version = "0.1.5"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "3b09c83c3c29d37506a3e260c08c03743a6bb66a9cd432c6934ab501a190571f"++[[package]]+name = "unicode-normalization"+version = "0.1.25"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "5fd4f6878c9cb28d874b009da9e8d183b5abc80117c40bbd187a1fde336be6e8"+dependencies = [+ "tinyvec",+]++[[package]]+name = "unicode-properties"+version = "0.1.4"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "7df058c713841ad818f1dc5d3fd88063241cc61f49f5fbea4b951e8cf5a8d71d"++[[package]]+name = "unicode-script"+version = "0.5.8"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "383ad40bb927465ec0ce7720e033cb4ca06912855fc35db31b5755d0de75b1ee"++[[package]]+name = "uniffi"+version = "0.31.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "46eefd5468602930da46b1f49d3448c6dfc2e81295f93120f23f8174fd70267f"+dependencies = [+ "anyhow",+ "uniffi_core",+ "uniffi_macros",+ "uniffi_pipeline",+]++[[package]]+name = "uniffi_core"+version = "0.31.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "eec017b112701681f6fbbe5d92014b5c468eb0b177a94389de03ceec40665095"+dependencies = [+ "anyhow",+ "bytes",+ "once_cell",+ "static_assertions",+]++[[package]]+name = "uniffi_internal_macros"+version = "0.31.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "4641669b48fefbc5e80ff08c5004d9c7617fb91232131a6734ab6712779cb04c"+dependencies = [+ "anyhow",+ "indexmap",+ "proc-macro2",+ "quote",+ "syn 2.0.119",+]++[[package]]+name = "uniffi_macros"+version = "0.31.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "eeb8617ee814de22caf7417bf514715ba0b3f46bd9d5a5d794413fd8282cb737"+dependencies = [+ "camino",+ "fs-err",+ "once_cell",+ "proc-macro2",+ "quote",+ "serde",+ "syn 2.0.119",+ "toml 0.9.12+spec-1.1.0",+ "uniffi_meta",+]++[[package]]+name = "uniffi_meta"+version = "0.31.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "58d5b94fc92803d21b2928bd15c6f06e57609b95caf98ea561c99cda1b6d2a25"+dependencies = [+ "anyhow",+ "siphasher",+ "uniffi_internal_macros",+ "uniffi_pipeline",+]++[[package]]+name = "uniffi_pipeline"+version = "0.31.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "032739b3ec725576914c15899dedaf080163ced86b6934566c20ec2b20ce90ca"+dependencies = [+ "anyhow",+ "heck",+ "indexmap",+ "tempfile",+ "uniffi_internal_macros",+]++[[package]]+name = "url"+version = "2.5.8"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "ff67a8a4397373c3ef660812acab3268222035010ab8680ec4215f38ba3d0eed"+dependencies = [+ "form_urlencoded",+ "idna",+ "percent-encoding",+ "serde",+]++[[package]]+name = "utf8-ranges"+version = "0.1.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "a1ca13c08c41c9c3e04224ed9ff80461d97e121589ff27c753a16cb10830ae0f"++[[package]]+name = "utf8_iter"+version = "1.0.4"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be"++[[package]]+name = "version_check"+version = "0.9.5"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a"++[[package]]+name = "walkdir"+version = "2.5.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b"+dependencies = [+ "same-file",+ "winapi-util",+]++[[package]]+name = "wasi"+version = "0.11.1+wasi-snapshot-preview1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b"++[[package]]+name = "wasip2"+version = "1.0.4+wasi-0.2.12"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "b67efb37e106e55ce722a510d6b5f9c17f083e5fc79afc2badeb12cc313d9487"+dependencies = [+ "wit-bindgen",+]++[[package]]+name = "wasm-bindgen"+version = "0.2.127"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "1b70935747edd64d89de3efa29d73789b806c15798f8e7dca4d8ac356b50ce70"+dependencies = [+ "cfg-if",+ "once_cell",+ "rustversion",+ "wasm-bindgen-macro",+ "wasm-bindgen-shared",+]++[[package]]+name = "wasm-bindgen-macro"+version = "0.2.127"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "77775f8f3f7217702089053b94958f8f54061a3f663417df76e19cbdcca29bc1"+dependencies = [+ "quote",+ "wasm-bindgen-macro-support",+]++[[package]]+name = "wasm-bindgen-macro-support"+version = "0.2.127"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "e11d33f857dc2fb11b8bc75aee111aa9cbeb12cd9f25efd3d4c2a3dd4e235284"+dependencies = [+ "bumpalo",+ "proc-macro2",+ "quote",+ "syn 2.0.119",+ "wasm-bindgen-shared",+]++[[package]]+name = "wasm-bindgen-shared"+version = "0.2.127"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "7ef64dbcc55df09c7e5a46182d181c2cfa3e925f3da937ea764728b4bbb9dcbf"+dependencies = [+ "unicode-ident",+]++[[package]]+name = "web-sys"+version = "0.3.104"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "c435338968042f4f59a557f690a253676d47ce13ceb55d70100e7facf6620a30"+dependencies = [+ "js-sys",+ "wasm-bindgen",+]++[[package]]+name = "web_atoms"+version = "0.2.6"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "ba8b815c1b593dc0baf78dd0f4fc8fdb2de53198fb1163738093e9a311c33fb3"+dependencies = [+ "phf",+ "phf_codegen",+ "string_cache",+ "string_cache_codegen",+]++[[package]]+name = "weezl"+version = "0.1.12"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "a28ac98ddc8b9274cb41bb4d9d4d5c425b6020c50c46f25559911905610b4a88"++[[package]]+name = "which"+version = "4.4.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "87ba24419a2078cd2b0f2ede2691b6c66d8e47836da3b6db8265ebad47afbfc7"+dependencies = [+ "either",+ "home",+ "once_cell",+ "rustix 0.38.44",+]++[[package]]+name = "wide"+version = "0.7.33"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "0ce5da8ecb62bcd8ec8b7ea19f69a51275e91299be594ea5cc6ef7819e16cd03"+dependencies = [+ "bytemuck",+ "safe_arch",+]++[[package]]+name = "winapi"+version = "0.2.8"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a"++[[package]]+name = "winapi"+version = "0.3.9"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419"+dependencies = [+ "winapi-i686-pc-windows-gnu",+ "winapi-x86_64-pc-windows-gnu",+]++[[package]]+name = "winapi-build"+version = "0.1.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc"++[[package]]+name = "winapi-i686-pc-windows-gnu"+version = "0.4.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"++[[package]]+name = "winapi-util"+version = "0.1.11"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22"+dependencies = [+ "windows-sys 0.61.2",+]++[[package]]+name = "winapi-x86_64-pc-windows-gnu"+version = "0.4.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"++[[package]]+name = "windows-core"+version = "0.62.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "b8e83a14d34d0623b51dce9581199302a221863196a1dde71a7663a4c2be9deb"+dependencies = [+ "windows-implement",+ "windows-interface",+ "windows-link",+ "windows-result",+ "windows-strings",+]++[[package]]+name = "windows-implement"+version = "0.60.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "053e2e040ab57b9dc951b72c264860db7eb3b0200ba345b4e4c3b14f67855ddf"+dependencies = [+ "proc-macro2",+ "quote",+ "syn 2.0.119",+]++[[package]]+name = "windows-interface"+version = "0.59.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "3f316c4a2570ba26bbec722032c4099d8c8bc095efccdc15688708623367e358"+dependencies = [+ "proc-macro2",+ "quote",+ "syn 2.0.119",+]++[[package]]+name = "windows-link"+version = "0.2.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5"++[[package]]+name = "windows-result"+version = "0.4.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "7781fa89eaf60850ac3d2da7af8e5242a5ea78d1a11c49bf2910bb5a73853eb5"+dependencies = [+ "windows-link",+]++[[package]]+name = "windows-strings"+version = "0.5.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "7837d08f69c77cf6b07689544538e017c1bfcf57e34b4c0ff58e6c2cd3b37091"+dependencies = [+ "windows-link",+]++[[package]]+name = "windows-sys"+version = "0.45.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0"+dependencies = [+ "windows-targets 0.42.2",+]++[[package]]+name = "windows-sys"+version = "0.59.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b"+dependencies = [+ "windows-targets 0.52.6",+]++[[package]]+name = "windows-sys"+version = "0.61.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc"+dependencies = [+ "windows-link",+]++[[package]]+name = "windows-targets"+version = "0.42.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "8e5180c00cd44c9b1c88adb3693291f1cd93605ded80c250a75d472756b4d071"+dependencies = [+ "windows_aarch64_gnullvm 0.42.2",+ "windows_aarch64_msvc 0.42.2",+ "windows_i686_gnu 0.42.2",+ "windows_i686_msvc 0.42.2",+ "windows_x86_64_gnu 0.42.2",+ "windows_x86_64_gnullvm 0.42.2",+ "windows_x86_64_msvc 0.42.2",+]++[[package]]+name = "windows-targets"+version = "0.52.6"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973"+dependencies = [+ "windows_aarch64_gnullvm 0.52.6",+ "windows_aarch64_msvc 0.52.6",+ "windows_i686_gnu 0.52.6",+ "windows_i686_gnullvm",+ "windows_i686_msvc 0.52.6",+ "windows_x86_64_gnu 0.52.6",+ "windows_x86_64_gnullvm 0.52.6",+ "windows_x86_64_msvc 0.52.6",+]++[[package]]+name = "windows_aarch64_gnullvm"+version = "0.42.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8"++[[package]]+name = "windows_aarch64_gnullvm"+version = "0.52.6"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3"++[[package]]+name = "windows_aarch64_msvc"+version = "0.42.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43"++[[package]]+name = "windows_aarch64_msvc"+version = "0.52.6"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469"++[[package]]+name = "windows_i686_gnu"+version = "0.42.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f"++[[package]]+name = "windows_i686_gnu"+version = "0.52.6"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b"++[[package]]+name = "windows_i686_gnullvm"+version = "0.52.6"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66"++[[package]]+name = "windows_i686_msvc"+version = "0.42.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060"++[[package]]+name = "windows_i686_msvc"+version = "0.52.6"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66"++[[package]]+name = "windows_x86_64_gnu"+version = "0.42.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36"++[[package]]+name = "windows_x86_64_gnu"+version = "0.52.6"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78"++[[package]]+name = "windows_x86_64_gnullvm"+version = "0.42.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3"++[[package]]+name = "windows_x86_64_gnullvm"+version = "0.52.6"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d"++[[package]]+name = "windows_x86_64_msvc"+version = "0.42.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0"++[[package]]+name = "windows_x86_64_msvc"+version = "0.52.6"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec"++[[package]]+name = "winnow"+version = "0.7.15"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "df79d97927682d2fd8adb29682d1140b343be4ac0f08fd68b7765d9c059d3945"++[[package]]+name = "winnow"+version = "1.0.4"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "23b97319f7b8343df12cc98938e5c3eb436064524c8d2b4e30a1d3a36eecdf81"++[[package]]+name = "wio"+version = "0.2.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "5d129932f4644ac2396cb456385cbf9e63b5b30c6e8dc4820bdca4eb082037a5"+dependencies = [+ "winapi 0.3.9",+]++[[package]]+name = "wit-bindgen"+version = "0.57.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "1ebf944e87a7c253233ad6766e082e3cd714b5d03812acc24c318f549614536e"++[[package]]+name = "writeable"+version = "0.6.4"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "3ad82d2a33cdc9674dc7465672f271e096168fcdbe0f799d9e6db8c5892679dc"+dependencies = [+ "either",+]++[[package]]+name = "xml5ever"+version = "0.38.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "d3dc9559429edf0cd3f327cc0afd9d6b36fa8cec6d93107b7fbe64f806b5f2d9"+dependencies = [+ "log",+ "markup5ever",+]++[[package]]+name = "yeslogic-fontconfig-sys"+version = "6.0.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "1d8b8abf912b9a29ff112e1671c97c33636903d13a69712037190e6805af4f76"+dependencies = [+ "dlib",+ "once_cell",+ "pkg-config",+]++[[package]]+name = "yoke"+version = "0.8.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "709fe23a0424b6a435d82152b1bd3fdfb0833487d5fa90d05d42762a9891fef5"+dependencies = [+ "stable_deref_trait",+ "yoke-derive",+ "zerofrom",+]++[[package]]+name = "yoke-derive"+version = "0.8.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "de844c262c8848816172cef550288e7dc6c7b7814b4ee56b3e1553f275f1858e"+dependencies = [+ "proc-macro2",+ "quote",+ "syn 2.0.119",+ "synstructure",+]++[[package]]+name = "zeekstd"+version = "0.6.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "a5f1379c45a7b52ed4aa3442da2cf5cc39abf1d8d178a5c02797be29c072ede2"+dependencies = [+ "zstd-safe",+]++[[package]]+name = "zeno"+version = "0.3.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "6df3dc4292935e51816d896edcd52aa30bc297907c26167fec31e2b0c6a32524"++[[package]]+name = "zerocopy"+version = "0.8.56"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "556764e583adb45a9f8d413c2a147fa7e8d821e48e12b14fd560b607998b75eb"+dependencies = [+ "zerocopy-derive",+]++[[package]]+name = "zerocopy-derive"+version = "0.8.56"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "f2ab42fc20575779bd240faa45f94a74256f755c0fa9e89f0ede20d91d0cdfc1"+dependencies = [+ "proc-macro2",+ "quote",+ "syn 2.0.119",+]++[[package]]+name = "zerofrom"+version = "0.1.8"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "0ec05a11813ea801ff6d75110ad09cd0824ddba17dfe17128ea0d5f68e6c5272"+dependencies = [+ "zerofrom-derive",+]++[[package]]+name = "zerofrom-derive"+version = "0.1.7"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "11532158c46691caf0f2593ea8358fed6bbf68a0315e80aae9bd41fbade684a1"+dependencies = [+ "proc-macro2",+ "quote",+ "syn 2.0.119",+ "synstructure",+]++[[package]]+name = "zerotrie"+version = "0.2.5"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "4ea269c3bd32f0a32c321907a2ae912ba6f4649bb0fc764a15627e99a7095a3f"+dependencies = [+ "displaydoc",+ "yoke",+ "zerofrom",+ "zerovec",+]++[[package]]+name = "zerovec"+version = "0.11.8"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "bb0464e17806c1d976d5cba29399c7f08e516e279e2ba493f63123b5fca67dd8"+dependencies = [+ "serde",+ "yoke",+ "zerofrom",+ "zerovec-derive",+]++[[package]]+name = "zerovec-derive"+version = "0.11.6"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "34df6fc39dbd26ddc9c10e6a2984476e13acce22e64e4487636ef494369225da"+dependencies = [+ "proc-macro2",+ "quote",+ "syn 3.0.4",+]++[[package]]+name = "zip"+version = "2.4.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "fabe6324e908f85a1c52063ce7aa26b68dcb7eb6dbc83a2d148403c9bc3eba50"+dependencies = [+ "arbitrary",+ "crc32fast",+ "crossbeam-utils",+ "displaydoc",+ "flate2",+ "indexmap",+ "memchr 2.8.3",+ "thiserror 2.0.20",+ "zopfli",+]++[[package]]+name = "zlib-rs"+version = "0.6.7"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "34b31d188d9d685a4f9c7b46d6e36631b07058d2cfe190267adce54dc230bf12"++[[package]]+name = "zmij"+version = "1.0.23"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "29666d0abbfad1e3dc4dcf6144730dd3a3ab225bbbdac83319345b1b44ccfc1b"++[[package]]+name = "zopfli"+version = "0.8.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "f05cd8797d63865425ff89b5c4a48804f35ba0ce8d125800027ad6017d2b5249"+dependencies = [+ "bumpalo",+ "crc32fast",+ "log",+ "simd-adler32",+]++[[package]]+name = "zstd-safe"+version = "7.2.4"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "8f49c4d5f0abb602a93fb8736af2a4f4dd9512e36f7f570d66e65ff867ed3b9d"+dependencies = [+ "zstd-sys",+]++[[package]]+name = "zstd-sys"+version = "2.0.16+zstd.1.5.7"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "91e19ebc2adc8f83e43039e79776e3fda8ca919132d68a1fed6a5faca2683748"+dependencies = [+ "bindgen 0.72.1",+ "cc",+ "pkg-config",+]++[[package]]+name = "zune-core"+version = "0.5.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "d56377fd46368984a170bc5aac5567e52ca5da874caa60bea39fcbca78fb658b"++[[package]]+name = "zune-jpeg"+version = "0.5.15"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "27bc9d5b815bc103f142aa054f561d9187d191692ec7c2d1e2b4737f8dbd7296"+dependencies = [+ "zune-core",+]diff --git a/OCR-translation/src/main/bindings/Cargo.toml b/OCR-translation/src/main/bindings/Cargo.tomlnew file mode 100644index 0000000..eea77f3--- /dev/null+++ b/OCR-translation/src/main/bindings/Cargo.toml@@ -0,0 +1,80 @@+[package]+name = "bindings"+version = "0.1.0"+edition = "2024"+# F-Droid builds with rustc 1.88+# need to bump both in tandem+rust-version = "1.88"++[lib]+crate-type = ["cdylib", "rlib"]+name = "bindings"+path = "src/lib.rs"++[features]+default = ["dictionary", "mucab", "tts", "pdf", "odt", "epub", "transliterate", "image-render", "pdf-image-translate", "doc-align", "ppocr", "planar-tracker", "gpu", "http"]+dictionary = ["translator/dictionary"]+gpu = ["translator/gpu"]+mucab = ["translator/mucab"]+tts = ["translator/tts"]+pdf = ["translator/pdf"]+odt = ["translator/odt"]+epub = ["translator/epub"]+transliterate = ["translator/transliterate"]+image-render = ["translator/image-render"]+pdf-image-translate = ["translator/pdf-image-translate"]+doc-align = ["translator/doc-align"]+ppocr = ["translator/ppocr"]+planar-tracker = ["translator/planar-tracker"]+http = ["translator/http"]++[dependencies]+adblock = { version = "0.12.2", default-features = false, features = ["full-regex-handling", "embedded-domain-resolver"] }+serde_json = "1"+uniffi = { version = "0.31", default-features = false }+thiserror = "2"+log = "0.4"+xml5ever = "0.38"+markup5ever = "0.38"+# Used for the live-OCR GPU per-frame fast path: a hand-rolled JNI entry+# (`LivePipelineJni.processFrameGl`) takes the camera's external-OES+# texture id + a couple of small float arrays and returns a packed+# tracker-result `jlong`, avoiding uniffi's per-call marshalling+# overhead on the 30 fps hot path.+jni = { version = "0.21", default-features = false }++[dependencies.translator]+default-features = false+git = "https://github.com/DavidVentura/translator-rs.git"+# path = "/home/david/git/translator-rs"+features = ["uniffi", "html"]++[target.'cfg(target_os = "android")'.dependencies]+android_logger = { version = "0.14", default-features = false }++# [patch."https://github.com/DavidVentura/slimt-sys"]+# slimt-sys = { path = "/home/david/git/slimt-sys" }++# [patch."https://github.com/DavidVentura/piper-rs"]+# piper-rs = { path = "/home/david/git/piper-rs" }+#+# [patch."https://github.com/DavidVentura/mnn-sys"]+# mnn-sys = { path = "/home/david/git/mnn-sys" }++[profile.release]+lto = "thin"+debug = false+strip = "debuginfo"++# Fast on-device dev builds. Override the built-in `dev` profile rather than+# a custom one: -sys build scripts (espeak/slimt/mnn) locate their target dir+# by matching the `PROFILE` env var against a path component, and cargo only+# ever sets PROFILE to debug/release — a custom profile name lands in an+# unmatched dir and the build scripts panic. dev defaults already give+# incremental=true, codegen-units=256, lto=off; we only raise opt-level so the+# Rust hot paths aren't unusably slow on the phone, and strip to keep the .so+# small for fast adb push.+[profile.dev]+opt-level = 1+debug = false+strip = "debuginfo"diff --git a/OCR-translation/src/main/bindings/src/adblock.rs b/OCR-translation/src/main/bindings/src/adblock.rsnew file mode 100644index 0000000..bab6ff3--- /dev/null+++ b/OCR-translation/src/main/bindings/src/adblock.rs@@ -0,0 +1,168 @@+use std::sync::Arc;++use adblock::Engine as InnerEngine;+use adblock::cosmetic_filter_cache::ProceduralOrActionFilter;+use adblock::lists::ParseOptions;+use adblock::request::Request;++#[derive(Debug, thiserror::Error, uniffi::Error)]+pub enum AdblockException {+ #[error("deserialization failed: {reason}")]+ Deserialize { reason: String },+}++#[derive(Debug, Clone, Copy, PartialEq, Eq, uniffi::Enum)]+pub enum AdblockRequestType {+ Document,+ Subdocument,+ Stylesheet,+ Script,+ Image,+ Font,+ Media,+ Object,+ Xhr,+ Fetch,+ WebSocket,+ Ping,+ Other,+}++impl AdblockRequestType {+ fn as_str(&self) -> &'static str {+ match self {+ AdblockRequestType::Document => "document",+ AdblockRequestType::Subdocument => "subdocument",+ AdblockRequestType::Stylesheet => "stylesheet",+ AdblockRequestType::Script => "script",+ AdblockRequestType::Image => "image",+ AdblockRequestType::Font => "font",+ AdblockRequestType::Media => "media",+ AdblockRequestType::Object => "object",+ AdblockRequestType::Xhr => "xmlhttprequest",+ AdblockRequestType::Fetch => "xmlhttprequest",+ AdblockRequestType::WebSocket => "websocket",+ AdblockRequestType::Ping => "ping",+ AdblockRequestType::Other => "other",+ }+ }+}++#[derive(Debug, Clone, uniffi::Record)]+pub struct AdblockVerdict {+ pub matched: bool,+ pub exception: bool,+ pub important: bool,+ pub redirect: Option<String>,+}++#[derive(Debug, Clone, uniffi::Record)]+pub struct AdblockCosmetic {+ pub hide_selectors: Vec<String>,+ pub style_rules: Vec<String>,+ pub procedural_filters: Vec<String>,+ pub exceptions: Vec<String>,+ pub injected_script: String,+ pub generichide: bool,+}++impl AdblockVerdict {+ fn allow() -> Self {+ Self {+ matched: false,+ exception: false,+ important: false,+ redirect: None,+ }+ }+}++#[derive(uniffi::Object)]+pub struct AdblockEngine {+ inner: InnerEngine,+}++#[uniffi::export]+impl AdblockEngine {+ #[uniffi::constructor]+ pub fn from_rules(rules_text: String) -> Arc<Self> {+ let inner = InnerEngine::from_rules(rules_text.lines(), ParseOptions::default());+ Arc::new(Self { inner })+ }++ #[uniffi::constructor]+ pub fn deserialize(bytes: Vec<u8>) -> Result<Arc<Self>, AdblockException> {+ let mut inner = InnerEngine::default();+ inner+ .deserialize(&bytes)+ .map_err(|e| AdblockException::Deserialize {+ reason: format!("{e:?}"),+ })?;+ Ok(Arc::new(Self { inner }))+ }++ pub fn serialize(&self) -> Vec<u8> {+ self.inner.serialize()+ }++ pub fn check_request(+ &self,+ url: String,+ source_url: String,+ request_type: AdblockRequestType,+ ) -> AdblockVerdict {+ let request = match Request::new(&url, &source_url, request_type.as_str()) {+ Ok(r) => r,+ Err(_) => return AdblockVerdict::allow(),+ };+ let result = self.inner.check_network_request(&request);+ AdblockVerdict {+ matched: result.matched,+ exception: result.exception.is_some(),+ important: result.important,+ redirect: result.redirect,+ }+ }++ pub fn hidden_class_id_selectors(+ &self,+ classes: Vec<String>,+ ids: Vec<String>,+ exceptions: Vec<String>,+ ) -> Vec<String> {+ let exception_set: std::collections::HashSet<String> = exceptions.into_iter().collect();+ self.inner+ .hidden_class_id_selectors(classes.iter(), ids.iter(), &exception_set)+ }++ pub fn cosmetic_resources(&self, url: String) -> AdblockCosmetic {+ let r = self.inner.url_cosmetic_resources(&url);+ let mut hide_selectors: Vec<String> = r.hide_selectors.into_iter().collect();+ let mut style_rules: Vec<String> = Vec::new();+ let mut procedural_filters: Vec<String> = Vec::new();++ for proc_json in &r.procedural_actions {+ let Ok(filter) = serde_json::from_str::<ProceduralOrActionFilter>(proc_json) else {+ continue;+ };+ if let Some((selector, style)) = filter.as_css() {+ if style == "display: none !important" {+ hide_selectors.push(selector);+ } else {+ style_rules.push(format!("{selector} {{ {style} }}"));+ }+ } else {+ procedural_filters.push(proc_json.clone());+ }+ }++ AdblockCosmetic {+ hide_selectors,+ style_rules,+ procedural_filters,+ exceptions: r.exceptions.into_iter().collect(),+ injected_script: r.injected_script,+ generichide: r.generichide,+ }+ }+}diff --git a/OCR-translation/src/main/bindings/src/android_font_provider.rs b/OCR-translation/src/main/bindings/src/android_font_provider.rsnew file mode 100644index 0000000..2b306ca--- /dev/null+++ b/OCR-translation/src/main/bindings/src/android_font_provider.rs@@ -0,0 +1,626 @@+//! Android-native [`FontProvider`] backed by `/system/etc/fonts.xml`.+//!+//! Latin-script targets render correctly through the PDF writer's+//! Standard-14 Helvetica/Courier fallback (WinAnsi covers the latin+//! glyphs that show up in en/es/fr/de/...), so for those [`locate`]+//! returns `None` and we never touch system font lookup. Only non-Latin+//! scripts (Cyrillic, CJK, Arabic, Indic, ...) need a real font handle+//! so the writer can embed a TTF subset.+//!+//! Lookup parses `/system/etc/fonts.xml` (the same data Skia / minikin+//! consume internally) and resolves to files in `/system/fonts/`. The+//! whole provider works back to minSdk 21 — the API-version differences+//! only affect *how* we identify a script's family, not whether we can.+//!+//! Three layered search passes (all run on every API level):+//!+//! 1. `<family lang="...">` exact match. CJK families (`ja`, `ko`,+//! `zh-Hans`, `zh-Hant`) have carried this attribute since API 21.+//! Other scripts (`und-Arab`, `und-Hebr`, `und-Thai`, Indic, …)+//! only got `lang=` in the API 28 fonts.xml refresh, so this pass+//! misses them on older devices.+//! 2. Filename keyword match (`NotoSansArabic`, `NotoNaskh`, …). On+//! API 21..27 the non-CJK fallback families have no `lang` and+//! are only identifiable by their Noto filenames; this pass picks+//! them up. Harmless on API 28+ since pass 1 already hit.+//! 3. Default `name="sans-serif"` family (Roboto). Covers Cyrillic and+//! Greek on every release — Roboto has shipped both glyph blocks+//! since Android 5.0, and no `und-Cyrl` / `und-Grek` family ever+//! existed.+//!+//! Within the chosen family we pick the closest `(weight, italic)`+//! match.++use std::cell::RefCell;+use std::path::PathBuf;+use std::sync::OnceLock;++use markup5ever::buffer_queue::BufferQueue;+use translator::font_provider::{FontHandle, FontProvider, FontRequest};+use translator::script::Script as TrScript;+use xml5ever::tendril::StrTendril;+use xml5ever::tokenizer::{EndTag, ProcessResult, StartTag, Token, TokenSink, XmlTokenizer};++const FONTS_XML_PATH: &str = "/system/etc/fonts.xml";+const SYSTEM_FONTS_DIR: &str = "/system/fonts";++#[derive(Debug, Clone)]+struct FontEntry {+ file_name: String,+ weight: u16,+ italic: bool,+ ttc_index: u32,+}++#[derive(Debug, Default, Clone)]+struct FamilyEntry {+ name: Option<String>,+ langs: Vec<String>,+ fonts: Vec<FontEntry>,+}++#[derive(Default)]+struct ParseState {+ families: Vec<FamilyEntry>,+ current_family: Option<FamilyEntry>,+ current_font: Option<FontEntry>,+ font_text_buf: String,+}++struct ParserSink {+ state: RefCell<ParseState>,+}++impl TokenSink for ParserSink {+ type Handle = ();++ fn process_token(&self, token: Token) -> ProcessResult<()> {+ let mut state = self.state.borrow_mut();+ match token {+ Token::Tag(tag) => {+ let local = &*tag.name.local;+ match tag.kind {+ StartTag => {+ if local == "family" {+ let mut entry = FamilyEntry::default();+ for attr in tag.attrs.iter() {+ match &*attr.name.local {+ "name" => entry.name = Some(attr.value.to_string()),+ "lang" => {+ entry.langs = attr+ .value+ .split_whitespace()+ .map(str::to_string)+ .collect();+ }+ _ => {}+ }+ }+ state.current_family = Some(entry);+ } else if local == "font" && state.current_family.is_some() {+ let mut font = FontEntry {+ file_name: String::new(),+ weight: 400,+ italic: false,+ ttc_index: 0,+ };+ for attr in tag.attrs.iter() {+ match &*attr.name.local {+ "weight" => {+ font.weight = attr.value.parse().unwrap_or(400);+ }+ "style" => {+ font.italic = &*attr.value == "italic";+ }+ "index" => {+ font.ttc_index = attr.value.parse().unwrap_or(0);+ }+ _ => {}+ }+ }+ state.current_font = Some(font);+ state.font_text_buf.clear();+ }+ }+ EndTag => {+ if local == "font" {+ if let Some(mut font) = state.current_font.take() {+ font.file_name = state.font_text_buf.trim().to_string();+ state.font_text_buf.clear();+ if !font.file_name.is_empty()+ && let Some(family) = state.current_family.as_mut()+ {+ family.fonts.push(font);+ }+ }+ } else if local == "family"+ && let Some(family) = state.current_family.take()+ && !family.fonts.is_empty()+ {+ state.families.push(family);+ }+ }+ _ => {}+ }+ }+ Token::Characters(s) => {+ if state.current_font.is_some() {+ state.font_text_buf.push_str(&s);+ }+ }+ _ => {}+ }+ ProcessResult::Continue+ }+}++fn parse_fonts_xml(xml: &str) -> Vec<FamilyEntry> {+ let sink = ParserSink {+ state: RefCell::new(ParseState::default()),+ };+ let buffer = BufferQueue::default();+ buffer.push_back(StrTendril::from_slice(xml));+ let tok = XmlTokenizer::new(sink, Default::default());+ let _ = tok.feed(&buffer);+ tok.end();+ tok.sink.state.into_inner().families+}++fn families() -> &'static [FamilyEntry] {+ static CACHE: OnceLock<Vec<FamilyEntry>> = OnceLock::new();+ CACHE.get_or_init(|| match std::fs::read_to_string(FONTS_XML_PATH) {+ Ok(xml) => {+ let parsed = parse_fonts_xml(&xml);+ log::debug!(+ "[font] parsed {} families from {FONTS_XML_PATH}",+ parsed.len()+ );+ parsed+ }+ Err(e) => {+ log::warn!("[font] cannot read {FONTS_XML_PATH}: {e}");+ Vec::new()+ }+ })+}++/// Scripts the translator catalog actually has models for (per+/// `index.json`). Anything outside this set returns `None` from+/// [`non_latin_script`] and rides the Latin / Helvetica path. Adding a+/// new pack to the catalog with a non-Latin script means adding a+/// variant here, a code in [`non_latin_script`], an entry in+/// [`lang_tags`], and a fallback keyword in [`name_keywords`] — the+/// `script_table_covers_all_index_scripts` test catches misses.+#[derive(Clone, Copy)]+enum Script {+ Cyrillic, // be, bg, ru, sr, uk+ Greek, // el+ Arabic, // ar, fa+ Hebrew, // he+ Thai, // th+ Devanagari, // hi+ Bengali, // bn+ Tamil, // ta+ Telugu, // te+ Kannada, // kn+ Malayalam, // ml+ Gujarati, // gu+ Japanese, // ja+ Korean, // ko+ HanSimplified, // zh+ HanTraditional, // zh_hant+}++fn non_latin_script(language: &str) -> Option<Script> {+ let normalized = language.replace('_', "-").to_ascii_lowercase();+ let mut parts = normalized.split('-');+ let primary = parts.next().unwrap_or(&normalized);+ let suffix = parts.next();+ Some(match primary {+ "ja" => Script::Japanese,+ "ko" => Script::Korean,+ "zh" => match suffix {+ Some("hant") | Some("tw") | Some("hk") | Some("mo") => Script::HanTraditional,+ _ => Script::HanSimplified,+ },+ "ru" | "uk" | "be" | "bg" | "sr" => Script::Cyrillic,+ "el" => Script::Greek,+ "ar" | "fa" => Script::Arabic,+ "he" => Script::Hebrew,+ "th" => Script::Thai,+ "hi" => Script::Devanagari,+ "bn" => Script::Bengali,+ "ta" => Script::Tamil,+ "te" => Script::Telugu,+ "kn" => Script::Kannada,+ "ml" => Script::Malayalam,+ "gu" => Script::Gujarati,+ _ => return None,+ })+}++/// Map the translator's [`TrScript`] to this provider's internal enum. The+/// internal enum exists because Android's `fonts.xml` distinguishes+/// simplified vs traditional Han via `lang=zh-Hans` / `lang=zh-Hant`, which+/// the translator's script enum collapses into a single `Han` variant.+/// We pull the disambiguation from the BCP-47 hint when needed.+fn script_from_translator(script: TrScript, language: &str) -> Option<Script> {+ Some(match script {+ TrScript::Cyrillic => Script::Cyrillic,+ TrScript::Greek => Script::Greek,+ TrScript::Arabic => Script::Arabic,+ TrScript::Hebrew => Script::Hebrew,+ TrScript::Thai => Script::Thai,+ TrScript::Devanagari => Script::Devanagari,+ TrScript::Bengali => Script::Bengali,+ TrScript::Tamil => Script::Tamil,+ TrScript::Telugu => Script::Telugu,+ TrScript::Kannada => Script::Kannada,+ TrScript::Malayalam => Script::Malayalam,+ TrScript::Gujarati => Script::Gujarati,+ TrScript::Hiragana | TrScript::Katakana => Script::Japanese,+ TrScript::Hangul => Script::Korean,+ TrScript::Han => match non_latin_script(language) {+ Some(Script::HanTraditional) => Script::HanTraditional,+ _ => Script::HanSimplified,+ },+ // Latin / Common / anything else: rides Helvetica or Roboto via the+ // empty chain returned from `locate`.+ _ => return None,+ })+}++fn lang_tags(script: Script) -> &'static [&'static str] {+ match script {+ Script::Cyrillic | Script::Greek => &[],+ Script::Japanese => &["ja"],+ Script::Korean => &["ko"],+ Script::HanSimplified => &["zh-Hans"],+ Script::HanTraditional => &["zh-Hant", "zh-Bopo"],+ Script::Arabic => &["und-Arab"],+ Script::Hebrew => &["und-Hebr"],+ Script::Thai => &["und-Thai"],+ Script::Devanagari => &["und-Deva"],+ Script::Bengali => &["und-Beng"],+ Script::Tamil => &["und-Taml"],+ Script::Telugu => &["und-Telu"],+ Script::Kannada => &["und-Knda"],+ Script::Malayalam => &["und-Mlym"],+ Script::Gujarati => &["und-Gujr"],+ }+}++/// Substrings to look for in font filenames when no `lang=` family is+/// found. This handles API 21..27 fonts.xml, where most fallback+/// families have no `lang` attribute and the only signal is the Noto+/// family encoded in the filename.+fn name_keywords(script: Script) -> &'static [&'static str] {+ match script {+ Script::Cyrillic | Script::Greek => &[],+ Script::Japanese => &["NotoSansCJK", "NotoSansJP", "DroidSansJapanese"],+ Script::Korean => &["NotoSansCJK", "NotoSansKR", "DroidSansKorean"],+ Script::HanSimplified => &["NotoSansSC", "NotoSansHans", "NotoSansCJK"],+ Script::HanTraditional => &["NotoSansTC", "NotoSansHant", "NotoSansCJK"],+ Script::Arabic => &["NotoNaskh", "NotoSansArabic", "DroidNaskh"],+ Script::Hebrew => &["NotoSansHebrew"],+ Script::Thai => &["NotoSansThai", "DroidSansThai"],+ Script::Devanagari => &["NotoSansDevanagari"],+ Script::Bengali => &["NotoSansBengali"],+ Script::Tamil => &["NotoSansTamil"],+ Script::Telugu => &["NotoSansTelugu"],+ Script::Kannada => &["NotoSansKannada"],+ Script::Malayalam => &["NotoSansMalayalam"],+ Script::Gujarati => &["NotoSansGujarati"],+ }+}++fn pick_font(family: &FamilyEntry, want_weight: u16, want_italic: bool) -> Option<&FontEntry> {+ if let Some(exact) = family+ .fonts+ .iter()+ .find(|f| f.weight == want_weight && f.italic == want_italic)+ {+ return Some(exact);+ }+ if let Some(matching_italic) = family+ .fonts+ .iter()+ .filter(|f| f.italic == want_italic)+ .min_by_key(|f| (f.weight as i32 - want_weight as i32).abs())+ {+ return Some(matching_italic);+ }+ family+ .fonts+ .iter()+ .min_by_key(|f| (f.weight as i32 - want_weight as i32).abs())+}++fn resolve(file_name: &str, ttc_index: u32) -> Option<(PathBuf, u32)> {+ let path = PathBuf::from(SYSTEM_FONTS_DIR).join(file_name);+ if !path.exists() {+ log::warn!("[font] missing system font: {}", path.display());+ return None;+ }+ Some((path, ttc_index))+}++fn locate_for(script: Script, bold: bool, italic: bool) -> Option<(PathBuf, u32, u16)> {+ let want_weight: u16 = if bold { 700 } else { 400 };+ let families = families();++ for want in lang_tags(script) {+ for family in families {+ if !family.langs.iter().any(|l| l == want) {+ continue;+ }+ if let Some(font) = pick_font(family, want_weight, italic)+ && let Some(r) = resolve(&font.file_name, font.ttc_index)+ {+ return Some((r.0, r.1, font.weight));+ }+ }+ }++ for keyword in name_keywords(script) {+ for family in families {+ if !family.fonts.iter().any(|f| f.file_name.contains(keyword)) {+ continue;+ }+ if let Some(font) = pick_font(family, want_weight, italic)+ && let Some(r) = resolve(&font.file_name, font.ttc_index)+ {+ return Some((r.0, r.1, font.weight));+ }+ }+ }++ for family in families {+ if family.name.as_deref() != Some("sans-serif") {+ continue;+ }+ if let Some(font) = pick_font(family, want_weight, italic)+ && let Some(r) = resolve(&font.file_name, font.ttc_index)+ {+ return Some((r.0, r.1, font.weight));+ }+ }++ None+}++pub struct AndroidFontProvider;++impl FontProvider for AndroidFontProvider {+ fn locate(&self, request: &FontRequest) -> Vec<FontHandle> {+ let mut chain: Vec<FontHandle> = Vec::new();++ if let Some(script) = script_from_translator(request.script, &request.language)+ && let Some((path, ttc_index, weight)) = locate_for(script, request.bold, request.italic)+ {+ log::debug!(+ "[font] {:?} lang={} bold={} italic={} -> {} (ttc={} weight={})",+ request.script,+ request.language,+ request.bold,+ request.italic,+ path.display(),+ ttc_index,+ weight,+ );+ chain.push(FontHandle::new(path, ttc_index).with_weight(weight));+ }++ // Always append Roboto (sans-serif default) as a Latin/Cyrillic/Greek+ // fallback. Roboto covers Latin/Cyrillic/Greek out of the box on every+ // Android release; it's the right fallback for ASCII embedded inside+ // a non-Latin run.+ if let Some(family) = families()+ .iter()+ .find(|f| f.name.as_deref() == Some("sans-serif"))+ && let Some(font) =+ pick_font(family, if request.bold { 700 } else { 400 }, request.italic)+ && let Some((path, ttc_index)) = resolve(&font.file_name, font.ttc_index)+ {+ chain.push(FontHandle::new(path, ttc_index).with_weight(font.weight));+ }++ chain+ }+}++#[cfg(test)]+mod tests {+ use super::*;++ const FONTS_XML_API28: &str = include_str!("../testdata/fonts_api28.xml");++ /// Snapshot of every language from `bucket/index.json` paired with+ /// its `meta.script` ISO 15924 code. Update both this list and the+ /// `non_latin_script` / `lang_tags` / `name_keywords` tables when+ /// new packs are added to the catalog. The two tests below assert+ /// that every entry here resolves correctly.+ const INDEX_LANGUAGES: &[(&str, &str)] = &[+ ("ar", "Arab"),+ ("az", "Latn"),+ ("be", "Cyrl"),+ ("bg", "Cyrl"),+ ("bn", "Beng"),+ ("bs", "Latn"),+ ("ca", "Latn"),+ ("cs", "Latn"),+ ("da", "Latn"),+ ("de", "Latn"),+ ("el", "Grek"),+ ("en", "Latn"),+ ("es", "Latn"),+ ("et", "Latn"),+ ("fa", "Arab"),+ ("fi", "Latn"),+ ("fr", "Latn"),+ ("gu", "Gujr"),+ ("he", "Hebr"),+ ("hi", "Deva"),+ ("hr", "Latn"),+ ("hu", "Latn"),+ ("id", "Latn"),+ ("is", "Latn"),+ ("it", "Latn"),+ ("ja", "Jpan"),+ ("kn", "Knda"),+ ("ko", "Hang"),+ ("lt", "Latn"),+ ("lv", "Latn"),+ ("ml", "Mlym"),+ ("ms", "Latn"),+ ("nb", "Latn"),+ ("nl", "Latn"),+ ("nn", "Latn"),+ ("no", "Latn"),+ ("pl", "Latn"),+ ("pt", "Latn"),+ ("ro", "Latn"),+ ("ru", "Cyrl"),+ ("sk", "Latn"),+ ("sl", "Latn"),+ ("sq", "Latn"),+ ("sr", "Cyrl"),+ ("sv", "Latn"),+ ("ta", "Taml"),+ ("te", "Telu"),+ ("th", "Thai"),+ ("tr", "Latn"),+ ("uk", "Cyrl"),+ ("vi", "Latn"),+ ("zh", "Hans"),+ ("zh_hant", "Hant"),+ ];++ #[test]+ fn every_index_language_maps_correctly() {+ for &(code, script) in INDEX_LANGUAGES {+ let mapped = non_latin_script(code);+ if script == "Latn" {+ assert!(+ mapped.is_none(),+ "{code} ({script}) must map to None — Latin uses Helvetica",+ );+ } else {+ assert!(+ mapped.is_some(),+ "{code} ({script}) is non-Latin but non_latin_script returned None",+ );+ }+ }+ }++ #[test]+ fn every_non_latin_script_resolves_in_api28_fonts_xml() {+ let families = parse_fonts_xml(FONTS_XML_API28);+ for &(code, script) in INDEX_LANGUAGES {+ if script == "Latn" {+ continue;+ }+ let s = non_latin_script(code).unwrap();+ let want_weight = 400;+ // Replicate the locate_for search on the parsed families,+ // without touching /system/fonts.+ let mut hit = None;+ for want in lang_tags(s) {+ if let Some(family) = families.iter().find(|f| f.langs.iter().any(|l| l == want))+ && let Some(font) = pick_font(family, want_weight, false)+ {+ hit = Some(font.file_name.clone());+ break;+ }+ }+ if hit.is_none() {+ for keyword in name_keywords(s) {+ if let Some(family) = families+ .iter()+ .find(|f| f.fonts.iter().any(|f| f.file_name.contains(keyword)))+ && let Some(font) = pick_font(family, want_weight, false)+ {+ hit = Some(font.file_name.clone());+ break;+ }+ }+ }+ if hit.is_none()+ && let Some(family) = families+ .iter()+ .find(|f| f.name.as_deref() == Some("sans-serif"))+ && let Some(font) = pick_font(family, want_weight, false)+ {+ hit = Some(font.file_name.clone());+ }+ assert!(+ hit.is_some(),+ "{code} ({script}) cannot be resolved from API 28 fonts.xml",+ );+ }+ }++ #[test]+ fn zh_hant_routes_to_traditional_family() {+ let families = parse_fonts_xml(FONTS_XML_API28);+ let s = non_latin_script("zh_hant").expect("zh_hant maps to a script");+ assert!(matches!(s, Script::HanTraditional));+ let tag = lang_tags(s)[0];+ let family = families+ .iter()+ .find(|f| f.langs.iter().any(|l| l == tag))+ .expect("API 28 fonts.xml has a zh-Hant family");+ let font = pick_font(family, 400, false).expect("zh-Hant has a regular font");+ assert!(+ font.ttc_index >= 1,+ "zh-Hant should pick a non-zero ttc index (got {})",+ font.ttc_index+ );+ }++ #[test]+ fn parses_default_sans_serif() {+ let families = parse_fonts_xml(FONTS_XML_API28);+ let sans = families+ .iter()+ .find(|f| f.name.as_deref() == Some("sans-serif"))+ .expect("sans-serif family present");+ assert!(+ sans.fonts+ .iter()+ .any(|f| f.file_name == "Roboto-Regular.ttf" && f.weight == 400 && !f.italic),+ "Roboto regular weight 400 normal must be parsed"+ );+ assert!(+ sans.fonts+ .iter()+ .any(|f| f.file_name == "Roboto-Bold.ttf" && f.weight == 700),+ "Roboto bold must be parsed"+ );+ }++ #[test]+ fn parses_lang_tagged_arabic() {+ let families = parse_fonts_xml(FONTS_XML_API28);+ assert!(+ families+ .iter()+ .any(|f| f.langs.iter().any(|l| l == "und-Arab")),+ "und-Arab family must be parsed"+ );+ }++ #[test]+ fn parses_ttc_index_for_cjk() {+ let families = parse_fonts_xml(FONTS_XML_API28);+ let zh_hans = families+ .iter()+ .find(|f| f.langs.iter().any(|l| l == "zh-Hans"))+ .expect("zh-Hans family present");+ assert!(+ zh_hans.fonts.iter().any(|f| f.ttc_index > 0),+ "zh-Hans should have a non-zero ttc index in NotoSansCJK"+ );+ }+}diff --git a/OCR-translation/src/main/bindings/src/bergamot.rs b/OCR-translation/src/main/bindings/src/bergamot.rsnew file mode 100644index 0000000..f7c4047--- /dev/null+++ b/OCR-translation/src/main/bindings/src/bergamot.rs@@ -0,0 +1,36 @@+use translator::language_detect::{detect_language, detect_language_robust_code};++#[uniffi::export]+pub fn detect_language_record(+ text: String,+ hint: Option<String>,+) -> Option<translator::DetectionResult> {+ let hint = hint.map(translator::LanguageCode::from);+ detect_language(&text, hint.as_ref())+}++/// A detection candidate and the writing system the catalog records for it.+/// The script travels with the code because this entry point is free-standing+/// and has no catalog to resolve one against.+#[derive(uniffi::Record)]+pub struct AvailableLanguage {+ pub code: String,+ pub script: translator::script::Script,+}++#[uniffi::export]+pub fn detect_language_robust_code_record(+ text: String,+ hint: Option<String>,+ available_languages: Vec<AvailableLanguage>,+) -> Option<String> {+ let hint = hint.map(translator::LanguageCode::from);+ let available = available_languages+ .into_iter()+ .map(|language| translator::api::ScriptedLanguage {+ code: translator::LanguageCode::from(language.code),+ script: language.script,+ })+ .collect::<Vec<_>>();+ detect_language_robust_code(&text, hint.as_ref(), &available).map(|code| code.code)+}diff --git a/OCR-translation/src/main/bindings/src/bitmap_jni.rs b/OCR-translation/src/main/bindings/src/bitmap_jni.rsnew file mode 100644index 0000000..e6eb3d4--- /dev/null+++ b/OCR-translation/src/main/bindings/src/bitmap_jni.rs@@ -0,0 +1,79 @@+//! Zero-copy access to an Android `Bitmap`'s pixels for the still-image OCR path.+//! [`lockPixels`] pins an `ARGB_8888` bitmap and returns the native pixel address as a+//! `jlong`; Rust reads/writes it directly (no `byte[]` copy, no uniffi marshal) and the+//! caller releases it with [`unlockPixels`]. Returns 0 unless the bitmap is tightly-packed+//! `RGBA_8888` (`stride == width*4`), the only layout the OCR pipeline indexes.++use jni::objects::{JClass, JObject};+use jni::sys::jlong;+use jni::JNIEnv;+use std::os::raw::{c_int, c_void};++const ANDROID_BITMAP_FORMAT_RGBA_8888: i32 = 1;+const ANDROID_BITMAP_RESULT_SUCCESS: c_int = 0;++#[repr(C)]+struct AndroidBitmapInfo {+ width: u32,+ height: u32,+ stride: u32,+ format: i32,+ flags: u32,+}++#[link(name = "jnigraphics")]+unsafe extern "C" {+ fn AndroidBitmap_getInfo(+ env: *mut jni::sys::JNIEnv,+ bitmap: jni::sys::jobject,+ info: *mut AndroidBitmapInfo,+ ) -> c_int;+ fn AndroidBitmap_lockPixels(+ env: *mut jni::sys::JNIEnv,+ bitmap: jni::sys::jobject,+ addr: *mut *mut c_void,+ ) -> c_int;+ fn AndroidBitmap_unlockPixels(env: *mut jni::sys::JNIEnv, bitmap: jni::sys::jobject) -> c_int;+}++#[unsafe(no_mangle)]+pub extern "system" fn Java_dev_davidv_translator_NativeBitmap_lockPixels(+ env: JNIEnv,+ _class: JClass,+ bitmap: JObject,+) -> jlong {+ let raw_env = env.get_raw();+ let raw_bitmap = bitmap.as_raw();+ let mut info = AndroidBitmapInfo {+ width: 0,+ height: 0,+ stride: 0,+ format: 0,+ flags: 0,+ };+ unsafe {+ if AndroidBitmap_getInfo(raw_env, raw_bitmap, &mut info) != ANDROID_BITMAP_RESULT_SUCCESS {+ return 0;+ }+ if info.format != ANDROID_BITMAP_FORMAT_RGBA_8888 || info.stride != info.width * 4 {+ return 0;+ }+ let mut addr: *mut c_void = std::ptr::null_mut();+ if AndroidBitmap_lockPixels(raw_env, raw_bitmap, &mut addr) != ANDROID_BITMAP_RESULT_SUCCESS+ {+ return 0;+ }+ addr as jlong+ }+}++#[unsafe(no_mangle)]+pub extern "system" fn Java_dev_davidv_translator_NativeBitmap_unlockPixels(+ env: JNIEnv,+ _class: JClass,+ bitmap: JObject,+) {+ unsafe {+ AndroidBitmap_unlockPixels(env.get_raw(), bitmap.as_raw());+ }+}diff --git a/OCR-translation/src/main/bindings/src/http_server.rs b/OCR-translation/src/main/bindings/src/http_server.rsnew file mode 100644index 0000000..85f8760--- /dev/null+++ b/OCR-translation/src/main/bindings/src/http_server.rs@@ -0,0 +1,65 @@+use std::sync::{Arc, Mutex};++use thiserror::Error;+use translator::TranslatorSession;+use translator::http::{HttpServer, HttpServerConfig, SessionSource};++use crate::uniffi_catalog::CatalogHandle;++/// Hands out the catalog to serve a request with. The app re-opens its+/// catalog after downloads and migrations, so the server asks per request+/// instead of holding the one it was started with.+#[uniffi::export(with_foreign)]+pub trait HttpSessionSource: Send + Sync {+ fn catalog(&self) -> Option<Arc<CatalogHandle>>;+}++struct ForeignSessionSource(Arc<dyn HttpSessionSource>);++impl SessionSource for ForeignSessionSource {+ fn session(&self) -> Option<Arc<TranslatorSession>> {+ self.0.catalog().map(|catalog| catalog.session.clone())+ }+}++#[derive(Debug, Error, uniffi::Error)]+pub enum HttpServerError {+ #[error("{reason}")]+ Start { reason: String },+}++#[derive(uniffi::Object)]+pub struct HttpServerHandle {+ server: Mutex<Option<HttpServer>>,+}++#[uniffi::export]+impl HttpServerHandle {+ /// Closes the socket and waits for in-flight requests to finish. A no-op+ /// after the first call.+ fn stop(&self) {+ let server = self.server.lock().expect("http server lock").take();+ if let Some(server) = server {+ server.stop();+ }+ }+}++#[uniffi::export]+pub fn start_http_server(+ config: HttpServerConfig,+ sessions: Arc<dyn HttpSessionSource>,+) -> Result<Arc<HttpServerHandle>, HttpServerError> {+ crate::init_logging();+ let server = translator::http::start(+ config,+ Arc::new(ForeignSessionSource(sessions)),+ Arc::new(crate::android_font_provider::AndroidFontProvider),+ )+ .map_err(|error| HttpServerError::Start {+ reason: error.to_string(),+ })?;+ Ok(Arc::new(HttpServerHandle {+ server: Mutex::new(Some(server)),+ }))+}diff --git a/OCR-translation/src/main/bindings/src/lib.rs b/OCR-translation/src/main/bindings/src/lib.rsnew file mode 100644index 0000000..24ed0b8--- /dev/null+++ b/OCR-translation/src/main/bindings/src/lib.rs@@ -0,0 +1,45 @@+uniffi::setup_scaffolding!();++pub mod adblock;+pub mod android_font_provider;+pub mod bergamot;+pub mod http_server;+pub mod selection;+pub mod transliterate;+pub mod uniffi_catalog;++#[cfg(all(feature = "planar-tracker", target_os = "android"))]+mod live_pipeline_jni;++#[cfg(target_os = "android")]+mod bitmap_jni;++/// Idempotent logger init. Called from the first uniffi entry point+/// (`CatalogHandle::open`) because uniffi 0.29 for Kotlin loads the+/// .so via JNA, which does *not* invoke `JNI_OnLoad` — so a JNI-style+/// init never fires and `log::set_max_level` stays at its default+/// `Off`, silently dropping every `log::*!` call. Calling it on every+/// constructor invocation is safe (`init_once` is idempotent and skips+/// after the first successful registration).+#[cfg(target_os = "android")]+pub(crate) fn init_logging() {+ // Default Info, but Debug for our own crates. Without the+ // per-target filter, third-party crates like `xml5ever` flood the+ // log at Debug ("got character l" per char) and bury anything+ // useful.+ let filter = android_logger::FilterBuilder::new()+ .parse("info,translator=info,bindings=info")+ .build();+ android_logger::init_once(+ android_logger::Config::default()+ .with_max_level(log::LevelFilter::Info)+ .with_filter(filter)+ .with_tag("rust-bindings"),+ );+ std::panic::set_hook(Box::new(|info| {+ log::error!("rust panic: {info}");+ }));+}++#[cfg(not(target_os = "android"))]+pub(crate) fn init_logging() {}diff --git a/OCR-translation/src/main/bindings/src/live_pipeline_jni.rs b/OCR-translation/src/main/bindings/src/live_pipeline_jni.rsnew file mode 100644index 0000000..470e617--- /dev/null+++ b/OCR-translation/src/main/bindings/src/live_pipeline_jni.rs@@ -0,0 +1,632 @@+//! Single-call JNI fast-path for the live-camera planar OCR pipeline.+//!+//! Per-frame Kotlin calls `LivePipelineJni.processFrameGl(pipelinePtr,+//! rendererPtr, cameraTexId, canonicalW/H, surfaceW/H, uvXform,+//! displayXform, tsNs)` on the GL render thread. The renderer borrows the+//! camera's `GL_TEXTURE_EXTERNAL_OES` (from CameraX `Preview` →+//! `SurfaceTexture`), GPU-renders the canonical luma into a small `Vec<u8>`+//! to feed the tracker, then composites the external camera + overlay+//! straight into the EGL surface. No CPU camera bytes cross the JNI seam;+//! per-frame transfer is one ~650 KB R8 readback instead of a full-res+//! RGBA copy + CPU luma walk.+//!+//! Acquire/refresh path: when the tracker needs full-res RGBA, the shared+//! [`translator::live_gpu_tick::run_tracker_with_acquire`] helper does a+//! one-shot GPU readback inside this same JNI call and feeds the worker.+//!+//! Returns a packed `jlong` carrying tracker state + anchor id + inliers ++//! ok flag so Kotlin doesn't need a follow-up uniffi call for the debug+//! pill update. Detailed async-job telemetry is *not* packed in — Kotlin+//! polls `LivePlanarTracker.lastAcquireTelemetry()` for that.++#![cfg(feature = "planar-tracker")]++use jni::JNIEnv;+use jni::objects::JClass;+use jni::sys::{jint, jlong};++use translator::live_tracker_pipeline::{LiveTrackerPipeline, PlanarTrackerState};++/// Pack the per-frame result into a single `jlong`. Layout (bit 63 →+/// bit 0):+///+/// - 63..62 : state (Idle=0, Acquiring=1, Locked=2, Lost=3)+/// - 61 : composite_ok (1 if a frame was presented)+/// - 60..45 : inliers (16 bits, saturating)+/// - 44..29 : anchor_id low 16 bits — sequential, so the bottom bits+/// are stable across acquires until the engine wraps+/// (would take ~65 k acquires; debug pill loses uniqueness+/// past that but never blocks behavior)+/// - 28 : started_acquire+/// - 27 : started_refresh+/// - 20..0 : scale × 1024, fixed-point (21 bits, saturating) — the+/// tracked plane's magnification vs acquire, used by the+/// camera layer to drive focus distance without AF+/// - 26..21 : reserved (0)+fn pack_result(+ state: PlanarTrackerState,+ anchor_id: u64,+ inliers: u32,+ scale: f32,+ composite_ok: bool,+ started_acquire: bool,+ started_refresh: bool,+) -> jlong {+ let state_bits: u64 = match state {+ PlanarTrackerState::Idle => 0,+ PlanarTrackerState::Acquiring => 1,+ PlanarTrackerState::Locked => 2,+ PlanarTrackerState::Lost => 3,+ };+ let inliers_capped = inliers.min(0xFFFF) as u64;+ let anchor_lo = (anchor_id & 0xFFFF) as u64;+ let scale_fixed = ((scale.max(0.0) * 1024.0).round() as u64).min(0x1F_FFFF);+ let packed: u64 = (state_bits << 62)+ | (if composite_ok { 1u64 << 61 } else { 0 })+ | (inliers_capped << 45)+ | (anchor_lo << 29)+ | (if started_acquire { 1u64 << 28 } else { 0 })+ | (if started_refresh { 1u64 << 27 } else { 0 })+ | scale_fixed;+ packed as jlong+}++// ---------------------------------------------------------------------+// GPU per-frame path. Camera arrives as a GL_TEXTURE_EXTERNAL_OES; all+// three calls MUST run on the GL render thread Kotlin owns, with its EGL+// context current.+// ---------------------------------------------------------------------++#[cfg(feature = "gpu")]+use std::ffi::{CString, c_char, c_void};+#[cfg(feature = "gpu")]+use translator::gl_renderer::{GlesRenderer, PresentContent};+#[cfg(feature = "gpu")]+use translator::live_gpu_tick::{+ frame_from_camera_gray, run_tracker_with_acquire, screen_acquire_frame,+};+#[cfg(feature = "gpu")]+use translator::live_screen::{LiveScreenPipeline, MonitorAction};++#[cfg(feature = "gpu")]+#[link(name = "EGL")]+unsafe extern "C" {+ fn eglGetProcAddress(procname: *const c_char) -> *const c_void;+}++// dlopen/dlsym live in libc on Android; used to resolve core GLES2+// entry points that `eglGetProcAddress` may not (it only guarantees+// EGL/extension functions pre-API-18).+#[cfg(feature = "gpu")]+unsafe extern "C" {+ fn dlopen(filename: *const c_char, flag: i32) -> *mut c_void;+ fn dlsym(handle: *mut c_void, symbol: *const c_char) -> *mut c_void;+}++#[cfg(feature = "gpu")]+const RTLD_NOW: i32 = 2;++#[cfg(feature = "gpu")]+fn gl_proc(libgles: *mut c_void, name: &str) -> *const c_void {+ let Ok(c) = CString::new(name) else {+ return std::ptr::null();+ };+ if !libgles.is_null() {+ let p = unsafe { dlsym(libgles, c.as_ptr()) };+ if !p.is_null() {+ return p as *const c_void;+ }+ }+ unsafe { eglGetProcAddress(c.as_ptr()) }+}++/// Build a `GlesRenderer` on the calling thread. The caller (Kotlin's GL+/// render thread) must have created and made-current a GLES3 context on+/// the SurfaceView's surface first. Returns a raw `*mut GlesRenderer` as+/// a `jlong`, or 0 on failure; release it with [`destroyGlRenderer`] on+/// the same thread.+#[cfg(feature = "gpu")]+#[unsafe(no_mangle)]+pub extern "system" fn Java_dev_davidv_translator_LivePipelineJni_createGlRenderer(+ _env: JNIEnv,+ _class: JClass,+) -> jlong {+ let libgles = {+ // GLES3 first; fall back to GLES2 if libGLESv3.so isn't present+ // (some older devices still ship it as libGLESv2.so only).+ let v3 = CString::new("libGLESv3.so").unwrap();+ let p = unsafe { dlopen(v3.as_ptr(), RTLD_NOW) };+ if !p.is_null() {+ p+ } else {+ let v2 = CString::new("libGLESv2.so").unwrap();+ unsafe { dlopen(v2.as_ptr(), RTLD_NOW) }+ }+ };+ if libgles.is_null() {+ log::warn!("dlopen(libGLESv3/2.so) failed; relying on eglGetProcAddress only");+ }+ match GlesRenderer::new(|name| gl_proc(libgles, name)) {+ Ok(r) => Box::into_raw(Box::new(r)) as jlong,+ Err(e) => {+ log::error!("GlesRenderer::new failed: {e:?}");+ 0+ }+ }+}++#[cfg(feature = "gpu")]+#[unsafe(no_mangle)]+pub extern "system" fn Java_dev_davidv_translator_LivePipelineJni_destroyGlRenderer(+ _env: JNIEnv,+ _class: JClass,+ renderer_ptr: jlong,+) {+ if renderer_ptr != 0 {+ // SAFETY: ptr came from `createGlRenderer`'s `Box::into_raw`,+ // dropped exactly once, on the GL thread that owns the context.+ unsafe { drop(Box::from_raw(renderer_ptr as *mut GlesRenderer)) };+ }+}++/// Switch a renderer to overlay-only present: subsequent `processFrameGl`+/// calls draw only the overlays over a transparent clear, skipping the camera+/// passthrough, for a translucent window floating over live content (the+/// MediaProjection screen-translate overlay). Call once on the GL thread after+/// [`createGlRenderer`]. The tracker gray/RGBA readbacks are unaffected.+#[cfg(feature = "gpu")]+#[unsafe(no_mangle)]+pub extern "system" fn Java_dev_davidv_translator_LivePipelineJni_setRendererOverlayOnly(+ _env: JNIEnv,+ _class: JClass,+ renderer_ptr: jlong,+) {+ if renderer_ptr == 0 {+ return;+ }+ // SAFETY: ptr came from `createGlRenderer`; used only on its owning thread.+ let renderer = unsafe { &mut *(renderer_ptr as *mut GlesRenderer) };+ renderer.set_present_content(PresentContent::OverlayOnly);+}++/// Set the renderer's parametric overlay opacity (0..1). Camera leaves it at+/// the 1.0 default; the screen path sets it to control overlay opacity+/// independently of the touch-capped window alpha. Call on the GL thread.+#[cfg(feature = "gpu")]+#[unsafe(no_mangle)]+pub extern "system" fn Java_dev_davidv_translator_LivePipelineJni_setRendererOverlayAlpha(+ _env: JNIEnv,+ _class: JClass,+ renderer_ptr: jlong,+ alpha: f32,+) {+ if renderer_ptr == 0 {+ return;+ }+ // SAFETY: ptr came from `createGlRenderer`; used only on its owning thread.+ let renderer = unsafe { &mut *(renderer_ptr as *mut GlesRenderer) };+ renderer.set_overlay_alpha(alpha);+}++/// Screen-translate acquire dispatch: GPU-render the two OCR inputs (detector+/// gray at the 32-aligned size, recognition RGBA at half canonical) off the+/// captured external texture, then hand the frame to the background worker —+/// non-blocking. The heavy detect/rec/translate runs off the GL thread; results+/// land in the session and are presented by [`screenPresentOverlayGl`] when+/// [`screenAcquireState`] reports a new overlay version. Returns 1 if dispatched.+#[cfg(feature = "gpu")]+#[unsafe(no_mangle)]+#[allow(clippy::too_many_arguments)]+pub extern "system" fn Java_dev_davidv_translator_LivePipelineJni_screenDispatchAcquire(+ env: JNIEnv,+ _class: JClass,+ pipeline_ptr: jlong,+ renderer_ptr: jlong,+ camera_tex_id: jint,+ canonical_w: jint,+ canonical_h: jint,+ surface_w: jint,+ surface_h: jint,+ uv_xform: jni::objects::JFloatArray,+) -> jint {+ if pipeline_ptr == 0+ || renderer_ptr == 0+ || camera_tex_id <= 0+ || canonical_w <= 0+ || canonical_h <= 0+ || surface_w <= 0+ || surface_h <= 0+ {+ return 0;+ }+ // SAFETY: ptr from `LiveScreenTracker::raw_address_for_jni`; Kotlin holds the+ // Arc across the call. Renderer used only on its owning (GL) thread.+ let pipeline = unsafe { &*(pipeline_ptr as *const LiveScreenPipeline) };+ let renderer = unsafe { &mut *(renderer_ptr as *mut GlesRenderer) };++ // The worker is still draining a prior (likely just-aborted) job — skip the+ // readback entirely and let the monitor retry next tick (it stays Settling).+ if pipeline.acquire_busy() {+ return 0;+ }+ let mut uv = [0f32; 9];+ if env.get_float_array_region(&uv_xform, 0, &mut uv).is_err() {+ return 0;+ }+ let cw = canonical_w as u32;+ let ch = canonical_h as u32;+ let canonical_long = cw.max(ch).max(1) as f32;+ let surface_long = surface_w.max(surface_h).max(1) as f32;+ // Set before dispatch: the worker bakes this oversample into the rendered+ // canvas (overlays authored in canonical coords, presented at full res).+ pipeline.set_overlay_oversample(surface_long / canonical_long);++ let Some(frame) = screen_acquire_frame(+ renderer,+ camera_tex_id as u32,+ cw,+ ch,+ uv,+ pipeline.det_max_pixels(),+ pipeline.region(),+ ) else {+ return 0;+ };+ if pipeline.dispatch_acquire(frame) {+ 1+ } else {+ 0+ }+}++/// Present the screen pipeline's resident overlay canvas straight into the bound+/// EGL window surface (the overlay `TextureView`): render it first if a deferred+/// upsert left it stale, then upload it to a texture and draw one premultiplied+/// quad — no Bitmap, no CPU readback. The caller (the GL worker) must have made+/// the window surface current; it swaps after. `canonical_*` is the OCR frame+/// size the overlay origin is in, `surface_*` the display/window size. Returns 1+/// if a frame was drawn, 0 when there's nothing to show.+#[cfg(feature = "gpu")]+#[unsafe(no_mangle)]+pub extern "system" fn Java_dev_davidv_translator_LivePipelineJni_screenPresentOverlayGl(+ _env: JNIEnv,+ _class: JClass,+ pipeline_ptr: jlong,+ renderer_ptr: jlong,+ canonical_w: jint,+ canonical_h: jint,+ surface_w: jint,+ surface_h: jint,+) -> jint {+ if pipeline_ptr == 0+ || renderer_ptr == 0+ || canonical_w <= 0+ || canonical_h <= 0+ || surface_w <= 0+ || surface_h <= 0+ {+ return 0;+ }+ // SAFETY: see `screenDispatchAcquire` — same ownership contract; the renderer+ // is used only on its owning (GL) thread.+ let pipeline = unsafe { &*(pipeline_ptr as *const LiveScreenPipeline) };+ let renderer = unsafe { &mut *(renderer_ptr as *mut GlesRenderer) };+ // Build the GPU draw list (pills + per-glyph instance data), bake it into the+ // overlay texture on the GPU (rounded pills opaque, then glyph quads), and present+ // that texture into the window surface — no CPU canvas raster. Screen pills+ // are opaque (the window alpha dims them) and text is opaque.+ //+ // Phase timing: `dl` = collect_overlay_glyphs (CPU text shaping + glyph mask+ // collection); `bake` = atlas upload + two-pass GPU composite; `present` = window blit.+ let t_dl = std::time::Instant::now();+ let Some(dl) = pipeline.overlay_draw_list() else {+ return 0;+ };+ let dl_ms = t_dl.elapsed().as_secs_f64() * 1000.0;+ let (n_pills, n_glyphs) = (dl.pills.len(), dl.glyphs.instances.len());+ let t_bake = std::time::Instant::now();+ // Punch the pinhole hole grid so the captured mirror exposes screen_est under+ // the pills for the v2 under-pill change detector. The hole's baked alpha is+ // sized against the effective opaque alpha (pill_alpha × window alpha).+ let (hole_radius, hole_alpha) = pipeline.hole_params(SCREEN_PILL_ALPHA * SCREEN_WINDOW_ALPHA);+ let holes = translator::gl_renderer::HoleGrid {+ spacing: pipeline.lattice_spacing(),+ radius: hole_radius,+ alpha: hole_alpha,+ };+ if !renderer.render_overlay_to_texture(+ &dl,+ SCREEN_PILL_ALPHA,+ SCREEN_TEXT_ALPHA,+ false,+ Some(holes),+ ) {+ return 0;+ }+ let bake_ms = t_bake.elapsed().as_secs_f64() * 1000.0;+ let t_present = std::time::Instant::now();+ let drawn = renderer.present_screen_overlay_fbo(+ canonical_w as u32,+ canonical_h as u32,+ surface_w as u32,+ surface_h as u32,+ );+ let present_ms = t_present.elapsed().as_secs_f64() * 1000.0;+ log::info!(+ "[screen-present] dl={dl_ms:.1}ms({n_pills}p/{n_glyphs}g) bake={bake_ms:.1} present={present_ms:.1}"+ );+ if drawn { 1 } else { 0 }+}++/// Screen overlay opacities baked into the overlay texture. Pills opaque (the+/// touch-capped window alpha does the dimming); text opaque for crispness.+#[cfg(feature = "gpu")]+const SCREEN_PILL_ALPHA: f32 = 1.0;+#[cfg(feature = "gpu")]+const SCREEN_TEXT_ALPHA: f32 = 1.0;+/// The overlay window's View alpha (touch-passthrough dimming). Must match+/// `ScreenTranslateService.WINDOW_ALPHA`; used to size the pinhole hole alpha so+/// the captured blend at a hole lands at the recovery's fixed fraction.+#[cfg(feature = "gpu")]+const SCREEN_WINDOW_ALPHA: f32 = 0.79;++/// Acquire state for the GL worker's poll loop: `(busy << 32) | overlay_version`.+/// `busy` = an acquire is in flight; `overlay_version` bumps each time the worker+/// upserts overlays (provisional, then full) so the worker knows to re-present.+#[cfg(feature = "gpu")]+#[unsafe(no_mangle)]+pub extern "system" fn Java_dev_davidv_translator_LivePipelineJni_screenAcquireState(+ _env: JNIEnv,+ _class: JClass,+ pipeline_ptr: jlong,+) -> jlong {+ if pipeline_ptr == 0 {+ return 0;+ }+ // SAFETY: see `screenDispatchAcquire`.+ let pipeline = unsafe { &*(pipeline_ptr as *const LiveScreenPipeline) };+ let busy = if pipeline.acquire_busy() { 1u64 } else { 0 };+ let version = pipeline.overlay_version() & 0xFFFF_FFFF;+ ((busy << 32) | version) as jlong+}++/// Abort an in-flight screen acquire (the screen moved): bumps the generation so+/// the worker bails at the next rec batch.+#[cfg(feature = "gpu")]+#[unsafe(no_mangle)]+pub extern "system" fn Java_dev_davidv_translator_LivePipelineJni_screenAbortAcquire(+ _env: JNIEnv,+ _class: JClass,+ pipeline_ptr: jlong,+) {+ if pipeline_ptr == 0 {+ return;+ }+ // SAFETY: see `screenDispatchAcquire`.+ let pipeline = unsafe { &*(pipeline_ptr as *const LiveScreenPipeline) };+ pipeline.abort_acquire();+}++/// Pack a [`MonitorAction`] + `wants_tick` into a jint for the GL worker:+/// bits 0-1 = action (None=0, Hide=1, Acquire=2), bit 8 = wants_tick.+#[cfg(feature = "gpu")]+fn pack_monitor(action: MonitorAction, wants_tick: bool) -> jint {+ let a = match action {+ MonitorAction::None => 0,+ MonitorAction::Hide => 1,+ MonitorAction::Acquire => 2,+ };+ let tick = if wants_tick { 1 << 8 } else { 0 };+ a | tick+}++/// Screen-translate change detection: GPU-read a coarse gray off the captured+/// external texture and feed it to the [`LiveScreenPipeline`] monitor, which+/// decides whether the screen moved (hide), settled (acquire), or is unchanged.+/// Returns the packed action + `wants_tick` (see [`pack_monitor`]). No overlay+/// readback — the heavy detect/rec only runs on the worker's follow-up+/// the worker (`screenDispatchAcquire`) once an `Acquire` is decided.+#[cfg(feature = "gpu")]+#[unsafe(no_mangle)]+#[allow(clippy::too_many_arguments)]+pub extern "system" fn Java_dev_davidv_translator_LivePipelineJni_screenMonitorFrameGl(+ env: JNIEnv,+ _class: JClass,+ pipeline_ptr: jlong,+ renderer_ptr: jlong,+ camera_tex_id: jint,+ canonical_w: jint,+ canonical_h: jint,+ uv_xform: jni::objects::JFloatArray,+ now_ns: jlong,+) -> jint {+ if pipeline_ptr == 0+ || renderer_ptr == 0+ || camera_tex_id <= 0+ || canonical_w <= 0+ || canonical_h <= 0+ {+ return 0;+ }+ // SAFETY: see `screenDispatchAcquire` — same ownership contract.+ let pipeline = unsafe { &*(pipeline_ptr as *const LiveScreenPipeline) };+ let renderer = unsafe { &mut *(renderer_ptr as *mut GlesRenderer) };++ let mut uv = [0f32; 9];+ if env.get_float_array_region(&uv_xform, 0, &mut uv).is_err() {+ return 0;+ }+ let cw = canonical_w as u32;+ let ch = canonical_h as u32;+ // v2 per-box detector is the sole authority for the screen path: recover+ // screen_est through the pinhole holes and let the monitor decide. It ignores+ // background motion (text-stable → None), drops + re-acquires a box whose text+ // changed (→ Acquire), and clears + re-acquires on a whole-screen change /+ // navigation (→ Hide, then a settle-delayed Acquire). No coarse global diff, so+ // a video in one region no longer tears the whole overlay down.+ let (cols, rows) = pipeline.lattice_dims(cw, ch);+ let pills = pipeline.monitor_pill_aabbs();+ let (pill_luma, screen_frac) = pipeline.recovery_params();+ let spacing = pipeline.lattice_spacing();+ renderer.set_camera_external(camera_tex_id as u32, uv);+ let action = renderer+ .read_lattice_screen_est(cols, rows, cw, ch, spacing, &pills, pill_luma, screen_frac)+ .map(|samples| pipeline.monitor_screen_v2(&samples, cw, ch, now_ns))+ .unwrap_or(MonitorAction::None);+ pack_monitor(action, pipeline.wants_tick())+}++/// Timed tick for the screen monitor (no new frame): fires a pending settle so+/// the screen settles even when the mirror stops emitting frames. Returns the+/// packed action + `wants_tick`.+#[cfg(feature = "gpu")]+#[unsafe(no_mangle)]+pub extern "system" fn Java_dev_davidv_translator_LivePipelineJni_screenMonitorTick(+ _env: JNIEnv,+ _class: JClass,+ pipeline_ptr: jlong,+ now_ns: jlong,+) -> jint {+ if pipeline_ptr == 0 {+ return 0;+ }+ // SAFETY: see `screenDispatchAcquire`.+ let pipeline = unsafe { &*(pipeline_ptr as *const LiveScreenPipeline) };+ let action = pipeline.monitor_screen_v2_tick(now_ns);+ pack_monitor(action, pipeline.wants_tick())+}++/// DEBUG: read back the canonical RGBA frame (top-down) for on-device+/// inspection of orientation / mirror / text size. Returns an empty array on+/// failure. Must run on the GL thread after a `processFrameGl` so the external+/// source + uv transform are set on the renderer.+#[cfg(feature = "gpu")]+#[unsafe(no_mangle)]+pub extern "system" fn Java_dev_davidv_translator_LivePipelineJni_debugReadCanonicalRgba<'local>(+ env: JNIEnv<'local>,+ _class: JClass<'local>,+ renderer_ptr: jlong,+ canonical_w: jint,+ canonical_h: jint,+ display_xform: jni::objects::JFloatArray<'local>,+) -> jni::objects::JByteArray<'local> {+ if renderer_ptr == 0 || canonical_w <= 0 || canonical_h <= 0 {+ return env.new_byte_array(0).unwrap_or_default();+ }+ // SAFETY: ptr came from `createGlRenderer`; used only on its owning thread.+ let renderer = unsafe { &mut *(renderer_ptr as *mut GlesRenderer) };+ let mut dx = [0f32; 9];+ if env+ .get_float_array_region(&display_xform, 0, &mut dx)+ .is_err()+ {+ return env.new_byte_array(0).unwrap_or_default();+ }+ let Some(rgba) = renderer.read_camera_rgba(canonical_w as u32, canonical_h as u32, &dx) else {+ return env.new_byte_array(0).unwrap_or_default();+ };+ let Ok(arr) = env.new_byte_array(rgba.len() as i32) else {+ return env.new_byte_array(0).unwrap_or_default();+ };+ let signed: &[i8] =+ unsafe { std::slice::from_raw_parts(rgba.as_ptr() as *const i8, rgba.len()) };+ let _ = env.set_byte_array_region(&arr, 0, signed);+ arr+}++/// Per-frame GPU path: borrow the camera's external-OES texture, GPU-render+/// canonical luma into a small `Vec<u8>` for the tracker, then composite+/// the camera + overlay into the EGL surface (FBO 0, sized+/// `surface_w*surface_h`). On acquire/refresh, reads back full-res RGBA+/// from the same texture and feeds the worker. Caller (Kotlin GL thread)+/// follows with `eglSwapBuffers`.+///+/// Returns the packed result `jlong` (`composite_ok` reflects that a frame+/// was drawn; 0 means the texture wasn't ready or process_frame failed).+#[cfg(feature = "gpu")]+#[unsafe(no_mangle)]+#[allow(clippy::too_many_arguments)]+pub extern "system" fn Java_dev_davidv_translator_LivePipelineJni_processFrameGl(+ env: JNIEnv,+ _class: JClass,+ pipeline_ptr: jlong,+ renderer_ptr: jlong,+ camera_tex_id: jint,+ canonical_w: jint,+ canonical_h: jint,+ surface_w: jint,+ surface_h: jint,+ uv_xform: jni::objects::JFloatArray,+ display_xform: jni::objects::JFloatArray,+ timestamp_ns: jlong,+) -> jlong {+ if pipeline_ptr == 0+ || renderer_ptr == 0+ || camera_tex_id <= 0+ || canonical_w <= 0+ || canonical_h <= 0+ || surface_w <= 0+ || surface_h <= 0+ {+ return 0;+ }+ // SAFETY: Kotlin holds the wrapper Arc alive across the call; the+ // renderer ptr came from `createGlRenderer` and is used only on this+ // (its owning) thread.+ let pipeline = unsafe { &*(pipeline_ptr as *const LiveTrackerPipeline) };+ let renderer = unsafe { &mut *(renderer_ptr as *mut GlesRenderer) };++ let mut uv = [0f32; 9];+ let mut dx = [0f32; 9];+ if env.get_float_array_region(&uv_xform, 0, &mut uv).is_err()+ || env+ .get_float_array_region(&display_xform, 0, &mut dx)+ .is_err()+ {+ log::warn!("processFrameGl: bad xform array");+ return 0;+ }++ let cw = canonical_w as u32;+ let ch = canonical_h as u32;++ // Overlay glyphs rasterize at half the display footprint: the canonical+ // frame (tracker + OCR) stays cheap while the overlay renders near+ // display res, with the composite warp absorbing the residual ~2x.+ let canonical_long = cw.max(ch).max(1) as f32;+ let surface_long = surface_w.max(surface_h).max(1) as f32;+ pipeline.set_overlay_oversample(0.5 * surface_long / canonical_long);++ let Some(frame) = frame_from_camera_gray(renderer, camera_tex_id as u32, cw, ch, uv, dx) else {+ return 0;+ };++ // run_tracker_with_acquire presents on the GPU (it binds the window surface+ // itself), so no pre-bind here — read_camera_gray's R8 FBO is left bound and the+ // present re-targets FBO 0.+ match run_tracker_with_acquire(+ pipeline,+ renderer,+ &frame,+ cw,+ ch,+ surface_w as u32,+ surface_h as u32,+ dx,+ timestamp_ns as u64,+ ) {+ Ok(r) => pack_result(+ r.state,+ r.anchor_id,+ r.inliers,+ r.scale,+ r.composite_bytes > 0,+ r.started_acquire,+ r.started_refresh,+ ),+ Err(e) => {+ log::warn!("process_frame_gl failed: {e:?}");+ 0+ }+ }+}diff --git a/OCR-translation/src/main/bindings/src/selection.rs b/OCR-translation/src/main/bindings/src/selection.rsnew file mode 100644index 0000000..9eb20e3--- /dev/null+++ b/OCR-translation/src/main/bindings/src/selection.rs@@ -0,0 +1,35 @@+//! On-image word selection. The geometry, the covered range, the highlight shapes and the+//! copied text all live in translator-rs so this app and the Qt one behave identically; these+//! are plain pass-throughs taking image-pixel coordinates.++use translator::ocr::PositionedWord;+use translator::selection::{self, SelectionView, WritingAxis};++#[uniffi::export]+pub fn selection_word_at(words: Vec<PositionedWord>, x: f32, y: f32) -> Option<u32> {+ selection::hit_test_word(&words, x, y)+}++#[uniffi::export]+pub fn selection_nearest_word(+ words: Vec<PositionedWord>,+ x: f32,+ y: f32,+ axis: Option<WritingAxis>,+) -> Option<u32> {+ selection::nearest_word(&words, x, y, axis)+}++#[uniffi::export]+pub fn selection_word_axis(words: Vec<PositionedWord>, index: u32) -> Option<WritingAxis> {+ selection::word_axis(&words, index)+}++#[uniffi::export]+pub fn selection_resolve(+ words: Vec<PositionedWord>,+ start: u32,+ end: u32,+) -> Option<SelectionView> {+ selection::resolve_selection(&words, start, end)+}diff --git a/OCR-translation/src/main/bindings/src/transliterate.rs b/OCR-translation/src/main/bindings/src/transliterate.rsnew file mode 100644index 0000000..d4d549e--- /dev/null+++ b/OCR-translation/src/main/bindings/src/transliterate.rs@@ -0,0 +1,30 @@+#[uniffi::export]+pub fn transliterate_with_policy_record(+ text: String,+ language_code: String,+ writing_system: translator::script::WritingSystem,+ japanese_dict_path: Option<String>,+ japanese_spaced: bool,+) -> Option<String> {+ #[cfg(feature = "transliterate")]+ {+ translator::transliterate::transliterate_with_policy_for_language(+ &text,+ &translator::LanguageCode::from(language_code),+ writing_system,+ japanese_dict_path.as_deref(),+ japanese_spaced,+ )+ }+ #[cfg(not(feature = "transliterate"))]+ {+ let _ = (+ text,+ language_code,+ writing_system,+ japanese_dict_path,+ japanese_spaced,+ );+ None+ }+}diff --git a/OCR-translation/src/main/bindings/src/uniffi_catalog.rs b/OCR-translation/src/main/bindings/src/uniffi_catalog.rsnew file mode 100644index 0000000..e91ce04--- /dev/null+++ b/OCR-translation/src/main/bindings/src/uniffi_catalog.rs@@ -0,0 +1,1344 @@+use std::num::NonZeroU32;+use std::sync::Arc;++/// Master toggle for per-frame outer timing logs emitted to logcat+/// target `planar_timing` from the JNI per-frame fast path. Pair with+/// `translator::planar_tracker::PER_FRAME_TIMING_LOG` (separate+/// crate) to silence the corresponding `guided: ...` / `brute: ...`+/// lines.+#[allow(dead_code)]+#[cfg(feature = "planar-tracker")]+pub(crate) const PER_FRAME_TIMING_LOG: bool = false;++use thiserror::Error;+use translator::{+ CatalogSnapshot, Feature, FsPackInstallChecker, TranslatorError, TranslatorErrorKind,+ TranslatorSession, language_rows_in_snapshot,+};++#[derive(Debug, Error, uniffi::Error)]+pub enum CatalogOpenError {+ #[error("failed to parse any catalog")]+ ParseFailed,+}++#[derive(Debug, Error, uniffi::Error)]+pub enum CatalogError {+ #[error("{reason}")]+ MissingAsset { reason: String },+ #[error("{reason}")]+ Other { reason: String },+ /// User-initiated cancel. The Kotlin side should treat this as a+ /// silent stop, not as a translation failure.+ #[error("cancelled")]+ Cancelled,+}++impl From<TranslatorError> for CatalogError {+ fn from(err: TranslatorError) -> Self {+ match err.kind {+ TranslatorErrorKind::MissingAsset => Self::MissingAsset {+ reason: err.message,+ },+ _ => Self::Other {+ reason: err.message,+ },+ }+ }+}++#[derive(Debug, Clone, uniffi::Enum)]+pub enum DocumentProgressEvent {+ Preparing,+ /// PDF-only: emitted once after inventory, before any pass starts.+ /// Lets the UI render three labelled progress lines (text / images /+ /// raster pages) with their image/raster totals up-front, instead of+ /// one bar that resets when each phase ends. The text bar is driven by+ /// `TranslatingText`, the image bar by `TranslatingImages`, the raster+ /// bar by `TranslatingRasterPages`.+ /// `raster_pages` is an upper bound; the raster pass refines it once the+ /// image pass has narrowed the actual set, by reporting the smaller+ /// `total` in its ticks.+ PdfPlan {+ text_pages: u32,+ image_xobjects: u32,+ raster_pages: u32,+ },+ /// Text-translation progress as a smooth completion fraction in+ /// `[0.0, 1.0]` (source-length weighted). Used for every text path+ /// (txt/odt/epub and the PDF text pass) — the per-paragraph/page counts it+ /// replaced were interpolated estimates, not real positions, so a fraction+ /// is the honest representation.+ TranslatingText { fraction: f32 },+ /// Image-XObject OCR+translation pass: real, in-order item counts.+ TranslatingImages { current: u32, total: u32 },+ /// Page-raster overlay OCR+translation pass: real, in-order item counts.+ TranslatingRasterPages { current: u32, total: u32 },+ Writing,+}++/// Caller-chosen layout for `.txt` translation. `wrap` of `0` (or absent)+/// means "do not re-wrap"; any positive value is the output column width.+/// Ignored for non-txt documents.+#[derive(Debug, Clone, uniffi::Enum)]+pub enum TxtLayout {+ Preserve,+ Reflow { wrap: Option<u32> },+}++impl From<TxtLayout> for translator::txt::TxtLayout {+ fn from(value: TxtLayout) -> Self {+ match value {+ TxtLayout::Preserve => Self::Preserve,+ TxtLayout::Reflow { wrap } => Self::Reflow {+ wrap: wrap.and_then(NonZeroU32::new),+ },+ }+ }+}++#[uniffi::export(with_foreign)]+pub trait DocumentProgressSink: Send + Sync {+ fn on_progress(&self, event: DocumentProgressEvent);+ fn is_cancelled(&self) -> bool;+}++#[derive(Debug, Clone, PartialEq, Eq, uniffi::Record)]+pub struct DictionaryGlossRecord {+ pub gloss_lines: Vec<String>,+}++#[derive(Debug, Clone, PartialEq, Eq, uniffi::Record)]+pub struct DictionarySenseRecord {+ pub pos: String,+ pub glosses: Vec<DictionaryGlossRecord>,+}++#[derive(Debug, Clone, PartialEq, Eq, uniffi::Record)]+pub struct DictionaryWordEntryRecord {+ pub senses: Vec<DictionarySenseRecord>,+}++#[derive(Debug, Clone, PartialEq, Eq, uniffi::Record)]+pub struct DictionaryWordRecord {+ pub word: String,+ pub tag: i32,+ pub entries: Vec<DictionaryWordEntryRecord>,+ pub sounds: Option<String>,+ pub hyphenations: Vec<String>,+ pub redirects: Vec<String>,+}++#[derive(Debug, Clone, PartialEq, Eq, uniffi::Record)]+pub struct CatalogFileRecord {+ pub name: String,+ pub size_bytes: u64,+ pub install_path: String,+ pub url: String,+}++impl From<translator::catalog::AssetFileV2> for CatalogFileRecord {+ fn from(file: translator::catalog::AssetFileV2) -> Self {+ Self {+ name: file.name,+ size_bytes: file.size_bytes,+ install_path: file.install_path,+ url: file.url,+ }+ }+}++/// One on-device ONNX→MNN migration step. Paths are relative to the catalog's+/// `base_dir` (the same one passed to `CatalogHandle.open`). When `needs_convert`+/// is false the `.mnn` already exists and only the stray `.onnx` needs dropping.+/// The actual conversion runs in the separate converter native lib; deletion ++/// snapshot refresh go through `discard_migration`.+#[derive(Debug, Clone, PartialEq, Eq, uniffi::Record)]+pub struct MigrationJobRecord {+ pub onnx_path: String,+ pub mnn_path: String,+ pub quant_bits: i32,+ pub onnx_bytes: u64,+ pub mnn_bytes: u64,+ pub feature: String,+ pub needs_convert: bool,+}++impl From<translator::catalog::MigrationJob> for MigrationJobRecord {+ fn from(job: translator::catalog::MigrationJob) -> Self {+ Self {+ onnx_path: job.entry.onnx,+ mnn_path: job.entry.mnn,+ quant_bits: job.entry.quant_bits,+ onnx_bytes: job.entry.onnx_bytes,+ mnn_bytes: job.entry.mnn_bytes,+ feature: job.entry.feature,+ needs_convert: matches!(job.action, translator::catalog::MigrationAction::Convert),+ }+ }+}++impl From<MigrationJobRecord> for translator::catalog::MigrationJob {+ fn from(record: MigrationJobRecord) -> Self {+ translator::catalog::MigrationJob {+ entry: translator::catalog::MigrationEntry {+ onnx: record.onnx_path,+ mnn: record.mnn_path,+ quant_bits: record.quant_bits,+ onnx_bytes: record.onnx_bytes,+ mnn_bytes: record.mnn_bytes,+ feature: record.feature,+ },+ action: if record.needs_convert {+ translator::catalog::MigrationAction::Convert+ } else {+ translator::catalog::MigrationAction::CleanupOnly+ },+ }+ }+}++#[cfg(feature = "dictionary")]+fn map_dictionary_word(word: translator::tarkka::WordWithTaggedEntries) -> DictionaryWordRecord {+ DictionaryWordRecord {+ word: word.word,+ tag: word.tag as i32,+ entries: word+ .entries+ .into_iter()+ .map(|entry| DictionaryWordEntryRecord {+ senses: entry+ .senses+ .into_iter()+ .map(|sense| DictionarySenseRecord {+ pos: sense.pos.to_string(),+ glosses: sense+ .glosses+ .into_iter()+ .map(|gloss| DictionaryGlossRecord {+ gloss_lines: gloss.gloss_lines,+ })+ .collect(),+ })+ .collect(),+ })+ .collect(),+ sounds: word.sounds,+ hyphenations: word.hyphenations,+ redirects: word.redirects,+ }+}+++/// Rasterize the translated overlay onto `prepared`. Returns the new RGBA+/// buffer (same dimensions as `prepared.width` x `prepared.height`).+///+/// `language` is a BCP-47 hint for font selection (CJK regional variants);+/// `min_font_size_px` floors the fit-loop's shrink (caller should pass the+/// equivalent of the old Kotlin `minTextSize`, typically 8.0).+#[cfg(feature = "image-render")]+#[uniffi::export]+fn render_translated_overlay(+ prepared: translator::PreparedImageOverlay,+ language: String,+ min_font_size_px: f32,+) -> Result<translator::image_render::RenderedOverlay, CatalogError> {+ use translator::image_render::{RenderOptions, render_overlay};+ let opts = RenderOptions {+ language,+ min_font_size_px,+ };+ let provider = crate::android_font_provider::AndroidFontProvider;+ render_overlay(&prepared, &provider, &opts).map_err(|e| CatalogError::Other {+ reason: e.to_string(),+ })+}++#[derive(uniffi::Record)]+pub struct RetranslateResult {+ pub plan: translator::PreparedImageOverlay,+ pub words: Vec<translator::ocr::PositionedWord>,+}++/// Owns a copy of a still image's pixels rust-side so detection, OCR, and overlay rendering+/// run as separate FFI calls without re-marshalling the (multi-MB) image between them. The+/// source pixels are read-only after construction; `render_into` composes the translated+/// overlay into a *caller-provided* buffer, leaving the source intact (re-renderable).+#[derive(uniffi::Object)]+pub struct OcrImage {+ source: Vec<u8>,+ width: u32,+ height: u32,+ // Display-orient RGB + detector downscale, built once and shared by `detect` + `ocr` so the+ // staged pass doesn't rebuild it (`None` until the first detect/ocr).+ #[cfg(feature = "ppocr")]+ still: std::sync::Mutex<Option<Arc<translator::live_frame::StillImage>>>,+ // Erased background produced by `ocr`, kept rust-side so `render_into` draws onto it+ // without the erased image crossing the FFI boundary.+ erased: std::sync::Mutex<Option<Vec<u8>>>,+}++impl OcrImage {+ #[cfg(feature = "ppocr")]+ fn ensure_still(+ &self,+ catalog: &CatalogHandle,+ max_image_size: u32,+ ) -> Result<Arc<translator::live_frame::StillImage>, CatalogError> {+ let mut guard = self.still.lock().expect("ocr image still lock");+ if let Some(still) = guard.as_ref() {+ return Ok(still.clone());+ }+ let still = Arc::new(+ catalog+ .session+ .build_still_image(&self.source, self.width, self.height, max_image_size)+ .map_err(CatalogError::from)?,+ );+ *guard = Some(still.clone());+ Ok(still)+ }+}++#[uniffi::export]+impl OcrImage {+ /// Copy the pixels at `pixels_addr` (a locked `ARGB_8888` bitmap, `width*height*4` bytes,+ /// from [`NativeBitmap.lockPixels`]) into an owned buffer. The caller may unlock immediately.+ #[uniffi::constructor]+ fn from_pixels(pixels_addr: u64, width: u32, height: u32) -> Arc<Self> {+ let len = (width as usize) * (height as usize) * 4;+ let source = unsafe { std::slice::from_raw_parts(pixels_addr as *const u8, len) }.to_vec();+ Arc::new(OcrImage {+ source,+ width,+ height,+ #[cfg(feature = "ppocr")]+ still: std::sync::Mutex::new(None),+ erased: std::sync::Mutex::new(None),+ })+ }++ #[cfg(feature = "ppocr")]+ fn detect(+ &self,+ catalog: Arc<CatalogHandle>,+ max_image_size: u32,+ ) -> Result<Vec<translator::DetectedTextBox>, CatalogError> {+ let still = self.ensure_still(&catalog, max_image_size)?;+ catalog+ .session+ .detect_boxes_from_still(&still, self.width, self.height)+ .map_err(CatalogError::from)+ }++ #[cfg(feature = "ppocr")]+ #[allow(clippy::too_many_arguments)]+ fn ocr(+ &self,+ catalog: Arc<CatalogHandle>,+ max_image_size: u32,+ source_selection: translator::OcrSourceSelection,+ target_code: String,+ min_confidence: u32,+ reading_order: Option<translator::ReadingOrder>,+ background_mode: translator::BackgroundMode,+ detection: Option<Vec<translator::DetectedTextBox>>,+ ) -> Result<translator::PreparedImageOverlay, CatalogError> {+ let still = self.ensure_still(&catalog, max_image_size)?;+ let mut overlay = catalog+ .session+ .translate_from_still(+ &still,+ &self.source,+ self.width,+ self.height,+ source_selection,+ &target_code,+ min_confidence,+ reading_order,+ background_mode,+ detection,+ )+ .map_err(CatalogError::from)?;+ // Stash the erased background (move, no clone) and hand back metadata only.+ *self.erased.lock().expect("ocr image erased lock") =+ Some(std::mem::take(&mut overlay.rgba_bytes));+ Ok(overlay)+ }++ #[cfg(feature = "image-render")]+ fn render_into(+ &self,+ plan: translator::PreparedImageOverlay,+ language: String,+ min_font_size_px: f32,+ dst_addr: u64,+ ) -> Result<Vec<translator::ocr::PositionedWord>, CatalogError> {+ use translator::image_render::{RenderOptions, render_overlay};+ let erased = self+ .erased+ .lock()+ .expect("ocr image erased lock")+ .clone()+ .ok_or_else(|| CatalogError::Other {+ reason: "render_into called before ocr".to_string(),+ })?;+ let mut prepared = plan;+ prepared.rgba_bytes = erased;+ let opts = RenderOptions {+ language,+ min_font_size_px,+ };+ let provider = crate::android_font_provider::AndroidFontProvider;+ let rendered = render_overlay(&prepared, &provider, &opts).map_err(|e| {+ CatalogError::Other {+ reason: e.to_string(),+ }+ })?;+ let len = (self.width as usize) * (self.height as usize) * 4;+ let dst = unsafe { std::slice::from_raw_parts_mut(dst_addr as *mut u8, len) };+ dst.copy_from_slice(&rendered.rgba_bytes);+ Ok(rendered.translated_words)+ }++ /// Re-translate the cached OCR result to a new language and compose it into `dst`, reusing+ /// the cached erased background — no re-OCR, and the erased image never crosses the FFI.+ #[cfg(feature = "image-render")]+ fn retranslate_into(+ &self,+ catalog: Arc<CatalogHandle>,+ plan: translator::PreparedImageOverlay,+ source_code: String,+ target_code: String,+ min_font_size_px: f32,+ dst_addr: u64,+ ) -> Result<RetranslateResult, CatalogError> {+ use translator::image_render::{RenderOptions, render_overlay};+ let erased = self+ .erased+ .lock()+ .expect("ocr image erased lock")+ .clone()+ .ok_or_else(|| CatalogError::Other {+ reason: "retranslate_into called before ocr".to_string(),+ })?;+ let mut prepared = plan;+ prepared.rgba_bytes = erased;+ let mut retranslated = catalog+ .session+ .retranslate_prepared_overlay(prepared, &source_code, &target_code)+ .map_err(CatalogError::from)?;+ let opts = RenderOptions {+ language: target_code,+ min_font_size_px,+ };+ let provider = crate::android_font_provider::AndroidFontProvider;+ let rendered = render_overlay(&retranslated, &provider, &opts).map_err(|e| {+ CatalogError::Other {+ reason: e.to_string(),+ }+ })?;+ let len = (self.width as usize) * (self.height as usize) * 4;+ let dst = unsafe { std::slice::from_raw_parts_mut(dst_addr as *mut u8, len) };+ dst.copy_from_slice(&rendered.rgba_bytes);+ retranslated.rgba_bytes = Vec::new();+ Ok(RetranslateResult {+ plan: retranslated,+ words: rendered.translated_words,+ })+ }+}++impl From<translator::document::DocumentProgress> for DocumentProgressEvent {+ fn from(progress: translator::document::DocumentProgress) -> Self {+ use translator::document::DocumentProgress as P;+ match progress {+ P::Preparing => Self::Preparing,+ P::PdfPlan {+ text_pages,+ image_xobjects,+ raster_pages,+ } => Self::PdfPlan {+ text_pages,+ image_xobjects,+ raster_pages,+ },+ P::TranslatingText { fraction } => Self::TranslatingText { fraction },+ P::TranslatingImages { current, total } => Self::TranslatingImages { current, total },+ P::TranslatingRasterPages { current, total } => {+ Self::TranslatingRasterPages { current, total }+ }+ P::Writing => Self::Writing,+ }+ }+}++impl From<translator::document::DocumentError> for CatalogError {+ fn from(error: translator::document::DocumentError) -> Self {+ match error {+ translator::document::DocumentError::Cancelled => Self::Cancelled,+ translator::document::DocumentError::Other(reason) => Self::Other { reason },+ }+ }+}++#[derive(uniffi::Object)]+pub struct CatalogHandle {+ pub(crate) session: Arc<TranslatorSession>,+}++impl CatalogHandle {+ fn snapshot(&self) -> Arc<CatalogSnapshot> {+ self.session.snapshot()+ }+}++#[uniffi::export]+impl CatalogHandle {+ #[uniffi::constructor]+ fn open(+ bundled_json: String,+ disk_json: Option<String>,+ base_dir: String,+ ) -> Result<Arc<Self>, CatalogOpenError> {+ crate::init_logging();+ let checker = FsPackInstallChecker::new(&base_dir);+ let session =+ TranslatorSession::open(&bundled_json, disk_json.as_deref(), base_dir, &checker)+ .map_err(|_| CatalogOpenError::ParseFailed)?;+ Ok(Arc::new(CatalogHandle {+ session: Arc::new(session),+ }))+ }++ fn format_version(&self) -> i32 {+ self.snapshot().catalog.format_version+ }++ fn generated_at(&self) -> i64 {+ self.snapshot().catalog.generated_at+ }++ fn dictionary_version(&self) -> i32 {+ self.snapshot().catalog.dictionary_version+ }++ fn language_rows(&self) -> Vec<translator::LanguageAvailabilityRow> {+ language_rows_in_snapshot(&self.snapshot())+ }++ fn dictionary_info(&self, dictionary_code: String) -> Option<translator::DictionaryInfo> {+ self.snapshot()+ .catalog+ .dictionary_info(&translator::DictionaryCode::from(dictionary_code))+ }++ fn support_files_by_kind(&self, support_kind: String) -> Vec<CatalogFileRecord> {+ self.snapshot()+ .catalog+ .support_files_by_kind(&support_kind)+ .into_iter()+ .map(Into::into)+ .collect()+ }++ /// ONNX→MNN conversions needed to migrate this install to the MNN-only+ /// runtime (only entries whose `.onnx` is present on disk). The caller runs+ /// the `needs_convert` jobs through the converter native lib, then passes the+ /// finished jobs (plus any cleanup-only / discarded ones) to+ /// `discard_migration` to drop the `.onnx` and refresh.+ fn plan_migration(&self) -> Vec<MigrationJobRecord> {+ self.session+ .plan_migration()+ .into_iter()+ .map(Into::into)+ .collect()+ }++ /// Delete the source `.onnx` of each job and refresh the catalog snapshot.+ /// Use after a successful conversion, for cleanup-only jobs, or when the user+ /// opts to drop models instead of migrating them.+ fn discard_migration(&self, jobs: Vec<MigrationJobRecord>) {+ let jobs: Vec<translator::catalog::MigrationJob> =+ jobs.into_iter().map(Into::into).collect();+ self.session.discard_migration(&jobs);+ }++ fn lookup_dictionary(+ &self,+ language_code: String,+ word: String,+ ) -> Result<Option<DictionaryWordRecord>, CatalogError> {+ #[cfg(not(feature = "dictionary"))]+ {+ let _ = (language_code, word);+ return Ok(None);+ }++ #[cfg(feature = "dictionary")]+ {+ self.session+ .lookup_dictionary(&language_code, &word)+ .map(|opt| opt.map(map_dictionary_word))+ .map_err(CatalogError::from)+ }+ }++ fn has_tts_voices(&self, language_code: String) -> bool {+ self.snapshot()+ .catalog+ .has_tts_voices(&translator::LanguageCode::from(language_code))+ }++ fn installed_ocr_engines(&self, language_code: String) -> Vec<String> {+ translator::installed_ocr_engines_for_language(+ &self.snapshot(),+ &translator::LanguageCode::from(language_code),+ )+ }++ fn available_ocr_engines(&self, language_code: String) -> Vec<String> {+ translator::available_ocr_engines_for_language(+ &self.snapshot(),+ &translator::LanguageCode::from(language_code),+ )+ }++ fn plan_ocr_engine_download(+ &self,+ language_code: String,+ engine: String,+ ) -> Option<translator::DownloadPlan> {+ translator::plan_ocr_engine_download(+ &self.snapshot(),+ &translator::LanguageCode::from(language_code),+ &engine,+ )+ }++ fn plan_ocr_engine_downloads(+ &self,+ language_codes: Vec<String>,+ engine: String,+ ) -> translator::DownloadPlan {+ let language_codes = language_codes+ .into_iter()+ .map(translator::LanguageCode::from)+ .collect::<Vec<_>>();+ translator::plan_ocr_engine_downloads(&self.snapshot(), &language_codes, &engine)+ }++ fn plan_ocr_engine_upgrades(+ &self,+ language_codes: Vec<String>,+ engine: String,+ ) -> translator::DownloadPlan {+ let language_codes = language_codes+ .into_iter()+ .map(translator::LanguageCode::from)+ .collect::<Vec<_>>();+ translator::plan_ocr_engine_upgrades(&self.snapshot(), &language_codes, &engine)+ }++ fn plan_translation_upgrades(&self, language_codes: Vec<String>) -> translator::DownloadPlan {+ let language_codes = language_codes+ .into_iter()+ .map(translator::LanguageCode::from)+ .collect::<Vec<_>>();+ translator::plan_translation_upgrades(&self.snapshot(), &language_codes)+ }++ fn translation_upgrade_language_codes(&self) -> Vec<String> {+ translator::translation_upgrade_language_codes(&self.snapshot())+ .into_iter()+ .map(|language_code| language_code.code)+ .collect()+ }++ fn plan_delete_superseded_files(&self) -> translator::DeletePlan {+ translator::plan_delete_superseded_files(&self.snapshot())+ }++ fn plan_repair(&self) -> translator::DownloadPlan {+ translator::plan_repair(&self.snapshot())+ }++ fn ocr_engine_ready(&self) -> bool {+ translator::ocr_engine_ready(&self.snapshot())+ }++ fn tts_sample_text(&self, language_code: String) -> Option<String> {+ self.snapshot()+ .catalog+ .tts_sample_text(&translator::LanguageCode::from(language_code))+ }++ fn tts_voice_picker_regions(+ &self,+ language_code: String,+ ) -> Vec<translator::TtsVoicePickerRegion> {+ self.snapshot()+ .catalog+ .tts_voice_picker_regions(&translator::LanguageCode::from(language_code))+ }++ fn installed_tts_voice_picker_regions(+ &self,+ language_code: String,+ ) -> Vec<translator::TtsVoicePickerRegion> {+ translator::installed_tts_voice_picker_regions(+ &self.snapshot(),+ &translator::LanguageCode::from(language_code),+ )+ }++ fn can_swap_languages(&self, from_code: String, to_code: String) -> bool {+ self.snapshot().catalog.can_swap_languages(+ &translator::LanguageCode::from(from_code),+ &translator::LanguageCode::from(to_code),+ )+ }++ fn can_translate(&self, from_code: String, to_code: String) -> bool {+ self.snapshot().can_translate(+ &translator::LanguageCode::from(from_code),+ &translator::LanguageCode::from(to_code),+ )+ }++ fn warm_translation_models(&self, from_code: String, to_code: String) -> bool {+ self.session.warm(&from_code, &to_code).is_ok()+ }++ fn translate_text(+ &self,+ from_code: String,+ to_code: String,+ text: String,+ ) -> Result<String, CatalogError> {+ self.session+ .translate_text(&from_code, &to_code, &text)+ .map_err(CatalogError::from)+ }++ fn translate_html_fragments(+ &self,+ from_code: String,+ to_code: String,+ fragments: Vec<String>,+ ) -> Result<Vec<String>, CatalogError> {+ self.session+ .translate_html_fragments(&from_code, &to_code, &fragments)+ .map_err(CatalogError::from)+ }++ fn translate_text_with_alternatives(+ &self,+ from_code: String,+ to_code: String,+ text: String,+ ) -> Result<translator::TranslationWithAlternatives, CatalogError> {+ self.session+ .translate_text_with_alternatives(&from_code, &to_code, &text)+ .map_err(CatalogError::from)+ }++ fn steer(+ &self,+ from_code: String,+ to_code: String,+ source: String,+ forced_prefix: String,+ ) -> Result<translator::TranslationWithAlternatives, CatalogError> {+ self.session+ .steer(&from_code, &to_code, &source, &forced_prefix)+ .map_err(CatalogError::from)+ }++ fn translate_mixed_texts(+ &self,+ inputs: Vec<String>,+ forced_source_code: Option<String>,+ target_code: String,+ available_language_codes: Vec<String>,+ ) -> translator::MixedTextTranslationResult {+ let available = available_language_codes+ .into_iter()+ .map(translator::LanguageCode::from)+ .collect::<Vec<_>>();+ self.session+ .translate_mixed_texts(+ &inputs,+ forced_source_code.as_deref(),+ &target_code,+ &available,+ )+ .unwrap_or_else(|_| translator::MixedTextTranslationResult::default())+ }++ fn translate_image_plan(+ &self,+ rgba_bytes: Vec<u8>,+ width: u32,+ height: u32,+ max_image_size: u32,+ source_selection: translator::OcrSourceSelection,+ target_code: String,+ min_confidence: u32,+ reading_order: Option<translator::ReadingOrder>,+ background_mode: translator::BackgroundMode,+ detection: Option<Vec<translator::DetectedTextBox>>,+ ) -> Result<translator::PreparedImageOverlay, CatalogError> {+ #[cfg(feature = "ppocr")]+ {+ return self+ .session+ .translate_image_rgba(+ &rgba_bytes,+ width,+ height,+ max_image_size,+ source_selection,+ &target_code,+ min_confidence,+ reading_order,+ background_mode,+ detection,+ )+ .map_err(CatalogError::from);+ }+ #[cfg(not(feature = "ppocr"))]+ {+ let _ = (+ rgba_bytes,+ width,+ height,+ max_image_size,+ source_selection,+ target_code,+ min_confidence,+ reading_order,+ background_mode,+ detection,+ );+ Err(CatalogError::Other {+ reason: "OCR feature disabled".to_string(),+ })+ }+ }++ fn detect_image_boxes(+ &self,+ rgba_bytes: Vec<u8>,+ width: u32,+ height: u32,+ max_image_size: u32,+ ) -> Result<Vec<translator::DetectedTextBox>, CatalogError> {+ #[cfg(feature = "ppocr")]+ {+ return self+ .session+ .detect_image_boxes(&rgba_bytes, width, height, max_image_size)+ .map_err(CatalogError::from);+ }+ #[cfg(not(feature = "ppocr"))]+ {+ let _ = (rgba_bytes, width, height, max_image_size);+ Err(CatalogError::Other {+ reason: "OCR feature disabled".to_string(),+ })+ }+ }++ fn retranslate_image_plan(+ &self,+ prepared: translator::PreparedImageOverlay,+ source_code: String,+ target_code: String,+ ) -> Result<translator::PreparedImageOverlay, CatalogError> {+ self.session+ .retranslate_prepared_overlay(prepared, &source_code, &target_code)+ .map_err(CatalogError::from)+ }++ /// Request cancellation of an in-flight `translate_document_path*` call.+ /// Safe to call from another thread (e.g. a UI "cancel" tap) while a+ /// document translation is running — slimt's worker pool observes it and+ /// stops within ~one batch, and the call returns `CatalogError::Cancelled`.+ /// A no-op if nothing is translating; the next document translation clears+ /// the flag at its start.+ fn cancel_ongoing_work(&self) {+ self.session.cancel_ongoing_work();+ }++ fn translate_document_path_with_progress(+ &self,+ input_path: String,+ output_path: String,+ forced_source_code: Option<String>,+ target_code: String,+ translate_pdf_images: bool,+ txt_layout: TxtLayout,+ progress: Arc<dyn DocumentProgressSink>,+ ) -> Result<String, CatalogError> {+ let options = translator::document::DocumentOptions {+ forced_source_code: forced_source_code.as_deref(),+ target_code: &target_code,+ translate_pdf_images,+ txt_layout: txt_layout.into(),+ fonts: &crate::android_font_provider::AndroidFontProvider,+ };+ translator::document::translate_document_path(+ &self.session,+ &input_path,+ &output_path,+ &options,+ &|event| progress.on_progress(event.into()),+ &|| progress.is_cancelled(),+ )?;+ Ok(output_path)+ }++ fn plan_download(+ &self,+ language_code: String,+ feature: Feature,+ selected_tts_pack_id: Option<String>,+ ) -> Option<translator::DownloadPlan> {+ self.session+ .plan_download(&language_code, feature, selected_tts_pack_id.as_deref())+ }++ fn plan_support_download_by_kind(+ &self,+ support_kind: String,+ ) -> Option<translator::DownloadPlan> {+ self.session.plan_support_download_by_kind(&support_kind)+ }++ fn prepare_delete(&self, language_code: String, feature: Feature) -> translator::DeletePlan {+ self.session.prepare_delete(&language_code, feature)+ }++ fn prepare_delete_support_by_kind(&self, support_kind: String) -> translator::DeletePlan {+ self.session.prepare_delete_support_by_kind(&support_kind)+ }++ fn prepare_delete_superseded_tts(+ &self,+ language_code: String,+ selected_pack_id: String,+ ) -> translator::DeletePlan {+ self.session+ .prepare_delete_superseded_tts(&language_code, &selected_pack_id)+ }++ fn prepare_delete_tts_pack(&self, pack_id: String) -> translator::DeletePlan {+ self.session.prepare_delete_tts_pack(&pack_id)+ }++ fn size_bytes(&self, language_code: String, feature: Feature) -> u64 {+ self.session.size_bytes(&language_code, feature)+ }++ fn support_size_bytes_by_kind(&self, support_kind: String) -> u64 {+ self.session.support_size_bytes_by_kind(&support_kind)+ }++ fn default_tts_pack_id(&self, language_code: String) -> Option<String> {+ self.snapshot()+ .catalog+ .default_tts_pack_id_for_language(&translator::LanguageCode::from(language_code))+ }++ fn available_tts_voices(&self, language_code: String) -> Vec<translator::TtsVoiceOption> {+ #[cfg(feature = "tts")]+ {+ return self+ .session+ .available_tts_voices(&language_code)+ .inspect_err(|err| {+ log::error!("listing TTS voices for `{language_code}` failed: {err}")+ })+ .unwrap_or_default();+ }++ #[cfg(not(feature = "tts"))]+ {+ let _ = language_code;+ Vec::new()+ }+ }++ fn plan_speech_chunks(+ &self,+ language_code: String,+ text: String,+ pack_id: Option<String>,+ urls_and_hashtags: translator::UrlsAndHashtags,+ ) -> Result<Vec<translator::SpeechChunk>, CatalogError> {+ #[cfg(feature = "tts")]+ {+ return self+ .session+ .plan_speech_chunks(&language_code, &text, pack_id.as_deref(), urls_and_hashtags)+ .map_err(CatalogError::from);+ }++ #[cfg(not(feature = "tts"))]+ {+ let _ = (language_code, text, pack_id, urls_and_hashtags);+ Err(CatalogError::Other {+ reason: "tts feature disabled".to_string(),+ })+ }+ }++ fn synthesize_speech_pcm(+ &self,+ language_code: String,+ text: String,+ speech_speed: f32,+ voice_name: Option<String>,+ is_phonemes: bool,+ pack_id: Option<String>,+ ) -> Result<translator::PcmAudio, CatalogError> {+ #[cfg(feature = "tts")]+ {+ return self+ .session+ .synthesize_pcm(+ &language_code,+ &text,+ speech_speed,+ voice_name.as_deref(),+ is_phonemes,+ pack_id.as_deref(),+ )+ .map_err(CatalogError::from);+ }++ #[cfg(not(feature = "tts"))]+ {+ let _ = (+ language_code,+ text,+ speech_speed,+ voice_name,+ is_phonemes,+ pack_id,+ );+ Err(CatalogError::Other {+ reason: "tts feature disabled".to_string(),+ })+ }+ }++ fn installed_tts_voices(&self, language_code: String) -> Vec<translator::InstalledTtsPack> {+ #[cfg(feature = "tts")]+ {+ return self.session.installed_tts_voices(&language_code);+ }++ #[cfg(not(feature = "tts"))]+ {+ let _ = language_code;+ Vec::new()+ }+ }++ fn detect_document_quad(+ &self,+ rgba_bytes: Vec<u8>,+ width: u32,+ height: u32,+ ) -> Result<Option<translator::doc_align::DocumentDetection>, CatalogError> {+ #[cfg(feature = "doc-align")]+ {+ return self+ .session+ .detect_document_quad(&rgba_bytes, width, height)+ .map_err(CatalogError::from);+ }+ #[cfg(not(feature = "doc-align"))]+ {+ let _ = (rgba_bytes, width, height);+ Err(CatalogError::Other {+ reason: "doc-align feature disabled".to_string(),+ })+ }+ }++ fn warp_document_rgba(+ &self,+ rgba_bytes: Vec<u8>,+ width: u32,+ height: u32,+ quad: translator::doc_align::DocumentQuad,+ out_width: Option<u32>,+ out_height: Option<u32>,+ postprocess: bool,+ ) -> Result<translator::doc_align::WarpedImageRgba, CatalogError> {+ #[cfg(feature = "doc-align")]+ {+ return self+ .session+ .warp_document_rgba(+ &rgba_bytes,+ width,+ height,+ &quad,+ out_width,+ out_height,+ postprocess,+ )+ .map_err(CatalogError::from);+ }+ #[cfg(not(feature = "doc-align"))]+ {+ let _ = (+ rgba_bytes,+ width,+ height,+ quad,+ out_width,+ out_height,+ postprocess,+ );+ Err(CatalogError::Other {+ reason: "doc-align feature disabled".to_string(),+ })+ }+ }+}++// =========================================================================+// Planar-surface OCR pipeline (uniffi wrapper).+//+// All the orchestration logic — tracker step, smoothed-H, composite,+// async acquire/refresh dispatch — lives in+// `translator::live_tracker_pipeline::LiveTrackerPipeline`. This+// uniffi `LivePlanarTracker` is a thin shim that holds an `Arc` to it+// + forwards a handful of uniffi-facing methods (set config, reset,+// telemetry getter). The hot per-frame entry is the JNI extern fn+// `Java_..._LivePipelineJni_processFrameGl`, which dereferences the+// raw address from `raw_address_for_jni`, GPU-renders canonical luma+// from the camera's external-OES texture into a fresh `LiveFrame`,+// runs `LiveTrackerPipeline::process_frame` with an+// `ExternalPresentTarget`, and on acquire reads back full-res RGBA+// from the same texture.+// =========================================================================++#[cfg(feature = "planar-tracker")]+#[derive(uniffi::Enum, Clone, Copy, Debug, PartialEq, Eq)]+pub enum PlanarTrackerState {+ Idle,+ Acquiring,+ Locked,+ Lost,+}++#[cfg(feature = "planar-tracker")]+impl From<translator::live_tracker_pipeline::PlanarTrackerState> for PlanarTrackerState {+ fn from(s: translator::live_tracker_pipeline::PlanarTrackerState) -> Self {+ use translator::live_tracker_pipeline::PlanarTrackerState as S;+ match s {+ S::Idle => Self::Idle,+ S::Acquiring => Self::Acquiring,+ S::Locked => Self::Locked,+ S::Lost => Self::Lost,+ }+ }+}++#[cfg(feature = "planar-tracker")]+#[derive(uniffi::Enum, Clone, Copy, Debug, PartialEq, Eq)]+pub enum PipelineTargetMode {+ /// Normal operation: tracker step + composite + async acquire/refresh.+ Active,+ /// Suppress: every frame bumps generation + clears engine + smoothed H.+ /// Used during camera AF scans so any in-flight acquire bails at its+ /// next gen-check and the stable-window restarts on every frame.+ Suppressed,+}++#[cfg(feature = "planar-tracker")]+impl From<PipelineTargetMode> for translator::live_tracker_pipeline::TargetMode {+ fn from(m: PipelineTargetMode) -> Self {+ match m {+ PipelineTargetMode::Active => Self::Active,+ PipelineTargetMode::Suppressed => Self::Suppressed,+ }+ }+}++/// Surfaced to Kotlin for the on-screen debug tracker pill. Drained+/// from the pipeline (take-and-clear) on each poll, so a subsequent+/// poll without a new acquire returns `None`.+#[cfg(feature = "planar-tracker")]+#[derive(uniffi::Record, Clone, Debug)]+pub struct AcquireTelemetryRecord {+ pub anchor_id: u64,+ pub detected_count: u32,+ pub rec_ok_count: u32,+ pub rec_empty_count: u32,+ pub cache_hits: u32,+ pub rec_called_count: u32,+ pub total_ms: f64,+ pub canceled: bool,+ pub error: Option<String>,+ pub is_refresh: bool,+}++#[cfg(feature = "planar-tracker")]+impl From<translator::live_tracker_pipeline::AcquireTelemetry> for AcquireTelemetryRecord {+ fn from(t: translator::live_tracker_pipeline::AcquireTelemetry) -> Self {+ AcquireTelemetryRecord {+ anchor_id: t.anchor_id,+ detected_count: t.detected_count,+ rec_ok_count: t.rec_ok_count,+ rec_empty_count: t.rec_empty_count,+ cache_hits: t.cache_hits,+ rec_called_count: t.rec_called_count,+ total_ms: t.total_ms,+ canceled: t.canceled,+ error: t.error,+ is_refresh: t.is_refresh,+ }+ }+}++#[cfg(feature = "planar-tracker")]+#[derive(uniffi::Object)]+pub struct LivePlanarTracker {+ pub(crate) pipeline: Arc<translator::live_tracker_pipeline::LiveTrackerPipeline>,+}++#[cfg(feature = "planar-tracker")]+#[uniffi::export]+impl LivePlanarTracker {+ #[uniffi::constructor]+ fn new(catalog: Arc<CatalogHandle>) -> Arc<Self> {+ let session = catalog.session_arc();+ let provider: Arc<dyn translator::font_provider::FontProvider + Send + Sync> =+ Arc::new(crate::android_font_provider::AndroidFontProvider);+ Arc::new(Self {+ pipeline: translator::live_tracker_pipeline::LiveTrackerPipeline::new(+ session, provider,+ ),+ })+ }++ /// Address of the underlying pipeline on the Rust heap. Used by+ /// the JNI per-frame fast path to cast back to+ /// `&LiveTrackerPipeline` without a uniffi marshalling hop.+ fn raw_address_for_jni(&self) -> u64 {+ Arc::as_ptr(&self.pipeline) as u64+ }++ fn set_languages(&self, from_code: String, to_code: String, is_auto_source: bool) {+ self.pipeline+ .set_languages(&from_code, &to_code, is_auto_source);+ }++ fn set_target_mode(&self, mode: PipelineTargetMode) {+ self.pipeline.set_target_mode(mode.into());+ }++ /// Bump generation, clear engine + smoothed H + session state.+ /// Tap-to-focus / language change / session teardown call this.+ fn reset(&self) {+ self.pipeline.reset();+ }++ /// Drop all resident overlay items without resetting the tracker+ /// engine. The compositor will draw camera-only frames after this+ /// until a fresh acquire completes.+ fn clear_overlay(&self) {+ self.pipeline.clear_overlay();+ }++ /// Pull (and clear) the most recent async-job telemetry. Returns+ /// `None` when no new acquire/refresh has finished since the last+ /// poll. Used by Kotlin to update the debug status pill.+ fn last_acquire_telemetry(&self) -> Option<AcquireTelemetryRecord> {+ self.pipeline.last_acquire_telemetry().map(Into::into)+ }+}++/// No-tracker screen-translate pipeline (flat fronto-parallel capture →+/// identity placement). Thin uniffi shim over+/// `translator::live_screen::LiveScreenPipeline`, mirroring+/// [`LivePlanarTracker`]: the per-frame fast path grabs the raw address from+/// `raw_address_for_jni` and calls `processScreenFrameGl`.+#[cfg(feature = "planar-tracker")]+#[derive(uniffi::Object)]+pub struct LiveScreenTracker {+ pub(crate) pipeline: Arc<translator::live_screen::LiveScreenPipeline>,+}++#[cfg(feature = "planar-tracker")]+#[uniffi::export]+impl LiveScreenTracker {+ #[uniffi::constructor]+ fn new(catalog: Arc<CatalogHandle>) -> Arc<Self> {+ let session = catalog.session_arc();+ let provider: Arc<dyn translator::font_provider::FontProvider + Send + Sync> =+ Arc::new(crate::android_font_provider::AndroidFontProvider);+ Arc::new(Self {+ pipeline: translator::live_screen::LiveScreenPipeline::new(session, provider),+ })+ }++ fn raw_address_for_jni(&self) -> u64 {+ Arc::as_ptr(&self.pipeline) as u64+ }++ fn set_languages(&self, from_code: String, to_code: String, is_auto_source: bool) {+ self.pipeline+ .set_languages(&from_code, &to_code, is_auto_source);+ }++ fn reset(&self) {+ self.pipeline.reset();+ }++ fn clear_overlay(&self) {+ self.pipeline.clear_overlay();+ }++ /// Restrict OCR + the motion monitor to a normalized `[0,1]` region, or pass+ /// `None` to translate the whole screen.+ fn set_region(&self, region: Option<ScreenRegion>) {+ self.pipeline.set_region(region.map(Into::into));+ }+}++/// A capture region in normalized `[0,1]` coordinates (origin top-left).+#[cfg(feature = "planar-tracker")]+#[derive(uniffi::Record, Clone, Copy, Debug)]+pub struct ScreenRegion {+ pub left: f32,+ pub top: f32,+ pub right: f32,+ pub bottom: f32,+}++#[cfg(feature = "planar-tracker")]+impl From<ScreenRegion> for translator::live_screen::NormRect {+ fn from(r: ScreenRegion) -> Self {+ translator::live_screen::NormRect {+ left: r.left,+ top: r.top,+ right: r.right,+ bottom: r.bottom,+ }+ }+}++#[cfg(feature = "ppocr")]+impl CatalogHandle {+ pub(crate) fn session_arc(&self) -> Arc<translator::TranslatorSession> {+ Arc::clone(&self.session)+ }+}diff --git a/OCR-translation/src/main/bindings/testdata/fonts_api28.xml b/OCR-translation/src/main/bindings/testdata/fonts_api28.xmlnew file mode 100644index 0000000..72d9bce--- /dev/null+++ b/OCR-translation/src/main/bindings/testdata/fonts_api28.xml@@ -0,0 +1,621 @@+<?xml version="1.0" encoding="utf-8"?>+<!--+ WARNING: Parsing of this file by third-party apps is not supported. The+ file, and the font files it refers to, will be renamed and/or moved out+ from their respective location in the next Android release, and/or the+ format or syntax of the file may change significantly. If you parse this+ file for information about system fonts, do it at your own risk. Your+ application will almost certainly break with the next major Android+ release.++ In this file, all fonts without names are added to the default list.+ Fonts are chosen based on a match: full BCP-47 language tag including+ script, then just language, and finally order (the first font containing+ the glyph).++ Order of appearance is also the tiebreaker for weight matching. This is+ the reason why the 900 weights of Roboto precede the 700 weights - we+ prefer the former when an 800 weight is requested. Since bold spans+ effectively add 300 to the weight, this ensures that 900 is the bold+ paired with the 500 weight, ensuring adequate contrast.+-->+<familyset version="23">+ <!-- first font is default -->+ <family name="sans-serif">+ <font weight="100" style="normal">Roboto-Thin.ttf</font>+ <font weight="100" style="italic">Roboto-ThinItalic.ttf</font>+ <font weight="300" style="normal">Roboto-Light.ttf</font>+ <font weight="300" style="italic">Roboto-LightItalic.ttf</font>+ <font weight="400" style="normal">Roboto-Regular.ttf</font>+ <font weight="400" style="italic">Roboto-Italic.ttf</font>+ <font weight="500" style="normal">Roboto-Medium.ttf</font>+ <font weight="500" style="italic">Roboto-MediumItalic.ttf</font>+ <font weight="900" style="normal">Roboto-Black.ttf</font>+ <font weight="900" style="italic">Roboto-BlackItalic.ttf</font>+ <font weight="700" style="normal">Roboto-Bold.ttf</font>+ <font weight="700" style="italic">Roboto-BoldItalic.ttf</font>+ </family>++ <!-- Note that aliases must come after the fonts they reference. -->+ <alias name="sans-serif-thin" to="sans-serif" weight="100" />+ <alias name="sans-serif-light" to="sans-serif" weight="300" />+ <alias name="sans-serif-medium" to="sans-serif" weight="500" />+ <alias name="sans-serif-black" to="sans-serif" weight="900" />+ <alias name="arial" to="sans-serif" />+ <alias name="helvetica" to="sans-serif" />+ <alias name="tahoma" to="sans-serif" />+ <alias name="verdana" to="sans-serif" />++ <family name="sans-serif-condensed">+ <font weight="300" style="normal">RobotoCondensed-Light.ttf</font>+ <font weight="300" style="italic">RobotoCondensed-LightItalic.ttf</font>+ <font weight="400" style="normal">RobotoCondensed-Regular.ttf</font>+ <font weight="400" style="italic">RobotoCondensed-Italic.ttf</font>+ <font weight="500" style="normal">RobotoCondensed-Medium.ttf</font>+ <font weight="500" style="italic">RobotoCondensed-MediumItalic.ttf</font>+ <font weight="700" style="normal">RobotoCondensed-Bold.ttf</font>+ <font weight="700" style="italic">RobotoCondensed-BoldItalic.ttf</font>+ </family>+ <alias name="sans-serif-condensed-light" to="sans-serif-condensed" weight="300" />+ <alias name="sans-serif-condensed-medium" to="sans-serif-condensed" weight="500" />++ <family name="serif">+ <font weight="400" style="normal">NotoSerif-Regular.ttf</font>+ <font weight="700" style="normal">NotoSerif-Bold.ttf</font>+ <font weight="400" style="italic">NotoSerif-Italic.ttf</font>+ <font weight="700" style="italic">NotoSerif-BoldItalic.ttf</font>+ </family>+ <alias name="times" to="serif" />+ <alias name="times new roman" to="serif" />+ <alias name="palatino" to="serif" />+ <alias name="georgia" to="serif" />+ <alias name="baskerville" to="serif" />+ <alias name="goudy" to="serif" />+ <alias name="fantasy" to="serif" />+ <alias name="ITC Stone Serif" to="serif" />++ <family name="monospace">+ <font weight="400" style="normal">DroidSansMono.ttf</font>+ </family>+ <alias name="sans-serif-monospace" to="monospace" />+ <alias name="monaco" to="monospace" />++ <family name="serif-monospace">+ <font weight="400" style="normal">CutiveMono.ttf</font>+ </family>+ <alias name="courier" to="serif-monospace" />+ <alias name="courier new" to="serif-monospace" />++ <family name="casual">+ <font weight="400" style="normal">ComingSoon.ttf</font>+ </family>++ <family name="cursive">+ <font weight="400" style="normal">DancingScript-Regular.ttf</font>+ <font weight="700" style="normal">DancingScript-Bold.ttf</font>+ </family>++ <family name="sans-serif-smallcaps">+ <font weight="400" style="normal">CarroisGothicSC-Regular.ttf</font>+ </family>++ <!-- fallback fonts -->+ <family lang="und-Arab" variant="elegant">+ <font weight="400" style="normal">NotoNaskhArabic-Regular.ttf</font>+ <font weight="700" style="normal">NotoNaskhArabic-Bold.ttf</font>+ </family>+ <family lang="und-Arab" variant="compact">+ <font weight="400" style="normal">NotoNaskhArabicUI-Regular.ttf</font>+ <font weight="700" style="normal">NotoNaskhArabicUI-Bold.ttf</font>+ </family>+ <family lang="und-Ethi">+ <font weight="400" style="normal">NotoSansEthiopic-Regular.ttf</font>+ <font weight="700" style="normal">NotoSansEthiopic-Bold.ttf</font>+ <font weight="400" style="normal" fallbackFor="serif">NotoSerifEthiopic-Regular.otf</font>+ <font weight="700" style="normal" fallbackFor="serif">NotoSerifEthiopic-Bold.otf</font>+ </family>+ <family lang="und-Hebr">+ <font weight="400" style="normal">NotoSansHebrew-Regular.ttf</font>+ <font weight="700" style="normal">NotoSansHebrew-Bold.ttf</font>+ <font weight="400" style="normal" fallbackFor="serif">NotoSerifHebrew-Regular.ttf</font>+ <font weight="700" style="normal" fallbackFor="serif">NotoSerifHebrew-Bold.ttf</font>+ </family>+ <family lang="und-Thai" variant="elegant">+ <font weight="400" style="normal">NotoSansThai-Regular.ttf</font>+ <font weight="700" style="normal">NotoSansThai-Bold.ttf</font>+ <font weight="400" style="normal" fallbackFor="serif">NotoSerifThai-Regular.ttf</font>+ <font weight="700" style="normal" fallbackFor="serif">NotoSerifThai-Bold.ttf</font>+ </family>+ <family lang="und-Thai" variant="compact">+ <font weight="400" style="normal">NotoSansThaiUI-Regular.ttf</font>+ <font weight="700" style="normal">NotoSansThaiUI-Bold.ttf</font>+ </family>+ <family lang="und-Armn">+ <font weight="400" style="normal">NotoSansArmenian-Regular.ttf</font>+ <font weight="700" style="normal">NotoSansArmenian-Bold.ttf</font>+ <font weight="400" style="normal" fallbackFor="serif">NotoSerifArmenian-Regular.ttf</font>+ <font weight="700" style="normal" fallbackFor="serif">NotoSerifArmenian-Bold.ttf</font>+ </family>+ <family lang="und-Geor und-Geok">+ <font weight="400" style="normal">NotoSansGeorgian-Regular.ttf</font>+ <font weight="700" style="normal">NotoSansGeorgian-Bold.ttf</font>+ <font weight="400" style="normal" fallbackFor="serif">NotoSerifGeorgian-Regular.ttf</font>+ <font weight="700" style="normal" fallbackFor="serif">NotoSerifGeorgian-Bold.ttf</font>+ </family>+ <family lang="und-Deva" variant="elegant">+ <font weight="400" style="normal">NotoSansDevanagari-Regular.ttf</font>+ <font weight="700" style="normal">NotoSansDevanagari-Bold.ttf</font>+ <font weight="400" style="normal" fallbackFor="serif">NotoSerifDevanagari-Regular.ttf</font>+ <font weight="700" style="normal" fallbackFor="serif">NotoSerifDevanagari-Bold.ttf</font>+ </family>+ <family lang="und-Deva" variant="compact">+ <font weight="400" style="normal">NotoSansDevanagariUI-Regular.ttf</font>+ <font weight="700" style="normal">NotoSansDevanagariUI-Bold.ttf</font>+ </family>++ <!-- All scripts of India should come after Devanagari, due to shared+ danda characters.+ -->+ <family lang="und-Gujr" variant="elegant">+ <font weight="400" style="normal">NotoSansGujarati-Regular.ttf</font>+ <font weight="700" style="normal">NotoSansGujarati-Bold.ttf</font>+ <font weight="400" style="normal" fallbackFor="serif">NotoSerifGujarati-Regular.ttf</font>+ <font weight="700" style="normal" fallbackFor="serif">NotoSerifGujarati-Bold.ttf</font>+ </family>+ <family lang="und-Gujr" variant="compact">+ <font weight="400" style="normal">NotoSansGujaratiUI-Regular.ttf</font>+ <font weight="700" style="normal">NotoSansGujaratiUI-Bold.ttf</font>+ </family>+ <family lang="und-Guru" variant="elegant">+ <font weight="400" style="normal">NotoSansGurmukhi-Regular.ttf</font>+ <font weight="700" style="normal">NotoSansGurmukhi-Bold.ttf</font>+ <font weight="400" style="normal" fallbackFor="serif">NotoSerifGurmukhi-Regular.otf</font>+ <font weight="700" style="normal" fallbackFor="serif">NotoSerifGurmukhi-Bold.otf</font>+ </family>+ <family lang="und-Guru" variant="compact">+ <font weight="400" style="normal">NotoSansGurmukhiUI-Regular.ttf</font>+ <font weight="700" style="normal">NotoSansGurmukhiUI-Bold.ttf</font>+ </family>+ <family lang="und-Taml" variant="elegant">+ <font weight="400" style="normal">NotoSansTamil-Regular.ttf</font>+ <font weight="700" style="normal">NotoSansTamil-Bold.ttf</font>+ <font weight="400" style="normal" fallbackFor="serif">NotoSerifTamil-Regular.ttf</font>+ <font weight="700" style="normal" fallbackFor="serif">NotoSerifTamil-Bold.ttf</font>+ </family>+ <family lang="und-Taml" variant="compact">+ <font weight="400" style="normal">NotoSansTamilUI-Regular.ttf</font>+ <font weight="700" style="normal">NotoSansTamilUI-Bold.ttf</font>+ </family>+ <family lang="und-Mlym" variant="elegant">+ <font weight="400" style="normal">NotoSansMalayalam-Regular.ttf</font>+ <font weight="700" style="normal">NotoSansMalayalam-Bold.ttf</font>+ <font weight="400" style="normal" fallbackFor="serif">NotoSerifMalayalam-Regular.ttf</font>+ <font weight="700" style="normal" fallbackFor="serif">NotoSerifMalayalam-Bold.ttf</font>+ </family>+ <family lang="und-Mlym" variant="compact">+ <font weight="400" style="normal">NotoSansMalayalamUI-Regular.ttf</font>+ <font weight="700" style="normal">NotoSansMalayalamUI-Bold.ttf</font>+ </family>+ <family lang="und-Beng" variant="elegant">+ <font weight="400" style="normal">NotoSansBengali-Regular.ttf</font>+ <font weight="700" style="normal">NotoSansBengali-Bold.ttf</font>+ <font weight="400" style="normal" fallbackFor="serif">NotoSerifBengali-Regular.ttf</font>+ <font weight="700" style="normal" fallbackFor="serif">NotoSerifBengali-Bold.ttf</font>+ </family>+ <family lang="und-Beng" variant="compact">+ <font weight="400" style="normal">NotoSansBengaliUI-Regular.ttf</font>+ <font weight="700" style="normal">NotoSansBengaliUI-Bold.ttf</font>+ </family>+ <family lang="und-Telu" variant="elegant">+ <font weight="400" style="normal">NotoSansTelugu-Regular.ttf</font>+ <font weight="700" style="normal">NotoSansTelugu-Bold.ttf</font>+ <font weight="400" style="normal" fallbackFor="serif">NotoSerifTelugu-Regular.ttf</font>+ <font weight="700" style="normal" fallbackFor="serif">NotoSerifTelugu-Bold.ttf</font>+ </family>+ <family lang="und-Telu" variant="compact">+ <font weight="400" style="normal">NotoSansTeluguUI-Regular.ttf</font>+ <font weight="700" style="normal">NotoSansTeluguUI-Bold.ttf</font>+ </family>+ <family lang="und-Knda" variant="elegant">+ <font weight="400" style="normal">NotoSansKannada-Regular.ttf</font>+ <font weight="700" style="normal">NotoSansKannada-Bold.ttf</font>+ <font weight="400" style="normal" fallbackFor="serif">NotoSerifKannada-Regular.ttf</font>+ <font weight="700" style="normal" fallbackFor="serif">NotoSerifKannada-Bold.ttf</font>+ </family>+ <family lang="und-Knda" variant="compact">+ <font weight="400" style="normal">NotoSansKannadaUI-Regular.ttf</font>+ <font weight="700" style="normal">NotoSansKannadaUI-Bold.ttf</font>+ </family>+ <family lang="und-Orya" variant="elegant">+ <font weight="400" style="normal">NotoSansOriya-Regular.ttf</font>+ <font weight="700" style="normal">NotoSansOriya-Bold.ttf</font>+ </family>+ <family lang="und-Orya" variant="compact">+ <font weight="400" style="normal">NotoSansOriyaUI-Regular.ttf</font>+ <font weight="700" style="normal">NotoSansOriyaUI-Bold.ttf</font>+ </family>++ <family lang="und-Sinh" variant="elegant">+ <font weight="400" style="normal">NotoSansSinhala-Regular.ttf</font>+ <font weight="700" style="normal">NotoSansSinhala-Bold.ttf</font>+ <font weight="400" style="normal" fallbackFor="serif">NotoSerifSinhala-Regular.otf</font>+ <font weight="700" style="normal" fallbackFor="serif">NotoSerifSinhala-Bold.otf</font>+ </family>+ <family lang="und-Sinh" variant="compact">+ <font weight="400" style="normal">NotoSansSinhalaUI-Regular.otf</font>+ <font weight="700" style="normal">NotoSansSinhalaUI-Bold.otf</font>+ </family>+ <family lang="und-Khmr" variant="elegant">+ <font weight="100" style="normal">NotoSansKhmer-VF.ttf+ <axis tag="wdth" stylevalue="100.0" />+ <axis tag="wght" stylevalue="26.0" />+ </font>+ <font weight="200" style="normal">NotoSansKhmer-VF.ttf+ <axis tag="wdth" stylevalue="100.0" />+ <axis tag="wght" stylevalue="39.0" />+ </font>+ <font weight="300" style="normal">NotoSansKhmer-VF.ttf+ <axis tag="wdth" stylevalue="100.0" />+ <axis tag="wght" stylevalue="58.0" />+ </font>+ <font weight="400" style="normal">NotoSansKhmer-VF.ttf+ <axis tag="wdth" stylevalue="100.0" />+ <axis tag="wght" stylevalue="90.0" />+ </font>+ <font weight="500" style="normal">NotoSansKhmer-VF.ttf+ <axis tag="wdth" stylevalue="100.0" />+ <axis tag="wght" stylevalue="108.0" />+ </font>+ <font weight="600" style="normal">NotoSansKhmer-VF.ttf+ <axis tag="wdth" stylevalue="100.0" />+ <axis tag="wght" stylevalue="128.0" />+ </font>+ <font weight="700" style="normal">NotoSansKhmer-VF.ttf+ <axis tag="wdth" stylevalue="100.0" />+ <axis tag="wght" stylevalue="151.0" />+ </font>+ <font weight="800" style="normal">NotoSansKhmer-VF.ttf+ <axis tag="wdth" stylevalue="100.0" />+ <axis tag="wght" stylevalue="169.0" />+ </font>+ <font weight="900" style="normal">NotoSansKhmer-VF.ttf+ <axis tag="wdth" stylevalue="100.0" />+ <axis tag="wght" stylevalue="190.0" />+ </font>+ <font weight="400" style="normal" fallbackFor="serif">NotoSerifKhmer-Regular.otf</font>+ <font weight="700" style="normal" fallbackFor="serif">NotoSerifKhmer-Bold.otf</font>+ </family>+ <family lang="und-Khmr" variant="compact">+ <font weight="400" style="normal">NotoSansKhmerUI-Regular.ttf</font>+ <font weight="700" style="normal">NotoSansKhmerUI-Bold.ttf</font>+ </family>+ <family lang="und-Laoo" variant="elegant">+ <font weight="400" style="normal">NotoSansLao-Regular.ttf</font>+ <font weight="700" style="normal">NotoSansLao-Bold.ttf</font>+ <font weight="400" style="normal" fallbackFor="serif">NotoSerifLao-Regular.ttf</font>+ <font weight="700" style="normal" fallbackFor="serif">NotoSerifLao-Bold.ttf</font>+ </family>+ <family lang="und-Laoo" variant="compact">+ <font weight="400" style="normal">NotoSansLaoUI-Regular.ttf</font>+ <font weight="700" style="normal">NotoSansLaoUI-Bold.ttf</font>+ </family>+ <family lang="und-Mymr" variant="elegant">+ <font weight="400" style="normal">NotoSansMyanmar-Regular.ttf</font>+ <font weight="700" style="normal">NotoSansMyanmar-Bold.ttf</font>+ <font weight="400" style="normal" fallbackFor="serif">NotoSerifMyanmar-Regular.otf</font>+ <font weight="700" style="normal" fallbackFor="serif">NotoSerifMyanmar-Bold.otf</font>+ </family>+ <family lang="und-Mymr" variant="compact">+ <font weight="400" style="normal">NotoSansMyanmarUI-Regular.ttf</font>+ <font weight="700" style="normal">NotoSansMyanmarUI-Bold.ttf</font>+ </family>+ <family lang="und-Thaa">+ <font weight="400" style="normal">NotoSansThaana-Regular.ttf</font>+ <font weight="700" style="normal">NotoSansThaana-Bold.ttf</font>+ </family>+ <family lang="und-Cham">+ <font weight="400" style="normal">NotoSansCham-Regular.ttf</font>+ <font weight="700" style="normal">NotoSansCham-Bold.ttf</font>+ </family>+ <family lang="und-Ahom">+ <font weight="400" style="normal">NotoSansAhom-Regular.otf</font>+ </family>+ <family lang="und-Adlm">+ <font weight="400" style="normal">NotoSansAdlam-Regular.ttf</font>+ </family>+ <family lang="und-Avst">+ <font weight="400" style="normal">NotoSansAvestan-Regular.ttf</font>+ </family>+ <family lang="und-Bali">+ <font weight="400" style="normal">NotoSansBalinese-Regular.ttf</font>+ </family>+ <family lang="und-Bamu">+ <font weight="400" style="normal">NotoSansBamum-Regular.ttf</font>+ </family>+ <family lang="und-Batk">+ <font weight="400" style="normal">NotoSansBatak-Regular.ttf</font>+ </family>+ <family lang="und-Brah">+ <font weight="400" style="normal">NotoSansBrahmi-Regular.ttf</font>+ </family>+ <family lang="und-Bugi">+ <font weight="400" style="normal">NotoSansBuginese-Regular.ttf</font>+ </family>+ <family lang="und-Buhd">+ <font weight="400" style="normal">NotoSansBuhid-Regular.ttf</font>+ </family>+ <family lang="und-Cans">+ <font weight="400" style="normal">NotoSansCanadianAboriginal-Regular.ttf</font>+ </family>+ <family lang="und-Cari">+ <font weight="400" style="normal">NotoSansCarian-Regular.ttf</font>+ </family>+ <family lang="und-Cakm">+ <font weight="400" style="normal">NotoSansChakma-Regular.ttf</font>+ </family>+ <family lang="und-Cher">+ <font weight="400" style="normal">NotoSansCherokee-Regular.ttf</font>+ </family>+ <family lang="und-Copt">+ <font weight="400" style="normal">NotoSansCoptic-Regular.ttf</font>+ </family>+ <family lang="und-Xsux">+ <font weight="400" style="normal">NotoSansCuneiform-Regular.ttf</font>+ </family>+ <family lang="und-Cprt">+ <font weight="400" style="normal">NotoSansCypriot-Regular.ttf</font>+ </family>+ <family lang="und-Dsrt">+ <font weight="400" style="normal">NotoSansDeseret-Regular.ttf</font>+ </family>+ <family lang="und-Egyp">+ <font weight="400" style="normal">NotoSansEgyptianHieroglyphs-Regular.ttf</font>+ </family>+ <family lang="und-Elba">+ <font weight="400" style="normal">NotoSansElbasan-Regular.otf</font>+ </family>+ <family lang="und-Glag">+ <font weight="400" style="normal">NotoSansGlagolitic-Regular.ttf</font>+ </family>+ <family lang="und-Goth">+ <font weight="400" style="normal">NotoSansGothic-Regular.ttf</font>+ </family>+ <family lang="und-Hano">+ <font weight="400" style="normal">NotoSansHanunoo-Regular.ttf</font>+ </family>+ <family lang="und-Armi">+ <font weight="400" style="normal">NotoSansImperialAramaic-Regular.ttf</font>+ </family>+ <family lang="und-Phli">+ <font weight="400" style="normal">NotoSansInscriptionalPahlavi-Regular.ttf</font>+ </family>+ <family lang="und-Prti">+ <font weight="400" style="normal">NotoSansInscriptionalParthian-Regular.ttf</font>+ </family>+ <family lang="und-Java">+ <font weight="400" style="normal">NotoSansJavanese-Regular.ttf</font>+ </family>+ <family lang="und-Kthi">+ <font weight="400" style="normal">NotoSansKaithi-Regular.ttf</font>+ </family>+ <family lang="und-Kali">+ <font weight="400" style="normal">NotoSansKayahLi-Regular.ttf</font>+ </family>+ <family lang="und-Khar">+ <font weight="400" style="normal">NotoSansKharoshthi-Regular.ttf</font>+ </family>+ <family lang="und-Lepc">+ <font weight="400" style="normal">NotoSansLepcha-Regular.ttf</font>+ </family>+ <family lang="und-Limb">+ <font weight="400" style="normal">NotoSansLimbu-Regular.ttf</font>+ </family>+ <family lang="und-Linb">+ <font weight="400" style="normal">NotoSansLinearB-Regular.ttf</font>+ </family>+ <family lang="und-Lisu">+ <font weight="400" style="normal">NotoSansLisu-Regular.ttf</font>+ </family>+ <family lang="und-Lyci">+ <font weight="400" style="normal">NotoSansLycian-Regular.ttf</font>+ </family>+ <family lang="und-Lydi">+ <font weight="400" style="normal">NotoSansLydian-Regular.ttf</font>+ </family>+ <family lang="und-Mand">+ <font weight="400" style="normal">NotoSansMandaic-Regular.ttf</font>+ </family>+ <family lang="und-Mtei">+ <font weight="400" style="normal">NotoSansMeeteiMayek-Regular.ttf</font>+ </family>+ <family lang="und-Talu">+ <font weight="400" style="normal">NotoSansNewTaiLue-Regular.ttf</font>+ </family>+ <family lang="und-Nkoo">+ <font weight="400" style="normal">NotoSansNKo-Regular.ttf</font>+ </family>+ <family lang="und-Ogam">+ <font weight="400" style="normal">NotoSansOgham-Regular.ttf</font>+ </family>+ <family lang="und-Olck">+ <font weight="400" style="normal">NotoSansOlChiki-Regular.ttf</font>+ </family>+ <family lang="und-Ital">+ <font weight="400" style="normal">NotoSansOldItalic-Regular.ttf</font>+ </family>+ <family lang="und-Xpeo">+ <font weight="400" style="normal">NotoSansOldPersian-Regular.ttf</font>+ </family>+ <family lang="und-Sarb">+ <font weight="400" style="normal">NotoSansOldSouthArabian-Regular.ttf</font>+ </family>+ <family lang="und-Orkh">+ <font weight="400" style="normal">NotoSansOldTurkic-Regular.ttf</font>+ </family>+ <family lang="und-Osge">+ <font weight="400" style="normal">NotoSansOsage-Regular.ttf</font>+ </family>+ <family lang="und-Osma">+ <font weight="400" style="normal">NotoSansOsmanya-Regular.ttf</font>+ </family>+ <family lang="und-Phnx">+ <font weight="400" style="normal">NotoSansPhoenician-Regular.ttf</font>+ </family>+ <family lang="und-Rjng">+ <font weight="400" style="normal">NotoSansRejang-Regular.ttf</font>+ </family>+ <family lang="und-Runr">+ <font weight="400" style="normal">NotoSansRunic-Regular.ttf</font>+ </family>+ <family lang="und-Samr">+ <font weight="400" style="normal">NotoSansSamaritan-Regular.ttf</font>+ </family>+ <family lang="und-Saur">+ <font weight="400" style="normal">NotoSansSaurashtra-Regular.ttf</font>+ </family>+ <family lang="und-Shaw">+ <font weight="400" style="normal">NotoSansShavian-Regular.ttf</font>+ </family>+ <family lang="und-Sund">+ <font weight="400" style="normal">NotoSansSundanese-Regular.ttf</font>+ </family>+ <family lang="und-Sylo">+ <font weight="400" style="normal">NotoSansSylotiNagri-Regular.ttf</font>+ </family>+ <!-- Esrangela should precede Eastern and Western Syriac, since it's our default form. -->+ <family lang="und-Syre">+ <font weight="400" style="normal">NotoSansSyriacEstrangela-Regular.ttf</font>+ </family>+ <family lang="und-Syrn">+ <font weight="400" style="normal">NotoSansSyriacEastern-Regular.ttf</font>+ </family>+ <family lang="und-Syrj">+ <font weight="400" style="normal">NotoSansSyriacWestern-Regular.ttf</font>+ </family>+ <family lang="und-Tglg">+ <font weight="400" style="normal">NotoSansTagalog-Regular.ttf</font>+ </family>+ <family lang="und-Tagb">+ <font weight="400" style="normal">NotoSansTagbanwa-Regular.ttf</font>+ </family>+ <family lang="und-Lana">+ <font weight="400" style="normal">NotoSansTaiTham-Regular.ttf</font>+ </family>+ <family lang="und-Tavt">+ <font weight="400" style="normal">NotoSansTaiViet-Regular.ttf</font>+ </family>+ <family lang="und-Tibt">+ <font weight="400" style="normal">NotoSansTibetan-Regular.ttf</font>+ <font weight="700" style="normal">NotoSansTibetan-Bold.ttf</font>+ </family>+ <family lang="und-Tfng">+ <font weight="400" style="normal">NotoSansTifinagh-Regular.ttf</font>+ </family>+ <family lang="und-Ugar">+ <font weight="400" style="normal">NotoSansUgaritic-Regular.ttf</font>+ </family>+ <family lang="und-Vaii">+ <font weight="400" style="normal">NotoSansVai-Regular.ttf</font>+ </family>+ <family>+ <font weight="400" style="normal">NotoSansSymbols-Regular-Subsetted.ttf</font>+ </family>+ <family lang="zh-Hans">+ <font weight="400" style="normal" index="2">NotoSansCJK-Regular.ttc</font>+ <font weight="400" style="normal" index="2" fallbackFor="serif">NotoSerifCJK-Regular.ttc</font>+ </family>+ <family lang="zh-Hant zh-Bopo">+ <font weight="400" style="normal" index="3">NotoSansCJK-Regular.ttc</font>+ <font weight="400" style="normal" index="3" fallbackFor="serif">NotoSerifCJK-Regular.ttc</font>+ </family>+ <family lang="ja">+ <font weight="400" style="normal" index="0">NotoSansCJK-Regular.ttc</font>+ <font weight="400" style="normal" index="0" fallbackFor="serif">NotoSerifCJK-Regular.ttc</font>+ </family>+ <family lang="ko">+ <font weight="400" style="normal" index="1">NotoSansCJK-Regular.ttc</font>+ <font weight="400" style="normal" index="1" fallbackFor="serif">NotoSerifCJK-Regular.ttc</font>+ </family>+ <family lang="und-Zsye">+ <font weight="400" style="normal">NotoColorEmoji.ttf</font>+ </family>+ <family lang="und-Zsym">+ <font weight="400" style="normal">NotoSansSymbols-Regular-Subsetted2.ttf</font>+ </family>+ <!--+ Tai Le, Yi, Mongolian, and Phags-pa are intentionally kept last, to make sure they don't+ override the East Asian punctuation for Chinese.+ -->+ <family lang="und-Tale">+ <font weight="400" style="normal">NotoSansTaiLe-Regular.ttf</font>+ </family>+ <family lang="und-Yiii">+ <font weight="400" style="normal">NotoSansYi-Regular.ttf</font>+ </family>+ <family lang="und-Mong">+ <font weight="400" style="normal">NotoSansMongolian-Regular.ttf</font>+ </family>+ <family lang="und-Phag">+ <font weight="400" style="normal">NotoSansPhagsPa-Regular.ttf</font>+ </family>+ <family lang="und-Hluw">+ <font weight="400" style="normal">NotoSansAnatolianHieroglyphs-Regular.otf</font>+ </family>+ <family lang="und-Bass">+ <font weight="400" style="normal">NotoSansBassaVah-Regular.otf</font>+ </family>+ <family lang="und-Bhks">+ <font weight="400" style="normal">NotoSansBhaiksuki-Regular.otf</font>+ </family>+ <family lang="und-Hatr">+ <font weight="400" style="normal">NotoSansHatran-Regular.otf</font>+ </family>+ <family lang="und-Lina">+ <font weight="400" style="normal">NotoSansLinearA-Regular.otf</font>+ </family>+ <family lang="und-Mani">+ <font weight="400" style="normal">NotoSansManichaean-Regular.otf</font>+ </family>+ <family lang="und-Marc">+ <font weight="400" style="normal">NotoSansMarchen-Regular.otf</font>+ </family>+ <family lang="und-Merc">+ <font weight="400" style="normal">NotoSansMeroitic-Regular.otf</font>+ </family>+ <family lang="und-Plrd">+ <font weight="400" style="normal">NotoSansMiao-Regular.otf</font>+ </family>+ <family lang="und-Mroo">+ <font weight="400" style="normal">NotoSansMro-Regular.otf</font>+ </family>+ <family lang="und-Mult">+ <font weight="400" style="normal">NotoSansMultani-Regular.otf</font>+ </family>+ <family lang="und-Nbat">+ <font weight="400" style="normal">NotoSansNabataean-Regular.otf</font>+ </family>+ <family lang="und-Newa">+ <font weight="400" style="normal">NotoSansNewa-Regular.otf</font>+ </family>+ <family lang="und-Narb">+ <font weight="400" style="normal">NotoSansOldNorthArabian-Regular.otf</font>+ </family>+ <family lang="und-Perm">+ <font weight="400" style="normal">NotoSansOldPermic-Regular.otf</font>+ </family>+ <family lang="und-Hmng">+ <font weight="400" style="normal">NotoSansPahawhHmong-Regular.otf</font>+ </family>+ <family lang="und-Palm">+ <font weight="400" style="normal">NotoSansPalmyrene-Regular.otf</font>+ </family>+ <family lang="und-Pauc">+ <font weight="400" style="normal">NotoSansPauCinHau-Regular.otf</font>+ </family>+ <family lang="und-Shrd">+ <font weight="400" style="normal">NotoSansSharada-Regular.otf</font>+ </family>+ <family lang="und-Sora">+ <font weight="400" style="normal">NotoSansSoraSompeng-Regular.otf</font>+ </family>+</familyset>diff --git a/OCR-translation/src/main/java/dev/davidv/translator/AidlTranslationService.kt b/OCR-translation/src/main/java/dev/davidv/translator/AidlTranslationService.ktnew file mode 100644index 0000000..e356c18--- /dev/null+++ b/OCR-translation/src/main/java/dev/davidv/translator/AidlTranslationService.kt@@ -0,0 +1,148 @@+package dev.davidv.translator++import android.app.Service+import android.content.Intent+import android.os.IBinder+import android.util.Log+import kotlinx.coroutines.CoroutineScope+import kotlinx.coroutines.Dispatchers+import kotlinx.coroutines.SupervisorJob+import kotlinx.coroutines.cancel+import kotlinx.coroutines.delay+import kotlinx.coroutines.flow.first+import kotlinx.coroutines.launch++class AidlTranslationService : Service() {+ private val tag = this.javaClass.name.substringAfterLast('.')++ private lateinit var settingsManager: SettingsManager+ private lateinit var translationCoordinator: TranslationCoordinator+ private lateinit var langStateManager: LanguageStateManager+ private val serviceScope = CoroutineScope(SupervisorJob() + Dispatchers.Main)++ override fun onCreate() {+ super.onCreate()+ settingsManager = SettingsManager(this)+ val filePathManager = FilePathManager(this, settingsManager.settings)+ langStateManager = LanguageStateManager(serviceScope, filePathManager, null)+ val languageDetector = LanguageDetector(langStateManager::languageByCode)+ val imageProcessor = ImageProcessor(this, filePathManager)++ serviceScope.launch {+ langStateManager.catalog.collect { catalog ->+ if (catalog == null) return@collect+ val translationService = TranslationService(settingsManager, filePathManager)+ val speechService = SpeechService(settingsManager, filePathManager)+ translationCoordinator = TranslationCoordinator(translationService, speechService, languageDetector, imageProcessor, settingsManager)+ Log.d(tag, "TranslationCoordinator initialized")+ }+ }+ Log.d(tag, "onCreate")+ }++ override fun onBind(intent: Intent?): IBinder {+ Log.d(tag, "onBind")+ return binder+ }++ private val binder =+ object : ITranslationService.Stub() {+ override fun translate(+ textToTranslate: String?,+ fromLanguageStr: String?,+ toLanguageStr: String?,+ callback: ITranslationCallback?,+ ) {+ Log.d(tag, "txt len:${textToTranslate?.length ?: -1}, from:$fromLanguageStr, to:$toLanguageStr, cb = ${callback != null}")++ if (textToTranslate == null || callback == null) {+ Log.w(tag, "translate: textToTranslate or callback is null")+ return+ }++ val fromLanguage = fromLanguageStr?.takeIf { it.isNotEmpty() }?.let { langStateManager.languageByCode(it) }+ val toLanguage = toLanguageStr?.takeIf { it.isNotEmpty() }?.let { langStateManager.languageByCode(it) }++ CoroutineScope(Dispatchers.IO).launch {+ langStateManager.languageState.first { !it.isChecking }+ val langs = langStateManager.languageState.value.translatorLanguages()+ while (translationCoordinator.isTranslating.value) {+ delay(100)+ }+ val from = fromLanguage ?: translationCoordinator.detectLanguageRobust(textToTranslate, null, langs)+ Log.d(tag, "Detected lang $from")+ if (from == null) {+ Log.d(tag, "Could not detect language")+ val err =+ TranslationError().apply {+ type = ErrorType.COULD_NOT_DETECT_LANGUAGE+ language = null+ message = null+ }+ callback.onTranslationError(err)+ return@launch+ }+ if (!langs.contains(from)) {+ Log.d(tag, "Detected language ${from.displayName} not available")+ val err =+ TranslationError().apply {+ type = ErrorType.DETECTED_BUT_UNAVAILABLE+ language = from.displayName+ message = null+ }+ callback.onTranslationError(err)+ return@launch+ }+ val to = toLanguage ?: langStateManager.languageByCode(settingsManager.settings.value.defaultTargetLanguageCode)+ if (to == null) {+ val err =+ TranslationError().apply {+ type = ErrorType.UNEXPECTED+ language = null+ message = getString(R.string.aidl_target_unavailable)+ }+ callback.onTranslationError(err)+ return@launch+ }+ when (val result = translationCoordinator.translateText(from, to, textToTranslate)) {+ is TranslationResult.Success -> {+ val translatedText = result.result.translated+ Log.d(tag, "translated text: $translatedText")+ callback.onTranslationResult(translatedText)+ }++ is TranslationResult.Error -> {+ Log.d(tag, "Translation error: ${result.message}")+ val err =+ TranslationError().apply {+ type = ErrorType.UNEXPECTED+ language = null+ message = result.message+ }+ callback.onTranslationError(err)+ }+ }+ }+ }+ }++ override fun onStartCommand(+ intent: Intent?,+ flags: Int,+ startId: Int,+ ): Int {+ Log.d(tag, "onStartCommand received, but this service is meant to be bound.")+ return START_NOT_STICKY+ }++ override fun onUnbind(intent: Intent?): Boolean {+ Log.d(tag, "onUnbind")+ return super.onUnbind(intent)+ }++ override fun onDestroy() {+ Log.d(tag, "onDestroy")+ serviceScope.cancel()+ super.onDestroy()+ }+}diff --git a/OCR-translation/src/main/java/dev/davidv/translator/AppSettings.kt b/OCR-translation/src/main/java/dev/davidv/translator/AppSettings.ktnew file mode 100644index 0000000..501ad2f--- /dev/null+++ b/OCR-translation/src/main/java/dev/davidv/translator/AppSettings.kt@@ -0,0 +1,71 @@+/*+ * Copyright (C) 2024 David V+ *+ * This program 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.+ *+ * This program 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 <https://www.gnu.org/licenses/>.+ */++package dev.davidv.translator++import androidx.annotation.StringRes++object Constants {+ const val DEFAULT_CATALOG_INDEX_URL = "https://offline-translator.davidv.dev/index_v6.json"+}++enum class AssistantAction(+ @StringRes val labelRes: Int,+) {+ STILL_IMAGE(R.string.assistant_action_still_image),+ LIVE_SCREEN(R.string.assistant_action_live_screen),+}++enum class HttpServerBindMode(+ @StringRes val labelRes: Int,+) {+ LOCALHOST(R.string.settings_http_server_bind_localhost),+ ALL_INTERFACES(R.string.settings_http_server_bind_all),+}++data class AppSettings(+ val defaultTargetLanguageCode: String = "en",+ val defaultSourceLanguageCode: String? = null,+ val catalogIndexUrl: String = Constants.DEFAULT_CATALOG_INDEX_URL,+ val backgroundMode: BackgroundMode = BackgroundMode.AUTO_DETECT,+ val minConfidence: Int = 75,+ val maxImageSize: Int = 1400,+ val disableCLD: Boolean = false,+ val experimentalScreenTranslate: Boolean = false,+ val enableOutputTransliteration: Boolean = true,+ val useExternalStorage: Boolean = false,+ val fontFactor: Float = 1.0f,+ val showTransliterationOnInput: Boolean = false,+ val onlyShowOutputOnReadonlyModal: Boolean = false,+ val readonlyModalOutputAlignment: ReadonlyModalOutputAlignment = ReadonlyModalOutputAlignment.MIDDLE,+ val readonlyModalCompactHeightFactor: Float = 0.35f,+ val addSpacesForJapaneseTransliteration: Boolean = true,+ val ttsPlaybackSpeed: Float = 1.0f,+ val ttsPlaybackSpeedOverrides: Map<String, Float> = emptyMap(),+ val ttsVoiceOverrides: Map<String, String> = emptyMap(),+ val ttsReadUrlsAndHashtags: Boolean = false,+ val tapToTranslateEnabled: Boolean = false,+ val clearWebTranslatorDataOnClose: Boolean = true,+ val translatePdfImages: Boolean = true,+ val liveCameraOverlayEnabled: Boolean = true,+ val registerAsBrowser: Boolean = true,+ val assistantAction: AssistantAction = AssistantAction.STILL_IMAGE,+ val multiTargetEnabled: Boolean = false,+ val httpServerEnabled: Boolean = false,+ val httpServerPort: Int = 5000,+ val httpServerBindMode: HttpServerBindMode = HttpServerBindMode.LOCALHOST,+)diff --git a/OCR-translation/src/main/java/dev/davidv/translator/BatchTextTranslator.kt b/OCR-translation/src/main/java/dev/davidv/translator/BatchTextTranslator.ktnew file mode 100644index 0000000..4057ccd--- /dev/null+++ b/OCR-translation/src/main/java/dev/davidv/translator/BatchTextTranslator.kt@@ -0,0 +1,11 @@+package dev.davidv.translator++sealed class BatchTextTranslationOutput {+ data class Translated(+ val results: LinkedHashMap<String, String>,+ ) : BatchTextTranslationOutput()++ data class NothingToTranslate(+ val reason: NothingReason,+ ) : BatchTextTranslationOutput()+}diff --git a/OCR-translation/src/main/java/dev/davidv/translator/CatalogModels.kt b/OCR-translation/src/main/java/dev/davidv/translator/CatalogModels.ktnew file mode 100644index 0000000..2082d35--- /dev/null+++ b/OCR-translation/src/main/java/dev/davidv/translator/CatalogModels.kt@@ -0,0 +1,541 @@+package dev.davidv.translator++import android.graphics.Bitmap+import uniffi.bindings.CatalogException+import uniffi.bindings.CatalogHandle+import uniffi.bindings.DocumentProgressEvent+import uniffi.bindings.DocumentProgressSink+import uniffi.bindings.TxtLayout+import java.nio.ByteBuffer++typealias CatalogError = CatalogException++// / Caller-chosen layout for `.txt` translation. Ignored for other+// / document types. `Reflow.wrapColumns == null` means do not re-wrap.+sealed class TxtLayoutChoice {+ data object Preserve : TxtLayoutChoice()++ data class Reflow(val wrapColumns: Int?) : TxtLayoutChoice()++ fun toUniffi(): TxtLayout =+ when (this) {+ Preserve -> TxtLayout.Preserve+ is Reflow -> TxtLayout.Reflow(wrap = wrapColumns?.toUInt())+ }+}++sealed class DocumentTranslationProgress {+ data object Preparing : DocumentTranslationProgress()++ data class PdfPlan(+ val textPages: Int,+ val imageXobjects: Int,+ val rasterPages: Int,+ ) : DocumentTranslationProgress()++ /** Text-translation completion as a smooth fraction in [0, 1]. */+ data class TranslatingText(+ val fraction: Float,+ ) : DocumentTranslationProgress()++ /** Image-XObject OCR pass: real item counts. */+ data class TranslatingImages(+ val current: Int,+ val total: Int,+ ) : DocumentTranslationProgress()++ /** Page-raster overlay pass: real item counts. */+ data class TranslatingRasterPages(+ val current: Int,+ val total: Int,+ ) : DocumentTranslationProgress()++ data object Writing : DocumentTranslationProgress()+}++private fun DocumentProgressEvent.toDocumentTranslationProgress(): DocumentTranslationProgress =+ when (this) {+ DocumentProgressEvent.Preparing -> DocumentTranslationProgress.Preparing+ is DocumentProgressEvent.PdfPlan ->+ DocumentTranslationProgress.PdfPlan(+ textPages = textPages.toInt(),+ imageXobjects = imageXobjects.toInt(),+ rasterPages = rasterPages.toInt(),+ )+ is DocumentProgressEvent.TranslatingText ->+ DocumentTranslationProgress.TranslatingText(fraction = fraction)+ is DocumentProgressEvent.TranslatingImages ->+ DocumentTranslationProgress.TranslatingImages(+ current = current.toInt(),+ total = total.toInt(),+ )+ is DocumentProgressEvent.TranslatingRasterPages ->+ DocumentTranslationProgress.TranslatingRasterPages(+ current = current.toInt(),+ total = total.toInt(),+ )+ DocumentProgressEvent.Writing -> DocumentTranslationProgress.Writing+ }++private fun rgbaBytes(bitmap: Bitmap): ByteArray {+ val start = System.nanoTime()+ return ByteArray(bitmap.byteCount).also { bytes ->+ bitmap.copyPixelsToBuffer(ByteBuffer.wrap(bytes))+ android.util.Log.i(+ "CatalogModels",+ "rgbaBytes extract: ${bitmap.width}x${bitmap.height} ${bytes.size / 1024}KB — ${(System.nanoTime() - start) / 1_000_000.0}ms",+ )+ }+}++data class LanguageTtsRegionV2(+ val displayName: String,+ val voices: List<String> = emptyList(),+)++data class LanguageAvailabilityEntry(+ val language: Language,+ val availability: LangAvailability,+)++data class CatalogFileEntry(+ val name: String,+ val sizeBytes: Long,+ val installPath: String,+ val url: String,+)++class LanguageCatalog private constructor(+ private val handle: CatalogHandle,+ val baseDir: String,+ val formatVersion: Int,+ val generatedAt: Long,+ val dictionaryVersion: Int,+ val languageRows: List<LanguageAvailabilityEntry>,+ val languageList: List<Language>,+ private val languagesByCode: Map<String, Language>,+ private val availabilityByCode: Map<String, LangAvailability>,+) {+ companion object {+ fun open(+ bundledJson: String,+ diskJson: String?,+ baseDir: String,+ ): LanguageCatalog? {+ val handle = CatalogHandle.open(bundledJson, diskJson, baseDir)+ val rows = handle.languageRows()+ val languageRows =+ rows.map { row ->+ LanguageAvailabilityEntry(+ language =+ Language(+ code = row.language.code,+ displayName = row.language.displayName,+ shortDisplayName = row.language.shortDisplayName,+ script = row.language.script,+ writingSystem = row.language.writingSystem,+ dictionaryCode = row.language.dictionaryCode,+ ),+ availability =+ LangAvailability(+ hasFromEnglish = row.availability.hasFromEnglish,+ hasToEnglish = row.availability.hasToEnglish,+ ocrFiles = row.availability.ocrFiles,+ dictionaryFiles = row.availability.dictionaryFiles,+ ttsFiles = row.availability.ttsFiles,+ ),+ )+ }+ val languageList = languageRows.map { it.language }+ val languagesByCode = languageList.associateBy { it.code }+ val availabilityByCode =+ languageRows.associate { row -> row.language.code to row.availability }+ return LanguageCatalog(+ handle = handle,+ baseDir = baseDir,+ formatVersion = handle.formatVersion(),+ generatedAt = handle.generatedAt(),+ dictionaryVersion = handle.dictionaryVersion(),+ languageRows = languageRows,+ languageList = languageList,+ languagesByCode = languagesByCode,+ availabilityByCode = availabilityByCode,+ )+ }+ }++ val english: Language by lazy {+ languagesByCode.getValue("en")+ }++ fun languageByCode(code: String): Language? = languagesByCode[code]++ fun dictionaryInfoFor(language: Language): DictionaryInfo? = dictionaryInfo(language.dictionaryCode)++ fun dictionaryInfo(dictionaryCode: String): DictionaryInfo? =+ handle.dictionaryInfo(dictionaryCode)?.let {+ DictionaryInfo(date = it.date, filename = it.filename, size = it.size.toLong(), type = it.typeName, wordCount = it.wordCount.toLong())+ }++ fun supportFilesByKind(kind: String): List<CatalogFileEntry> =+ handle.supportFilesByKind(kind).map { file ->+ CatalogFileEntry(+ name = file.name,+ sizeBytes = file.sizeBytes.toLong(),+ installPath = file.installPath,+ url = file.url,+ )+ }++ @Throws(CatalogException::class)+ fun lookupDictionary(+ language: Language,+ word: String,+ ): WordWithTaggedEntries? = handle.lookupDictionary(language.code, word)++ fun availabilityFor(language: Language?): LangAvailability? = language?.let { availabilityByCode[it.code] }++ fun hasTtsVoices(languageCode: String): Boolean = handle.hasTtsVoices(languageCode)++ fun installedOcrEngines(languageCode: String): List<String> = handle.installedOcrEngines(languageCode)++ fun availableOcrEngines(languageCode: String): List<String> = handle.availableOcrEngines(languageCode)++ fun planOcrEngineDownload(+ languageCode: String,+ engine: String,+ ): DownloadPlan? = handle.planOcrEngineDownload(languageCode, engine)++ fun planOcrEngineDownloads(+ languageCodes: List<String>,+ engine: String,+ ): DownloadPlan = handle.planOcrEngineDownloads(languageCodes, engine)++ fun planOcrEngineUpgrades(+ languageCodes: List<String>,+ engine: String,+ ): DownloadPlan = handle.planOcrEngineUpgrades(languageCodes, engine)++ fun planTranslationUpgrades(languageCodes: List<String>): DownloadPlan = handle.planTranslationUpgrades(languageCodes)++ fun translationUpgradeLanguageCodes(): List<String> = handle.translationUpgradeLanguageCodes()++ fun planDeleteSupersededFiles(): DeletePlan = handle.planDeleteSupersededFiles()++ fun planRepair(): DownloadPlan = handle.planRepair()++ fun ocrEngineReady(): Boolean = handle.ocrEngineReady()++ fun ttsVoicePickerRegions(languageCode: String): List<TtsVoicePickerRegion> = handle.ttsVoicePickerRegions(languageCode)++ fun installedTtsVoicePickerRegions(languageCode: String): List<TtsVoicePickerRegion> = handle.installedTtsVoicePickerRegions(languageCode)++ fun ttsSampleText(languageCode: String): String? = handle.ttsSampleText(languageCode)++ fun canSwapLanguages(+ from: Language,+ to: Language,+ ): Boolean = handle.canSwapLanguages(from.code, to.code)++ fun canTranslate(+ from: Language,+ to: Language,+ ): Boolean = handle.canTranslate(from.code, to.code)++ fun warmTranslationModels(+ from: Language,+ to: Language,+ ): Boolean = handle.warmTranslationModels(from.code, to.code)++ @Throws(CatalogException::class)+ fun translateText(+ from: Language,+ to: Language,+ text: String,+ ): String = handle.translateText(from.code, to.code, text)++ fun translateTextWithAlternatives(+ from: Language,+ to: Language,+ text: String,+ ): TranslationWithAlternatives = handle.translateTextWithAlternatives(from.code, to.code, text)++ fun steer(+ from: Language,+ to: Language,+ source: String,+ forcedPrefix: String,+ ): TranslationWithAlternatives = handle.steer(from.code, to.code, source, forcedPrefix)++ fun translateMixedTexts(+ inputs: List<String>,+ forcedSourceLanguage: Language?,+ targetLanguage: Language,+ availableLanguages: List<Language>,+ ): uniffi.translator_translate.MixedTextTranslationResult =+ handle.translateMixedTexts(+ inputs,+ forcedSourceLanguage?.code,+ targetLanguage.code,+ availableLanguages.map { it.code },+ )++ @Throws(CatalogException::class)+ fun translateHtmlFragments(+ from: Language,+ to: Language,+ fragments: List<String>,+ ): List<String> = handle.translateHtmlFragments(from.code, to.code, fragments)++ @Throws(CatalogException::class)+ fun translateImagePlan(+ bitmap: Bitmap,+ maxImageSize: Int,+ sourceSelection: uniffi.translator_core.OcrSourceSelection,+ to: Language,+ minConfidence: Int,+ readingOrder: ReadingOrder?,+ backgroundMode: BackgroundMode,+ detection: List<uniffi.translator_core.DetectedTextBox>? = null,+ ): uniffi.translator_core.PreparedImageOverlay =+ handle.translateImagePlan(+ rgbaBytes(bitmap),+ bitmap.width.toUInt(),+ bitmap.height.toUInt(),+ maxImageSize.toUInt(),+ sourceSelection,+ to.code,+ minConfidence.toUInt(),+ readingOrder,+ backgroundMode,+ detection,+ )++ @Throws(CatalogException::class)+ fun detectImageBoxes(+ bitmap: Bitmap,+ maxImageSize: Int,+ ): List<uniffi.translator_core.DetectedTextBox> =+ handle.detectImageBoxes(+ rgbaBytes(bitmap),+ bitmap.width.toUInt(),+ bitmap.height.toUInt(),+ maxImageSize.toUInt(),+ )++ @Throws(CatalogException::class)+ fun retranslateImagePlan(+ prepared: uniffi.translator_core.PreparedImageOverlay,+ from: Language,+ to: Language,+ ): uniffi.translator_core.PreparedImageOverlay = handle.retranslateImagePlan(prepared, from.code, to.code)++ @Throws(CatalogException::class)+ fun ocrImageDetect(+ img: uniffi.bindings.OcrImage,+ maxImageSize: Int,+ ): List<uniffi.translator_core.DetectedTextBox> = img.detect(handle, maxImageSize.toUInt())++ @Throws(CatalogException::class)+ fun ocrImagePlan(+ img: uniffi.bindings.OcrImage,+ maxImageSize: Int,+ sourceSelection: uniffi.translator_core.OcrSourceSelection,+ to: Language,+ minConfidence: Int,+ readingOrder: ReadingOrder?,+ backgroundMode: BackgroundMode,+ detection: List<uniffi.translator_core.DetectedTextBox>?,+ ): uniffi.translator_core.PreparedImageOverlay =+ img.ocr(+ handle,+ maxImageSize.toUInt(),+ sourceSelection,+ to.code,+ minConfidence.toUInt(),+ readingOrder,+ backgroundMode,+ detection,+ )++ @Throws(CatalogException::class)+ fun ocrImageRenderInto(+ img: uniffi.bindings.OcrImage,+ plan: uniffi.translator_core.PreparedImageOverlay,+ to: Language,+ minFontSizePx: Float,+ dstAddr: Long,+ ): List<uniffi.translator_core.PositionedWord> = img.renderInto(plan, to.code, minFontSizePx, dstAddr.toULong())++ @Throws(CatalogException::class)+ fun ocrImageRetranslateInto(+ img: uniffi.bindings.OcrImage,+ plan: uniffi.translator_core.PreparedImageOverlay,+ from: Language,+ to: Language,+ minFontSizePx: Float,+ dstAddr: Long,+ ): uniffi.bindings.RetranslateResult = img.retranslateInto(handle, plan, from.code, to.code, minFontSizePx, dstAddr.toULong())++ /** Internal accessor for the raw uniffi `CatalogHandle`. The live-+ * overlay pipeline constructor takes this so it can hold an Arc to+ * the underlying TranslatorSession for its async acquire/refresh+ * worker, and the API server resolves the current session through+ * it per request. */+ internal fun planarHandle(): CatalogHandle = handle++ @Throws(CatalogException::class)+ fun renderTranslatedOverlay(+ plan: uniffi.translator_core.PreparedImageOverlay,+ targetLanguage: Language,+ minFontSizePx: Float,+ ): uniffi.translator_render.RenderedOverlay = uniffi.bindings.renderTranslatedOverlay(plan, targetLanguage.code, minFontSizePx)++ @Throws(CatalogException::class)+ fun detectDocumentQuad(bitmap: Bitmap): uniffi.translator_align.DocumentDetection? =+ handle.detectDocumentQuad(rgbaBytes(bitmap), bitmap.width.toUInt(), bitmap.height.toUInt())++ @Throws(CatalogException::class)+ fun warpDocumentRgba(+ bitmap: Bitmap,+ quad: uniffi.translator_align.DocumentQuad,+ outWidth: Int? = null,+ outHeight: Int? = null,+ postprocess: Boolean = true,+ ): uniffi.translator_align.WarpedImageRgba =+ handle.warpDocumentRgba(+ rgbaBytes(bitmap),+ bitmap.width.toUInt(),+ bitmap.height.toUInt(),+ quad,+ outWidth?.toUInt(),+ outHeight?.toUInt(),+ postprocess,+ )++ @Throws(CatalogException::class)+ fun translateDocumentPath(+ inputPath: String,+ outputPath: String,+ from: Language,+ to: Language,+ translatePdfImages: Boolean,+ txtLayout: TxtLayoutChoice,+ onProgress: (DocumentTranslationProgress) -> Unit = {},+ isCancelled: () -> Boolean = { false },+ ): String =+ handle.translateDocumentPathWithProgress(+ inputPath,+ outputPath,+ from.code,+ to.code,+ translatePdfImages,+ txtLayout.toUniffi(),+ object : DocumentProgressSink {+ override fun onProgress(event: DocumentProgressEvent) {+ onProgress(event.toDocumentTranslationProgress())+ }++ override fun isCancelled(): Boolean = isCancelled()+ },+ )++ /** Abort an in-flight document translation; workers stop within ~one batch. */+ fun cancelOngoingWork() = handle.cancelOngoingWork()++ /** ONNX→MNN migrations needed for this install (only entries whose `.onnx` is+ * on disk). Run `needsConvert` jobs through [ModelConverterJni], then pass the+ * finished/cleanup/discarded jobs to [discardMigration]. */+ fun planMigration(): List<uniffi.bindings.MigrationJobRecord> = handle.planMigration()++ /** Delete each job's source `.onnx` and refresh the catalog snapshot. */+ fun discardMigration(jobs: List<uniffi.bindings.MigrationJobRecord>) = handle.discardMigration(jobs)++ fun planDownload(+ languageCode: String,+ feature: Feature,+ selectedTtsPackId: String? = null,+ ): DownloadPlan? = handle.planDownload(languageCode, feature, selectedTtsPackId)++ fun planSupportDownloadByKind(kind: String): DownloadPlan? = handle.planSupportDownloadByKind(kind)++ fun prepareDelete(+ languageCode: String,+ feature: Feature,+ ): DeletePlan = handle.prepareDelete(languageCode, feature)++ fun prepareDeleteSupportByKind(kind: String): DeletePlan = handle.prepareDeleteSupportByKind(kind)++ fun prepareDeleteSupersededTts(+ languageCode: String,+ selectedPackId: String,+ ): DeletePlan = handle.prepareDeleteSupersededTts(languageCode, selectedPackId)++ fun prepareDeleteTtsPack(packId: String): DeletePlan = handle.prepareDeleteTtsPack(packId)++ fun defaultTtsPackIdForLanguage(languageCode: String): String? = handle.defaultTtsPackId(languageCode)++ fun sizeBytesForFeature(+ languageCode: String,+ feature: Feature,+ ): Long = handle.sizeBytes(languageCode, feature).toLong()++ fun supportSizeBytesByKind(kind: String): Long = handle.supportSizeBytesByKind(kind).toLong()++ fun supportInstalledByKind(kind: String): Boolean {+ val sizeBytes = supportSizeBytesByKind(kind)+ val plan = planSupportDownloadByKind(kind)+ val installed = plan != null && sizeBytes > 0 && plan.tasks.isEmpty()+ android.util.Log.i(+ "CatalogSupport",+ "supportInstalledByKind $kind: size=$sizeBytes tasks=${plan?.tasks?.size ?: -1} -> $installed",+ )+ return installed+ }++ fun availableTtsVoices(languageCode: String): List<TtsVoiceOption> =+ handle.availableTtsVoices(languageCode).map { voice ->+ TtsVoiceOption(+ name = voice.name,+ speakerId = voice.speakerId.toInt(),+ displayName = voice.displayName,+ )+ }++ fun installedTtsVoices(languageCode: String): List<uniffi.translator_core.InstalledTtsPack> = handle.installedTtsVoices(languageCode)++ @Throws(CatalogException::class)+ fun planSpeechChunks(+ languageCode: String,+ text: String,+ packId: String? = null,+ readUrlsAndHashtags: Boolean = false,+ ): List<SpeechChunkPlan> =+ handle+ .planSpeechChunks(+ languageCode,+ text,+ packId,+ if (readUrlsAndHashtags) UrlsAndHashtags.READ else UrlsAndHashtags.SKIP,+ ).map { chunk ->+ SpeechChunkPlan(+ content = chunk.content,+ isPhonemes = chunk.isPhonemes,+ pauseAfterMs = chunk.pauseAfterMs,+ )+ }++ @Throws(CatalogException::class)+ fun synthesizeSpeechPcm(+ languageCode: String,+ text: String,+ speechSpeed: Float,+ voiceName: String?,+ isPhonemes: Boolean,+ packId: String? = null,+ ): PcmAudio {+ val audio =+ handle.synthesizeSpeechPcm(languageCode, text, speechSpeed, voiceName, isPhonemes, packId)+ return PcmAudio(sampleRate = audio.sampleRate, pcmSamples = audio.pcmSamples.toShortArray())+ }+}diff --git a/OCR-translation/src/main/java/dev/davidv/translator/DictionaryIndex.kt b/OCR-translation/src/main/java/dev/davidv/translator/DictionaryIndex.ktnew file mode 100644index 0000000..4fdb6eb--- /dev/null+++ b/OCR-translation/src/main/java/dev/davidv/translator/DictionaryIndex.kt@@ -0,0 +1,26 @@+/*+ * Copyright (C) 2024 David V+ *+ * This program 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.+ *+ * This program 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 <https://www.gnu.org/licenses/>.+ */++package dev.davidv.translator++data class DictionaryInfo(+ val date: Long,+ val filename: String,+ val size: Long,+ val type: String,+ val wordCount: Long,+)diff --git a/OCR-translation/src/main/java/dev/davidv/translator/DocumentImport.kt b/OCR-translation/src/main/java/dev/davidv/translator/DocumentImport.ktnew file mode 100644index 0000000..433051c--- /dev/null+++ b/OCR-translation/src/main/java/dev/davidv/translator/DocumentImport.kt@@ -0,0 +1,97 @@+/*+ * Copyright (C) 2024 David V+ *+ * This program 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.+ *+ * This program 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 <https://www.gnu.org/licenses/>.+ */++package dev.davidv.translator++import android.content.Context+import android.net.Uri+import android.provider.OpenableColumns+import java.io.File++// Shared content-URI import helpers used by both the file picker+// (ImageCaptureComponent) and shared-document intents (MainActivity →+// TranslatorViewModel), so a picked file and a shared file reach the document+// drawer through the same code.++internal fun displayNameForUri(+ context: Context,+ uri: Uri,+): String? =+ context.contentResolver+ .query(uri, arrayOf(OpenableColumns.DISPLAY_NAME), null, null, null)+ ?.use { cursor ->+ if (cursor.moveToFirst()) {+ val index = cursor.getColumnIndex(OpenableColumns.DISPLAY_NAME)+ if (index >= 0) cursor.getString(index) else null+ } else {+ null+ }+ }++internal fun sizeBytesForUri(+ context: Context,+ uri: Uri,+): Long? =+ context.contentResolver+ .query(uri, arrayOf(OpenableColumns.SIZE), null, null, null)+ ?.use { cursor ->+ if (cursor.moveToFirst()) {+ val index = cursor.getColumnIndex(OpenableColumns.SIZE)+ if (index >= 0 && !cursor.isNull(index)) cursor.getLong(index) else null+ } else {+ null+ }+ }++internal fun documentFileExtension(+ context: Context,+ uri: Uri,+): String {+ val displayName = displayNameForUri(context, uri)+ val displayExtension =+ displayName+ ?.substringAfterLast('.', missingDelimiterValue = "")+ ?.takeIf { it.isNotBlank() && it.length <= 8 }+ if (displayExtension != null) return ".$displayExtension"++ return when (context.contentResolver.getType(uri)) {+ "application/pdf" -> ".pdf"+ "text/plain" -> ".txt"+ "application/vnd.oasis.opendocument.text" -> ".odt"+ "application/epub+zip" -> ".epub"+ else -> ".bin"+ }+}++internal fun copyDocumentUriToCache(+ context: Context,+ uri: Uri,+): File {+ val outputFile = File.createTempFile("input_document_", documentFileExtension(context, uri), context.cacheDir)+ context.contentResolver.openInputStream(uri).use { input ->+ requireNotNull(input) { "Unable to open selected document" }+ outputFile.outputStream().use { output ->+ input.copyTo(output)+ }+ }+ return outputFile+}++internal fun isImageUri(+ context: Context,+ uri: Uri,+): Boolean = context.contentResolver.getType(uri)?.startsWith("image/") == truediff --git a/OCR-translation/src/main/java/dev/davidv/translator/DocumentTranslationService.kt b/OCR-translation/src/main/java/dev/davidv/translator/DocumentTranslationService.ktnew file mode 100644index 0000000..548943d--- /dev/null+++ b/OCR-translation/src/main/java/dev/davidv/translator/DocumentTranslationService.kt@@ -0,0 +1,521 @@+/*+ * Copyright (C) 2024 David V+ *+ * This program 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.+ *+ * This program 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 <https://www.gnu.org/licenses/>.+ */++package dev.davidv.translator++import android.app.Notification+import android.app.NotificationChannel+import android.app.NotificationManager+import android.app.PendingIntent+import android.app.Service+import android.content.Context+import android.content.Intent+import android.content.pm.ServiceInfo+import android.os.Build+import android.os.IBinder+import android.util.Log+import androidx.annotation.StringRes+import androidx.core.app.NotificationCompat+import androidx.core.app.NotificationManagerCompat+import androidx.core.content.ContextCompat+import kotlinx.coroutines.CoroutineScope+import kotlinx.coroutines.Dispatchers+import kotlinx.coroutines.Job+import kotlinx.coroutines.SupervisorJob+import kotlinx.coroutines.cancel+import kotlinx.coroutines.flow.MutableStateFlow+import kotlinx.coroutines.flow.StateFlow+import kotlinx.coroutines.flow.asStateFlow+import kotlinx.coroutines.isActive+import kotlinx.coroutines.launch+import java.io.File+import java.util.concurrent.atomic.AtomicBoolean+import kotlin.coroutines.coroutineContext+import kotlin.system.measureTimeMillis++data class PdfPhaseProgress(+ // Text translation is a smooth fraction; the image and raster passes are+ // real, in-order item counts. `textTotal` (page count) is kept for the+ // combined-progress weighting and the page-count display.+ val textFraction: Float = 0f,+ val textTotal: Int,+ val imageCurrent: Int = 0,+ val imageTotal: Int,+ val rasterCurrent: Int = 0,+ val rasterTotal: Int,+)++data class DocumentTranslationServiceState(+ val taskId: Long,+ val fileName: String,+ val fileSizeBytes: Long,+ val outputPath: String? = null,+ val errorMessage: String? = null,+ @StringRes val progressLabelRes: Int = R.string.doc_progress_preparing,+ // Set once a PdfPlan event arrives. While non-null the UI renders+ // three labelled progress bars (text pages / images / raster+ // pages); each phase ticks its own counter. Null for non-PDF+ // (odt/txt) flows where the legacy single-bar fields drive the UI.+ val pdfPhases: PdfPhaseProgress? = null,+ // Non-PDF (txt/odt/epub) text-translation completion fraction in [0, 1].+ val progressFraction: Float? = null,+) {+ val isTranslating: Boolean+ get() = outputPath == null && errorMessage == null+}++class DocumentTranslationService : Service() {+ private val serviceScope = CoroutineScope(Dispatchers.IO + SupervisorJob())+ private var translationJob: Job? = null+ private val cancelRequested = AtomicBoolean(false)++ companion object {+ private const val ACTION_START = "dev.davidv.translator.action.START_DOCUMENT_TRANSLATION"+ private const val ACTION_CANCEL = "dev.davidv.translator.action.CANCEL_DOCUMENT_TRANSLATION"+ private const val EXTRA_TASK_ID = "task_id"+ private const val EXTRA_INPUT_PATH = "input_path"+ private const val EXTRA_OUTPUT_PATH = "output_path"+ private const val EXTRA_FILE_NAME = "file_name"+ private const val EXTRA_FILE_SIZE_BYTES = "file_size_bytes"+ private const val EXTRA_FROM_CODE = "from_code"+ private const val EXTRA_TO_CODE = "to_code"+ private const val EXTRA_DELETE_AFTER_LOAD = "delete_after_load"+ private const val EXTRA_TRANSLATE_PDF_IMAGES = "translate_pdf_images"+ private const val EXTRA_TXT_LAYOUT_REFLOW = "txt_layout_reflow"+ private const val EXTRA_TXT_WRAP_COLUMNS = "txt_wrap_columns"++ private const val CHANNEL_ID = "document_translation"+ private const val NOTIFICATION_ID = 1002++ private val _documentTranslationState = MutableStateFlow<DocumentTranslationServiceState?>(null)+ val documentTranslationState: StateFlow<DocumentTranslationServiceState?> = _documentTranslationState.asStateFlow()++ fun startTranslation(+ context: Context,+ inputPath: String,+ outputPath: String,+ displayName: String,+ sizeBytes: Long,+ from: Language,+ to: Language,+ deleteAfterLoad: Boolean,+ translatePdfImages: Boolean,+ txtLayout: TxtLayoutChoice,+ ) {+ val taskId = System.currentTimeMillis()+ _documentTranslationState.value =+ DocumentTranslationServiceState(+ taskId = taskId,+ fileName = displayName,+ fileSizeBytes = sizeBytes,+ )++ val intent =+ Intent(context, DocumentTranslationService::class.java).apply {+ action = ACTION_START+ putExtra(EXTRA_TASK_ID, taskId)+ putExtra(EXTRA_INPUT_PATH, inputPath)+ putExtra(EXTRA_OUTPUT_PATH, outputPath)+ putExtra(EXTRA_FILE_NAME, displayName)+ putExtra(EXTRA_FILE_SIZE_BYTES, sizeBytes)+ putExtra(EXTRA_FROM_CODE, from.code)+ putExtra(EXTRA_TO_CODE, to.code)+ putExtra(EXTRA_DELETE_AFTER_LOAD, deleteAfterLoad)+ putExtra(EXTRA_TRANSLATE_PDF_IMAGES, translatePdfImages)+ putExtra(EXTRA_TXT_LAYOUT_REFLOW, txtLayout is TxtLayoutChoice.Reflow)+ putExtra(EXTRA_TXT_WRAP_COLUMNS, (txtLayout as? TxtLayoutChoice.Reflow)?.wrapColumns ?: -1)+ }+ ContextCompat.startForegroundService(context, intent)+ }++ fun dismiss(context: Context) {+ _documentTranslationState.value = null+ NotificationManagerCompat.from(context).cancel(NOTIFICATION_ID)+ }++ fun cancel(context: Context) {+ _documentTranslationState.value = null+ NotificationManagerCompat.from(context).cancel(NOTIFICATION_ID)+ val intent =+ Intent(context, DocumentTranslationService::class.java).apply {+ action = ACTION_CANCEL+ }+ context.startService(intent)+ }+ }++ override fun onBind(intent: Intent?): IBinder? = null++ override fun onStartCommand(+ intent: Intent?,+ flags: Int,+ startId: Int,+ ): Int {+ if (intent?.action == ACTION_CANCEL) {+ cancelDocumentTranslation()+ return START_NOT_STICKY+ }+ if (intent?.action != ACTION_START) return START_NOT_STICKY+ val request = intent.toTranslationRequest() ?: return START_NOT_STICKY++ ensureChannel()+ cancelRequested.set(false)+ startForegroundCompat(buildNotification(request.initialState()))++ translationJob?.cancel()+ translationJob =+ serviceScope.launch {+ translateDocument(request)+ }++ return START_NOT_STICKY+ }++ override fun onDestroy() {+ translationJob?.cancel()+ serviceScope.cancel()+ super.onDestroy()+ }++ private suspend fun translateDocument(request: DocumentTranslationRequest) {+ val app = application as TranslatorApplication+ val inputFile = File(request.inputPath)+ try {+ val catalog =+ app.filePathManager.loadCatalog()+ ?: throw IllegalStateException("Catalog unavailable")+ val from = catalog.languageByCode(request.fromCode) ?: throw IllegalStateException("Source language unavailable")+ val to = catalog.languageByCode(request.toCode) ?: throw IllegalStateException("Target language unavailable")++ updateState(request.taskId) {+ it.copy(progressLabelRes = R.string.doc_progress_preparing, progressFraction = null)+ }++ var result: Result<String>? = null+ val elapsedMs =+ measureTimeMillis {+ result =+ app.translationCoordinator.translateDocumentPath(+ inputPath = request.inputPath,+ outputPath = request.outputPath,+ from = from,+ to = to,+ translatePdfImages = request.translatePdfImages,+ txtLayout = request.txtLayout,+ onProgress = { progress ->+ updateProgress(request.taskId, progress)+ },+ isCancelled = { cancelRequested.get() },+ )+ }+ Log.i(+ "DocumentTranslationService",+ "${if (cancelRequested.get()) "Cancelled" else "Translated"} ${request.fileName} from ${from.code} to ${to.code} in ${elapsedMs}ms",+ )++ if (cancelRequested.get()) return+ if (!coroutineContext.isActive) return++ requireNotNull(result)+ .onSuccess { outputPath ->+ updateState(request.taskId) {+ it.copy(+ outputPath = outputPath,+ errorMessage = null,+ progressLabelRes = R.string.doc_progress_translated,+ progressFraction = 1f,+ pdfPhases =+ it.pdfPhases?.let { p ->+ p.copy(+ textFraction = 1f,+ imageCurrent = p.imageTotal,+ rasterCurrent = p.rasterTotal,+ )+ },+ )+ }+ }.onFailure { error ->+ val message = error.message ?: getString(R.string.doc_translation_failed)+ updateState(request.taskId) {+ it.copy(errorMessage = message)+ }+ }+ } catch (e: Exception) {+ if (cancelRequested.get()) {+ Log.i("DocumentTranslationService", "Cancelled ${request.fileName}")+ return+ }+ Log.e("DocumentTranslationService", "Document translation failed", e)+ updateState(request.taskId) {+ it.copy(errorMessage = e.message ?: getString(R.string.doc_translation_failed))+ }+ } finally {+ if (request.deleteAfterLoad) {+ inputFile.delete()+ }+ documentTranslationState.value?.let { state ->+ if (state.taskId == request.taskId) {+ updateNotification(state)+ }+ }+ removeForegroundNotification()+ stopSelf()+ }+ }++ private fun cancelDocumentTranslation() {+ cancelRequested.set(true)+ // Push the cancel into the engine so slimt's workers abort the in-flight+ // single-batch translation within ~one batch (the `isCancelled` flag is+ // only polled at coarse pre-phase checkpoints now).+ (application as TranslatorApplication).translationCoordinator.cancelOngoingWork()+ _documentTranslationState.value = null+ removeForegroundNotification()+ }++ private fun updateProgress(+ taskId: Long,+ progress: DocumentTranslationProgress,+ ) {+ updateState(taskId) { current ->+ when (progress) {+ DocumentTranslationProgress.Preparing ->+ current.copy(+ progressLabelRes = R.string.doc_progress_preparing,+ )+ is DocumentTranslationProgress.PdfPlan ->+ current.copy(+ progressLabelRes = R.string.doc_progress_translating,+ pdfPhases =+ PdfPhaseProgress(+ textTotal = progress.textPages,+ imageTotal = progress.imageXobjects,+ rasterTotal = progress.rasterPages,+ ),+ )+ is DocumentTranslationProgress.TranslatingText ->+ if (current.pdfPhases != null) {+ current.copy(+ progressLabelRes = R.string.doc_progress_translating,+ pdfPhases = current.pdfPhases.copy(textFraction = progress.fraction),+ )+ } else {+ current.copy(+ progressLabelRes = R.string.doc_progress_translating,+ progressFraction = progress.fraction,+ )+ }+ is DocumentTranslationProgress.TranslatingImages ->+ current.copy(+ progressLabelRes = R.string.doc_progress_translating,+ pdfPhases =+ current.pdfPhases?.copy(+ imageCurrent = progress.current,+ imageTotal = progress.total,+ ),+ )+ is DocumentTranslationProgress.TranslatingRasterPages ->+ current.copy(+ progressLabelRes = R.string.doc_progress_translating,+ pdfPhases =+ current.pdfPhases?.copy(+ rasterCurrent = progress.current,+ rasterTotal = progress.total,+ ),+ )+ DocumentTranslationProgress.Writing ->+ current.copy(+ progressLabelRes = R.string.doc_progress_saving,+ )+ }+ }+ }++ private fun updateState(+ taskId: Long,+ transform: (DocumentTranslationServiceState) -> DocumentTranslationServiceState,+ ) {+ val current = documentTranslationState.value ?: return+ if (current.taskId != taskId) return+ val next = transform(current)+ _documentTranslationState.value = next+ updateNotification(next)+ }++ private fun buildNotification(state: DocumentTranslationServiceState): Notification {+ val openIntent =+ Intent(this, MainActivity::class.java).apply {+ flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TOP+ }+ val openPendingIntent =+ PendingIntent.getActivity(+ this,+ 0,+ openIntent,+ PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE,+ )++ val notification =+ NotificationCompat.Builder(this, CHANNEL_ID)+ .setSmallIcon(R.drawable.ic_translate_button)+ .setContentTitle(+ getString(+ if (state.isTranslating) R.string.doc_notif_translating else R.string.doc_notif_translated,+ ),+ )+ .setContentText(notificationText(state))+ .setContentIntent(openPendingIntent)+ .setPriority(NotificationCompat.PRIORITY_LOW)+ .setCategory(NotificationCompat.CATEGORY_PROGRESS)+ .setOngoing(state.isTranslating)+ .setAutoCancel(!state.isTranslating)+ .setOnlyAlertOnce(true)++ if (state.isTranslating) {+ val phases = state.pdfPhases+ if (phases != null) {+ // Combine the three phases into one bar: the text pass contributes+ // `fraction × pages` page-equivalents alongside the real image/raster+ // counts.+ val total = phases.textTotal + phases.imageTotal + phases.rasterTotal+ if (total > 0) {+ val current =+ (phases.textFraction * phases.textTotal).toInt() ++ phases.imageCurrent ++ phases.rasterCurrent+ notification.setProgress(total, current.coerceIn(0, total), false)+ }+ } else {+ val fraction = state.progressFraction+ if (fraction != null) {+ notification.setProgress(1000, (fraction * 1000).toInt().coerceIn(0, 1000), false)+ }+ }+ }++ return notification.build()+ }++ private fun notificationText(state: DocumentTranslationServiceState): String {+ if (state.errorMessage != null) return state.errorMessage+ if (state.outputPath != null) return File(state.outputPath).name+ val phases = state.pdfPhases+ if (phases != null) {+ // One line with all three phases so pending work stays visible: text as+ // a percentage, image/raster as real counts.+ return listOf(+ getString(R.string.doc_notif_phase_text, (phases.textFraction * 100).toInt()),+ getString(R.string.doc_notif_phase_images, phases.imageCurrent, phases.imageTotal),+ getString(R.string.doc_notif_phase_raster, phases.rasterCurrent, phases.rasterTotal),+ ).joinToString(" • ")+ }+ val fraction = state.progressFraction+ if (fraction != null) {+ return getString(R.string.doc_notif_progress_percent, (fraction * 100).toInt())+ }+ return getString(state.progressLabelRes)+ }++ private fun updateNotification(state: DocumentTranslationServiceState) {+ NotificationManagerCompat.from(this).notify(NOTIFICATION_ID, buildNotification(state))+ }++ private fun startForegroundCompat(notification: Notification) {+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE) {+ startForeground(NOTIFICATION_ID, notification, ServiceInfo.FOREGROUND_SERVICE_TYPE_SPECIAL_USE)+ } else {+ startForeground(NOTIFICATION_ID, notification)+ }+ }++ private fun removeForegroundNotification() {+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {+ stopForeground(STOP_FOREGROUND_REMOVE)+ } else {+ @Suppress("DEPRECATION")+ stopForeground(true)+ }+ NotificationManagerCompat.from(this).cancel(NOTIFICATION_ID)+ }++ private fun ensureChannel() {+ if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) return+ val nm = getSystemService(NotificationManager::class.java) ?: return+ if (nm.getNotificationChannel(CHANNEL_ID) != null) return+ val channel =+ NotificationChannel(+ CHANNEL_ID,+ getString(R.string.doc_notif_channel_name),+ NotificationManager.IMPORTANCE_LOW,+ ).apply {+ description = getString(R.string.doc_notif_channel_desc)+ setShowBadge(false)+ }+ nm.createNotificationChannel(channel)+ }++ private fun Intent.toTranslationRequest(): DocumentTranslationRequest? {+ val taskId = getLongExtra(EXTRA_TASK_ID, -1L)+ val inputPath = getStringExtra(EXTRA_INPUT_PATH)+ val outputPath = getStringExtra(EXTRA_OUTPUT_PATH)+ val fileName = getStringExtra(EXTRA_FILE_NAME)+ val fromCode = getStringExtra(EXTRA_FROM_CODE)+ val toCode = getStringExtra(EXTRA_TO_CODE)+ if (taskId < 0 || inputPath == null || outputPath == null || fileName == null || fromCode == null || toCode == null) {+ return null+ }+ val wrapColumns = getIntExtra(EXTRA_TXT_WRAP_COLUMNS, -1)+ val txtLayout =+ if (getBooleanExtra(EXTRA_TXT_LAYOUT_REFLOW, false)) {+ TxtLayoutChoice.Reflow(wrapColumns = wrapColumns.takeIf { it > 0 })+ } else {+ TxtLayoutChoice.Preserve+ }+ return DocumentTranslationRequest(+ taskId = taskId,+ inputPath = inputPath,+ outputPath = outputPath,+ fileName = fileName,+ fileSizeBytes = getLongExtra(EXTRA_FILE_SIZE_BYTES, -1L),+ fromCode = fromCode,+ toCode = toCode,+ deleteAfterLoad = getBooleanExtra(EXTRA_DELETE_AFTER_LOAD, false),+ translatePdfImages = getBooleanExtra(EXTRA_TRANSLATE_PDF_IMAGES, false),+ txtLayout = txtLayout,+ )+ }++ private fun DocumentTranslationRequest.initialState(): DocumentTranslationServiceState =+ DocumentTranslationServiceState(+ taskId = taskId,+ fileName = fileName,+ fileSizeBytes = fileSizeBytes,+ )+}++private data class DocumentTranslationRequest(+ val taskId: Long,+ val inputPath: String,+ val outputPath: String,+ val fileName: String,+ val fileSizeBytes: Long,+ val fromCode: String,+ val toCode: String,+ val deleteAfterLoad: Boolean,+ val translatePdfImages: Boolean,+ val txtLayout: TxtLayoutChoice,+)diff --git a/OCR-translation/src/main/java/dev/davidv/translator/DownloadEvent.kt b/OCR-translation/src/main/java/dev/davidv/translator/DownloadEvent.ktnew file mode 100644index 0000000..af723ab--- /dev/null+++ b/OCR-translation/src/main/java/dev/davidv/translator/DownloadEvent.kt@@ -0,0 +1,42 @@+/*+ * Copyright (C) 2024 David V+ *+ * This program 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.+ *+ * This program 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 <https://www.gnu.org/licenses/>.+ */++package dev.davidv.translator++sealed class DownloadEvent {+ data class NewTranslationAvailable(+ val language: Language,+ ) : DownloadEvent()++ data class NewDictionaryAvailable(+ val language: Language,+ ) : DownloadEvent()++ data class NewTtsAvailable(+ val language: Language,+ ) : DownloadEvent()++ data class NewSupportAvailable(+ val kind: String,+ ) : DownloadEvent()++ data object CatalogDownloaded : DownloadEvent()++ data class DownloadError(+ val message: String,+ ) : DownloadEvent()+}diff --git a/OCR-translation/src/main/java/dev/davidv/translator/DownloadService.kt b/OCR-translation/src/main/java/dev/davidv/translator/DownloadService.ktnew file mode 100644index 0000000..1fac70d--- /dev/null+++ b/OCR-translation/src/main/java/dev/davidv/translator/DownloadService.kt@@ -0,0 +1,1412 @@+/*+ * Copyright (C) 2024 David V+ *+ * This program 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.+ *+ * This program 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 <https://www.gnu.org/licenses/>.+ */++package dev.davidv.translator++import android.app.Service+import android.content.Context+import android.content.Intent+import android.os.Binder+import android.os.IBinder+import android.util.Log+import androidx.annotation.StringRes+import kotlinx.coroutines.CoroutineScope+import kotlinx.coroutines.Dispatchers+import kotlinx.coroutines.Job+import kotlinx.coroutines.SupervisorJob+import kotlinx.coroutines.async+import kotlinx.coroutines.awaitAll+import kotlinx.coroutines.cancel+import kotlinx.coroutines.flow.MutableSharedFlow+import kotlinx.coroutines.flow.MutableStateFlow+import kotlinx.coroutines.flow.SharedFlow+import kotlinx.coroutines.flow.StateFlow+import kotlinx.coroutines.flow.asSharedFlow+import kotlinx.coroutines.flow.update+import kotlinx.coroutines.launch+import kotlinx.coroutines.sync.Mutex+import kotlinx.coroutines.sync.withLock+import kotlinx.coroutines.withContext+import java.io.File+import java.io.InputStream+import java.net.URL+import java.util.zip.GZIPInputStream+import java.util.zip.ZipFile+import java.util.zip.ZipInputStream+import kotlin.math.max++class TrackingInputStream(+ private val inputStream: InputStream,+ private val size: Long,+ private val onProgress: (Long) -> Unit,+) : InputStream() {+ private var totalBytesRead = 0L+ private var lastReportedBytes = 0L++ override fun read(): Int {+ val byte = inputStream.read()+ if (byte != -1) {+ totalBytesRead+++ checkProgress()+ }+ return byte+ }++ override fun read(+ b: ByteArray,+ off: Int,+ len: Int,+ ): Int {+ val bytesRead = inputStream.read(b, off, len)+ if (bytesRead > 0) {+ totalBytesRead += bytesRead+ checkProgress()+ }+ return bytesRead+ }++ private fun checkProgress() {+ if (size > 0) {+ val currentProgress = totalBytesRead+ val incrementalProgress = currentProgress - lastReportedBytes+ if (incrementalProgress > max(128 * 1024, size / 20)) { // 128KiB or 5%+ onProgress(incrementalProgress)+ lastReportedBytes = currentProgress+ }+ }+ }++ override fun close() {+ onProgress(size - lastReportedBytes)+ inputStream.close()+ }+}++class DownloadService : Service() {+ private val binder = DownloadBinder()+ private val serviceScope = CoroutineScope(Dispatchers.IO + SupervisorJob())+ private val settingsManager by lazy { SettingsManager(this) }+ private val filePathManager by lazy { FilePathManager(this, settingsManager.settings) }++ private fun getCatalog(): LanguageCatalog? = filePathManager.loadCatalog()++ private val _downloadStates = MutableStateFlow<Map<Language, DownloadState>>(emptyMap())+ val downloadStates: StateFlow<Map<Language, DownloadState>> = _downloadStates++ private val _dictionaryDownloadStates = MutableStateFlow<Map<Language, DownloadState>>(emptyMap())+ val dictionaryDownloadStates: StateFlow<Map<Language, DownloadState>> = _dictionaryDownloadStates++ private val _ttsDownloadStates = MutableStateFlow<Map<Language, DownloadState>>(emptyMap())+ val ttsDownloadStates: StateFlow<Map<Language, DownloadState>> = _ttsDownloadStates++ private val _activeTtsPackIds = MutableStateFlow<Map<Language, String>>(emptyMap())+ val activeTtsPackIds: StateFlow<Map<Language, String>> = _activeTtsPackIds++ private val _queuedTtsPackIds = MutableStateFlow<Map<Language, List<String>>>(emptyMap())+ val queuedTtsPackIds: StateFlow<Map<Language, List<String>>> = _queuedTtsPackIds++ private val _adblockDownloadState = MutableStateFlow(DownloadState())+ val adblockDownloadState: StateFlow<DownloadState> = _adblockDownloadState++ private val _repairDownloadState = MutableStateFlow(DownloadState())+ val repairDownloadState: StateFlow<DownloadState> = _repairDownloadState++ private val _downloadEvents = MutableSharedFlow<DownloadEvent>()+ val downloadEvents: SharedFlow<DownloadEvent> = _downloadEvents.asSharedFlow()++ private val downloadJobs = mutableMapOf<Language, Job>()+ private val dictionaryDownloadJobs = mutableMapOf<Language, Job>()+ private val ttsDownloadJobs = mutableMapOf<Language, Job>()+ private var adblockDownloadJob: Job? = null+ private var repairDownloadJob: Job? = null+ private val fileDownloadLocksGuard = Any()+ private val fileDownloadLocks = mutableMapOf<String, Mutex>()+ private val baseDirPath: String+ get() = filePathManager.currentBaseDir().absolutePath++ companion object {+ fun startDownload(+ context: Context,+ language: Language,+ ) {+ val intent =+ Intent(context, DownloadService::class.java).apply {+ action = "START_DOWNLOAD"+ putExtra("language_code", language.code)+ }+ context.startService(intent)+ }++ fun cancelDownload(+ context: Context,+ language: Language,+ ) {+ val intent =+ Intent(context, DownloadService::class.java).apply {+ action = "CANCEL_DOWNLOAD"+ putExtra("language_code", language.code)+ }+ context.startService(intent)+ }++ fun startOcrEngineDownload(+ context: Context,+ language: Language,+ engine: String,+ ) {+ val intent =+ Intent(context, DownloadService::class.java).apply {+ action = "START_OCR_ENGINE_DOWNLOAD"+ putExtra("language_code", language.code)+ putExtra("engine", engine)+ }+ context.startService(intent)+ }++ fun startOcrEngineDownloads(+ context: Context,+ languages: List<Language>,+ engine: String,+ ) {+ val languageCodes = ArrayList(languages.map { it.code })+ val intent =+ Intent(context, DownloadService::class.java).apply {+ action = "START_OCR_ENGINE_DOWNLOADS"+ putStringArrayListExtra("language_codes", languageCodes)+ putExtra("engine", engine)+ }+ context.startService(intent)+ }++ fun startOcrEngineUpgrades(+ context: Context,+ languages: List<Language>,+ engine: String,+ ) {+ val languageCodes = ArrayList(languages.map { it.code })+ val intent =+ Intent(context, DownloadService::class.java).apply {+ action = "START_OCR_ENGINE_UPGRADES"+ putStringArrayListExtra("language_codes", languageCodes)+ putExtra("engine", engine)+ }+ context.startService(intent)+ }++ fun startTranslationUpgrades(+ context: Context,+ languages: List<Language>,+ ) {+ val languageCodes = ArrayList(languages.map { it.code })+ val intent =+ Intent(context, DownloadService::class.java).apply {+ action = "START_TRANSLATION_UPGRADES"+ putStringArrayListExtra("language_codes", languageCodes)+ }+ context.startService(intent)+ }++ fun startDictDownload(+ context: Context,+ language: Language,+ dictionaryInfo: DictionaryInfo?,+ ) {+ Log.d("Intent", "Send START_DICT_DOWNLOAD with ${language.code}")+ val intent =+ Intent(context, DownloadService::class.java).apply {+ action = "START_DICT_DOWNLOAD"+ putExtra("language_code", language.code)+ putExtra("dictionary_size", dictionaryInfo?.size ?: 1000000L)+ }+ context.startService(intent)+ }++ fun cancelDictDownload(+ context: Context,+ language: Language,+ ) {+ val intent =+ Intent(context, DownloadService::class.java).apply {+ action = "CANCEL_DICT_DOWNLOAD"+ putExtra("language_code", language.code)+ }+ context.startService(intent)+ }++ fun startTtsDownload(+ context: Context,+ language: Language,+ packId: String? = null,+ ) {+ val intent =+ Intent(context, DownloadService::class.java).apply {+ action = "START_TTS_DOWNLOAD"+ putExtra("language_code", language.code)+ packId?.let { putExtra("pack_id", it) }+ }+ context.startService(intent)+ }++ fun cancelTtsDownload(+ context: Context,+ language: Language,+ ) {+ val intent =+ Intent(context, DownloadService::class.java).apply {+ action = "CANCEL_TTS_DOWNLOAD"+ putExtra("language_code", language.code)+ }+ context.startService(intent)+ }++ fun startAdblockDownload(context: Context) {+ val intent =+ Intent(context, DownloadService::class.java).apply {+ action = "START_ADBLOCK_DOWNLOAD"+ }+ context.startService(intent)+ }++ fun cancelAdblockDownload(context: Context) {+ val intent =+ Intent(context, DownloadService::class.java).apply {+ action = "CANCEL_ADBLOCK_DOWNLOAD"+ }+ context.startService(intent)+ }++ fun fetchCatalog(context: Context) {+ val intent =+ Intent(context, DownloadService::class.java).apply {+ action = "FETCH_CATALOG"+ }+ context.startService(intent)+ }++ fun startRepairDownload(context: Context) {+ val intent =+ Intent(context, DownloadService::class.java).apply {+ action = "START_REPAIR_DOWNLOAD"+ }+ context.startService(intent)+ }+ }++ override fun onStartCommand(+ intent: Intent?,+ flags: Int,+ startId: Int,+ ): Int {+ when (intent?.action) {+ "START_DOWNLOAD" -> {+ val languageCode = intent.getStringExtra("language_code") ?: return START_NOT_STICKY+ val catalog = getCatalog() ?: return START_NOT_STICKY+ val language = catalog.languageByCode(languageCode) ?: return START_NOT_STICKY+ startLanguageDownload(language)+ }++ "CANCEL_DOWNLOAD" -> {+ val languageCode = intent.getStringExtra("language_code") ?: return START_NOT_STICKY+ val catalog = getCatalog() ?: return START_NOT_STICKY+ val language = catalog.languageByCode(languageCode) ?: return START_NOT_STICKY+ cancelLanguageDownload(language)+ }++ "START_OCR_ENGINE_DOWNLOAD" -> {+ val languageCode = intent.getStringExtra("language_code") ?: return START_NOT_STICKY+ val engine = intent.getStringExtra("engine") ?: return START_NOT_STICKY+ val catalog = getCatalog() ?: return START_NOT_STICKY+ val language = catalog.languageByCode(languageCode) ?: return START_NOT_STICKY+ startOcrEngineDownload(language, engine)+ }++ "START_OCR_ENGINE_DOWNLOADS" -> {+ val languageCodes = intent.getStringArrayListExtra("language_codes").orEmpty()+ val engine = intent.getStringExtra("engine") ?: return START_NOT_STICKY+ val catalog = getCatalog() ?: return START_NOT_STICKY+ val languages = languageCodes.mapNotNull(catalog::languageByCode)+ startOcrEngineDownloads(languages, engine)+ }++ "START_OCR_ENGINE_UPGRADES" -> {+ val languageCodes = intent.getStringArrayListExtra("language_codes").orEmpty()+ val engine = intent.getStringExtra("engine") ?: return START_NOT_STICKY+ val catalog = getCatalog() ?: return START_NOT_STICKY+ val languages = languageCodes.mapNotNull(catalog::languageByCode)+ startOcrEngineUpgrades(languages, engine)+ }++ "START_TRANSLATION_UPGRADES" -> {+ val languageCodes = intent.getStringArrayListExtra("language_codes").orEmpty()+ val catalog = getCatalog() ?: return START_NOT_STICKY+ val languages = languageCodes.mapNotNull(catalog::languageByCode)+ startTranslationUpgrades(languages)+ }++ "START_DICT_DOWNLOAD" -> {+ val languageCode = intent.getStringExtra("language_code") ?: return START_NOT_STICKY+ val dictionarySize = intent.getLongExtra("dictionary_size", 1000000L)+ Log.d("onStartCommand", "Dict download for $languageCode")+ val catalog = getCatalog() ?: return START_NOT_STICKY+ val language = catalog.languageByCode(languageCode) ?: return START_NOT_STICKY+ startDictionaryDownload(language, dictionarySize)+ }++ "CANCEL_DICT_DOWNLOAD" -> {+ val languageCode = intent.getStringExtra("language_code") ?: return START_NOT_STICKY+ val catalog = getCatalog() ?: return START_NOT_STICKY+ val language = catalog.languageByCode(languageCode) ?: return START_NOT_STICKY+ cancelDictionaryDownload(language)+ }++ "START_TTS_DOWNLOAD" -> {+ val languageCode = intent.getStringExtra("language_code") ?: return START_NOT_STICKY+ val packId = intent.getStringExtra("pack_id")+ val catalog = getCatalog() ?: return START_NOT_STICKY+ val language = catalog.languageByCode(languageCode) ?: return START_NOT_STICKY+ startTtsDownload(language, packId)+ }++ "CANCEL_TTS_DOWNLOAD" -> {+ val languageCode = intent.getStringExtra("language_code") ?: return START_NOT_STICKY+ val catalog = getCatalog() ?: return START_NOT_STICKY+ val language = catalog.languageByCode(languageCode) ?: return START_NOT_STICKY+ cancelTtsDownload(language)+ }++ "START_ADBLOCK_DOWNLOAD" -> {+ startAdblockDownload()+ }++ "CANCEL_ADBLOCK_DOWNLOAD" -> {+ cancelAdblockDownload()+ }++ "FETCH_CATALOG" -> {+ fetchCatalog()+ }++ "START_REPAIR_DOWNLOAD" -> {+ startRepairDownload()+ }+ }+ return START_STICKY+ }++ override fun onBind(intent: Intent): IBinder = binder++ private fun startPrimaryDownload(+ language: Language,+ actionLabel: String,+ @StringRes failureMessageRes: Int,+ planProvider: (LanguageCatalog) -> DownloadPlan,+ onSuccess: suspend (LanguageCatalog, LanguageCatalog) -> Unit = { _, _ -> },+ ) {+ if (_downloadStates.value[language]?.isDownloading == true) return+ updateDownloadState(language) {+ DownloadState(+ isDownloading = true,+ isCompleted = false,+ downloaded = 1,+ )+ }+ val job =+ serviceScope.launch {+ try {+ val catalog = getCatalog() ?: return@launch+ val downloadPlan = planProvider(catalog)+ val downloadTasks =+ downloadPlan.tasks.map { task ->+ suspend { downloadPackFile(task, language) }+ }++ var success = true+ if (downloadTasks.isNotEmpty()) {+ updateDownloadState(language) {+ it.copy(+ isDownloading = true,+ downloaded = 1,+ totalSize = downloadPlan.totalSize.toLong(),+ )+ }+ Log.i("DownloadService", "Starting $actionLabel for ${language.displayName}")+ val activeJobs = downloadTasks.map { task -> async { task() } }+ success = activeJobs.awaitAll().all { it }+ }+ updateDownloadState(language) {+ DownloadState(+ isDownloading = false,+ isCompleted = success,+ )+ }+ if (success) {+ val refreshedCatalog = filePathManager.reloadCatalog() ?: catalog+ onSuccess(catalog, refreshedCatalog)+ Log.i("DownloadService", "${actionLabel.replaceFirstChar(Char::titlecase)} complete: ${language.displayName}")+ _downloadEvents.emit(DownloadEvent.NewTranslationAvailable(language))+ } else {+ _downloadEvents.emit(DownloadEvent.DownloadError(getString(failureMessageRes, language.displayName)))+ }+ } catch (e: Exception) {+ Log.e("DownloadService", "${actionLabel.replaceFirstChar(Char::titlecase)} failed for ${language.displayName}", e)+ updateDownloadState(language) {+ it.copy(isDownloading = false, error = e.message)+ }+ _downloadEvents.emit(DownloadEvent.DownloadError(getString(failureMessageRes, language.displayName)))+ } finally {+ downloadJobs.remove(language)+ }+ }++ downloadJobs[language] = job+ }++ private fun startLanguageDownload(language: Language) {+ startPrimaryDownload(+ language = language,+ actionLabel = "download",+ failureMessageRes = R.string.download_failed_core,+ planProvider = { catalog ->+ val corePlan = catalog.planDownload(language.code, Feature.CORE) ?: DownloadPlan(0UL, emptyList())+ val docDetectPlan =+ if (catalog.supportInstalledByKind(DOC_DETECT_KIND)) {+ null+ } else {+ catalog.planSupportDownloadByKind(DOC_DETECT_KIND)+ }+ if (docDetectPlan == null) {+ corePlan+ } else {+ DownloadPlan(+ corePlan.totalSize + docDetectPlan.totalSize,+ corePlan.tasks + docDetectPlan.tasks,+ )+ }+ },+ )+ }++ private fun startOcrEngineDownload(+ language: Language,+ engine: String,+ ) {+ startPrimaryDownload(+ language = language,+ actionLabel = "OCR engine download",+ failureMessageRes = R.string.download_failed_ocr,+ planProvider = { catalog ->+ catalog.planOcrEngineDownload(language.code, engine) ?: DownloadPlan(0UL, emptyList())+ },+ )+ }++ private fun startOcrEngineDownloads(+ languages: List<Language>,+ engine: String,+ ) {+ startLanguageBatch(languages, R.string.download_failed_ocr_batch) { catalog, codes ->+ catalog.planOcrEngineDownloads(codes, engine)+ }+ }++ private fun startOcrEngineUpgrades(+ languages: List<Language>,+ engine: String,+ ) {+ startLanguageBatch(+ languages,+ R.string.download_failed_ocr_batch,+ onSuccess = {+ getCatalog()?.let { catalog ->+ filePathManager.applyDeletePlan(catalog.planDeleteSupersededFiles())+ }+ },+ ) { catalog, codes ->+ catalog.planOcrEngineUpgrades(codes, engine)+ }+ }++ private fun startTranslationUpgrades(languages: List<Language>) {+ startLanguageBatch(+ languages,+ R.string.download_failed_translation_batch,+ onSuccess = {+ getCatalog()?.let { catalog ->+ filePathManager.applyDeletePlan(catalog.planDeleteSupersededFiles())+ }+ },+ ) { catalog, codes ->+ catalog.planTranslationUpgrades(codes)+ }+ }++ private fun startLanguageBatch(+ languages: List<Language>,+ failureMessageRes: Int,+ onSuccess: suspend () -> Unit = {},+ planProvider: (LanguageCatalog, List<String>) -> DownloadPlan,+ ) {+ val activeLanguages = languages.distinctBy { it.code }.filter { _downloadStates.value[it]?.isDownloading != true }+ if (activeLanguages.isEmpty()) return++ activeLanguages.forEach { language ->+ updateDownloadState(language) {+ DownloadState(+ isDownloading = true,+ isCompleted = false,+ downloaded = 1,+ )+ }+ }++ val job =+ serviceScope.launch {+ try {+ val catalog = getCatalog() ?: return@launch+ val downloadPlan = planProvider(catalog, activeLanguages.map { it.code })+ var success = true+ if (downloadPlan.tasks.isNotEmpty()) {+ activeLanguages.forEach { language ->+ updateDownloadState(language) {+ it.copy(+ isDownloading = true,+ downloaded = 1,+ totalSize = downloadPlan.totalSize.toLong(),+ )+ }+ }+ Log.i(+ "DownloadService",+ "Starting OCR engine batch download for ${activeLanguages.size} languages",+ )+ val activeJobs =+ downloadPlan.tasks.map { task ->+ async {+ downloadPackFile(task) { incrementalProgress ->+ activeLanguages.forEach { language ->+ incrementDownloadBytes(language, incrementalProgress)+ }+ }+ }+ }+ success = activeJobs.awaitAll().all { it }+ }++ activeLanguages.forEach { language ->+ updateDownloadState(language) {+ DownloadState(+ isDownloading = false,+ isCompleted = success,+ )+ }+ }+ if (success) {+ filePathManager.reloadCatalog()+ onSuccess()+ Log.i("DownloadService", "Language batch download complete")+ activeLanguages.forEach { language ->+ _downloadEvents.emit(DownloadEvent.NewTranslationAvailable(language))+ }+ } else {+ _downloadEvents.emit(DownloadEvent.DownloadError(getString(failureMessageRes)))+ }+ } catch (e: Exception) {+ Log.e("DownloadService", "Language batch download failed", e)+ activeLanguages.forEach { language ->+ updateDownloadState(language) {+ it.copy(isDownloading = false, error = e.message)+ }+ }+ _downloadEvents.emit(DownloadEvent.DownloadError(getString(failureMessageRes)))+ } finally {+ activeLanguages.forEach(downloadJobs::remove)+ }+ }++ activeLanguages.forEach { language ->+ downloadJobs[language] = job+ }+ }++ private fun startDictionaryDownload(+ language: Language,+ dictionarySize: Long,+ ) {+ if (_dictionaryDownloadStates.value[language]?.isDownloading == true) return+ Log.d("DictionaryDownload", "Starting for $language")+ updateDictionaryDownloadState(language) {+ DownloadState(+ isDownloading = true,+ isCompleted = false,+ downloaded = 1,+ )+ }+ val job =+ serviceScope.launch {+ val catalog = getCatalog() ?: return@launch+ val downloadPlan = catalog.planDownload(language.code, Feature.DICTIONARY) ?: return@launch+ val downloadTasks = mutableListOf<suspend () -> Boolean>()+ val toDownload = if (downloadPlan.tasks.isNotEmpty()) downloadPlan.totalSize.toLong() else dictionarySize++ downloadPlan.tasks.forEach { task ->+ downloadTasks.add {+ downloadPackFile(task, language, incrementDictionary = true)+ }+ }++ var success = true+ if (downloadTasks.isNotEmpty()) {+ updateDictionaryDownloadState(language) {+ it.copy(+ isDownloading = true,+ downloaded = 1,+ totalSize = toDownload,+ )+ }+ Log.i("DownloadService", "Starting dictionary download for ${language.displayName}")+ success = downloadTasks.all { task -> task() }+ }++ updateDictionaryDownloadState(language) {+ DownloadState(+ isDownloading = false,+ isCompleted = success,+ )+ }++ if (success) {+ filePathManager.reloadCatalog()+ Log.i("DownloadService", "Dictionary download complete: ${language.displayName}")+ _downloadEvents.emit(DownloadEvent.NewDictionaryAvailable(language))+ } else {+ _downloadEvents.emit(DownloadEvent.DownloadError(getString(R.string.download_failed_dictionary, language.displayName)))+ Log.e("DownloadService", "Dictionary download failed for ${language.displayName}")+ updateDictionaryDownloadState(language) {+ it.copy(isDownloading = false, error = "Dictionary download failed for ${language.displayName}")+ }+ }++ dictionaryDownloadJobs.remove(language)+ }++ dictionaryDownloadJobs[language] = job+ }++ private fun cancelDictionaryDownload(language: Language) {+ dictionaryDownloadJobs[language]?.cancel()+ dictionaryDownloadJobs.remove(language)++ updateDictionaryDownloadState(language) {+ it.copy(isDownloading = false, isCancelled = true, error = null)+ }++ Log.i("DownloadService", "Cancelled dictionary download for ${language.displayName}")+ }++ private fun startTtsDownload(+ language: Language,+ requestedPackId: String? = null,+ ) {+ if (_ttsDownloadStates.value[language]?.isDownloading == true) {+ val resolvedPackId = requestedPackId ?: getCatalog()?.defaultTtsPackIdForLanguage(language.code) ?: return+ if (_activeTtsPackIds.value[language] == resolvedPackId) return+ _queuedTtsPackIds.update { current ->+ val existing = current[language].orEmpty()+ if (resolvedPackId in existing) current else current + (language to existing + resolvedPackId)+ }+ return+ }+ updateTtsDownloadState(language) {+ DownloadState(+ isDownloading = true,+ isCompleted = false,+ downloaded = 1,+ )+ }+ val job =+ serviceScope.launch {+ try {+ val catalog = getCatalog() ?: return@launch+ val ttsPackId = requestedPackId ?: catalog.defaultTtsPackIdForLanguage(language.code) ?: return@launch+ _activeTtsPackIds.update { it + (language to ttsPackId) }+ val downloadPlan =+ catalog.planDownload(language.code, Feature.TTS, ttsPackId) ?: run {+ Log.w("DownloadService", "Ignoring invalid TTS pack $ttsPackId for ${language.code}")+ return@launch+ }+ val downloadTasks = mutableListOf<suspend () -> Boolean>()+ val toDownload = downloadPlan.totalSize.toLong()++ downloadPlan.tasks.forEach { task ->+ downloadTasks.add {+ downloadPackFile(task, language, incrementTts = true)+ }+ }++ var success = true+ if (downloadTasks.isNotEmpty()) {+ updateTtsDownloadState(language) {+ it.copy(+ isDownloading = true,+ downloaded = 1,+ totalSize = toDownload,+ )+ }+ Log.i("DownloadService", "Starting TTS download for ${language.displayName}")+ success = downloadTasks.all { task -> task() }+ }++ updateTtsDownloadState(language) {+ DownloadState(+ isDownloading = false,+ isCompleted = success,+ )+ }++ if (success) {+ filePathManager.reloadCatalog()+ TranslatorTtsEngine.notifyVoiceDataChanged(this@DownloadService)+ Log.i("DownloadService", "TTS download complete: ${language.displayName}")+ _downloadEvents.emit(DownloadEvent.NewTtsAvailable(language))+ } else {+ _downloadEvents.emit(DownloadEvent.DownloadError(getString(R.string.download_failed_tts, language.displayName)))+ updateTtsDownloadState(language) {+ it.copy(isDownloading = false, error = "TTS download failed for ${language.displayName}")+ }+ }+ } catch (e: Exception) {+ Log.e("DownloadService", "TTS download failed for ${language.displayName}", e)+ updateTtsDownloadState(language) {+ it.copy(isDownloading = false, error = e.message)+ }+ _downloadEvents.emit(DownloadEvent.DownloadError("${language.displayName} TTS download failed"))+ } finally {+ ttsDownloadJobs.remove(language)+ _activeTtsPackIds.update { it - language }+ val nextPackId =+ _queuedTtsPackIds.value[language]?.firstOrNull()?.also {+ _queuedTtsPackIds.update { current ->+ val rest = current[language].orEmpty().drop(1)+ if (rest.isEmpty()) current - language else current + (language to rest)+ }+ }+ if (nextPackId != null) {+ startTtsDownload(language, nextPackId)+ }+ }+ }++ ttsDownloadJobs[language] = job+ }++ private fun cancelTtsDownload(language: Language) {+ ttsDownloadJobs[language]?.cancel()+ ttsDownloadJobs.remove(language)+ _activeTtsPackIds.update { it - language }+ _queuedTtsPackIds.update { it - language }++ updateTtsDownloadState(language) {+ it.copy(isDownloading = false, isCancelled = true, error = null)+ }++ Log.i("DownloadService", "Cancelled TTS download for ${language.displayName}")+ }++ private fun startAdblockDownload() {+ if (_adblockDownloadState.value.isDownloading) return+ updateAdblockDownloadState {+ DownloadState(+ isDownloading = true,+ isCompleted = false,+ downloaded = 1,+ )+ }+ val job =+ serviceScope.launch {+ try {+ val catalog =+ getCatalog() ?: run {+ updateAdblockDownloadState {+ it.copy(isDownloading = false, error = "Catalog unavailable")+ }+ _downloadEvents.emit(DownloadEvent.DownloadError(getString(R.string.download_catalog_unavailable)))+ return@launch+ }+ val downloadPlan =+ catalog.planSupportDownloadByKind(ADBLOCK_KIND) ?: run {+ Log.w("DownloadService", "No adblock support pack in catalog")+ updateAdblockDownloadState {+ it.copy(isDownloading = false, error = "No adblock support pack in catalog")+ }+ return@launch+ }+ var success = true+ if (downloadPlan.tasks.isNotEmpty()) {+ updateAdblockDownloadState {+ it.copy(+ isDownloading = true,+ downloaded = 1,+ totalSize = downloadPlan.totalSize.toLong(),+ )+ }+ Log.i("DownloadService", "Starting adblock download")+ for (task in downloadPlan.tasks) {+ if (!downloadPackFile(task, ::incrementAdblockDownloadBytes)) {+ success = false+ }+ }+ }++ updateAdblockDownloadState {+ DownloadState(+ isDownloading = false,+ isCompleted = success,+ )+ }++ if (success) {+ filePathManager.reloadCatalog()+ (application as? TranslatorApplication)?.adblockManager?.reload()+ Log.i("DownloadService", "Adblock download complete")+ _downloadEvents.emit(DownloadEvent.NewSupportAvailable(ADBLOCK_KIND))+ } else {+ updateAdblockDownloadState {+ it.copy(isDownloading = false, error = "Adblock download failed")+ }+ _downloadEvents.emit(DownloadEvent.DownloadError(getString(R.string.download_failed_adblock)))+ }+ } catch (e: Exception) {+ Log.e("DownloadService", "Adblock download failed", e)+ updateAdblockDownloadState {+ it.copy(isDownloading = false, error = e.message)+ }+ _downloadEvents.emit(DownloadEvent.DownloadError(getString(R.string.download_failed_adblock)))+ } finally {+ adblockDownloadJob = null+ }+ }++ adblockDownloadJob = job+ }++ private fun startRepairDownload() {+ if (_repairDownloadState.value.isDownloading) return+ updateRepairDownloadState {+ DownloadState(+ isDownloading = true,+ isCompleted = false,+ downloaded = 1,+ )+ }+ val job =+ serviceScope.launch {+ try {+ val catalog =+ getCatalog() ?: run {+ updateRepairDownloadState {+ it.copy(isDownloading = false, error = "Catalog unavailable")+ }+ _downloadEvents.emit(DownloadEvent.DownloadError(getString(R.string.download_catalog_unavailable)))+ return@launch+ }+ val downloadPlan = catalog.planRepair()+ var success = true+ if (downloadPlan.tasks.isNotEmpty()) {+ updateRepairDownloadState {+ it.copy(+ isDownloading = true,+ downloaded = 1,+ totalSize = downloadPlan.totalSize.toLong(),+ )+ }+ Log.i("DownloadService", "Starting repair download: ${downloadPlan.tasks.size} files")+ for (task in downloadPlan.tasks) {+ if (!downloadPackFile(task, ::incrementRepairDownloadBytes)) {+ success = false+ }+ }+ }++ updateRepairDownloadState {+ DownloadState(+ isDownloading = false,+ isCompleted = success,+ )+ }++ if (success) {+ filePathManager.reloadCatalog()+ Log.i("DownloadService", "Repair download complete")+ _downloadEvents.emit(DownloadEvent.NewSupportAvailable(REPAIR_KIND))+ } else {+ _downloadEvents.emit(DownloadEvent.DownloadError(getString(R.string.download_failed_repair)))+ }+ } catch (e: Exception) {+ Log.e("DownloadService", "Repair download failed", e)+ updateRepairDownloadState {+ it.copy(isDownloading = false, error = e.message)+ }+ _downloadEvents.emit(DownloadEvent.DownloadError(getString(R.string.download_failed_repair)))+ } finally {+ repairDownloadJob = null+ }+ }++ repairDownloadJob = job+ }++ private fun cancelAdblockDownload() {+ adblockDownloadJob?.cancel()+ adblockDownloadJob = null++ updateAdblockDownloadState {+ it.copy(isDownloading = false, isCancelled = true, error = null)+ }++ Log.i("DownloadService", "Cancelled adblock download")+ }++ private fun cancelLanguageDownload(language: Language) {+ downloadJobs[language]?.cancel()+ downloadJobs.remove(language)++ updateDownloadState(language) {+ it.copy(isDownloading = false, isCancelled = true, error = null)+ }++ Log.i("DownloadService", "Cancelled download for ${language.displayName}")+ }++ private fun updateDownloadState(+ language: Language,+ update: (DownloadState) -> DownloadState,+ ) {+ synchronized(this) {+ val currentStates = _downloadStates.value.toMutableMap()+ val currentState = currentStates[language] ?: DownloadState()+ val newState = update(currentState)+ Log.d(+ "DownloadService",+ "updateDownloadState: ${language.code} thread=${Thread.currentThread().name} before=${currentState.downloaded} after=${newState.downloaded} isDownloading=${newState.isDownloading}",+ )+ currentStates[language] = newState+ _downloadStates.value = currentStates+ }+ }++ private fun incrementDownloadBytes(+ language: Language,+ incrementalBytes: Long,+ ) {+ synchronized(this) {+ val currentStates = _downloadStates.value.toMutableMap()+ val currentState = currentStates[language] ?: DownloadState()+ val newDownloaded = currentState.downloaded + incrementalBytes+ currentStates[language] =+ currentState.copy(+ downloaded = newDownloaded,+ )+ _downloadStates.value = currentStates+ }+ }++ private fun updateDictionaryDownloadState(+ language: Language,+ update: (DownloadState) -> DownloadState,+ ) {+ synchronized(this) {+ val currentStates = _dictionaryDownloadStates.value.toMutableMap()+ val currentState = currentStates[language] ?: DownloadState()+ val newState = update(currentState)+ Log.d(+ "DownloadService",+ "updateDictionaryDownloadState: ${language.code} thread=${Thread.currentThread().name} before=${currentState.downloaded} after=${newState.downloaded} isDownloading=${newState.isDownloading}",+ )+ currentStates[language] = newState+ _dictionaryDownloadStates.value = currentStates+ }+ }++ private fun incrementDictionaryDownloadBytes(+ language: Language,+ incrementalBytes: Long,+ ) {+ synchronized(this) {+ val currentStates = _dictionaryDownloadStates.value.toMutableMap()+ val currentState = currentStates[language] ?: DownloadState()+ val newDownloaded = currentState.downloaded + incrementalBytes+ currentStates[language] =+ currentState.copy(+ downloaded = newDownloaded,+ )+ _dictionaryDownloadStates.value = currentStates+ }+ }++ private fun updateTtsDownloadState(+ language: Language,+ update: (DownloadState) -> DownloadState,+ ) {+ synchronized(this) {+ val currentStates = _ttsDownloadStates.value.toMutableMap()+ val currentState = currentStates[language] ?: DownloadState()+ currentStates[language] = update(currentState)+ _ttsDownloadStates.value = currentStates+ }+ }++ private fun incrementTtsDownloadBytes(+ language: Language,+ incrementalBytes: Long,+ ) {+ synchronized(this) {+ val currentStates = _ttsDownloadStates.value.toMutableMap()+ val currentState = currentStates[language] ?: DownloadState()+ currentStates[language] =+ currentState.copy(+ downloaded = currentState.downloaded + incrementalBytes,+ )+ _ttsDownloadStates.value = currentStates+ }+ }++ private fun updateAdblockDownloadState(update: (DownloadState) -> DownloadState) {+ synchronized(this) {+ _adblockDownloadState.value = update(_adblockDownloadState.value)+ }+ }++ private fun incrementAdblockDownloadBytes(incrementalBytes: Long) {+ updateAdblockDownloadState {+ it.copy(downloaded = it.downloaded + incrementalBytes)+ }+ }++ private fun updateRepairDownloadState(update: (DownloadState) -> DownloadState) {+ synchronized(this) {+ _repairDownloadState.value = update(_repairDownloadState.value)+ }+ }++ private fun incrementRepairDownloadBytes(incrementalBytes: Long) {+ updateRepairDownloadState {+ it.copy(downloaded = it.downloaded + incrementalBytes)+ }+ }++ private suspend fun downloadPackFile(+ task: DownloadTask,+ targetLanguage: Language,+ incrementDictionary: Boolean = false,+ incrementTts: Boolean = false,+ ): Boolean =+ downloadPackFile(task) { incrementalProgress ->+ if (incrementDictionary) {+ incrementDictionaryDownloadBytes(targetLanguage, incrementalProgress)+ } else if (incrementTts) {+ incrementTtsDownloadBytes(targetLanguage, incrementalProgress)+ } else {+ incrementDownloadBytes(targetLanguage, incrementalProgress)+ }+ }++ private suspend fun downloadPackFile(+ task: DownloadTask,+ onProgress: (Long) -> Unit,+ ): Boolean {+ val outputFile = filePathManager.resolveInstallPath(task.installPath)+ val lock = fileDownloadLock(outputFile)+ return lock.withLock {+ if (task.archiveFormat != "zip" && outputFile.exists() && outputFile.length() > 0L) {+ onProgress(task.sizeBytes.toLong())+ Log.i("DownloadService", "Reusing downloaded ${task.packId}:${task.installPath}")+ true+ } else {+ downloadPackFileLocked(task, outputFile, onProgress)+ }+ }+ }++ private fun fileDownloadLock(outputFile: File): Mutex =+ synchronized(fileDownloadLocksGuard) {+ fileDownloadLocks.getOrPut(outputFile.absolutePath) { Mutex() }+ }++ private suspend fun downloadPackFileLocked(+ task: DownloadTask,+ outputFile: File,+ onProgress: (Long) -> Unit,+ ): Boolean {+ val url = task.url+ val extractTo = task.extractTo+ val installMarkerPath = task.installMarkerPath+ val installMarkerVersion = task.installMarkerVersion+ return try {+ val success =+ if (task.archiveFormat == "zip" && extractTo != null) {+ downloadAndExtractZip(+ url = url,+ archiveFile = outputFile,+ extractTo = filePathManager.resolveInstallPath(extractTo),+ deleteAfterExtract = task.deleteAfterExtract,+ installMarkerPath = installMarkerPath,+ onProgress = onProgress,+ ).also { extracted ->+ if (extracted && installMarkerPath != null && installMarkerVersion != null) {+ filePathManager.writeInstallMarker(installMarkerPath, installMarkerVersion)+ }+ }+ } else {+ download(+ url,+ outputFile,+ decompress = task.decompress,+ onProgress = onProgress,+ )+ }+ Log.i("DownloadService", "Downloaded ${task.packId}:${task.installPath} from $url = $success")+ success+ } catch (e: Exception) {+ Log.e("DownloadService", "Failed to download ${task.packId}:${task.installPath} from $url", e)+ false+ }+ }++ private suspend fun download(+ url: String,+ outputFile: File,+ decompress: Boolean = false,+ onProgress: (Long) -> Unit,+ ) = withContext(Dispatchers.IO) {+ val conn = URL(url).openConnection()+ val size = conn.contentLengthLong+ val tempFile = File(outputFile.parentFile, "${outputFile.name}.tmp")++ try {+ outputFile.parentFile?.mkdirs()+ } catch (e: Exception) {+ Log.e("DownloadService", "Failed to mkdirs", e)+ return@withContext false+ }+ try {+ conn.getInputStream().use { rawInputStream ->+ val trackingStream =+ TrackingInputStream(rawInputStream, size) { incrementalProgress ->+ onProgress(incrementalProgress)+ }++ tempFile.outputStream().use { output ->+ val processedStream = if (decompress) GZIPInputStream(trackingStream) else trackingStream+ processedStream.use { stream ->+ val buffer = ByteArray(16384)+ var bytesRead: Int+ while (stream.read(buffer).also { bytesRead = it } != -1) {+ output.write(buffer, 0, bytesRead)+ }+ }+ }+ }++ if (tempFile.renameTo(outputFile)) {+ true+ } else {+ Log.e(+ "DownloadService",+ "Failed to move temp file $tempFile to final location $outputFile",+ )+ tempFile.delete()+ false+ }+ } catch (e: Exception) {+ val operation = if (decompress) "downloading/decompressing" else "downloading"+ Log.e("DownloadService", "Error $operation file from $url to $outputFile: ${e.javaClass.simpleName}: ${e.message}", e)+ if (tempFile.exists()) {+ tempFile.delete()+ }+ if (outputFile.exists()) {+ outputFile.delete()+ }+ false+ }+ }++ private suspend fun downloadAndExtractZip(+ url: String,+ archiveFile: File,+ extractTo: File,+ deleteAfterExtract: Boolean,+ installMarkerPath: String? = null,+ onProgress: (Long) -> Unit,+ ) = withContext(Dispatchers.IO) {+ val downloaded =+ download(+ url = url,+ outputFile = archiveFile,+ decompress = false,+ onProgress = onProgress,+ )+ if (!downloaded) {+ return@withContext false+ }++ try {+ val installRootName =+ installMarkerPath+ ?.let(filePathManager::resolveInstallPath)+ ?.parentFile+ ?.name++ fun normalizedEntryName(entryName: String): String {+ val trimmed = entryName.trimStart('/').removePrefix("./")+ if (trimmed.isBlank()) return trimmed+ val rootName = installRootName ?: return trimmed+ return if (trimmed == rootName || trimmed.startsWith("$rootName/")) {+ trimmed+ } else {+ "$rootName/$trimmed"+ }+ }++ val managedPaths = mutableSetOf<File>()+ ZipFile(archiveFile).use { zipFile ->+ val entries = zipFile.entries()+ while (entries.hasMoreElements()) {+ val entry = entries.nextElement()+ val normalizedName = normalizedEntryName(entry.name)+ val parts = normalizedName.split('/').filter { it.isNotBlank() }+ if (parts.size >= 2) {+ managedPaths += File(extractTo, "${parts[0]}/${parts[1]}")+ } else if (parts.size == 1) {+ managedPaths += File(extractTo, parts[0])+ }+ }+ }+ managedPaths+ .sortedByDescending { it.absolutePath.length }+ .forEach { path ->+ if (path.exists()) {+ path.deleteRecursively()+ }+ }++ ZipInputStream(archiveFile.inputStream().buffered()).use { zipInput ->+ var entry = zipInput.nextEntry+ while (entry != null) {+ val output = File(extractTo, normalizedEntryName(entry.name))+ if (entry.isDirectory) {+ output.mkdirs()+ } else {+ output.parentFile?.mkdirs()+ output.outputStream().use { stream ->+ val buffer = ByteArray(16384)+ var bytesRead: Int+ while (zipInput.read(buffer).also { bytesRead = it } != -1) {+ stream.write(buffer, 0, bytesRead)+ }+ }+ }+ zipInput.closeEntry()+ entry = zipInput.nextEntry+ }+ }+ if (deleteAfterExtract && archiveFile.exists()) {+ archiveFile.delete()+ }+ true+ } catch (e: Exception) {+ Log.e("DownloadService", "Failed to extract zip $archiveFile", e)+ if (archiveFile.exists()) {+ archiveFile.delete()+ }+ false+ }+ }++ private fun fetchCatalog() {+ serviceScope.launch {+ try {+ val catalogFile = filePathManager.getCatalogFile()+ val url = settingsManager.settings.value.catalogIndexUrl++ catalogFile.parentFile?.mkdirs()+ val tempFile = File(catalogFile.parentFile, "${catalogFile.name}.tmp")++ val conn = URL(url).openConnection()+ conn.getInputStream().use { inputStream ->+ tempFile.outputStream().use { output ->+ val buffer = ByteArray(16384)+ var bytesRead: Int+ while (inputStream.read(buffer).also { bytesRead = it } != -1) {+ output.write(buffer, 0, bytesRead)+ }+ }+ }++ if (tempFile.renameTo(catalogFile)) {+ Log.i("DownloadService", "Downloaded catalog from $url to $catalogFile")+ filePathManager.reloadCatalog()+ _downloadEvents.emit(DownloadEvent.CatalogDownloaded)+ } else {+ Log.e("DownloadService", "Failed to move temp catalog file $tempFile to final location $catalogFile")+ tempFile.delete()+ _downloadEvents.emit(DownloadEvent.DownloadError(getString(R.string.download_catalog_save_failed)))+ }+ } catch (e: Exception) {+ Log.e("DownloadService", "Error downloading catalog", e)+ val detail = e.message ?: getString(R.string.download_unknown_error)+ _downloadEvents.emit(DownloadEvent.DownloadError(getString(R.string.download_catalog_failed, detail)))+ }+ }+ }++ override fun onDestroy() {+ super.onDestroy()+ serviceScope.cancel()+ cleanupTempFiles()+ }++ private fun cleanupTempFiles() {+ val binDir = filePathManager.getDataDir()+ if (binDir.exists()) {+ binDir.listFiles()?.filter { it.name.endsWith(".tmp") }?.forEach { tempFile ->+ if (tempFile.delete()) {+ Log.d("DownloadService", "Cleaned up temp file: ${tempFile.name}")+ }+ }+ }+ }++ inner class DownloadBinder : Binder() {+ fun getService(): DownloadService = this@DownloadService+ }+}++data class DownloadState(+ val isDownloading: Boolean = false,+ val isCompleted: Boolean = false,+ val isCancelled: Boolean = false,+ val downloaded: Long = 0,+ val totalSize: Long = 1,+ val error: String? = null,+)++private const val ADBLOCK_KIND = "adblock"+private const val DOC_DETECT_KIND = "doc_detect"++// Not a catalog pack kind: the NewSupportAvailable event key for a finished+// repair download, so availability listeners refresh like any support install.+private const val REPAIR_KIND = "repair"diff --git a/OCR-translation/src/main/java/dev/davidv/translator/FileEvent.kt b/OCR-translation/src/main/java/dev/davidv/translator/FileEvent.ktnew file mode 100644index 0000000..c0a526a--- /dev/null+++ b/OCR-translation/src/main/java/dev/davidv/translator/FileEvent.kt@@ -0,0 +1,28 @@+/*+ * Copyright (C) 2024 David V+ *+ * This program 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.+ *+ * This program 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 <https://www.gnu.org/licenses/>.+ */++package dev.davidv.translator++sealed class FileEvent {+ data class LanguageDeleted(+ val language: Language,+ ) : FileEvent()++ data class Error(+ val message: String,+ ) : FileEvent()+}diff --git a/OCR-translation/src/main/java/dev/davidv/translator/FilePathManager.kt b/OCR-translation/src/main/java/dev/davidv/translator/FilePathManager.ktnew file mode 100644index 0000000..9a14f2e--- /dev/null+++ b/OCR-translation/src/main/java/dev/davidv/translator/FilePathManager.kt@@ -0,0 +1,187 @@+package dev.davidv.translator++import android.content.Context+import android.os.Build+import android.os.Environment+import android.util.Log+import kotlinx.coroutines.flow.StateFlow+import org.json.JSONObject+import java.io.File++class FilePathManager(+ val context: Context,+ private val settingsFlow: StateFlow<AppSettings>,+) {+ private val catalogLock = Any()++ // Kotlin treats LanguageCatalog as an immutable snapshot.+ // FilePathManager owns the current cached snapshot reference and swaps it on reload.+ private var cachedCatalog: LanguageCatalog? = null+ private var cachedCatalogBaseDir: String? = null++ private val baseDir: File+ get() =+ if (settingsFlow.value.useExternalStorage) {+ if (Build.VERSION.SDK_INT == Build.VERSION_CODES.Q) {+ val ext = context.getExternalFilesDir(null)+ ext ?: context.filesDir+ } else {+ val documentsDir = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOCUMENTS)+ File(documentsDir, "dev.davidv.translator").also { dir ->+ if (!dir.exists()) {+ dir.mkdirs()+ }+ }+ }+ } else {+ context.filesDir+ }++ fun currentBaseDir(): File = baseDir++ fun getTranslatedDocumentsDir(): File =+ File(context.cacheDir, "translated_documents").also { dir ->+ if (!dir.exists()) {+ dir.mkdirs()+ }+ }++ fun getDataDir(): File = File(baseDir, "bin")++ fun getDictionariesDir(): File = File(baseDir, "dictionaries")++ fun getAdblockDir(): File = File(baseDir, "adblock")++ fun resolveInstallPath(relativePath: String): File = File(baseDir, relativePath)++ fun getDictionaryFile(language: Language): File = File(getDictionariesDir(), "${language.dictionaryCode}.dict")++ fun getCatalogFile(): File = File(baseDir, "index_v6.json")++ fun getMucabFile(): File = File(getDataDir(), "mucab.bin")++ fun hasInstallMarker(+ relativePath: String,+ expectedVersion: Int,+ ): Boolean {+ val markerFile = resolveInstallPath(relativePath)+ if (!markerFile.exists()) return false+ return try {+ val root = JSONObject(markerFile.readText())+ root.optInt("version", -1) == expectedVersion+ } catch (_: Exception) {+ false+ }+ }++ fun writeInstallMarker(+ relativePath: String,+ version: Int,+ ) {+ val markerFile = resolveInstallPath(relativePath)+ markerFile.parentFile?.mkdirs()+ markerFile.writeText(+ JSONObject()+ .put("version", version)+ .toString(),+ )+ invalidateCatalog()+ }++ fun applyDeletePlan(plan: DeletePlan) {+ plan.directoryPaths.forEach { relativePath ->+ val directory = resolveInstallPath(relativePath)+ if (directory.exists() && directory.deleteRecursively()) {+ Log.i("FilePathManager", "Deleted directory $relativePath")+ }+ }++ plan.filePaths.forEach { relativePath ->+ val file = resolveInstallPath(relativePath)+ if (file.exists() && file.delete()) {+ Log.i("FilePathManager", "Deleted file $relativePath")+ }+ }++ invalidateCatalog()+ }++ fun loadCatalog(): LanguageCatalog? {+ val baseDirPath = currentBaseDir().absolutePath+ synchronized(catalogLock) {+ cachedCatalog?.takeIf { cachedCatalogBaseDir == baseDirPath }?.let { return it }+ val catalog = openCatalog(baseDirPath)+ replaceCachedCatalogLocked(catalog, baseDirPath)+ return catalog+ }+ }++ fun reloadCatalog(): LanguageCatalog? =+ synchronized(catalogLock) {+ val baseDirPath = currentBaseDir().absolutePath+ val catalog = openCatalog(baseDirPath)+ replaceCachedCatalogLocked(catalog, baseDirPath)+ catalog+ }++ fun invalidateCatalog() {+ synchronized(catalogLock) {+ replaceCachedCatalogLocked(null, null)+ }+ }++ private fun openCatalog(baseDirPath: String): LanguageCatalog? {+ // Older catalog formats served under earlier filenames stay served for old+ // app versions, but their on-disk copies are stale once this build moves to+ // a newer one. Delete every superseded index_v*.json, keeping only the one+ // this build reads.+ val currentCatalogName = getCatalogFile().name+ baseDir+ .listFiles { file -> file.name.matches(Regex("index_v\\d+\\.json")) && file.name != currentCatalogName }+ ?.forEach { it.delete() }+ // The kokoro ONNX engine is gone (dropped from v5, unloadable under MNN). Its+ // 92 MB core blob is no longer in any pack, so reclaim it directly here.+ File(baseDir, "bin/kokoro/kokoro-v1.0.int8.onnx").delete()+ val bundledJson =+ try {+ context.assets.open("index_v6.json").bufferedReader().readText()+ } catch (e: Exception) {+ Log.e("FilePathManager", "Error reading bundled catalog index", e)+ null+ }++ val diskJson =+ try {+ getCatalogFile().takeIf(File::exists)?.readText()+ } catch (e: Exception) {+ Log.w("FilePathManager", "Error reading cached catalog index", e)+ null+ }++ val catalog =+ try {+ when {+ bundledJson != null -> LanguageCatalog.open(bundledJson, diskJson, baseDirPath)+ diskJson != null -> LanguageCatalog.open(diskJson, null, baseDirPath)+ else -> null+ }+ } catch (e: Exception) {+ Log.e("FilePathManager", "Error loading catalog index", e)+ null+ }++ if (catalog == null) {+ Log.e("FilePathManager", "No valid catalog found")+ }+ return catalog+ }++ private fun replaceCachedCatalogLocked(+ newCatalog: LanguageCatalog?,+ baseDirPath: String?,+ ) {+ if (cachedCatalog === newCatalog && cachedCatalogBaseDir == baseDirPath) return+ cachedCatalog = newCatalog+ cachedCatalogBaseDir = baseDirPath+ }+}diff --git a/OCR-translation/src/main/java/dev/davidv/translator/FontSize.kt b/OCR-translation/src/main/java/dev/davidv/translator/FontSize.ktnew file mode 100644index 0000000..b295c53--- /dev/null+++ b/OCR-translation/src/main/java/dev/davidv/translator/FontSize.kt@@ -0,0 +1,40 @@+/*+ * Copyright (C) 2024 David V+ *+ * This program 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.+ *+ * This program 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 <https://www.gnu.org/licenses/>.+ */++package dev.davidv.translator++import androidx.compose.material3.MaterialTheme+import androidx.compose.runtime.Composable+import androidx.compose.ui.text.TextStyle+import androidx.compose.ui.unit.sp++enum class FontSize(+ val displayName: String,+) {+ SMALL("Small"),+ MEDIUM("Medium"),+ LARGE("Large"),+ ;++ @Composable+ fun getTextStyle(): TextStyle =+ when (this) {+ SMALL -> MaterialTheme.typography.bodyLarge+ MEDIUM -> MaterialTheme.typography.bodyLarge.copy(fontSize = 24.sp, lineHeight = 32.sp)+ LARGE -> MaterialTheme.typography.bodyLarge.copy(fontSize = 32.sp, lineHeight = 40.sp)+ }+}diff --git a/OCR-translation/src/main/java/dev/davidv/translator/FragmentNormalization.kt b/OCR-translation/src/main/java/dev/davidv/translator/FragmentNormalization.ktnew file mode 100644index 0000000..60a74c2--- /dev/null+++ b/OCR-translation/src/main/java/dev/davidv/translator/FragmentNormalization.kt@@ -0,0 +1,22 @@+package dev.davidv.translator++internal fun normalizeFragmentText(text: String): String =+ text+ .replace(Regex("\\s+"), " ")+ .replace(Regex("\\s+([.,;:!?])"), "$1")+ .trim()+ .lowercase()++internal fun areEquivalentFragmentTexts(+ first: String,+ second: String,+): Boolean = normalizeFragmentText(first) == normalizeFragmentText(second)++internal fun <T> dedupeFragmentsByBoundsAndText(+ fragments: List<T>,+ boundsKey: (T) -> String,+ text: (T) -> String,+): List<T> {+ val deduped = fragments.distinctBy { "${boundsKey(it)}|${normalizeFragmentText(text(it))}" }+ return deduped.groupBy(boundsKey).values.map { it.first() }+}diff --git a/OCR-translation/src/main/java/dev/davidv/translator/Geometry.kt b/OCR-translation/src/main/java/dev/davidv/translator/Geometry.ktnew file mode 100644index 0000000..3762fba--- /dev/null+++ b/OCR-translation/src/main/java/dev/davidv/translator/Geometry.kt@@ -0,0 +1,49 @@+/*+ * Copyright (C) 2024 David V+ *+ * This program 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.+ *+ * This program 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 <https://www.gnu.org/licenses/>.+ */++package dev.davidv.translator++data class Rect(+ var left: Int,+ var top: Int,+ var right: Int,+ var bottom: Int,+) {+ constructor(other: Rect) : this(other.left, other.top, other.right, other.bottom)++ fun width(): Int = right - left++ fun height(): Int = bottom - top++ fun centerY(): Int = (top + bottom) / 2++ fun isEmpty(): Boolean = left >= right || top >= bottom++ fun union(other: Rect) {+ if (isEmpty()) {+ left = other.left+ top = other.top+ right = other.right+ bottom = other.bottom+ } else {+ if (other.left < left) left = other.left+ if (other.top < top) top = other.top+ if (other.right > right) right = other.right+ if (other.bottom > bottom) bottom = other.bottom+ }+ }+}diff --git a/OCR-translation/src/main/java/dev/davidv/translator/GlEgl.kt b/OCR-translation/src/main/java/dev/davidv/translator/GlEgl.ktnew file mode 100644index 0000000..d255204--- /dev/null+++ b/OCR-translation/src/main/java/dev/davidv/translator/GlEgl.kt@@ -0,0 +1,90 @@+package dev.davidv.translator++import android.opengl.EGL14+import android.opengl.EGLConfig+import android.opengl.EGLContext+import android.opengl.EGLDisplay+import android.opengl.GLES20++/**+ * GLES/EGL boilerplate shared by the live render threads — the camera+ * ([dev.davidv.translator.ui.components.LiveGlSurfaceView]) and the screen-capture+ * worker ([dev.davidv.translator.screenTranslate.ScreenCaptureGlWorker]). Both mint+ * a `GL_TEXTURE_EXTERNAL_OES` source texture and bring up an ES3 display+context the+ * same way; only the EGL config attribs (alpha size, WINDOW vs WINDOW|PBUFFER) and+ * the surface lifecycle differ, so those stay in each thread.+ */+object GlEgl {+ // android.opengl.GLES11Ext.GL_TEXTURE_EXTERNAL_OES — using the literal avoids the+ // GLES11Ext import (which only exists for this one constant).+ const val GL_TEXTURE_EXTERNAL_OES: Int = 0x8D65++ // EGL10.EGL_OPENGL_ES3_BIT_KHR; EGL14 doesn't expose it as a named constant+ // despite being defined since API 18.+ const val EGL_OPENGL_ES3_BIT: Int = 0x40++ /** A brought-up EGL display + chosen config + ES3 context. The context is created+ * but NOT made current — the caller creates its surface(s) and binds them. */+ data class EglCore(val display: EGLDisplay, val config: EGLConfig, val context: EGLContext)++ /** Mint a `GL_TEXTURE_EXTERNAL_OES` texture (linear filter, clamp-to-edge) for a+ * SurfaceTexture-backed camera/screen source. Returns 0 on failure. Must run on+ * the thread that owns the GL context. */+ fun createExternalOesTexture(): Int {+ val ids = IntArray(1)+ GLES20.glGenTextures(1, ids, 0)+ val id = ids[0]+ if (id == 0) return 0+ val target = GL_TEXTURE_EXTERNAL_OES+ GLES20.glBindTexture(target, id)+ GLES20.glTexParameteri(target, GLES20.GL_TEXTURE_MIN_FILTER, GLES20.GL_LINEAR)+ GLES20.glTexParameteri(target, GLES20.GL_TEXTURE_MAG_FILTER, GLES20.GL_LINEAR)+ GLES20.glTexParameteri(target, GLES20.GL_TEXTURE_WRAP_S, GLES20.GL_CLAMP_TO_EDGE)+ GLES20.glTexParameteri(target, GLES20.GL_TEXTURE_WRAP_T, GLES20.GL_CLAMP_TO_EDGE)+ GLES20.glBindTexture(target, 0)+ return id+ }++ /** Open the default display, initialize EGL, choose a config matching+ * `configAttribs`, and create an ES3 context. Returns null on any failure. No+ * surface is created and the context is not current yet. */+ fun initContext(configAttribs: IntArray): EglCore? {+ val display = EGL14.eglGetDisplay(EGL14.EGL_DEFAULT_DISPLAY)+ if (display == EGL14.EGL_NO_DISPLAY) return null+ val ver = IntArray(2)+ if (!EGL14.eglInitialize(display, ver, 0, ver, 1)) return null+ val cfgs = arrayOfNulls<EGLConfig>(1)+ val num = IntArray(1)+ if (!EGL14.eglChooseConfig(display, configAttribs, 0, cfgs, 0, 1, num, 0) || num[0] <= 0) {+ return null+ }+ val cfg = cfgs[0] ?: return null+ val context =+ EGL14.eglCreateContext(+ display,+ cfg,+ EGL14.EGL_NO_CONTEXT,+ intArrayOf(EGL14.EGL_CONTEXT_CLIENT_VERSION, 3, EGL14.EGL_NONE),+ 0,+ )+ if (context == EGL14.EGL_NO_CONTEXT) return null+ return EglCore(display, cfg, context)+ }++ /** Unbind the current context, destroy `context`, and terminate `display`. The+ * caller must destroy its own surfaces first. */+ fun destroyContext(+ display: EGLDisplay,+ context: EGLContext,+ ) {+ if (display == EGL14.EGL_NO_DISPLAY) return+ EGL14.eglMakeCurrent(+ display,+ EGL14.EGL_NO_SURFACE,+ EGL14.EGL_NO_SURFACE,+ EGL14.EGL_NO_CONTEXT,+ )+ if (context != EGL14.EGL_NO_CONTEXT) EGL14.eglDestroyContext(display, context)+ EGL14.eglTerminate(display)+ }+}diff --git a/OCR-translation/src/main/java/dev/davidv/translator/ImageProcessor.kt b/OCR-translation/src/main/java/dev/davidv/translator/ImageProcessor.ktnew file mode 100644index 0000000..bdca04f--- /dev/null+++ b/OCR-translation/src/main/java/dev/davidv/translator/ImageProcessor.kt@@ -0,0 +1,90 @@+/*+ * Copyright (C) 2024 David V+ *+ * This program 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.+ *+ * This program 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 <https://www.gnu.org/licenses/>.+ */++package dev.davidv.translator++import android.content.Context+import android.graphics.Bitmap+import android.graphics.BitmapFactory+import android.graphics.Matrix+import android.net.Uri+import android.util.Log+import androidx.exifinterface.media.ExifInterface+import java.io.File++class ImageProcessor(+ private val context: Context,+ private val filePathManager: FilePathManager,+) {+ fun loadCatalog(): LanguageCatalog? = filePathManager.loadCatalog()++ fun loadBitmapFromUri(uri: Uri): Bitmap =+ context.contentResolver.openInputStream(uri)?.use { inputStream ->+ BitmapFactory.decodeStream(inputStream)+ } ?: throw IllegalArgumentException("Cannot load bitmap from URI: $uri")++ fun deleteTemporaryImageUri(uri: Uri): Boolean =+ try {+ when (uri.scheme) {+ "content" -> context.contentResolver.delete(uri, null, null) > 0+ "file" -> uri.path?.let(::File)?.delete() == true+ else -> false+ }+ } catch (e: Exception) {+ Log.w("ImageProcessor", "Failed to delete temporary image URI: $uri", e)+ false+ }++ fun correctImageOrientation(+ uri: Uri,+ bitmap: Bitmap,+ ): Bitmap {+ return try {+ context.contentResolver.openInputStream(uri)?.use { inputStream ->+ val exif = ExifInterface(inputStream)+ val orientation =+ exif.getAttributeInt(+ ExifInterface.TAG_ORIENTATION,+ ExifInterface.ORIENTATION_NORMAL,+ )++ val matrix = Matrix()+ when (orientation) {+ ExifInterface.ORIENTATION_ROTATE_90 -> matrix.postRotate(90f)+ ExifInterface.ORIENTATION_ROTATE_180 -> matrix.postRotate(180f)+ ExifInterface.ORIENTATION_ROTATE_270 -> matrix.postRotate(270f)+ ExifInterface.ORIENTATION_FLIP_HORIZONTAL -> matrix.postScale(-1f, 1f)+ ExifInterface.ORIENTATION_FLIP_VERTICAL -> matrix.postScale(1f, -1f)+ ExifInterface.ORIENTATION_TRANSPOSE -> {+ matrix.postRotate(90f)+ matrix.postScale(-1f, 1f)+ }+ ExifInterface.ORIENTATION_TRANSVERSE -> {+ matrix.postRotate(270f)+ matrix.postScale(-1f, 1f)+ }+ else -> return bitmap+ }++ Bitmap.createBitmap(bitmap, 0, 0, bitmap.width, bitmap.height, matrix, true)+ } ?: bitmap+ } catch (e: Exception) {+ Log.e("ImageProcessor", "Error correcting image orientation", e)+ bitmap+ }+ }+}diff --git a/OCR-translation/src/main/java/dev/davidv/translator/InputType.kt b/OCR-translation/src/main/java/dev/davidv/translator/InputType.ktnew file mode 100644index 0000000..93ce0e5--- /dev/null+++ b/OCR-translation/src/main/java/dev/davidv/translator/InputType.kt@@ -0,0 +1,24 @@+/*+ * Copyright (C) 2024 David V+ *+ * This program 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.+ *+ * This program 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 <https://www.gnu.org/licenses/>.+ */++package dev.davidv.translator++enum class InputType {+ TEXT,+ IMAGE,+ FILE,+}diff --git a/OCR-translation/src/main/java/dev/davidv/translator/Language.kt b/OCR-translation/src/main/java/dev/davidv/translator/Language.ktnew file mode 100644index 0000000..46b3790--- /dev/null+++ b/OCR-translation/src/main/java/dev/davidv/translator/Language.kt@@ -0,0 +1,57 @@+/*+ * Copyright (C) 2024 David V+ *+ * This program 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.+ *+ * This program 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 <https://www.gnu.org/licenses/>.+ */++package dev.davidv.translator++import java.text.Collator+import java.util.Locale++data class Language(+ val code: String,+ val displayName: String,+ val shortDisplayName: String,+ val script: Script,+ val writingSystem: WritingSystem,+ val dictionaryCode: String,+) {+ val isEnglish: Boolean get() = code == "en"++ override fun equals(other: Any?): Boolean = other is Language && code == other.code++ override fun hashCode(): Int = code.hashCode()++ override fun toString(): String = "Language($code)"+}++fun Language.localizedName(locale: Locale = Locale.getDefault()): String {+ val tag =+ when (code) {+ "zh" -> "zh-Hans"+ "zh_hant" -> "zh-Hant"+ else -> code+ }+ val raw = Locale.forLanguageTag(tag).getDisplayName(locale)+ // forLanguageTag echoes the subtag back verbatim when CLDR has no entry for it+ val name = if (raw.isBlank() || raw.equals(tag, ignoreCase = true)) displayName else raw+ // CLDR lowercases language names in many locales (e.g. fr "persan"); title-case for list display+ return name.replaceFirstChar { if (it.isLowerCase()) it.titlecase(locale) else it.toString() }+}++fun languageNameComparator(locale: Locale = Locale.getDefault()): Comparator<String> {+ val collator = Collator.getInstance(locale).apply { strength = Collator.SECONDARY }+ return Comparator { a, b -> collator.compare(a, b) }+}diff --git a/OCR-translation/src/main/java/dev/davidv/translator/LanguageDetector.kt b/OCR-translation/src/main/java/dev/davidv/translator/LanguageDetector.ktnew file mode 100644index 0000000..372c38d--- /dev/null+++ b/OCR-translation/src/main/java/dev/davidv/translator/LanguageDetector.kt@@ -0,0 +1,47 @@+/*+ * Copyright (C) 2024 David V+ *+ * This program 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.+ *+ * This program 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 <https://www.gnu.org/licenses/>.+ */++package dev.davidv.translator++import android.util.Log+import kotlinx.coroutines.Dispatchers+import kotlinx.coroutines.withContext++class LanguageDetector(+ private val languageByCode: (String) -> Language?,+) {+ private val tag = this.javaClass.name.substringAfterLast('.')+ private val nativeLanguageRuntime = NativeLanguageRuntime()++ private fun languageForCode(code: String?): Language? = code?.let(languageByCode)++ suspend fun detectLanguageRobust(+ text: String,+ hint: Language?,+ availableLanguages: List<Language>,+ ): Language? =+ withContext(Dispatchers.IO) {+ Log.d(tag, "detectLanguageRobust: ${hint ?: "null"} | $text")+ languageForCode(+ nativeLanguageRuntime.detectLanguageRobustCode(+ text,+ hint?.code,+ availableLanguages,+ ),+ )+ }+}diff --git a/OCR-translation/src/main/java/dev/davidv/translator/LanguageMetadata.kt b/OCR-translation/src/main/java/dev/davidv/translator/LanguageMetadata.ktnew file mode 100644index 0000000..575410c--- /dev/null+++ b/OCR-translation/src/main/java/dev/davidv/translator/LanguageMetadata.kt@@ -0,0 +1,25 @@+/*+ * Copyright (C) 2024 David V+ *+ * This program 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.+ *+ * This program 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 <https://www.gnu.org/licenses/>.+ */++package dev.davidv.translator++import kotlinx.serialization.Serializable++@Serializable+data class LanguageMetadata(+ val favorite: Boolean = false,+)diff --git a/OCR-translation/src/main/java/dev/davidv/translator/LanguageMetadataManager.kt b/OCR-translation/src/main/java/dev/davidv/translator/LanguageMetadataManager.ktnew file mode 100644index 0000000..af34c19--- /dev/null+++ b/OCR-translation/src/main/java/dev/davidv/translator/LanguageMetadataManager.kt@@ -0,0 +1,70 @@+/*+ * Copyright (C) 2024 David V+ *+ * This program 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.+ *+ * This program 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 <https://www.gnu.org/licenses/>.+ */++package dev.davidv.translator++import android.content.Context+import androidx.datastore.core.DataStore+import androidx.datastore.preferences.core.Preferences+import androidx.datastore.preferences.core.edit+import androidx.datastore.preferences.core.stringPreferencesKey+import androidx.datastore.preferences.preferencesDataStore+import kotlinx.coroutines.CoroutineScope+import kotlinx.coroutines.Dispatchers+import kotlinx.coroutines.SupervisorJob+import kotlinx.coroutines.flow.SharingStarted+import kotlinx.coroutines.flow.StateFlow+import kotlinx.coroutines.flow.combine+import kotlinx.coroutines.flow.stateIn+import kotlinx.coroutines.launch+import kotlinx.serialization.encodeToString+import kotlinx.serialization.json.Json++private val Context.dataStore: DataStore<Preferences> by preferencesDataStore(name = "language_metadata")++class LanguageMetadataManager(+ private val context: Context,+ private val languagesFlow: StateFlow<List<Language>>,+) {+ private val scope = CoroutineScope(SupervisorJob() + Dispatchers.IO)++ val metadata: StateFlow<Map<Language, LanguageMetadata>> =+ combine(context.dataStore.data, languagesFlow) { prefs, languages ->+ languages.associateWith { lang ->+ (+ prefs[stringPreferencesKey("lang_${lang.code}")]?.let {+ Json.decodeFromString<LanguageMetadata>(it)+ } ?: LanguageMetadata()+ )+ }+ }.stateIn(+ scope = scope,+ started = SharingStarted.Eagerly,+ initialValue = emptyMap(),+ )++ fun updateLanguage(+ language: Language,+ metadata: LanguageMetadata,+ ) {+ scope.launch {+ context.dataStore.edit { prefs ->+ prefs[stringPreferencesKey("lang_${language.code}")] = Json.encodeToString(metadata)+ }+ }+ }+}diff --git a/OCR-translation/src/main/java/dev/davidv/translator/LanguageStateManager.kt b/OCR-translation/src/main/java/dev/davidv/translator/LanguageStateManager.ktnew file mode 100644index 0000000..23f2e6c--- /dev/null+++ b/OCR-translation/src/main/java/dev/davidv/translator/LanguageStateManager.kt@@ -0,0 +1,257 @@+/*+ * Copyright (C) 2024 David V+ *+ * This program 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.+ *+ * This program 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 <https://www.gnu.org/licenses/>.+ */++package dev.davidv.translator++import android.util.Log+import kotlinx.coroutines.CoroutineScope+import kotlinx.coroutines.Dispatchers+import kotlinx.coroutines.flow.MutableSharedFlow+import kotlinx.coroutines.flow.MutableStateFlow+import kotlinx.coroutines.flow.SharedFlow+import kotlinx.coroutines.flow.StateFlow+import kotlinx.coroutines.flow.asSharedFlow+import kotlinx.coroutines.flow.asStateFlow+import kotlinx.coroutines.launch+import kotlinx.coroutines.withContext++data class LangAvailability(+ val hasFromEnglish: Boolean,+ val hasToEnglish: Boolean,+ val ocrFiles: Boolean,+ val dictionaryFiles: Boolean,+ val ttsFiles: Boolean = false,+) {+ val translatorFiles: Boolean get() = hasFromEnglish || hasToEnglish+}++data class LanguageAvailabilityState(+ val hasLanguages: Boolean = false,+ val availableLanguages: List<LanguageAvailabilityEntry> = emptyList(),+ val isChecking: Boolean = true,+) {+ fun availabilityFor(language: Language?): LangAvailability? =+ language?.let { target ->+ availableLanguages.firstOrNull { it.language.code == target.code }?.availability+ }++ fun allLanguages(): List<Language> = availableLanguages.map { it.language }++ fun translatorLanguages(requireOcr: Boolean = false): List<Language> =+ availableLanguages+ .asSequence()+ .filter { it.availability.translatorFiles && (!requireOcr || it.availability.ocrFiles) }+ .map { it.language }+ .toList()+}++class LanguageStateManager(+ private val scope: CoroutineScope,+ private val filePathManager: FilePathManager,+ downloadEvents: SharedFlow<DownloadEvent>? = null,+) {+ private val catalogState = MutableStateFlow<LanguageCatalog?>(null)+ val catalog: StateFlow<LanguageCatalog?> = catalogState.asStateFlow()+ private val _languageState = MutableStateFlow(LanguageAvailabilityState())+ val languageState: StateFlow<LanguageAvailabilityState> = _languageState.asStateFlow()++ private val _catalogRefreshToken = MutableStateFlow(0)+ val catalogRefreshToken: StateFlow<Int> = _catalogRefreshToken.asStateFlow()++ private val _fileEvents = MutableSharedFlow<FileEvent>()+ val fileEvents: SharedFlow<FileEvent> = _fileEvents.asSharedFlow()++ private var downloadEventsJob: kotlinx.coroutines.Job? = null++ fun languageByCode(code: String): Language? = catalogState.value?.languageByCode(code)++ init {+ if (downloadEvents != null) {+ connectToDownloadEvents(downloadEvents)+ }+ loadCatalog()+ }++ private fun loadCatalog() {+ scope.launch {+ withContext(Dispatchers.IO) {+ setCatalog(filePathManager.loadCatalog())+ Log.i("LanguageStateManager", "Catalog loaded from file: ${catalogState.value != null}")+ }+ refreshLanguageAvailability()+ }+ }++ fun connectToDownloadEvents(downloadEvents: SharedFlow<DownloadEvent>) {+ downloadEventsJob?.cancel()+ downloadEventsJob =+ scope.launch {+ downloadEvents.collect { event ->+ when (event) {+ is DownloadEvent.NewTranslationAvailable -> {+ setCatalog(withContext(Dispatchers.IO) { filePathManager.reloadCatalog() })+ refreshLanguageAvailability()+ }++ is DownloadEvent.NewDictionaryAvailable -> {+ setCatalog(withContext(Dispatchers.IO) { filePathManager.reloadCatalog() })+ refreshLanguageAvailability()+ }++ is DownloadEvent.NewTtsAvailable -> {+ setCatalog(withContext(Dispatchers.IO) { filePathManager.reloadCatalog() })+ refreshLanguageAvailability()+ }++ is DownloadEvent.NewSupportAvailable -> {+ setCatalog(withContext(Dispatchers.IO) { filePathManager.reloadCatalog() })+ _catalogRefreshToken.value+++ refreshLanguageAvailability()+ }++ is DownloadEvent.CatalogDownloaded -> {+ setCatalog(withContext(Dispatchers.IO) { filePathManager.reloadCatalog() })+ _catalogRefreshToken.value+++ refreshLanguageAvailability()+ Log.i("LanguageStateManager", "Catalog downloaded")+ }++ is DownloadEvent.DownloadError -> {+ Log.w("LanguageStateManager", "Download error: ${event.message}")+ _fileEvents.emit(FileEvent.Error(event.message))+ }+ }+ }+ }+ }++ fun refreshLanguageAvailability() {+ _languageState.value = _languageState.value.copy(isChecking = true)+ scope.launch {+ val catalog =+ withContext(Dispatchers.IO) { filePathManager.reloadCatalog() } ?: run {+ _languageState.value = _languageState.value.copy(isChecking = false)+ return@launch+ }+ setCatalog(catalog)++ Log.i("LanguageStateManager", "Refreshing language availability")+ val availableLanguages = catalog.languageRows+ val hasLanguages = availableLanguages.any { !it.language.isEnglish && it.availability.translatorFiles }+ Log.i("LanguageStateManager", "hasLanguages = $hasLanguages")+ _languageState.value =+ LanguageAvailabilityState(+ hasLanguages = hasLanguages,+ availableLanguages = availableLanguages,+ isChecking = false,+ )+ }+ }++ fun deleteDict(language: Language) {+ val catalog = catalogState.value ?: filePathManager.loadCatalog() ?: return+ filePathManager.applyDeletePlan(catalog.prepareDelete(language.code, Feature.DICTIONARY))++ refreshLanguageAvailability()+ Log.i("LanguageStateManager", "Removed dictionary for language: ${language.displayName}")+ }++ fun deleteLanguage(language: Language) {+ val catalog = catalogState.value ?: filePathManager.loadCatalog() ?: return+ filePathManager.applyDeletePlan(catalog.prepareDelete(language.code, Feature.CORE))+ refreshLanguageAvailability()+ scope.launch { _fileEvents.emit(FileEvent.LanguageDeleted(language)) }+ TranslatorTtsEngine.notifyVoiceDataChanged(filePathManager.context)+ Log.i("LanguageStateManager", "Removed language: ${language.displayName}")+ }++ fun deleteTts(language: Language) {+ val catalog = catalogState.value ?: filePathManager.loadCatalog() ?: return+ filePathManager.applyDeletePlan(catalog.prepareDelete(language.code, Feature.TTS))+ refreshLanguageAvailability()+ TranslatorTtsEngine.notifyVoiceDataChanged(filePathManager.context)+ Log.i("LanguageStateManager", "Removed TTS for language: ${language.displayName}")+ }++ fun deleteTtsPack(+ language: Language,+ packId: String,+ ) {+ val catalog = catalogState.value ?: filePathManager.loadCatalog() ?: return+ filePathManager.applyDeletePlan(catalog.prepareDeleteTtsPack(packId))+ refreshLanguageAvailability()+ TranslatorTtsEngine.notifyVoiceDataChanged(filePathManager.context)+ Log.i("LanguageStateManager", "Removed TTS pack $packId for language: ${language.displayName}")+ }++ fun deleteSupportByKind(kind: String) {+ val catalog = catalogState.value ?: filePathManager.loadCatalog() ?: return+ filePathManager.applyDeletePlan(catalog.prepareDeleteSupportByKind(kind))+ refreshLanguageAvailability()+ Log.i("LanguageStateManager", "Removed support files for kind: $kind")+ }++ fun canSwapLanguages(+ from: Language,+ to: Language,+ ): Boolean {+ val catalog = catalogState.value ?: return false+ return catalog.canSwapLanguages(from, to)+ }++ fun canTranslate(+ from: Language,+ to: Language,+ ): Boolean {+ val catalog = catalogState.value ?: return false+ return catalog.canTranslate(from, to)+ }++ fun getFirstAvailableFromLanguage(excluding: Language? = null): Language? {+ val state = _languageState.value+ return state.translatorLanguages().firstOrNull { it != excluding }+ }++ fun getFirstAvailableSourceLanguage(+ target: Language,+ excluding: Language? = null,+ ): Language? {+ val state = _languageState.value+ return state.allLanguages()+ .asSequence()+ .filterNot { it == excluding }+ .filter { canTranslate(it, target) }+ .firstOrNull()+ }++ fun getFirstAvailableTargetLanguage(+ source: Language,+ excluding: Language? = null,+ ): Language? {+ val state = _languageState.value+ return state.allLanguages()+ .asSequence()+ .filterNot { it == excluding }+ .filter { canTranslate(source, it) }+ .firstOrNull()+ }++ private fun setCatalog(newCatalog: LanguageCatalog?) {+ if (catalogState.value === newCatalog) return+ catalogState.value = newCatalog+ }+}diff --git a/OCR-translation/src/main/java/dev/davidv/translator/LaunchMode.kt b/OCR-translation/src/main/java/dev/davidv/translator/LaunchMode.ktnew file mode 100644index 0000000..bf7e462--- /dev/null+++ b/OCR-translation/src/main/java/dev/davidv/translator/LaunchMode.kt@@ -0,0 +1,26 @@+/*+ * Copyright (C) 2024 David V+ *+ * This program 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.+ *+ * This program 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 <https://www.gnu.org/licenses/>.+ */++package dev.davidv.translator++sealed class LaunchMode {+ object Normal : LaunchMode()++ object ReadonlyModal : LaunchMode()++ data class ReadWriteModal(val reply: (String) -> Unit) : LaunchMode()+}diff --git a/OCR-translation/src/main/java/dev/davidv/translator/LivePipelineJni.kt b/OCR-translation/src/main/java/dev/davidv/translator/LivePipelineJni.ktnew file mode 100644index 0000000..5a92b40--- /dev/null+++ b/OCR-translation/src/main/java/dev/davidv/translator/LivePipelineJni.kt@@ -0,0 +1,220 @@+/*+ * Copyright (C) 2024 David V+ *+ * This program 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.+ *+ * This program 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 <https://www.gnu.org/licenses/>.+ */++package dev.davidv.translator++/** Single-call JNI fast-path for the live-camera planar OCR pipeline.+ *+ * Per-frame entry point: [processFrameGl] borrows the camera's+ * `GL_TEXTURE_EXTERNAL_OES`, GPU-renders canonical luma into a small+ * `Vec<u8>` to feed the tracker, then presents the camera + overlay+ * composite straight to the bound EGL surface via the native+ * `GlesRenderer` — all in one JNI call. Acquire/refresh frames read+ * full-res RGBA back from the same texture inside the call.+ *+ * Returns a packed `Long` so Kotlin doesn't need a follow-up uniffi+ * call for the debug-pill update. Detailed async-job telemetry (rec+ * counts, ms, cancel) is *not* packed in — poll+ * `LivePlanarTracker.lastAcquireTelemetry()` to refresh the pill.+ */+internal object LivePipelineJni {+ init {+ System.loadLibrary("bindings")+ }++ /** Build a native `GlesRenderer` for the GPU present path. MUST be+ * called on the GL render thread with its EGL GLES3 context already+ * current. Returns a native pointer (`Long`), or 0 on failure.+ * Release with [destroyGlRenderer] on the same thread. */+ @JvmStatic+ external fun createGlRenderer(): Long++ /** Free a renderer from [createGlRenderer]. Same-thread / context as+ * creation. */+ @JvmStatic+ external fun destroyGlRenderer(rendererPtr: Long)++ /** Switch a renderer to overlay-only present: [processFrameGl] then draws+ * only the overlays over a transparent clear (premultiplied), skipping the+ * camera passthrough — for a translucent FLAG_SECURE window floating over+ * the live screen (the MediaProjection screen-translate path). Call once on+ * the GL thread after [createGlRenderer]. Tracker readbacks are unaffected. */+ @JvmStatic+ external fun setRendererOverlayOnly(rendererPtr: Long)++ /** Set the renderer's parametric overlay opacity (0..1). The screen path+ * uses this to control overlay opacity independently of the touch-capped+ * window alpha; camera leaves it at the 1.0 default. */+ @JvmStatic+ external fun setRendererOverlayAlpha(+ rendererPtr: Long,+ alpha: Float,+ )++ /** Dispatch a screen acquire: GPU-render the detector gray + recognition RGBA+ * off the captured texture and hand the frame to the background OCR worker.+ * Non-blocking — detect/rec/translate runs off the GL thread; poll+ * [screenAcquireState] and call [screenPresentOverlay] when the version bumps.+ * Returns 1 if dispatched. */+ @JvmStatic+ external fun screenDispatchAcquire(+ pipelinePtr: Long,+ rendererPtr: Long,+ cameraTexId: Int,+ canonicalWidth: Int,+ canonicalHeight: Int,+ surfaceWidth: Int,+ surfaceHeight: Int,+ uvXform: FloatArray,+ ): Int++ /** Present the screen pipeline's resident overlay canvas straight into the+ * currently-bound EGL window surface (the overlay TextureView): renders it if a+ * deferred upsert left it stale, then uploads it to a texture and draws one+ * premultiplied quad — no Bitmap, no CPU readback. Make the window surface+ * current before calling and `eglSwapBuffers` after. Returns 1 if a frame was+ * drawn, 0 when there's nothing to show. */+ @JvmStatic+ external fun screenPresentOverlayGl(+ pipelinePtr: Long,+ rendererPtr: Long,+ canonicalWidth: Int,+ canonicalHeight: Int,+ surfaceWidth: Int,+ surfaceHeight: Int,+ ): Int++ /** Acquire state for the poll loop: `(busy shl 32) or overlayVersion`. `busy`+ * = an acquire is in flight; `overlayVersion` bumps each time the worker+ * upserts overlays (provisional, then full). */+ @JvmStatic+ external fun screenAcquireState(pipelinePtr: Long): Long++ /** Abort an in-flight screen acquire (the screen moved). */+ @JvmStatic+ external fun screenAbortAcquire(pipelinePtr: Long)++ /** Screen-translate change detection: GPU-reads a coarse gray off the captured+ * external texture and feeds the `LiveScreenPipeline` monitor. Returns a+ * packed `Int`: bits 0-1 = action (0=none, 1=hide, 2=acquire), bit 8 =+ * wants-tick (a settle deadline is armed / an acquire is in flight → poll on a+ * timer). Cheap (no overlay readback); the heavy detect/rec runs on the worker+ * via [screenDispatchAcquire] once an acquire is decided. */+ @JvmStatic+ external fun screenMonitorFrameGl(+ pipelinePtr: Long,+ rendererPtr: Long,+ cameraTexId: Int,+ canonicalWidth: Int,+ canonicalHeight: Int,+ uvXform: FloatArray,+ nowNs: Long,+ ): Int++ /** Timed tick for the screen monitor (no new frame): fires a pending settle so+ * the screen settles even when the mirror stops emitting frames. Same packed+ * `Int` as [screenMonitorFrameGl]. */+ @JvmStatic+ external fun screenMonitorTick(+ pipelinePtr: Long,+ nowNs: Long,+ ): Int++ /** DEBUG: read back the canonical RGBA frame (top-down, `cw*ch*4` bytes) the+ * tracker/recognizer sees, for on-device inspection. Call on the GL thread+ * after a [processFrameGl] (so the external source + uv are set). Empty on+ * failure. */+ @JvmStatic+ external fun debugReadCanonicalRgba(+ rendererPtr: Long,+ canonicalWidth: Int,+ canonicalHeight: Int,+ displayXform: FloatArray,+ ): ByteArray++ /** Per-frame GPU path. Call on the GL render thread; follow with+ * `eglSwapBuffers`. Returns a packed `Long` (see [FrameResult.unpack]);+ * `compositeOk` means a frame was drawn.+ *+ * - `cameraTexId`: id of the `GL_TEXTURE_EXTERNAL_OES` the camera's+ * `SurfaceTexture` writes into. Must be valid for the duration of+ * the call.+ * - `canonicalWidth/Height`: small downscaled tracker frame size (the+ * R8 readback the GPU produces feeds the BRIEF tracker at these+ * dims). Capped to ~1000 on the long side; preserves surface aspect.+ * - `surfaceWidth/Height`: EGL window surface dims; viewport for the+ * final composite into FBO 0.+ * - `uvXform`: row-major 3×3 mapping display UV [0,1]² → external-OES+ * texture UV (sensor orientation). Derived from+ * `SurfaceTexture.getTransformMatrix`.+ * - `displayXform`: row-major 3×3 mapping canonical-pixel coords+ * (top-left origin, y-down) → clip space. */+ @JvmStatic+ external fun processFrameGl(+ pipelinePtr: Long,+ rendererPtr: Long,+ cameraTexId: Int,+ canonicalWidth: Int,+ canonicalHeight: Int,+ surfaceWidth: Int,+ surfaceHeight: Int,+ uvXform: FloatArray,+ displayXform: FloatArray,+ timestampNs: Long,+ ): Long++ /** Decoded per-frame result (see Rust `pack_result` for the bit+ * layout). `compositeOk == false` means no frame was drawn this+ * tick. */+ data class FrameResult(+ val state: uniffi.bindings.PlanarTrackerState,+ val anchorIdLow16: Long,+ val inliers: Int,+ val scale: Float,+ val compositeOk: Boolean,+ val startedAcquire: Boolean,+ val startedRefresh: Boolean,+ ) {+ companion object {+ fun unpack(packed: Long): FrameResult? {+ if (packed == 0L) return null+ val state =+ when ((packed ushr 62) and 0x3L) {+ 0L -> uniffi.bindings.PlanarTrackerState.IDLE+ 1L -> uniffi.bindings.PlanarTrackerState.ACQUIRING+ 2L -> uniffi.bindings.PlanarTrackerState.LOCKED+ else -> uniffi.bindings.PlanarTrackerState.LOST+ }+ val compositeOk = ((packed ushr 61) and 0x1L) != 0L+ val inliers = ((packed ushr 45) and 0xFFFFL).toInt()+ val anchorLo = (packed ushr 29) and 0xFFFFL+ val startedAcquire = ((packed ushr 28) and 0x1L) != 0L+ val startedRefresh = ((packed ushr 27) and 0x1L) != 0L+ val scale = (packed and 0x1FFFFFL).toFloat() / 1024f+ return FrameResult(+ state,+ anchorLo,+ inliers,+ scale,+ compositeOk,+ startedAcquire,+ startedRefresh,+ )+ }+ }+ }+}diff --git a/OCR-translation/src/main/java/dev/davidv/translator/LivePlanarOcrEngine.kt b/OCR-translation/src/main/java/dev/davidv/translator/LivePlanarOcrEngine.ktnew file mode 100644index 0000000..3abc8c4--- /dev/null+++ b/OCR-translation/src/main/java/dev/davidv/translator/LivePlanarOcrEngine.kt@@ -0,0 +1,185 @@+/*+ * Copyright (C) 2024 David V+ *+ * This program 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.+ *+ * This program 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 <https://www.gnu.org/licenses/>.+ */++package dev.davidv.translator++import android.util.Log+import kotlinx.coroutines.CoroutineScope+import kotlinx.coroutines.flow.MutableStateFlow+import kotlinx.coroutines.flow.StateFlow+import kotlinx.coroutines.flow.asStateFlow+import uniffi.bindings.PipelineTargetMode+import uniffi.bindings.PlanarTrackerState++private const val TAG_PLANAR = "LivePlanarOcrEngine"++/** Debug status snapshot for the on-screen tracker pill. */+data class TrackerStatus(+ val state: PlanarTrackerState,+ val anchorId: Long,+ /** Low-16 id of the chain root, straight from the per-frame result+ * and never overwritten by acquire telemetry (unlike [anchorId],+ * which the debug pill repoints at the last acquired anchor). The+ * focus controller watches this to detect a full re-acquire — a new+ * root means the scale baseline reset and focus must re-baseline. */+ val rootAnchorId: Long,+ val inliers: Int,+ /** Magnification of the tracked plane vs the chain root's acquire+ * frame; `1.0` at acquire, larger as the camera nears the plane.+ * `0` when not LOCKED. Drives the focus-distance estimate. */+ val scale: Float,+ val lastAcquireDet: Int,+ val lastAcquireRecOk: Int,+ val lastAcquireRecEmpty: Int,+ val lastAcquirePending: Int,+)++/** Thin Kotlin host for the Rust `LiveTrackerPipeline`. Owns the tracker+ * + AF/overlay/language config; per-frame work happens entirely on the+ * GL render thread inside `LiveGlSurfaceView` (driven by+ * `SurfaceTexture.onFrameAvailable`), which invokes+ * [LivePipelineJni.processFrameGl] directly with the tracker's raw+ * address.+ *+ * This class no longer touches per-frame camera bytes; the analyzer+ * thread and the `FrameHandle` pool are both gone. It surfaces:+ *+ * - [pipelinePtr] for the GL thread to drive the per-frame call+ * - [onFrameResult] for the GL thread to publish the packed result+ * back so the tracker pill flow stays in sync+ * - language/focus/AF/overlay configuration knobs that translate+ * directly into pipeline mutators (no per-frame state). */+class LivePlanarOcrEngine(+ private val catalog: LanguageCatalog,+ @Suppress("UNUSED_PARAMETER") workerScope: CoroutineScope,+) {+ private val tracker = uniffi.bindings.LivePlanarTracker(catalog.planarHandle())++ /** Raw pointer to the `LiveTrackerPipeline` so the GL render thread+ * can drive per-frame `processFrameGl` calls without a uniffi hop.+ * `0` if the tracker pointer couldn't be fetched. */+ val pipelinePtr: Long =+ runCatching { tracker.rawAddressForJni().toLong() }+ .onFailure { Log.w(TAG_PLANAR, "tracker.rawAddressForJni failed", it) }+ .getOrDefault(0L)++ private val _trackerStatus =+ MutableStateFlow(+ TrackerStatus(+ state = PlanarTrackerState.IDLE,+ anchorId = 0L,+ rootAnchorId = 0L,+ inliers = 0,+ scale = 0f,+ lastAcquireDet = -1,+ lastAcquireRecOk = 0,+ lastAcquireRecEmpty = 0,+ lastAcquirePending = 0,+ ),+ )+ val trackerStatus: StateFlow<TrackerStatus> = _trackerStatus.asStateFlow()++ @Volatile+ private var afScanning: Boolean = false++ @Volatile+ private var overlayEnabled: Boolean = true++ fun setLanguages(+ from: Language,+ to: Language,+ isAutoSource: Boolean,+ ) {+ runCatching { tracker.setLanguages(from.code, to.code, isAutoSource) }+ .onFailure { Log.w(TAG_PLANAR, "setLanguages failed", it) }+ }++ /** Tap-to-focus = fresh-start intent. Resetting the tracker bumps the+ * Rust generation so any in-flight async job bails at its next+ * gen-check. */+ fun resetTracker() {+ runCatching { tracker.reset() }+ .onFailure { Log.w(TAG_PLANAR, "tracker.reset failed", it) }+ }++ /** Receives the packed per-frame result from the GL thread. Updates+ * the tracker status flow + pulls the latest acquire telemetry for+ * the debug pill. */+ fun onFrameResult(packed: Long) {+ val result = LivePipelineJni.FrameResult.unpack(packed) ?: return+ val baseStatus =+ _trackerStatus.value.copy(+ state = result.state,+ anchorId = result.anchorIdLow16,+ rootAnchorId = result.anchorIdLow16,+ inliers = result.inliers,+ scale = result.scale,+ )+ val telemetry =+ runCatching { tracker.lastAcquireTelemetry() }.getOrNull()+ _trackerStatus.value =+ if (telemetry != null) {+ baseStatus.copy(+ anchorId = telemetry.anchorId.toLong(),+ lastAcquireDet = telemetry.detectedCount.toInt(),+ lastAcquireRecOk = telemetry.recOkCount.toInt(),+ lastAcquireRecEmpty = telemetry.recEmptyCount.toInt(),+ lastAcquirePending =+ (telemetry.detectedCount - telemetry.recOkCount - telemetry.recEmptyCount).toInt(),+ )+ } else {+ baseStatus+ }+ }++ fun onAfScanStart() {+ if (afScanning) return+ afScanning = true+ Log.i(TAG_PLANAR, "AF scan started → suspending pipeline")+ applyTargetMode()+ }++ fun onAfScanEnd() {+ if (!afScanning) return+ afScanning = false+ Log.i(TAG_PLANAR, "AF scan ended → resuming pipeline")+ applyTargetMode()+ }++ /** Toggle whether OCR/translation overlay work runs. When disabled,+ * the tracker is held in SUPPRESSED so per-frame composites still+ * produce camera pixels but no acquire/refresh worker is dispatched.+ * This lets the camera keep rendering when models are missing or+ * the user has turned the overlay off. */+ fun setOverlayEnabled(enabled: Boolean) {+ if (overlayEnabled == enabled) return+ overlayEnabled = enabled+ applyTargetMode()+ }++ private fun applyTargetMode() {+ val mode =+ if (overlayEnabled && !afScanning) PipelineTargetMode.ACTIVE else PipelineTargetMode.SUPPRESSED+ runCatching { tracker.setTargetMode(mode) }+ .onFailure { Log.w(TAG_PLANAR, "setTargetMode failed", it) }+ }++ fun clear() {+ runCatching { tracker.reset() }+ runCatching { tracker.clearOverlay() }+ }+}diff --git a/OCR-translation/src/main/java/dev/davidv/translator/MainActivity.kt b/OCR-translation/src/main/java/dev/davidv/translator/MainActivity.ktnew file mode 100644index 0000000..4db86b5--- /dev/null+++ b/OCR-translation/src/main/java/dev/davidv/translator/MainActivity.kt@@ -0,0 +1,253 @@+/*+ * Copyright (C) 2024 David V+ *+ * This program 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.+ *+ * This program 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 <https://www.gnu.org/licenses/>.+ */++package dev.davidv.translator++import android.content.ComponentName+import android.content.Context+import android.content.Intent+import android.content.ServiceConnection+import android.net.Uri+import android.os.Build+import android.os.Bundle+import android.os.IBinder+import android.util.Log+import android.widget.Toast+import androidx.activity.ComponentActivity+import androidx.activity.compose.setContent+import androidx.activity.enableEdgeToEdge+import androidx.lifecycle.ViewModelProvider+import dev.davidv.translator.browser.BrowserActivity+import dev.davidv.translator.ui.TranslatorViewModel+import dev.davidv.translator.ui.TranslatorViewModelFactory+import dev.davidv.translator.ui.screens.TranslatorApp+import dev.davidv.translator.ui.theme.TranslatorTheme+import kotlinx.coroutines.flow.MutableStateFlow+import kotlinx.coroutines.flow.StateFlow+import kotlinx.coroutines.flow.asStateFlow++class MainActivity : ComponentActivity() {+ companion object {+ const val EXTRA_OPEN_LANGUAGE_MANAGER = "dev.davidv.translator.OPEN_LANGUAGE_MANAGER"+ }++ // Identity in production; only the UI-export test flips UiExportRecorder.active to record which+ // R.string each rendered label resolved from.+ override fun attachBaseContext(newBase: Context) {+ super.attachBaseContext(UiExportRecorder.wrap(newBase))+ }++ private var textToTranslate: String = ""+ private var launchMode: LaunchMode = LaunchMode.Normal+ private var sharedImageUri: Uri? = null+ private var sharedDocumentUri: Uri? = null+ private var openLanguageManager: Boolean = false+ private lateinit var viewModel: TranslatorViewModel+ private var downloadService: DownloadService? = null+ private lateinit var serviceConnection: ServiceConnection+ private val _downloadServiceState = MutableStateFlow<DownloadService?>(null)+ private val downloadServiceState: StateFlow<DownloadService?> = _downloadServiceState.asStateFlow()++ override fun onCreate(savedInstanceState: Bundle?) {+ super.onCreate(savedInstanceState)+ enableEdgeToEdge()+ handleIntent(intent)+ if (isFinishing) return++ val app = application as TranslatorApplication++ viewModel =+ ViewModelProvider(+ this,+ TranslatorViewModelFactory(+ appContext = applicationContext,+ translationCoordinator = app.translationCoordinator,+ settingsManager = app.settingsManager,+ filePathManager = app.filePathManager,+ languageMetadataManager = app.languageMetadataManager,+ initialText = textToTranslate,+ initialLaunchMode = launchMode,+ ),+ )[TranslatorViewModel::class.java]++ // Deliver any shared input now that the ViewModel exists.+ sharedImageUri?.let { viewModel.setSharedImageUri(it) }+ sharedDocumentUri?.let { viewModel.setSharedDocumentUri(it) }+ if (openLanguageManager) {+ viewModel.requestLanguageManager()+ openLanguageManager = false+ }++ setContent {+ TranslatorTheme {+ MigrationGate(+ filePathManager = app.filePathManager,+ onMigrated = {+ TranslatorTtsEngine.notifyVoiceDataChanged(applicationContext)+ // The Application holds its own catalog instance (used by e.g. the+ // doc-align gate) separate from LanguageStateManager's; refresh it too.+ app.reloadLanguageCatalog()+ viewModel.languageStateManager.refreshLanguageAvailability()+ },+ ) {+ TranslatorApp(+ viewModel = viewModel,+ downloadServiceState = downloadServiceState,+ )+ }+ }+ }++ serviceConnection =+ object : ServiceConnection {+ override fun onServiceConnected(+ name: ComponentName?,+ service: IBinder?,+ ) {+ Log.d("ServiceConnection", "download service done")+ val binder = service as DownloadService.DownloadBinder+ downloadService = binder.getService()+ _downloadServiceState.value = downloadService+ }++ override fun onServiceDisconnected(name: ComponentName?) {+ downloadService = null+ _downloadServiceState.value = null+ }+ }++ val serviceIntent = Intent(this, DownloadService::class.java)+ bindService(serviceIntent, serviceConnection, Context.BIND_AUTO_CREATE)+ }++ override fun onDestroy() {+ super.onDestroy()+ if (::serviceConnection.isInitialized) {+ unbindService(serviceConnection)+ }+ Log.i("MainActivity", "cleaning up")+ }++ override fun onNewIntent(intent: Intent) {+ super.onNewIntent(intent)+ handleIntent(intent)+ // Warm start (activity already created): deliver straight to the ViewModel,+ // since onCreate's one-shot delivery has already run.+ if (::viewModel.isInitialized) {+ sharedImageUri?.let {+ viewModel.setSharedImageUri(it)+ sharedImageUri = null+ }+ sharedDocumentUri?.let {+ viewModel.setSharedDocumentUri(it)+ sharedDocumentUri = null+ }+ if (openLanguageManager) {+ viewModel.requestLanguageManager()+ openLanguageManager = false+ }+ }+ }++ private fun handleIntent(intent: Intent?) {+ Log.d("MainActivity", "Got intent $intent")+ openLanguageManager = intent?.getBooleanExtra(EXTRA_OPEN_LANGUAGE_MANAGER, false) == true+ when (intent?.action) {+ Intent.ACTION_SEND -> {+ val text = intent.getStringExtra(Intent.EXTRA_TEXT)+ val streamUri =+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {+ intent.getParcelableExtra(Intent.EXTRA_STREAM, Uri::class.java)+ } else {+ @Suppress("DEPRECATION")+ intent.getParcelableExtra(Intent.EXTRA_STREAM)+ }++ if (text != null) {+ val trimmed = text.trim()+ if (isWebUrl(trimmed)) {+ if (isSupportedDocumentUrl(trimmed)) {+ Toast.makeText(this, getString(R.string.doc_url_unsupported), Toast.LENGTH_LONG).show()+ } else {+ openUrl(trimmed)+ return+ }+ } else {+ textToTranslate = text+ }+ } else if (streamUri != null) {+ // EXTRA_STREAM carries both shared images (→ crop) and shared documents+ // (→ the document drawer); route by MIME so a pdf/odt/txt/epub doesn't+ // get sent to the image cropper.+ if (isImageUri(this, streamUri)) {+ sharedImageUri = streamUri+ } else {+ sharedDocumentUri = streamUri+ }+ textToTranslate = ""+ }+ }+ Intent.ACTION_VIEW -> {+ val url = intent.data?.toString()+ if (!url.isNullOrBlank() && isWebUrl(url)) {+ if (isSupportedDocumentUrl(url)) {+ Toast.makeText(this, getString(R.string.doc_url_unsupported), Toast.LENGTH_LONG).show()+ } else {+ openUrl(url)+ return+ }+ }+ }+ }+ }++ private fun openUrl(url: String) {+ val browserIntent =+ Intent(this, BrowserActivity::class.java).apply {+ putExtra(BrowserActivity.EXTRA_URL, url)+ }+ startActivity(browserIntent)+ finish()+ }+}++internal fun isWebUrl(text: String): Boolean {+ val trimmed = text.trim()+ if (trimmed.contains(Regex("\\s"))) return false+ return trimmed.startsWith("http://") || trimmed.startsWith("https://")+}++private val SUPPORTED_DOCUMENT_URL_EXTENSIONS =+ setOf(+ "pdf", "odt", "epub",+ "png", "jpg", "jpeg", "webp", "gif", "bmp", "heic", "heif", "tiff", "tif", "avif",+ )++internal fun isSupportedDocumentUrl(url: String): Boolean {+ val path =+ try {+ java.net.URI(url).path ?: return false+ } catch (_: Exception) {+ return false+ }+ val lastSlash = path.lastIndexOf('/')+ val lastSegment = if (lastSlash >= 0) path.substring(lastSlash + 1) else path+ val lastDot = lastSegment.lastIndexOf('.')+ if (lastDot <= 0) return false+ val ext = lastSegment.substring(lastDot + 1).lowercase()+ return ext in SUPPORTED_DOCUMENT_URL_EXTENSIONS+}diff --git a/OCR-translation/src/main/java/dev/davidv/translator/MigrationGate.kt b/OCR-translation/src/main/java/dev/davidv/translator/MigrationGate.ktnew file mode 100644index 0000000..a23c4f3--- /dev/null+++ b/OCR-translation/src/main/java/dev/davidv/translator/MigrationGate.kt@@ -0,0 +1,269 @@+package dev.davidv.translator++import android.util.Log+import androidx.compose.animation.core.RepeatMode+import androidx.compose.animation.core.animateFloat+import androidx.compose.animation.core.infiniteRepeatable+import androidx.compose.animation.core.rememberInfiniteTransition+import androidx.compose.animation.core.tween+import androidx.compose.foundation.layout.Arrangement+import androidx.compose.foundation.layout.Column+import androidx.compose.foundation.layout.Spacer+import androidx.compose.foundation.layout.fillMaxSize+import androidx.compose.foundation.layout.fillMaxWidth+import androidx.compose.foundation.layout.height+import androidx.compose.foundation.layout.padding+import androidx.compose.material3.Button+import androidx.compose.material3.CircularProgressIndicator+import androidx.compose.material3.LinearProgressIndicator+import androidx.compose.material3.MaterialTheme+import androidx.compose.material3.OutlinedButton+import androidx.compose.material3.Surface+import androidx.compose.material3.Text+import androidx.compose.runtime.Composable+import androidx.compose.runtime.LaunchedEffect+import androidx.compose.runtime.getValue+import androidx.compose.runtime.mutableStateOf+import androidx.compose.runtime.remember+import androidx.compose.runtime.rememberCoroutineScope+import androidx.compose.runtime.setValue+import androidx.compose.ui.Alignment+import androidx.compose.ui.Modifier+import androidx.compose.ui.res.pluralStringResource+import androidx.compose.ui.res.stringResource+import androidx.compose.ui.text.style.TextAlign+import androidx.compose.ui.unit.dp+import kotlinx.coroutines.Dispatchers+import kotlinx.coroutines.launch+import kotlinx.coroutines.withContext+import uniffi.bindings.MigrationJobRecord+import java.io.File++private const val TAG = "MigrationGate"++// The doc-detection model (docaligner) is required and tiny, so it converts+// silently; TTS voices are user-facing and big, so they go through a mandatory+// prompt with a delete-all alternative.+private const val FEATURE_DOC_DETECT = "doc_detect"++sealed interface MigrationUiState {+ /** Planning / converting the required (doc-detect) models. */+ data object Working : MigrationUiState++ data class Converting(val current: Int, val total: Int, val label: String) : MigrationUiState++ /** Mandatory choice for TTS voices before the app can be used. */+ data class AwaitTtsDecision(val ttsCount: Int, val savedBytes: Long) : MigrationUiState++ /** Nothing to migrate, or migration finished — show the app. */+ data object Passed : MigrationUiState+}++private fun jobLabel(job: MigrationJobRecord): String = File(job.mnnPath).name++private fun savedBytes(jobs: List<MigrationJobRecord>): Long =+ jobs.sumOf { (it.onnxBytes.toLong() - it.mnnBytes.toLong()).coerceAtLeast(0) }++/**+ * Convert each job's `.onnx` to `.mnn` (cleanup-only jobs are passed through),+ * reporting N-of-M progress. Each job's source `.onnx` is dropped via [onJobDone]+ * the moment that job is safe — right after its own successful conversion, or+ * immediately for cleanup-only jobs whose `.mnn` already exists. Failed+ * conversions keep their `.onnx` so the next launch retries.+ */+private fun convertGroup(+ baseDir: String,+ jobs: List<MigrationJobRecord>,+ onProgress: (Int, Int, String) -> Unit,+ onJobDone: (MigrationJobRecord) -> Unit,+) {+ // Jobs already satisfied — cleanup-only, or whose `.mnn` already exists from a+ // prior/duplicate run — need no conversion and must NOT drive the progress bar.+ // Otherwise an intermittent re-run (e.g. the gate re-mounting on an activity+ // recreate) visibly sweeps the bar again over already-migrated models.+ val toConvert =+ jobs.filter { job ->+ val done = !job.needsConvert || File(baseDir, job.mnnPath).exists()+ if (done) onJobDone(job)+ !done+ }+ Log.i(TAG, "convertGroup ENTER total=${jobs.size} toConvert=${toConvert.size}")+ toConvert.forEachIndexed { index, job ->+ onProgress(index, toConvert.size, jobLabel(job))+ val onnx = File(baseDir, job.onnxPath).absolutePath+ val error = ModelConverterJni.convert(onnx, File(baseDir, job.mnnPath).absolutePath, job.quantBits)+ if (error == null) {+ onJobDone(job)+ } else {+ Log.e(TAG, "convert failed for ${job.onnxPath}: $error")+ }+ }+}++/**+ * Blocks the app on first launch after the ONNX→MNN migration until every needed+ * model is converted (or the user drops the TTS voices). Once nothing is left to+ * migrate this is a cheap no-op and renders [content] directly.+ */+@Composable+fun MigrationGate(+ filePathManager: FilePathManager,+ onMigrated: () -> Unit,+ content: @Composable () -> Unit,+) {+ var state by remember { mutableStateOf<MigrationUiState>(MigrationUiState.Working) }+ var ttsJobs by remember { mutableStateOf<List<MigrationJobRecord>>(emptyList()) }+ // Guards against the Accept/Delete tap registering more than once: without it a+ // second invocation re-runs convertGroup over already-migrated jobs (whose+ // `.onnx` is gone), flashing the bar through a second time.+ var ttsHandled by remember { mutableStateOf(false) }+ val scope = rememberCoroutineScope()++ val ttsProgress: (Int, Int, String) -> Unit = { current, total, label ->+ state = MigrationUiState.Converting(current = current, total = total, label = label)+ }++ // Phase 1: plan + convert the required doc-detect models silently (no per-file+ // bar — just the spinner). Then either pass (no TTS) or surface the mandatory+ // TTS decision. `migrated` distinguishes "did real work" from "nothing to do"+ // so we only refresh availability when something actually changed.+ LaunchedEffect(Unit) {+ Log.i(TAG, "phase1 LaunchedEffect ENTER")+ val (outcome, migrated) =+ withContext(Dispatchers.IO) {+ val catalog =+ filePathManager.loadCatalog() ?: return@withContext MigrationUiState.Passed to false+ val plan = catalog.planMigration()+ Log.i(TAG, "phase1 plan size=${plan.size}")+ if (plan.isEmpty()) return@withContext MigrationUiState.Passed to false++ val (docDetect, tts) = plan.partition { it.feature == FEATURE_DOC_DETECT }+ if (docDetect.isNotEmpty()) {+ convertGroup(catalog.baseDir, docDetect, { _, _, _ -> }) { catalog.discardMigration(listOf(it)) }+ }+ ttsJobs = tts+ if (tts.isEmpty()) {+ filePathManager.invalidateCatalog()+ MigrationUiState.Passed to true+ } else {+ MigrationUiState.AwaitTtsDecision(+ ttsCount = tts.count { it.needsConvert },+ savedBytes = savedBytes(tts.filter { it.needsConvert }),+ ) to false+ }+ }+ state = outcome+ if (migrated) onMigrated()+ }++ val finishTts: (convert: Boolean) -> Unit = { convert ->+ Log.i(TAG, "finishTts ENTER convert=$convert ttsHandled=$ttsHandled ttsJobs=${ttsJobs.size}")+ if (!ttsHandled) {+ ttsHandled = true+ scope.launch {+ withContext(Dispatchers.IO) {+ val catalog = filePathManager.loadCatalog()+ if (catalog != null) {+ if (convert) {+ convertGroup(catalog.baseDir, ttsJobs, ttsProgress) { catalog.discardMigration(listOf(it)) }+ } else {+ // Drop the voices: delete every source .onnx without converting.+ catalog.discardMigration(ttsJobs)+ }+ }+ filePathManager.invalidateCatalog()+ }+ onMigrated()+ state = MigrationUiState.Passed+ }+ }+ }++ when (val current = state) {+ MigrationUiState.Passed -> content()+ else ->+ MigrationBlockingScreen(+ state = current,+ onConvert = { finishTts(true) },+ onDeleteAll = { finishTts(false) },+ )+ }+}++@Composable+internal fun MigrationBlockingScreen(+ state: MigrationUiState,+ onConvert: () -> Unit,+ onDeleteAll: () -> Unit,+) {+ Surface(modifier = Modifier.fillMaxSize()) {+ Column(+ modifier = Modifier.fillMaxSize().padding(32.dp),+ horizontalAlignment = Alignment.CenterHorizontally,+ verticalArrangement = Arrangement.Center,+ ) {+ when (state) {+ is MigrationUiState.AwaitTtsDecision -> {+ val savedMb = state.savedBytes / 1_000_000.0+ Text(+ text = stringResource(R.string.migration_updating_speech_models),+ textAlign = TextAlign.Center,+ )+ Spacer(Modifier.height(12.dp))+ Text(+ text =+ pluralStringResource(+ R.plurals.migration_convert_prompt,+ state.ttsCount,+ state.ttsCount,+ 6 * state.ttsCount,+ savedMb,+ ),+ textAlign = TextAlign.Center,+ )+ Spacer(Modifier.height(24.dp))+ Button(modifier = Modifier.fillMaxWidth(), onClick = onConvert) {+ Text(stringResource(R.string.migration_accept_convert))+ }+ Spacer(Modifier.height(8.dp))+ OutlinedButton(modifier = Modifier.fillMaxWidth(), onClick = onDeleteAll) {+ Text(stringResource(R.string.migration_delete_all))+ }+ }++ is MigrationUiState.Converting -> {+ // Each `.onnx`→`.mnn` step blocks for seconds, so the bar value changes+ // only ~once per model. A static window lets the surface's BufferQueue+ // fill with those few stale frames, which the hand-off to the app then+ // replays as a phantom re-sweep. Breathing the bar colour keeps a fresh+ // frame flowing every vsync, so there is nothing stale to re-present.+ val breathing = rememberInfiniteTransition(label = "convert-breath")+ val breathAlpha by breathing.animateFloat(+ initialValue = 0.72f,+ targetValue = 1f,+ animationSpec = infiniteRepeatable(tween(1800), RepeatMode.Reverse),+ label = "convert-breath-alpha",+ )+ Text(+ text = stringResource(R.string.migration_converting, state.current + 1, state.total),+ textAlign = TextAlign.Center,+ )+ Spacer(Modifier.height(8.dp))+ Text(text = state.label, textAlign = TextAlign.Center)+ Spacer(Modifier.height(24.dp))+ LinearProgressIndicator(+ progress = { (state.current + 1).toFloat() / state.total.coerceAtLeast(1) },+ color = MaterialTheme.colorScheme.primary.copy(alpha = breathAlpha),+ modifier = Modifier.fillMaxWidth(),+ )+ }++ else -> {+ CircularProgressIndicator()+ Spacer(Modifier.height(16.dp))+ Text(text = stringResource(R.string.migration_optimizing), textAlign = TextAlign.Center)+ }+ }+ }+ }+}diff --git a/OCR-translation/src/main/java/dev/davidv/translator/ModelConverterJni.kt b/OCR-translation/src/main/java/dev/davidv/translator/ModelConverterJni.ktnew file mode 100644index 0000000..6c6362f--- /dev/null+++ b/OCR-translation/src/main/java/dev/davidv/translator/ModelConverterJni.kt@@ -0,0 +1,22 @@+package dev.davidv.translator++/**+ * Thin JNI front for the on-device ONNX→MNN converter, which lives in its own+ * native lib (`libmodel_converter.so`) because the MNN converter's protobuf+ * cannot share a binary with slimt's sentencepiece protobuf-lite.+ */+object ModelConverterJni {+ init {+ System.loadLibrary("model_converter")+ }++ /**+ * Convert [onnxPath] to [mnnPath]. Returns `null` on success or an error+ * message on failure. `quantBits` of 8 = int8 weight quant; 0 = none.+ */+ external fun convert(+ onnxPath: String,+ mnnPath: String,+ quantBits: Int,+ ): String?+}diff --git a/OCR-translation/src/main/java/dev/davidv/translator/NativeBitmap.kt b/OCR-translation/src/main/java/dev/davidv/translator/NativeBitmap.ktnew file mode 100644index 0000000..c63367d--- /dev/null+++ b/OCR-translation/src/main/java/dev/davidv/translator/NativeBitmap.kt@@ -0,0 +1,16 @@+package dev.davidv.translator++import android.graphics.Bitmap++// Pins a software ARGB_8888 bitmap and returns its native pixel address so the OCR pipeline+// can read/write the pixels in place — no byte[] copy across the uniffi boundary. Returns 0+// when the bitmap can't be locked tightly-packed (caller falls back to the copying path).+internal object NativeBitmap {+ init {+ System.loadLibrary("bindings")+ }++ external fun lockPixels(bitmap: Bitmap): Long++ external fun unlockPixels(bitmap: Bitmap)+}diff --git a/OCR-translation/src/main/java/dev/davidv/translator/OverlayTextTranslationHelper.kt b/OCR-translation/src/main/java/dev/davidv/translator/OverlayTextTranslationHelper.ktnew file mode 100644index 0000000..ab455ab--- /dev/null+++ b/OCR-translation/src/main/java/dev/davidv/translator/OverlayTextTranslationHelper.kt@@ -0,0 +1,28 @@+package dev.davidv.translator++import kotlinx.coroutines.flow.first++class OverlayTextTranslationHelper(+ private val langStateManager: LanguageStateManager,+ private val languageMetadataManager: LanguageMetadataManager,+) {+ fun availableLanguages(isSource: Boolean): List<Language> {+ val metadata = languageMetadataManager.metadata.value+ return langStateManager.languageState.value+ .translatorLanguages(requireOcr = isSource)+ .sortedWith(+ compareByDescending<Language> { metadata[it]?.favorite ?: false }+ .thenBy(languageNameComparator()) { it.localizedName() },+ )+ }++ suspend fun awaitAvailableLanguages(isSource: Boolean): List<Language> {+ awaitTranslatorLanguages()+ return availableLanguages(isSource)+ }++ private suspend fun awaitTranslatorLanguages(): List<Language> {+ langStateManager.languageState.first { !it.isChecking }+ return langStateManager.languageState.value.translatorLanguages()+ }+}diff --git a/OCR-translation/src/main/java/dev/davidv/translator/PcmAudio.kt b/OCR-translation/src/main/java/dev/davidv/translator/PcmAudio.ktnew file mode 100644index 0000000..b261163--- /dev/null+++ b/OCR-translation/src/main/java/dev/davidv/translator/PcmAudio.kt@@ -0,0 +1,16 @@+package dev.davidv.translator++data class PcmAudio(+ val sampleRate: Int,+ val pcmSamples: ShortArray,+) {+ companion object {+ fun silence(+ sampleRate: Int,+ durationMs: Int,+ ): PcmAudio {+ val sampleCount = ((sampleRate.toLong() * durationMs) / 1000L).toInt().coerceAtLeast(1)+ return PcmAudio(sampleRate = sampleRate, pcmSamples = ShortArray(sampleCount))+ }+ }+}diff --git a/OCR-translation/src/main/java/dev/davidv/translator/PcmAudioPlayer.kt b/OCR-translation/src/main/java/dev/davidv/translator/PcmAudioPlayer.ktnew file mode 100644index 0000000..7f1e914--- /dev/null+++ b/OCR-translation/src/main/java/dev/davidv/translator/PcmAudioPlayer.kt@@ -0,0 +1,209 @@+package dev.davidv.translator++import android.media.AudioAttributes+import android.media.AudioFormat+import android.media.AudioTrack+import android.os.Handler+import android.os.Looper+import android.util.Log+import kotlinx.coroutines.CancellationException+import kotlinx.coroutines.CoroutineScope+import kotlinx.coroutines.Dispatchers+import kotlinx.coroutines.Job+import kotlinx.coroutines.SupervisorJob+import kotlinx.coroutines.cancel+import kotlinx.coroutines.currentCoroutineContext+import kotlinx.coroutines.delay+import kotlinx.coroutines.ensureActive+import kotlinx.coroutines.flow.Flow+import kotlinx.coroutines.flow.buffer+import kotlinx.coroutines.flow.flowOf+import kotlinx.coroutines.isActive+import kotlinx.coroutines.launch++class PcmAudioPlayer(+ private val onPlaybackStateChanged: (Boolean) -> Unit = {},+) {+ private val mainHandler = Handler(Looper.getMainLooper())+ private val playbackScope = CoroutineScope(SupervisorJob() + Dispatchers.IO)+ private var audioTrack: AudioTrack? = null+ private var playbackJob: Job? = null++ fun play(audio: PcmAudio) {+ play(flowOf(audio))+ }++ fun play(+ audioChunks: Flow<PcmAudio>,+ onError: (String) -> Unit = {},+ ) {+ stop()++ playbackJob =+ playbackScope.launch {+ var track: AudioTrack? = null+ var sampleRate: Int? = null+ var totalFrames = 0++ try {+ var chunkIndex = 0+ audioChunks.buffer(capacity = 2).collect { audio ->+ ensureActive()+ chunkIndex += 1++ val currentTrack =+ if (track == null) {+ buildAudioTrack(audio).also { newTrack ->+ track = newTrack+ sampleRate = audio.sampleRate+ audioTrack = newTrack+ notifyPlaybackStateChanged(true)+ }+ } else {+ if (audio.sampleRate != sampleRate) {+ throw IllegalStateException(+ "Audio stream sample rate changed from $sampleRate to ${audio.sampleRate}",+ )+ }+ track!!+ }++ val audioDurationMs = (audio.pcmSamples.size * 1000L) / audio.sampleRate+ Log.d(+ "PcmAudioPlayer",+ "Chunk $chunkIndex: write start samples=${audio.pcmSamples.size} sampleRate=${audio.sampleRate} audioMs=$audioDurationMs playing=${currentTrack.playState == AudioTrack.PLAYSTATE_PLAYING}",+ )+ val written =+ currentTrack.write(+ audio.pcmSamples,+ 0,+ audio.pcmSamples.size,+ AudioTrack.WRITE_BLOCKING,+ )+ if (written != audio.pcmSamples.size) {+ val context = currentCoroutineContext()+ if (!context.isActive || audioTrack !== currentTrack) {+ throw CancellationException()+ }+ currentTrack.release()+ throw IllegalStateException("AudioTrack wrote $written of ${audio.pcmSamples.size} samples")+ }+ Log.d("PcmAudioPlayer", "Chunk $chunkIndex: write done written=$written")++ totalFrames += audio.pcmSamples.size+ if (currentTrack.playState != AudioTrack.PLAYSTATE_PLAYING) {+ Log.d("PcmAudioPlayer", "Chunk $chunkIndex: playback start")+ currentTrack.play()+ }+ }++ val finalTrack = track ?: return@launch+ waitForPlaybackDrain(finalTrack, totalFrames)+ finishPlayback(finalTrack)+ } catch (_: CancellationException) {+ Unit+ } catch (error: RuntimeException) {+ if (audioTrack === track) {+ audioTrack = null+ notifyPlaybackStateChanged(false)+ }+ playbackJob = null+ mainHandler.post {+ onError(error.message ?: "Audio playback failed")+ }+ cleanupTrack(track)+ }+ }+ }++ fun stop() {+ playbackJob?.cancel()+ playbackJob = null++ val track = audioTrack ?: return+ audioTrack = null+ runCatching {+ if (track.playState != AudioTrack.PLAYSTATE_STOPPED) {+ track.stop()+ }+ }+ track.release()+ notifyPlaybackStateChanged(false)+ }++ fun release() {+ stop()+ playbackScope.cancel()+ }++ private fun buildAudioTrack(audio: PcmAudio): AudioTrack {+ val minBufferSize =+ AudioTrack.getMinBufferSize(+ audio.sampleRate,+ AudioFormat.CHANNEL_OUT_MONO,+ AudioFormat.ENCODING_PCM_16BIT,+ )+ if (minBufferSize <= 0) {+ throw IllegalStateException("Invalid AudioTrack buffer size: $minBufferSize")+ }++ return AudioTrack+ .Builder()+ .setAudioAttributes(+ AudioAttributes+ .Builder()+ .setUsage(AudioAttributes.USAGE_MEDIA)+ .setContentType(AudioAttributes.CONTENT_TYPE_SPEECH)+ .build(),+ ).setAudioFormat(+ AudioFormat+ .Builder()+ .setEncoding(AudioFormat.ENCODING_PCM_16BIT)+ .setSampleRate(audio.sampleRate)+ .setChannelMask(AudioFormat.CHANNEL_OUT_MONO)+ .build(),+ ).setTransferMode(AudioTrack.MODE_STREAM)+ .setBufferSizeInBytes(maxOf(minBufferSize, audio.pcmSamples.size * Short.SIZE_BYTES))+ .build()+ }++ private suspend fun waitForPlaybackDrain(+ track: AudioTrack,+ totalFrames: Int,+ ) {+ while (track.playState == AudioTrack.PLAYSTATE_PLAYING) {+ currentCoroutineContext().ensureActive()+ if (track.playbackHeadPosition >= totalFrames) {+ break+ }+ delay(20)+ }+ }++ private fun finishPlayback(track: AudioTrack) {+ if (audioTrack === track) {+ audioTrack = null+ cleanupTrack(track)+ notifyPlaybackStateChanged(false)+ } else {+ cleanupTrack(track)+ }+ playbackJob = null+ }++ private fun cleanupTrack(track: AudioTrack?) {+ if (track == null) return+ runCatching {+ if (track.playState != AudioTrack.PLAYSTATE_STOPPED) {+ track.stop()+ }+ }+ track.release()+ }++ private fun notifyPlaybackStateChanged(playing: Boolean) {+ mainHandler.post {+ onPlaybackStateChanged(playing)+ }+ }+}diff --git a/OCR-translation/src/main/java/dev/davidv/translator/PermissionHelper.kt b/OCR-translation/src/main/java/dev/davidv/translator/PermissionHelper.ktnew file mode 100644index 0000000..0de9b8c--- /dev/null+++ b/OCR-translation/src/main/java/dev/davidv/translator/PermissionHelper.kt@@ -0,0 +1,72 @@+/*+ * Copyright (C) 2024 David V+ *+ * This program 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.+ *+ * This program 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 <https://www.gnu.org/licenses/>.+ */++package dev.davidv.translator++import android.Manifest+import android.content.Context+import android.content.Intent+import android.content.pm.PackageManager+import android.net.Uri+import android.os.Build+import android.os.Environment+import android.provider.Settings+import androidx.core.content.ContextCompat++object PermissionHelper {+ fun hasExternalStoragePermission(context: Context): Boolean =+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {+ Environment.isExternalStorageManager()+ } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {+ ContextCompat.checkSelfPermission(+ context,+ Manifest.permission.READ_EXTERNAL_STORAGE,+ ) == PackageManager.PERMISSION_GRANTED &&+ (+ Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q ||+ ContextCompat.checkSelfPermission(+ context,+ Manifest.permission.WRITE_EXTERNAL_STORAGE,+ ) == PackageManager.PERMISSION_GRANTED+ )+ } else {+ true+ }++ fun getExternalStoragePermissions(): Array<String> =+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {+ emptyArray() // MANAGE_EXTERNAL_STORAGE requires special intent+ } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {+ arrayOf(Manifest.permission.READ_EXTERNAL_STORAGE)+ } else {+ arrayOf(+ Manifest.permission.READ_EXTERNAL_STORAGE,+ Manifest.permission.WRITE_EXTERNAL_STORAGE,+ )+ }++ fun needsSpecialPermissionIntent(): Boolean = Build.VERSION.SDK_INT >= Build.VERSION_CODES.R++ fun createManageStorageIntent(context: Context): Intent =+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {+ Intent(Settings.ACTION_MANAGE_APP_ALL_FILES_ACCESS_PERMISSION).apply {+ data = Uri.parse("package:${context.packageName}")+ }+ } else {+ error("Special permission intent not needed for this Android version")+ }+}diff --git a/OCR-translation/src/main/java/dev/davidv/translator/ProcessTextActivity.kt b/OCR-translation/src/main/java/dev/davidv/translator/ProcessTextActivity.ktnew file mode 100644index 0000000..141ddcc--- /dev/null+++ b/OCR-translation/src/main/java/dev/davidv/translator/ProcessTextActivity.kt@@ -0,0 +1,148 @@+/*+ * Copyright (C) 2024 David V+ *+ * This program 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.+ *+ * This program 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 <https://www.gnu.org/licenses/>.+ */++package dev.davidv.translator++import android.content.ComponentName+import android.content.Context+import android.content.Intent+import android.content.ServiceConnection+import android.os.Bundle+import android.os.IBinder+import android.util.Log+import androidx.activity.ComponentActivity+import androidx.activity.compose.setContent+import androidx.activity.enableEdgeToEdge+import androidx.lifecycle.ViewModelProvider+import dev.davidv.translator.ui.TranslatorViewModel+import dev.davidv.translator.ui.TranslatorViewModelFactory+import dev.davidv.translator.ui.screens.TranslatorApp+import dev.davidv.translator.ui.theme.TranslatorTheme+import kotlinx.coroutines.flow.MutableStateFlow+import kotlinx.coroutines.flow.StateFlow+import kotlinx.coroutines.flow.asStateFlow++class ProcessTextActivity : ComponentActivity() {+ private var textToTranslate: String = ""+ private var launchMode: LaunchMode = LaunchMode.Normal+ private lateinit var viewModel: TranslatorViewModel+ private var downloadService: DownloadService? = null+ private lateinit var serviceConnection: ServiceConnection+ private val _downloadServiceState = MutableStateFlow<DownloadService?>(null)+ val downloadServiceState: StateFlow<DownloadService?> = _downloadServiceState.asStateFlow()++ override fun onCreate(savedInstanceState: Bundle?) {+ super.onCreate(savedInstanceState)+ enableEdgeToEdge()+ handleIntent(intent)++ val app = application as TranslatorApplication++ viewModel =+ ViewModelProvider(+ this,+ TranslatorViewModelFactory(+ appContext = applicationContext,+ translationCoordinator = app.translationCoordinator,+ settingsManager = app.settingsManager,+ filePathManager = app.filePathManager,+ languageMetadataManager = app.languageMetadataManager,+ initialText = textToTranslate,+ initialLaunchMode = launchMode,+ ),+ )[TranslatorViewModel::class.java]++ setContent {+ TranslatorTheme {+ TranslatorApp(+ viewModel = viewModel,+ downloadServiceState = downloadServiceState,+ onClose = { finish() },+ )+ }+ }++ serviceConnection =+ object : ServiceConnection {+ override fun onServiceConnected(+ name: ComponentName?,+ service: IBinder?,+ ) {+ val binder = service as DownloadService.DownloadBinder+ downloadService = binder.getService()+ _downloadServiceState.value = downloadService+ }++ override fun onServiceDisconnected(name: ComponentName?) {+ downloadService = null+ _downloadServiceState.value = null+ }+ }++ val serviceIntent = Intent(this, DownloadService::class.java)+ bindService(serviceIntent, serviceConnection, Context.BIND_AUTO_CREATE)+ }++ override fun onDestroy() {+ super.onDestroy()+ if (::serviceConnection.isInitialized) {+ unbindService(serviceConnection)+ }+ Log.i("ProcessTextActivity", "cleaning up")+ }++ override fun onNewIntent(intent: Intent) {+ super.onNewIntent(intent)+ handleIntent(intent)+ }++ private fun handleIntent(intent: Intent?) {+ val replyModalIntent = { text: String ->+ Log.i("IntentMessage", "sending response '$text' to intent")+ val respIntent = Intent()+ respIntent.putExtra(Intent.EXTRA_PROCESS_TEXT, text)+ setResult(RESULT_OK, respIntent)+ finish()+ }++ when (intent?.action) {+ TapToTranslateNotification.ACTION_OPEN_POPUP -> {+ launchMode = LaunchMode.ReadonlyModal+ textToTranslate = ""+ }+ Intent.ACTION_TRANSLATE -> {+ val isReadonly = intent.getBooleanExtra(Intent.EXTRA_PROCESS_TEXT_READONLY, true)+ Log.i("IntentMessage", "is RO: $isReadonly")+ launchMode = if (isReadonly) LaunchMode.ReadonlyModal else LaunchMode.ReadWriteModal(replyModalIntent)+ val text = intent.getStringExtra(Intent.EXTRA_TEXT)+ textToTranslate = text ?: ""+ }+ Intent.ACTION_PROCESS_TEXT -> {+ val isReadonly = intent.getBooleanExtra(Intent.EXTRA_PROCESS_TEXT_READONLY, true)+ Log.i("IntentMessage", "is RO: $isReadonly")+ launchMode = if (isReadonly) LaunchMode.ReadonlyModal else LaunchMode.ReadWriteModal(replyModalIntent)+ val text =+ if (intent.hasExtra(Intent.EXTRA_PROCESS_TEXT)) {+ intent.getCharSequenceExtra(Intent.EXTRA_PROCESS_TEXT)?.toString()+ } else {+ intent.getStringExtra(Intent.EXTRA_TEXT)+ }+ textToTranslate = text ?: ""+ }+ }+ }+}diff --git a/OCR-translation/src/main/java/dev/davidv/translator/QuickTranslateTileService.kt b/OCR-translation/src/main/java/dev/davidv/translator/QuickTranslateTileService.ktnew file mode 100644index 0000000..9a82281--- /dev/null+++ b/OCR-translation/src/main/java/dev/davidv/translator/QuickTranslateTileService.kt@@ -0,0 +1,49 @@+/*+ * Copyright (C) 2024 David V+ *+ * This program 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.+ *+ * This program 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 <https://www.gnu.org/licenses/>.+ */++package dev.davidv.translator++import android.app.PendingIntent+import android.content.Intent+import android.os.Build+import android.service.quicksettings.TileService+import androidx.annotation.RequiresApi++@RequiresApi(Build.VERSION_CODES.N)+class QuickTranslateTileService : TileService() {+ override fun onClick() {+ super.onClick()+ val intent =+ Intent(this, ProcessTextActivity::class.java).apply {+ action = TapToTranslateNotification.ACTION_OPEN_POPUP+ flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TOP+ }+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE) {+ val pi =+ PendingIntent.getActivity(+ this,+ 0,+ intent,+ PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE,+ )+ startActivityAndCollapse(pi)+ } else {+ @Suppress("DEPRECATION")+ startActivityAndCollapse(intent)+ }+ }+}diff --git a/OCR-translation/src/main/java/dev/davidv/translator/ReadonlyModalOutputAlignment.kt b/OCR-translation/src/main/java/dev/davidv/translator/ReadonlyModalOutputAlignment.ktnew file mode 100644index 0000000..e81cda8--- /dev/null+++ b/OCR-translation/src/main/java/dev/davidv/translator/ReadonlyModalOutputAlignment.kt@@ -0,0 +1,28 @@+/*+ * Copyright (C) 2024 David V+ *+ * This program 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.+ *+ * This program 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 <https://www.gnu.org/licenses/>.+ */++package dev.davidv.translator++import androidx.annotation.StringRes++enum class ReadonlyModalOutputAlignment(+ @StringRes val labelRes: Int,+) {+ TOP(R.string.align_top),+ MIDDLE(R.string.align_middle),+ BOTTOM(R.string.align_bottom),+}diff --git a/OCR-translation/src/main/java/dev/davidv/translator/SettingsManager.kt b/OCR-translation/src/main/java/dev/davidv/translator/SettingsManager.ktnew file mode 100644index 0000000..db285af--- /dev/null+++ b/OCR-translation/src/main/java/dev/davidv/translator/SettingsManager.kt@@ -0,0 +1,407 @@+/*+ * Copyright (C) 2024 David V+ *+ * This program 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.+ *+ * This program 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 <https://www.gnu.org/licenses/>.+ */++package dev.davidv.translator++import android.content.ComponentName+import android.content.Context+import android.content.SharedPreferences+import android.content.pm.PackageManager+import kotlinx.coroutines.flow.MutableStateFlow+import kotlinx.coroutines.flow.StateFlow+import kotlinx.coroutines.flow.asStateFlow+import org.json.JSONObject++class SettingsManager(+ context: Context,+) {+ private val appContext: Context = context.applicationContext+ private val prefs: SharedPreferences = context.getSharedPreferences("app_settings", Context.MODE_PRIVATE)++ private val modifiedSettings = mutableSetOf<String>()++ private val _settings = MutableStateFlow(loadSettings())+ val settings: StateFlow<AppSettings> = _settings.asStateFlow()++ private val prefsListener =+ SharedPreferences.OnSharedPreferenceChangeListener { _, _ ->+ _settings.value = loadSettings()+ }++ init {+ prefs.registerOnSharedPreferenceChangeListener(prefsListener)+ }++ private fun loadSettings(): AppSettings {+ val defaults = AppSettings()++ modifiedSettings.clear()+ prefs.all.keys.forEach { key ->+ modifiedSettings.add(key)+ }++ val defaultTargetLanguageCode = prefs.getString("default_target_language", null) ?: defaults.defaultTargetLanguageCode+ val defaultSourceLanguageCode = prefs.getString("default_source_language", null)++ val catalogIndexUrl =+ prefs.getString("catalog_index_url", null)+ ?: defaults.catalogIndexUrl++ val backgroundModeName = prefs.getString("background_mode", null)+ val backgroundMode =+ if (backgroundModeName != null) {+ try {+ BackgroundMode.valueOf(backgroundModeName)+ } catch (_: IllegalArgumentException) {+ defaults.backgroundMode+ }+ } else {+ defaults.backgroundMode+ }++ val minConfidence = prefs.getInt("min_confidence", defaults.minConfidence)+ val maxImageSize = prefs.getInt("max_image_size", defaults.maxImageSize).coerceIn(600, 2000)+ val disableCLD = prefs.getBoolean("disable_cld", defaults.disableCLD)+ val experimentalScreenTranslate =+ prefs.getBoolean("experimental_screen_translate", defaults.experimentalScreenTranslate)+ val enableOutputTransliteration = prefs.getBoolean("enable_output_transliteration", defaults.enableOutputTransliteration)+ val useExternalStorage = prefs.getBoolean("use_external_storage", defaults.useExternalStorage)+ val fontFactor = prefs.getFloat("font_factor", defaults.fontFactor)+ val showTransliterationOnInput = prefs.getBoolean("show_transliteration_on_input", defaults.showTransliterationOnInput)+ val onlyShowOutputOnReadonlyModal =+ prefs.getBoolean(+ "only_show_output_on_readonly_modal",+ defaults.onlyShowOutputOnReadonlyModal,+ )+ val readonlyModalOutputAlignmentName = prefs.getString("readonly_modal_output_alignment", null)+ val readonlyModalOutputAlignment =+ if (readonlyModalOutputAlignmentName != null) {+ try {+ ReadonlyModalOutputAlignment.valueOf(readonlyModalOutputAlignmentName)+ } catch (_: IllegalArgumentException) {+ defaults.readonlyModalOutputAlignment+ }+ } else {+ defaults.readonlyModalOutputAlignment+ }+ val readonlyModalCompactHeightFactor =+ prefs.getFloat(+ "readonly_modal_compact_height_factor",+ defaults.readonlyModalCompactHeightFactor,+ )+ val addSpacesForJapaneseTransliteration =+ prefs.getBoolean(+ "add_spaces_for_japanese_transliteration",+ defaults.addSpacesForJapaneseTransliteration,+ )+ val ttsPlaybackSpeed = prefs.getFloat("tts_playback_speed", defaults.ttsPlaybackSpeed)+ val ttsPlaybackSpeedOverrides =+ prefs+ .getString("tts_playback_speed_overrides", null)+ ?.let(::parsePlaybackSpeedOverrides)+ ?: defaults.ttsPlaybackSpeedOverrides+ val tapToTranslateEnabled = prefs.getBoolean("tap_to_translate_enabled", defaults.tapToTranslateEnabled)+ val ttsVoiceOverrides =+ prefs+ .getString("tts_voice_overrides", null)+ ?.let(::parseVoiceOverrides)+ ?: defaults.ttsVoiceOverrides+ val ttsReadUrlsAndHashtags =+ prefs.getBoolean("tts_read_urls_and_hashtags", defaults.ttsReadUrlsAndHashtags)+ val clearWebTranslatorDataOnClose =+ prefs.getBoolean(+ "clear_web_translator_data_on_close",+ defaults.clearWebTranslatorDataOnClose,+ )+ val translatePdfImages =+ prefs.getBoolean("translate_pdf_images", defaults.translatePdfImages)+ val liveCameraOverlayEnabled =+ prefs.getBoolean("live_camera_overlay_enabled", defaults.liveCameraOverlayEnabled)+ val registerAsBrowser =+ prefs.getBoolean("register_as_browser", defaults.registerAsBrowser)+ val multiTargetEnabled =+ prefs.getBoolean("multi_target_enabled", defaults.multiTargetEnabled)+ val httpServerEnabled = prefs.getBoolean("http_server_enabled", defaults.httpServerEnabled)+ val httpServerPort = prefs.getInt("http_server_port", defaults.httpServerPort).coerceIn(1, 65535)+ val httpServerBindModeName = prefs.getString("http_server_bind_mode", null)+ val httpServerBindMode =+ if (httpServerBindModeName != null) {+ try {+ HttpServerBindMode.valueOf(httpServerBindModeName)+ } catch (_: IllegalArgumentException) {+ defaults.httpServerBindMode+ }+ } else {+ defaults.httpServerBindMode+ }+ val assistantActionName = prefs.getString("assistant_action", null)+ val assistantAction =+ if (assistantActionName != null) {+ try {+ AssistantAction.valueOf(assistantActionName)+ } catch (_: IllegalArgumentException) {+ defaults.assistantAction+ }+ } else {+ defaults.assistantAction+ }++ return AppSettings(+ defaultTargetLanguageCode = defaultTargetLanguageCode,+ defaultSourceLanguageCode = defaultSourceLanguageCode,+ catalogIndexUrl = catalogIndexUrl,+ backgroundMode = backgroundMode,+ minConfidence = minConfidence,+ maxImageSize = maxImageSize,+ disableCLD = disableCLD,+ experimentalScreenTranslate = experimentalScreenTranslate,+ enableOutputTransliteration = enableOutputTransliteration,+ useExternalStorage = useExternalStorage,+ fontFactor = fontFactor,+ showTransliterationOnInput = showTransliterationOnInput,+ onlyShowOutputOnReadonlyModal = onlyShowOutputOnReadonlyModal,+ readonlyModalOutputAlignment = readonlyModalOutputAlignment,+ readonlyModalCompactHeightFactor = readonlyModalCompactHeightFactor,+ addSpacesForJapaneseTransliteration = addSpacesForJapaneseTransliteration,+ ttsPlaybackSpeed = ttsPlaybackSpeed,+ ttsPlaybackSpeedOverrides = ttsPlaybackSpeedOverrides,+ ttsVoiceOverrides = ttsVoiceOverrides,+ ttsReadUrlsAndHashtags = ttsReadUrlsAndHashtags,+ tapToTranslateEnabled = tapToTranslateEnabled,+ clearWebTranslatorDataOnClose = clearWebTranslatorDataOnClose,+ translatePdfImages = translatePdfImages,+ liveCameraOverlayEnabled = liveCameraOverlayEnabled,+ registerAsBrowser = registerAsBrowser,+ assistantAction = assistantAction,+ multiTargetEnabled = multiTargetEnabled,+ httpServerEnabled = httpServerEnabled,+ httpServerPort = httpServerPort,+ httpServerBindMode = httpServerBindMode,+ )+ }++ fun updateSettings(newSettings: AppSettings) {+ val currentSettings = _settings.value++ prefs.edit().apply {+ if (newSettings.defaultTargetLanguageCode != currentSettings.defaultTargetLanguageCode) {+ putString("default_target_language", newSettings.defaultTargetLanguageCode)+ modifiedSettings.add("default_target_language")+ }+ if (newSettings.defaultSourceLanguageCode != currentSettings.defaultSourceLanguageCode) {+ if (newSettings.defaultSourceLanguageCode != null) {+ putString("default_source_language", newSettings.defaultSourceLanguageCode)+ } else {+ remove("default_source_language")+ }+ modifiedSettings.add("default_source_language")+ }+ if (newSettings.catalogIndexUrl != currentSettings.catalogIndexUrl) {+ putString("catalog_index_url", newSettings.catalogIndexUrl)+ modifiedSettings.add("catalog_index_url")+ }+ if (newSettings.backgroundMode != currentSettings.backgroundMode) {+ putString("background_mode", newSettings.backgroundMode.name)+ modifiedSettings.add("background_mode")+ }+ if (newSettings.minConfidence != currentSettings.minConfidence) {+ putInt("min_confidence", newSettings.minConfidence)+ modifiedSettings.add("min_confidence")+ }+ if (newSettings.maxImageSize != currentSettings.maxImageSize) {+ putInt("max_image_size", newSettings.maxImageSize)+ modifiedSettings.add("max_image_size")+ }+ if (newSettings.disableCLD != currentSettings.disableCLD) {+ putBoolean("disable_cld", newSettings.disableCLD)+ modifiedSettings.add("disable_cld")+ }+ if (newSettings.experimentalScreenTranslate != currentSettings.experimentalScreenTranslate) {+ putBoolean("experimental_screen_translate", newSettings.experimentalScreenTranslate)+ modifiedSettings.add("experimental_screen_translate")+ }+ if (newSettings.enableOutputTransliteration != currentSettings.enableOutputTransliteration) {+ putBoolean("enable_output_transliteration", newSettings.enableOutputTransliteration)+ modifiedSettings.add("enable_output_transliteration")+ }+ if (newSettings.useExternalStorage != currentSettings.useExternalStorage) {+ putBoolean("use_external_storage", newSettings.useExternalStorage)+ modifiedSettings.add("use_external_storage")+ }+ if (newSettings.fontFactor != currentSettings.fontFactor) {+ putFloat("font_factor", newSettings.fontFactor)+ modifiedSettings.add("font_factor")+ }+ if (newSettings.showTransliterationOnInput != currentSettings.showTransliterationOnInput) {+ putBoolean("show_transliteration_on_input", newSettings.showTransliterationOnInput)+ modifiedSettings.add("show_transliteration_on_input")+ }+ if (newSettings.onlyShowOutputOnReadonlyModal != currentSettings.onlyShowOutputOnReadonlyModal) {+ putBoolean("only_show_output_on_readonly_modal", newSettings.onlyShowOutputOnReadonlyModal)+ modifiedSettings.add("only_show_output_on_readonly_modal")+ }+ if (newSettings.readonlyModalOutputAlignment != currentSettings.readonlyModalOutputAlignment) {+ putString("readonly_modal_output_alignment", newSettings.readonlyModalOutputAlignment.name)+ modifiedSettings.add("readonly_modal_output_alignment")+ }+ if (newSettings.readonlyModalCompactHeightFactor != currentSettings.readonlyModalCompactHeightFactor) {+ putFloat("readonly_modal_compact_height_factor", newSettings.readonlyModalCompactHeightFactor)+ modifiedSettings.add("readonly_modal_compact_height_factor")+ }+ if (newSettings.addSpacesForJapaneseTransliteration != currentSettings.addSpacesForJapaneseTransliteration) {+ putBoolean("add_spaces_for_japanese_transliteration", newSettings.addSpacesForJapaneseTransliteration)+ modifiedSettings.add("add_spaces_for_japanese_transliteration")+ }+ if (newSettings.ttsPlaybackSpeed != currentSettings.ttsPlaybackSpeed) {+ putFloat("tts_playback_speed", newSettings.ttsPlaybackSpeed)+ modifiedSettings.add("tts_playback_speed")+ }+ if (newSettings.ttsPlaybackSpeedOverrides != currentSettings.ttsPlaybackSpeedOverrides) {+ putString("tts_playback_speed_overrides", serializePlaybackSpeedOverrides(newSettings.ttsPlaybackSpeedOverrides))+ modifiedSettings.add("tts_playback_speed_overrides")+ }+ if (newSettings.ttsVoiceOverrides != currentSettings.ttsVoiceOverrides) {+ putString("tts_voice_overrides", serializeVoiceOverrides(newSettings.ttsVoiceOverrides))+ modifiedSettings.add("tts_voice_overrides")+ TranslatorTtsEngine.notifyVoiceDataChanged(appContext)+ }+ if (newSettings.ttsReadUrlsAndHashtags != currentSettings.ttsReadUrlsAndHashtags) {+ putBoolean("tts_read_urls_and_hashtags", newSettings.ttsReadUrlsAndHashtags)+ modifiedSettings.add("tts_read_urls_and_hashtags")+ }+ if (newSettings.tapToTranslateEnabled != currentSettings.tapToTranslateEnabled) {+ putBoolean("tap_to_translate_enabled", newSettings.tapToTranslateEnabled)+ modifiedSettings.add("tap_to_translate_enabled")+ }+ if (newSettings.clearWebTranslatorDataOnClose != currentSettings.clearWebTranslatorDataOnClose) {+ putBoolean("clear_web_translator_data_on_close", newSettings.clearWebTranslatorDataOnClose)+ modifiedSettings.add("clear_web_translator_data_on_close")+ }+ if (newSettings.translatePdfImages != currentSettings.translatePdfImages) {+ putBoolean("translate_pdf_images", newSettings.translatePdfImages)+ modifiedSettings.add("translate_pdf_images")+ }+ if (newSettings.liveCameraOverlayEnabled != currentSettings.liveCameraOverlayEnabled) {+ putBoolean("live_camera_overlay_enabled", newSettings.liveCameraOverlayEnabled)+ modifiedSettings.add("live_camera_overlay_enabled")+ }+ if (newSettings.registerAsBrowser != currentSettings.registerAsBrowser) {+ putBoolean("register_as_browser", newSettings.registerAsBrowser)+ modifiedSettings.add("register_as_browser")+ applyBrowserAliasState(newSettings.registerAsBrowser)+ }+ if (newSettings.assistantAction != currentSettings.assistantAction) {+ putString("assistant_action", newSettings.assistantAction.name)+ modifiedSettings.add("assistant_action")+ }+ if (newSettings.multiTargetEnabled != currentSettings.multiTargetEnabled) {+ putBoolean("multi_target_enabled", newSettings.multiTargetEnabled)+ modifiedSettings.add("multi_target_enabled")+ }+ if (newSettings.httpServerEnabled != currentSettings.httpServerEnabled) {+ putBoolean("http_server_enabled", newSettings.httpServerEnabled)+ modifiedSettings.add("http_server_enabled")+ }+ if (newSettings.httpServerPort != currentSettings.httpServerPort) {+ putInt("http_server_port", newSettings.httpServerPort)+ modifiedSettings.add("http_server_port")+ }+ if (newSettings.httpServerBindMode != currentSettings.httpServerBindMode) {+ putString("http_server_bind_mode", newSettings.httpServerBindMode.name)+ modifiedSettings.add("http_server_bind_mode")+ }+ remove("translation_models_base_url_v3")+ remove("tesseract_models_base_url")+ remove("dictionary_base_url")+ apply()+ }+ _settings.value = newSettings++ // The native server takes a config snapshot at start, so anything it+ // serves from settings restarts it.+ val serverConfigChanged =+ newSettings.httpServerPort != currentSettings.httpServerPort ||+ newSettings.httpServerBindMode != currentSettings.httpServerBindMode ||+ newSettings.maxImageSize != currentSettings.maxImageSize ||+ newSettings.minConfidence != currentSettings.minConfidence ||+ newSettings.backgroundMode != currentSettings.backgroundMode ||+ newSettings.translatePdfImages != currentSettings.translatePdfImages+ if (newSettings.httpServerEnabled != currentSettings.httpServerEnabled || serverConfigChanged) {+ applyHttpServerState(newSettings)+ }+ }++ fun applyHttpServerState(settings: AppSettings) {+ if (settings.httpServerEnabled) {+ TranslationApiService.start(appContext, settings.httpServerPort, settings.httpServerBindMode)+ } else {+ TranslationApiService.stop(appContext)+ }+ }++ fun applyBrowserAliasState(enabled: Boolean) {+ val component = ComponentName(appContext, "dev.davidv.translator.MainActivityBrowser")+ val desired =+ if (enabled) {+ PackageManager.COMPONENT_ENABLED_STATE_ENABLED+ } else {+ PackageManager.COMPONENT_ENABLED_STATE_DISABLED+ }+ appContext.packageManager.setComponentEnabledSetting(+ component,+ desired,+ PackageManager.DONT_KILL_APP,+ )+ }++ private fun parseVoiceOverrides(json: String): Map<String, String> =+ runCatching {+ val root = JSONObject(json)+ root.keys().asSequence().mapNotNull { languageCode ->+ root.optString(languageCode).takeIf { it.isNotBlank() }?.let { languageCode to it }+ }.toMap()+ }.getOrDefault(emptyMap())++ private fun serializeVoiceOverrides(overrides: Map<String, String>): String {+ val root = JSONObject()+ overrides.toSortedMap().forEach { (languageCode, voiceName) ->+ root.put(languageCode, voiceName)+ }+ return root.toString()+ }++ private fun parsePlaybackSpeedOverrides(json: String): Map<String, Float> =+ runCatching {+ val root = JSONObject(json)+ root.keys().asSequence().mapNotNull { voiceName ->+ val speed = root.optDouble(voiceName, Double.NaN)+ if (speed.isNaN()) {+ null+ } else {+ voiceName to speed.toFloat().coerceIn(0.5f, 2.0f)+ }+ }.toMap()+ }.getOrDefault(emptyMap())++ private fun serializePlaybackSpeedOverrides(overrides: Map<String, Float>): String {+ val root = JSONObject()+ overrides.toSortedMap().forEach { (voiceName, speed) ->+ root.put(voiceName, speed.coerceIn(0.5f, 2.0f))+ }+ return root.toString()+ }+}diff --git a/OCR-translation/src/main/java/dev/davidv/translator/SpeechModels.kt b/OCR-translation/src/main/java/dev/davidv/translator/SpeechModels.ktnew file mode 100644index 0000000..099054b--- /dev/null+++ b/OCR-translation/src/main/java/dev/davidv/translator/SpeechModels.kt@@ -0,0 +1,13 @@+package dev.davidv.translator++data class TtsVoiceOption(+ val name: String,+ val speakerId: Int,+ val displayName: String,+)++data class SpeechChunkPlan(+ val content: String,+ val isPhonemes: Boolean,+ val pauseAfterMs: Int?,+)diff --git a/OCR-translation/src/main/java/dev/davidv/translator/SpeechService.kt b/OCR-translation/src/main/java/dev/davidv/translator/SpeechService.ktnew file mode 100644index 0000000..e7105a5--- /dev/null+++ b/OCR-translation/src/main/java/dev/davidv/translator/SpeechService.kt@@ -0,0 +1,192 @@+/*+ * Copyright (C) 2024 David V+ *+ * This program 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.+ *+ * This program 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 <https://www.gnu.org/licenses/>.+ */++package dev.davidv.translator++import android.util.Log+import kotlinx.coroutines.Dispatchers+import kotlinx.coroutines.currentCoroutineContext+import kotlinx.coroutines.ensureActive+import kotlinx.coroutines.flow.Flow+import kotlinx.coroutines.flow.flow+import kotlinx.coroutines.withContext++class SpeechService(+ private val settingsManager: SettingsManager,+ private val filePathManager: FilePathManager,+) {+ suspend fun synthesizeSpeech(+ language: Language,+ text: String,+ ): SpeechSynthesisResult =+ withContext(Dispatchers.IO) {+ if (text.isBlank()) {+ return@withContext SpeechSynthesisResult.Error(SpeechError.NothingToSpeak)+ }++ val catalog =+ filePathManager.loadCatalog()+ ?: return@withContext SpeechSynthesisResult.Error(SpeechError.CatalogUnavailable)+ if (!catalog.hasTtsVoices(language.code)) {+ return@withContext SpeechSynthesisResult.Error(SpeechError.NoVoiceInstalled(language))+ }++ val settings = settingsManager.settings.value+ val parsed = parseVoiceOverride(settings.ttsVoiceOverrides[language.code])+ val selectedVoiceName = parsed?.voiceName+ val selectedPackId = parsed?.packId+ val speechSpeedVoiceName =+ selectedVoiceName+ ?: catalog.availableTtsVoices(language.code).firstOrNull()?.name+ val speechSpeed =+ speechSpeedVoiceName+ ?.let { voiceName -> settings.ttsPlaybackSpeedOverrides["${language.code}:$voiceName"] }+ ?: settings.ttsPlaybackSpeed+ val boundedSpeechSpeed = speechSpeed.coerceIn(0.5f, 2.0f)+ Log.d(+ "SpeechService",+ "Using TTS pack=$selectedPackId voice=$selectedVoiceName speed=$boundedSpeechSpeed lang=${language.code}",+ )+ val chunkRequests =+ try {+ catalog.planSpeechChunks(+ languageCode = language.code,+ text = text,+ packId = selectedPackId,+ readUrlsAndHashtags = settings.ttsReadUrlsAndHashtags,+ )+ } catch (e: uniffi.bindings.CatalogException) {+ Log.e("SpeechService", "planSpeechChunks failed lang=${language.code} pack=$selectedPackId", e)+ return@withContext SpeechSynthesisResult.Error(+ SpeechError.SynthesisError(language, e.message ?: e.toString()),+ )+ }+ if (chunkRequests.isEmpty()) {+ return@withContext SpeechSynthesisResult.Error(SpeechError.SynthesisFailed(language))+ }++ SpeechSynthesisResult.Success(+ flow {+ for ((index, chunkRequest) in chunkRequests.withIndex()) {+ currentCoroutineContext().ensureActive()+ Log.d(+ "SpeechService",+ "Speech chunk ${index + 1}/${chunkRequests.size}: synth start isPhonemes=${chunkRequest.isPhonemes} textLen=${chunkRequest.content.length} pauseAfterMs=${chunkRequest.pauseAfterMs}",+ )+ val pcmAudio =+ try {+ catalog.synthesizeSpeechPcm(+ languageCode = language.code,+ text = chunkRequest.content,+ speechSpeed = boundedSpeechSpeed,+ voiceName = selectedVoiceName,+ isPhonemes = chunkRequest.isPhonemes,+ packId = selectedPackId,+ )+ } catch (e: uniffi.bindings.CatalogException) {+ Log.e("SpeechService", "synthesizeSpeechPcm failed lang=${language.code} pack=$selectedPackId", e)+ throw IllegalStateException(+ "Speech synthesis failed for ${language.displayName}: ${e.message ?: e.toString()}",+ e,+ )+ }+ val audioDurationMs = (pcmAudio.pcmSamples.size * 1000L) / pcmAudio.sampleRate+ Log.d(+ "SpeechService",+ "Speech chunk ${index + 1}/${chunkRequests.size}: synth ready samples=${pcmAudio.pcmSamples.size} sampleRate=${pcmAudio.sampleRate} audioMs=$audioDurationMs",+ )+ currentCoroutineContext().ensureActive()+ emit(pcmAudio)++ val silenceChunk =+ chunkRequest.pauseAfterMs?.let { pauseMs ->+ PcmAudio.silence(pcmAudio.sampleRate, pauseMs)+ }+ if (silenceChunk != null) {+ emit(silenceChunk)+ }+ }+ },+ )+ }++ suspend fun availableTtsVoices(language: Language): List<TtsVoiceOption> =+ withContext(Dispatchers.IO) {+ val catalog = filePathManager.loadCatalog() ?: return@withContext emptyList()+ catalog.availableTtsVoices(language.code)+ }++ suspend fun installedTtsVoices(language: Language): List<uniffi.translator_core.InstalledTtsPack> =+ withContext(Dispatchers.IO) {+ val catalog = filePathManager.loadCatalog() ?: return@withContext emptyList()+ catalog.installedTtsVoices(language.code)+ }+}++data class VoiceOverride(+ val packId: String?,+ val voiceName: String,+)++private const val OVERRIDE_SEPARATOR = "|"++fun encodeVoiceOverride(+ packId: String,+ voiceName: String,+): String = "$packId$OVERRIDE_SEPARATOR$voiceName"++fun parseVoiceOverride(raw: String?): VoiceOverride? {+ if (raw.isNullOrBlank()) return null+ val sepIndex = raw.indexOf(OVERRIDE_SEPARATOR)+ return if (sepIndex < 0) {+ VoiceOverride(packId = null, voiceName = raw)+ } else {+ VoiceOverride(+ packId = raw.substring(0, sepIndex).takeIf(String::isNotBlank),+ voiceName = raw.substring(sepIndex + 1),+ )+ }+}++sealed class SpeechSynthesisResult {+ data class Success(+ val audioChunks: Flow<PcmAudio>,+ ) : SpeechSynthesisResult()++ data class Error(+ val reason: SpeechError,+ ) : SpeechSynthesisResult()+}++sealed interface SpeechError {+ data object NothingToSpeak : SpeechError++ data object CatalogUnavailable : SpeechError++ data class NoVoiceInstalled(+ val language: Language,+ ) : SpeechError++ data class SynthesisFailed(+ val language: Language,+ ) : SpeechError++ data class SynthesisError(+ val language: Language,+ val reason: String,+ ) : SpeechError+}diff --git a/OCR-translation/src/main/java/dev/davidv/translator/TapToTranslateNotification.kt b/OCR-translation/src/main/java/dev/davidv/translator/TapToTranslateNotification.ktnew file mode 100644index 0000000..d59edb7--- /dev/null+++ b/OCR-translation/src/main/java/dev/davidv/translator/TapToTranslateNotification.kt@@ -0,0 +1,120 @@+/*+ * Copyright (C) 2024 David V+ *+ * This program 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.+ *+ * This program 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 <https://www.gnu.org/licenses/>.+ */++package dev.davidv.translator++import android.app.NotificationChannel+import android.app.NotificationManager+import android.app.PendingIntent+import android.content.BroadcastReceiver+import android.content.Context+import android.content.Intent+import android.os.Build+import androidx.core.app.NotificationCompat+import androidx.core.app.NotificationManagerCompat++object TapToTranslateNotification {+ const val CHANNEL_ID = "tap_to_translate"+ const val NOTIFICATION_ID = 1001+ const val ACTION_OPEN_POPUP = "dev.davidv.translator.OPEN_POPUP"++ fun show(context: Context) {+ ensureChannel(context)++ val tapIntent =+ Intent(context, ProcessTextActivity::class.java).apply {+ action = ACTION_OPEN_POPUP+ flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TOP+ }+ val tapPendingIntent =+ PendingIntent.getActivity(+ context,+ 0,+ tapIntent,+ PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE,+ )++ val dismissIntent = Intent(context, TapToTranslateDismissReceiver::class.java)+ val dismissPendingIntent =+ PendingIntent.getBroadcast(+ context,+ 0,+ dismissIntent,+ PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE,+ )++ val notification =+ NotificationCompat.Builder(context, CHANNEL_ID)+ .setSmallIcon(R.drawable.ic_translate_button)+ .setContentTitle(context.getString(R.string.tap_to_translate_title))+ .setContentText(context.getString(R.string.tap_to_translate_body))+ .setContentIntent(tapPendingIntent)+ .setDeleteIntent(dismissPendingIntent)+ .setPriority(NotificationCompat.PRIORITY_LOW)+ .setShowWhen(false)+ .setCategory(NotificationCompat.CATEGORY_SERVICE)+ .build()++ NotificationManagerCompat.from(context).notify(NOTIFICATION_ID, notification)+ }++ fun hide(context: Context) {+ NotificationManagerCompat.from(context).cancel(NOTIFICATION_ID)+ }++ private fun ensureChannel(context: Context) {+ if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) return+ val nm = context.getSystemService(NotificationManager::class.java) ?: return+ if (nm.getNotificationChannel(CHANNEL_ID) != null) return+ val channel =+ NotificationChannel(+ CHANNEL_ID,+ context.getString(R.string.tap_to_translate_channel),+ NotificationManager.IMPORTANCE_LOW,+ ).apply {+ description = context.getString(R.string.tap_to_translate_channel_description)+ setShowBadge(false)+ }+ nm.createNotificationChannel(channel)+ }+}++class TapToTranslateDismissReceiver : BroadcastReceiver() {+ override fun onReceive(+ context: Context,+ intent: Intent,+ ) {+ val app = context.applicationContext as TranslatorApplication+ val current = app.settingsManager.settings.value+ if (current.tapToTranslateEnabled) {+ app.settingsManager.updateSettings(current.copy(tapToTranslateEnabled = false))+ }+ }+}++class TapToTranslateBootReceiver : BroadcastReceiver() {+ override fun onReceive(+ context: Context,+ intent: Intent,+ ) {+ if (intent.action != Intent.ACTION_BOOT_COMPLETED) return+ val app = context.applicationContext as TranslatorApplication+ if (app.settingsManager.settings.value.tapToTranslateEnabled) {+ TapToTranslateNotification.show(context)+ }+ }+}diff --git a/OCR-translation/src/main/java/dev/davidv/translator/TargetTabs.kt b/OCR-translation/src/main/java/dev/davidv/translator/TargetTabs.ktnew file mode 100644index 0000000..d706590--- /dev/null+++ b/OCR-translation/src/main/java/dev/davidv/translator/TargetTabs.kt@@ -0,0 +1,69 @@+/*+ * Copyright (C) 2024 David V+ *+ * This program 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.+ *+ * This program 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 <https://www.gnu.org/licenses/>.+ */++package dev.davidv.translator++/**+ * A list zipper over the target languages: the ordered tab list is+ * `before + active + after`. Holding [active] as its own field (rather than an+ * index or a flag per element) makes the invariants structural — the list is+ * always non-empty, there is always exactly one active tab, and the active tab+ * is always a member.+ */+data class TargetTabs(+ val before: List<Language>,+ val active: Language,+ val after: List<Language>,+) {+ val tabs: List<Language> get() = before + active + after++ /**+ * Move the focus to [lang]. If [lang] is already a tab it becomes active+ * (order preserved); otherwise it replaces the active tab in place (retarget).+ */+ fun select(lang: Language): TargetTabs =+ when {+ lang == active -> this+ lang in before -> {+ val i = before.indexOf(lang)+ TargetTabs(before.take(i), lang, before.drop(i + 1) + active + after)+ }+ lang in after -> {+ val i = after.indexOf(lang)+ TargetTabs(before + active + after.take(i), lang, after.drop(i + 1))+ }+ else -> copy(active = lang)+ }++ /** Append [lang] as a new tab and focus it (a no-op switch if already present). */+ fun add(lang: Language): TargetTabs = if (lang in tabs) select(lang) else TargetTabs(before + active + after, lang, emptyList())++ /** Drop [lang]; if it was the active tab the focus moves to a neighbour. The last tab cannot be removed. */+ fun remove(lang: Language): TargetTabs =+ when {+ lang == active && after.isNotEmpty() -> TargetTabs(before, after.first(), after.drop(1))+ lang == active && before.isNotEmpty() -> TargetTabs(before.dropLast(1), before.last(), emptyList())+ lang == active -> this+ lang in before -> copy(before = before - lang)+ lang in after -> copy(after = after - lang)+ else -> this+ }++ companion object {+ fun of(lang: Language) = TargetTabs(emptyList(), lang, emptyList())+ }+}diff --git a/OCR-translation/src/main/java/dev/davidv/translator/TarkkaData.kt b/OCR-translation/src/main/java/dev/davidv/translator/TarkkaData.ktnew file mode 100644index 0000000..8375ac7--- /dev/null+++ b/OCR-translation/src/main/java/dev/davidv/translator/TarkkaData.kt@@ -0,0 +1,22 @@+package dev.davidv.translator++typealias Gloss = uniffi.bindings.DictionaryGlossRecord+typealias Sense = uniffi.bindings.DictionarySenseRecord+typealias WordEntryComplete = uniffi.bindings.DictionaryWordEntryRecord+typealias WordWithTaggedEntries = uniffi.bindings.DictionaryWordRecord++enum class WordTag(+ val value: Int,+) {+ MONOLINGUAL(1),+ ENGLISH(2),+ BOTH(3),+ ;++ companion object {+ fun fromValue(value: Int): WordTag? = entries.find { it.value == value }+ }+}++val WordWithTaggedEntries.wordTag: WordTag+ get() = WordTag.fromValue(tag)!!diff --git a/OCR-translation/src/main/java/dev/davidv/translator/TranslatedText.kt b/OCR-translation/src/main/java/dev/davidv/translator/TranslatedText.ktnew file mode 100644index 0000000..a4598ea--- /dev/null+++ b/OCR-translation/src/main/java/dev/davidv/translator/TranslatedText.kt@@ -0,0 +1,12 @@+package dev.davidv.translator++data class TranslatedText(+ val translated: String,+ val transliterated: String?,+ // Source text that produced this translation, needed to re-translate (steer)+ // when the user picks an alternative. Empty for paths that don't carry it.+ val source: String = "",+ // Per-word alternatives on the translated text (char offsets into `translated`).+ // Empty unless produced by the alternatives-bearing translation path.+ val alternatives: List<WordAlternatives> = emptyList(),+)diff --git a/OCR-translation/src/main/java/dev/davidv/translator/TranslationApiService.kt b/OCR-translation/src/main/java/dev/davidv/translator/TranslationApiService.ktnew file mode 100644index 0000000..edfa7f5--- /dev/null+++ b/OCR-translation/src/main/java/dev/davidv/translator/TranslationApiService.kt@@ -0,0 +1,268 @@+/*+ * Copyright (C) 2024 David V+ *+ * This program 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.+ *+ * This program 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 <https://www.gnu.org/licenses/>.+ */++package dev.davidv.translator++import android.app.Notification+import android.app.NotificationChannel+import android.app.NotificationManager+import android.app.PendingIntent+import android.app.Service+import android.content.Context+import android.content.Intent+import android.content.pm.ServiceInfo+import android.os.Build+import android.os.IBinder+import android.util.Log+import androidx.core.app.NotificationCompat+import androidx.core.app.NotificationManagerCompat+import androidx.core.content.ContextCompat+import uniffi.bindings.CatalogHandle+import uniffi.bindings.HttpServerException+import uniffi.bindings.HttpServerHandle+import uniffi.bindings.HttpSessionSource+import uniffi.bindings.startHttpServer+import uniffi.translator.BindAddress+import uniffi.translator.HttpServerConfig+import uniffi.translator.OcrSettings+import java.io.File++/**+ * Foreground service hosting the native LibreTranslate-compatible HTTP server. It+ * must be foreground because the whole point is to answer requests from other apps+ * while this app is backgrounded, which would otherwise let the process (and its+ * listening socket) be suspended or killed.+ */+class TranslationApiService : Service() {+ private var server: HttpServerHandle? = null+ private var currentConfig: HttpServerConfig? = null++ companion object {+ private const val TAG = "TranslationApiService"+ private const val ACTION_START = "dev.davidv.translator.action.START_TRANSLATION_API"+ private const val ACTION_STOP = "dev.davidv.translator.action.STOP_TRANSLATION_API"+ private const val ACTION_DISABLE = "dev.davidv.translator.action.DISABLE_TRANSLATION_API"+ private const val EXTRA_PORT = "port"+ private const val EXTRA_BIND_MODE = "bind_mode"+ private const val CHANNEL_ID = "translation_api"+ private const val NOTIFICATION_ID = 1003++ fun start(+ context: Context,+ port: Int,+ bindMode: HttpServerBindMode,+ ) {+ val intent =+ Intent(context, TranslationApiService::class.java).apply {+ action = ACTION_START+ putExtra(EXTRA_PORT, port)+ putExtra(EXTRA_BIND_MODE, bindMode.name)+ }+ ContextCompat.startForegroundService(context, intent)+ }++ fun stop(context: Context) {+ val intent =+ Intent(context, TranslationApiService::class.java).apply {+ action = ACTION_STOP+ }+ context.startService(intent)+ }+ }++ override fun onBind(intent: Intent?): IBinder? = null++ override fun onStartCommand(+ intent: Intent?,+ flags: Int,+ startId: Int,+ ): Int {+ if (intent?.action == ACTION_STOP) {+ shutdown()+ return START_NOT_STICKY+ }+ if (intent?.action == ACTION_DISABLE) {+ // The notification's "Disable" flips the setting off (keeping the settings+ // switch and the service in sync), which cascades into stop() via+ // applyHttpServerState; only stop directly if it was already off.+ val settingsManager = (application as TranslatorApplication).settingsManager+ val settings = settingsManager.settings.value+ if (settings.httpServerEnabled) {+ settingsManager.updateSettings(settings.copy(httpServerEnabled = false))+ } else {+ shutdown()+ }+ return START_NOT_STICKY+ }+ if (intent?.action != ACTION_START) return START_NOT_STICKY++ val port = intent.getIntExtra(EXTRA_PORT, 5000)+ val bindMode =+ intent.getStringExtra(EXTRA_BIND_MODE)?.let { runCatching { HttpServerBindMode.valueOf(it) }.getOrNull() }+ ?: HttpServerBindMode.LOCALHOST++ ensureChannel()+ startForegroundCompat(runningNotification(hostFor(bindMode), port))++ val app = application as TranslatorApplication+ val config = serverConfig(port, bindMode, app.settingsManager.settings.value)+ if (server != null && config == currentConfig) {+ return START_REDELIVER_INTENT+ }++ stopServer()+ val host = hostFor(bindMode)+ try {+ server =+ startHttpServer(+ config,+ object : HttpSessionSource {+ override fun catalog(): CatalogHandle? = app.filePathManager.loadCatalog()?.planarHandle()+ },+ )+ currentConfig = config+ Log.i(TAG, "Translation API server listening on $host:$port")+ } catch (e: HttpServerException) {+ Log.e(TAG, "Failed to bind translation API server on $host:$port", e)+ server = null+ NotificationManagerCompat.from(this).notify(NOTIFICATION_ID, errorNotification(port))+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {+ stopForeground(STOP_FOREGROUND_DETACH)+ } else {+ @Suppress("DEPRECATION")+ stopForeground(false)+ }+ stopSelf()+ }+ return START_REDELIVER_INTENT+ }++ override fun onDestroy() {+ stopServer()+ super.onDestroy()+ }++ private fun shutdown() {+ stopServer()+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {+ stopForeground(STOP_FOREGROUND_REMOVE)+ } else {+ @Suppress("DEPRECATION")+ stopForeground(true)+ }+ NotificationManagerCompat.from(this).cancel(NOTIFICATION_ID)+ stopSelf()+ }++ private fun stopServer() {+ server?.stop()+ server = null+ currentConfig = null+ }++ private fun serverConfig(+ port: Int,+ bindMode: HttpServerBindMode,+ settings: AppSettings,+ ): HttpServerConfig =+ HttpServerConfig(+ bind = bindMode.toNative(),+ port = port.toUShort(),+ outputDir = File(cacheDir, "translate_file").absolutePath,+ ocr =+ OcrSettings(+ maxImageSize = settings.maxImageSize.toUInt(),+ minConfidence = settings.minConfidence.toUInt(),+ backgroundMode = settings.backgroundMode,+ ),+ translatePdfImages = settings.translatePdfImages,+ )++ private fun hostFor(bindMode: HttpServerBindMode): String =+ when (bindMode) {+ HttpServerBindMode.LOCALHOST -> "127.0.0.1"+ HttpServerBindMode.ALL_INTERFACES -> "0.0.0.0"+ }++ private fun HttpServerBindMode.toNative(): BindAddress =+ when (this) {+ HttpServerBindMode.LOCALHOST -> BindAddress.LOCALHOST+ HttpServerBindMode.ALL_INTERFACES -> BindAddress.ALL_INTERFACES+ }++ private fun startForegroundCompat(notification: Notification) {+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE) {+ startForeground(NOTIFICATION_ID, notification, ServiceInfo.FOREGROUND_SERVICE_TYPE_SPECIAL_USE)+ } else {+ startForeground(NOTIFICATION_ID, notification)+ }+ }++ private fun runningNotification(+ host: String,+ port: Int,+ ): Notification {+ val openIntent =+ Intent(this, MainActivity::class.java).apply {+ flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TOP+ }+ val openPendingIntent =+ PendingIntent.getActivity(this, 0, openIntent, PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE)+ val disableIntent =+ Intent(this, TranslationApiService::class.java).apply { action = ACTION_DISABLE }+ val disablePendingIntent =+ PendingIntent.getService(this, 1, disableIntent, PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE)++ return NotificationCompat.Builder(this, CHANNEL_ID)+ .setSmallIcon(R.drawable.ic_translate_button)+ .setContentTitle(getString(R.string.http_server_notif_running))+ .setContentText(getString(R.string.http_server_notif_text, host, port))+ .setContentIntent(openPendingIntent)+ .setPriority(NotificationCompat.PRIORITY_LOW)+ .setCategory(NotificationCompat.CATEGORY_SERVICE)+ .setOngoing(true)+ .setOnlyAlertOnce(true)+ .addAction(0, getString(R.string.http_server_notif_disable), disablePendingIntent)+ .build()+ }++ private fun errorNotification(port: Int): Notification =+ NotificationCompat.Builder(this, CHANNEL_ID)+ .setSmallIcon(R.drawable.ic_translate_button)+ .setContentTitle(getString(R.string.http_server_notif_running))+ .setContentText(getString(R.string.http_server_notif_error, port))+ .setPriority(NotificationCompat.PRIORITY_LOW)+ .setCategory(NotificationCompat.CATEGORY_ERROR)+ .setAutoCancel(true)+ .build()++ private fun ensureChannel() {+ if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) return+ val nm = getSystemService(NotificationManager::class.java) ?: return+ if (nm.getNotificationChannel(CHANNEL_ID) != null) return+ val channel =+ NotificationChannel(+ CHANNEL_ID,+ getString(R.string.http_server_notif_channel_name),+ NotificationManager.IMPORTANCE_LOW,+ ).apply {+ description = getString(R.string.http_server_notif_channel_desc)+ setShowBadge(false)+ }+ nm.createNotificationChannel(channel)+ }+}diff --git a/OCR-translation/src/main/java/dev/davidv/translator/TranslationCoordinator.kt b/OCR-translation/src/main/java/dev/davidv/translator/TranslationCoordinator.ktnew file mode 100644index 0000000..72c4ea8--- /dev/null+++ b/OCR-translation/src/main/java/dev/davidv/translator/TranslationCoordinator.kt@@ -0,0 +1,438 @@+/*+ * Copyright (C) 2024 David V+ *+ * This program 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.+ *+ * This program 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 <https://www.gnu.org/licenses/>.+ */++package dev.davidv.translator++import android.graphics.Bitmap+import android.net.Uri+import android.util.Log+import kotlinx.coroutines.Dispatchers+import kotlinx.coroutines.flow.MutableStateFlow+import kotlinx.coroutines.flow.StateFlow+import kotlinx.coroutines.flow.asStateFlow+import kotlinx.coroutines.withContext+import uniffi.translator_core.OcrSourceSelection+import uniffi.translator_core.PreparedImageOverlay+import java.nio.ByteBuffer+import kotlin.system.measureTimeMillis++class TranslationCoordinator(+ private val translationService: TranslationService,+ private val speechService: SpeechService,+ private val languageDetector: LanguageDetector,+ private val imageProcessor: ImageProcessor,+ private val settingsManager: SettingsManager,+) {+ private val _isTranslating = MutableStateFlow(false)+ val isTranslating: StateFlow<Boolean> = _isTranslating.asStateFlow()++ private val _isOcrInProgress = MutableStateFlow(false)+ val isOcrInProgress: StateFlow<Boolean> = _isOcrInProgress.asStateFlow()++ var lastTranslatedInput: String = ""++ suspend fun preloadModel(+ from: Language,+ to: Language,+ ) {+ if (_isTranslating.value) {+ return+ }+ translationService.preloadModel(from, to)+ }++ suspend fun translateText(+ from: Language,+ to: Language,+ text: String,+ ): TranslationResult {+ if (text.isBlank()) return TranslationResult.Success(TranslatedText("", ""))++ _isTranslating.value = true+ val result: TranslationResult+ try {+ val elapsed =+ measureTimeMillis {+ result = translationService.translate(from, to, text)+ }+ Log.d("TranslationCoordinator", "Translating ${text.length} chars from ${from.displayName} to ${to.displayName} took ${elapsed}ms")+ } finally {+ lastTranslatedInput = text+ _isTranslating.value = false+ }+ return result+ }++ suspend fun steer(+ from: Language,+ to: Language,+ source: String,+ forcedPrefix: String,+ ): TranslationResult {+ _isTranslating.value = true+ return try {+ translationService.steer(from, to, source, forcedPrefix)+ } finally {+ _isTranslating.value = false+ }+ }++ /** Abort the in-flight document translation (fast, mid-batch). */+ fun cancelOngoingWork() = translationService.cancelOngoingWork()++ suspend fun translateDocumentPath(+ inputPath: String,+ outputPath: String,+ from: Language,+ to: Language,+ translatePdfImages: Boolean,+ txtLayout: TxtLayoutChoice,+ onProgress: (DocumentTranslationProgress) -> Unit = {},+ isCancelled: () -> Boolean = { false },+ ): Result<String> {+ _isTranslating.value = true+ try {+ val result =+ translationService.translateDocumentPath(+ inputPath = inputPath,+ outputPath = outputPath,+ from = from,+ to = to,+ translatePdfImages = translatePdfImages,+ txtLayout = txtLayout,+ onProgress = onProgress,+ isCancelled = isCancelled,+ )+ result.onSuccess { path ->+ Log.d("TranslationCoordinator", "Translated document to $path")+ }+ return result+ } finally {+ lastTranslatedInput = inputPath+ _isTranslating.value = false+ }+ }++ suspend fun detectLanguageRobust(+ text: String,+ hint: Language?,+ availableLanguages: List<Language>,+ ): Language? = languageDetector.detectLanguageRobust(text, hint, availableLanguages)++ suspend fun correctBitmap(+ uri: Uri,+ deleteAfterLoad: Boolean = false,+ ): Bitmap =+ withContext(Dispatchers.IO) {+ try {+ val originalBitmap = imageProcessor.loadBitmapFromUri(uri)+ val correctedBitmap = imageProcessor.correctImageOrientation(uri, originalBitmap)++ if (correctedBitmap !== originalBitmap && !originalBitmap.isRecycled) {+ originalBitmap.recycle()+ }++ correctedBitmap+ } finally {+ if (deleteAfterLoad) {+ imageProcessor.deleteTemporaryImageUri(uri)+ }+ }+ }++ suspend fun translateImageWithOverlay(+ from: Language,+ to: Language,+ finalBitmap: Bitmap,+ onMessage: (TranslatorMessage.ImageTextDetected) -> Unit,+ readingOrder: ReadingOrder? = null,+ isAutoSource: Boolean = false,+ onMissingDetectedLanguage: (Language) -> Unit = {},+ onOcrUnavailable: () -> Unit = {},+ onDetectedRegions: (List<uniffi.translator_core.OrientedRect>, Int, Int) -> Unit = { _, _, _ -> },+ ): ProcessedImageResult? =+ withContext(Dispatchers.IO) {+ _isTranslating.value = true+ val totalStart = System.currentTimeMillis()+ try {+ _isOcrInProgress.value = true+ val catalog = imageProcessor.loadCatalog() ?: return@withContext null+ val minConfidence = settingsManager.settings.value.minConfidence+ val backgroundMode = settingsManager.settings.value.backgroundMode+ val maxImageSize = settingsManager.settings.value.maxImageSize+ val sourceSelection =+ if (isAutoSource) {+ OcrSourceSelection.Auto+ } else {+ OcrSourceSelection.Specific(uniffi.translator_core.LanguageCode(from.code))+ }+ // Own the source pixels rust-side (one in-process copy via lockPixels, no byte[]/marshal),+ // then run detect → ocr → renderInto as separate cheap calls; the multi-MB image never+ // crosses the FFI boundary. `renderInto` composes the final overlay straight into the+ // display bitmap's locked pixels.+ val translateStart = System.currentTimeMillis()+ val srcAddr = NativeBitmap.lockPixels(finalBitmap)+ if (srcAddr == 0L) {+ Log.e("TranslationCoordinator", "lockPixels(source) failed")+ return@withContext null+ }+ val ocrImage =+ uniffi.bindings.OcrImage.fromPixels(+ srcAddr.toULong(),+ finalBitmap.width.toUInt(),+ finalBitmap.height.toUInt(),+ )+ NativeBitmap.unlockPixels(finalBitmap)++ val detection =+ try {+ catalog.ocrImageDetect(ocrImage, maxImageSize)+ } catch (e: uniffi.bindings.CatalogException) {+ Log.d("OCR", "detect failed: ${e.message}")+ null+ }+ detection?.let { boxes ->+ onDetectedRegions(boxes.map { it.orientedBox }, finalBitmap.width, finalBitmap.height)+ }++ val plan =+ try {+ catalog.ocrImagePlan(+ ocrImage,+ maxImageSize,+ sourceSelection,+ to,+ minConfidence,+ readingOrder,+ backgroundMode,+ detection,+ )+ } catch (e: uniffi.bindings.CatalogException.MissingAsset) {+ Log.d("OCR", "ocr failed: ${e.message}")+ val missingDetected =+ if (isAutoSource) {+ detectedLanguageCodeFromMissingAsset(e.message)?.let(catalog::languageByCode)+ } else {+ null+ }+ if (missingDetected != null) {+ onMissingDetectedLanguage(missingDetected)+ } else {+ // Not a translation-pair gap: the OCR model chain itself is+ // broken/missing (e.g. detector pack) — actionable via repair.+ onOcrUnavailable()+ }+ ocrImage.close()+ return@withContext null+ } catch (e: uniffi.bindings.CatalogException) {+ Log.d("OCR", "ocr failed: ${e.message}")+ ocrImage.close()+ return@withContext null+ }+ _isOcrInProgress.value = false+ Log.i(+ "TranslationCoordinator",+ "detect+ocr (lockpixels, no marshal): ${System.currentTimeMillis() - translateStart}ms",+ )+ Log.d("OCR", "complete, blocks=${plan.blocks.size}")++ val extractedText = plan.extractedText+ onMessage(TranslatorMessage.ImageTextDetected(extractedText))++ val output =+ Bitmap.createBitmap(finalBitmap.width, finalBitmap.height, Bitmap.Config.ARGB_8888)+ val dstAddr = NativeBitmap.lockPixels(output)+ if (dstAddr == 0L) {+ Log.e("TranslationCoordinator", "lockPixels(output) failed")+ ocrImage.close()+ return@withContext null+ }+ var translatedWords: List<uniffi.translator_core.PositionedWord> = emptyList()+ val renderMs =+ measureTimeMillis {+ translatedWords =+ try {+ catalog.ocrImageRenderInto(ocrImage, plan, to, MIN_OVERLAY_FONT_SIZE_PX, dstAddr)+ } finally {+ NativeBitmap.unlockPixels(output)+ }+ }+ Log.i("TranslationCoordinator", "renderInto took ${renderMs}ms")+ Log.i("TranslationCoordinator", "OCR+translate+.. total: ${System.currentTimeMillis() - totalStart}ms")++ ProcessedImageResult(+ correctedBitmap = output,+ extractedText = extractedText,+ translatedText = plan.translatedText,+ metadata = plan,+ translatedWords = translatedWords,+ ocrImage = ocrImage,+ )+ } catch (e: Exception) {+ Log.e("TranslationCoordinator", "Exception ${e.stackTrace}")+ null+ } finally {+ _isOcrInProgress.value = false+ _isTranslating.value = false+ }+ }++ suspend fun retranslateImageWithOverlay(+ cachedPlan: PreparedImageOverlay,+ from: Language,+ to: Language,+ onMessage: (TranslatorMessage.ImageTextDetected) -> Unit,+ ocrImage: uniffi.bindings.OcrImage? = null,+ ): ProcessedImageResult? =+ withContext(Dispatchers.IO) {+ _isTranslating.value = true+ try {+ val catalog = imageProcessor.loadCatalog() ?: return@withContext null++ // Fast path: the source pixels are still owned rust-side, so re-render the cached OCR+ // result into a fresh display bitmap without re-OCR or any image copy across the FFI.+ if (ocrImage != null) {+ val output =+ Bitmap.createBitmap(+ cachedPlan.width.toInt(),+ cachedPlan.height.toInt(),+ Bitmap.Config.ARGB_8888,+ )+ val dstAddr = NativeBitmap.lockPixels(output)+ if (dstAddr == 0L) {+ Log.e("TranslationCoordinator", "lockPixels(retranslate output) failed")+ return@withContext null+ }+ val res =+ try {+ catalog.ocrImageRetranslateInto(+ ocrImage,+ cachedPlan,+ from,+ to,+ MIN_OVERLAY_FONT_SIZE_PX,+ dstAddr,+ )+ } catch (e: uniffi.bindings.CatalogException) {+ Log.d("OCR", "retranslateInto failed: ${e.message}")+ NativeBitmap.unlockPixels(output)+ return@withContext null+ } finally {+ NativeBitmap.unlockPixels(output)+ }+ val extractedText = res.plan.extractedText+ onMessage(TranslatorMessage.ImageTextDetected(extractedText))+ return@withContext ProcessedImageResult(+ correctedBitmap = output,+ extractedText = extractedText,+ translatedText = res.plan.translatedText,+ metadata = res.plan,+ translatedWords = res.words,+ ocrImage = ocrImage,+ )+ }++ val plan =+ try {+ catalog.retranslateImagePlan(cachedPlan, from, to)+ } catch (e: uniffi.bindings.CatalogException) {+ Log.d("OCR", "retranslateImagePlan failed: ${e.message}")+ return@withContext null+ }++ val extractedText = plan.extractedText+ onMessage(TranslatorMessage.ImageTextDetected(extractedText))+ lateinit var overlayBitmap: Bitmap+ var translatedWords: List<uniffi.translator_core.PositionedWord> = emptyList()+ val translatePaint =+ measureTimeMillis {+ val rendered = catalog.renderTranslatedOverlay(plan, to, MIN_OVERLAY_FONT_SIZE_PX)+ overlayBitmap = bitmapFromRgba(rendered.rgbaBytes, plan.width.toInt(), plan.height.toInt())+ ?: return@withContext null+ translatedWords = rendered.translatedWords+ }+ Log.i("TranslationCoordinator", "Retranslate overpainting took ${translatePaint}ms")++ ProcessedImageResult(+ correctedBitmap = overlayBitmap,+ extractedText = extractedText,+ translatedText = plan.translatedText,+ metadata = plan,+ translatedWords = translatedWords,+ )+ } catch (e: Exception) {+ Log.e("TranslationCoordinator", "Exception ${e.stackTrace}")+ null+ } finally {+ _isTranslating.value = false+ }+ }++ fun transliterate(+ text: String,+ from: Language,+ ): String? = translationService.transliterate(text, from)++ private fun detectedLanguageCodeFromMissingAsset(message: String?): String? {+ if (message == null) return null+ val direction = Regex("\\b([a-z]{2,3}(?:-[A-Za-z0-9]+)?)->[a-z]{2,3}(?:-[A-Za-z0-9]+)?\\b").find(message)+ return direction?.groupValues?.getOrNull(1)+ }++ suspend fun synthesizeSpeech(+ language: Language,+ text: String,+ ): SpeechSynthesisResult = speechService.synthesizeSpeech(language, text)++ suspend fun availableTtsVoices(language: Language): List<TtsVoiceOption> = speechService.availableTtsVoices(language)++ suspend fun installedTtsVoices(language: Language): List<uniffi.translator_core.InstalledTtsPack> =+ speechService.installedTtsVoices(+ language,+ )++ private fun bitmapFromRgba(+ bytes: ByteArray,+ width: Int,+ height: Int,+ ): Bitmap? {+ return try {+ Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888).apply {+ copyPixelsFromBuffer(ByteBuffer.wrap(bytes))+ }+ } catch (e: Exception) {+ Log.e("TranslationCoordinator", "Failed to decode rendered overlay bitmap", e)+ null+ }+ }++ private companion object {+ const val MIN_OVERLAY_FONT_SIZE_PX: Float = 8.0f+ }+}++data class ProcessedImageResult(+ val correctedBitmap: Bitmap,+ val extractedText: String,+ val translatedText: String,+ val metadata: PreparedImageOverlay,+ // Per-word boxes of the rendered translation (image space). Source-word boxes for the+ // original text live on `metadata.sourceWords`. Both drive drag-to-copy.+ val translatedWords: List<uniffi.translator_core.PositionedWord>,+ // Rust-side owner of the source pixels; reused for a language switch without re-OCR/copy.+ val ocrImage: uniffi.bindings.OcrImage? = null,+)diff --git a/OCR-translation/src/main/java/dev/davidv/translator/TranslationRuntime.kt b/OCR-translation/src/main/java/dev/davidv/translator/TranslationRuntime.ktnew file mode 100644index 0000000..783e195--- /dev/null+++ b/OCR-translation/src/main/java/dev/davidv/translator/TranslationRuntime.kt@@ -0,0 +1,34 @@+/*+ * Copyright (C) 2024 David V+ *+ * This program 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.+ *+ * This program 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 <https://www.gnu.org/licenses/>.+ */++package dev.davidv.translator++import uniffi.bindings.AvailableLanguage+import uniffi.bindings.detectLanguageRobustCodeRecord++internal class NativeLanguageRuntime {+ fun detectLanguageRobustCode(+ text: String,+ hintCode: String?,+ availableLanguages: List<Language>,+ ): String? =+ detectLanguageRobustCodeRecord(+ text,+ hintCode,+ availableLanguages.map { AvailableLanguage(it.code, it.script) },+ )+}diff --git a/OCR-translation/src/main/java/dev/davidv/translator/TranslationService.kt b/OCR-translation/src/main/java/dev/davidv/translator/TranslationService.ktnew file mode 100644index 0000000..22c45a8--- /dev/null+++ b/OCR-translation/src/main/java/dev/davidv/translator/TranslationService.kt@@ -0,0 +1,224 @@+/*+ * Copyright (C) 2024 David V+ *+ * This program 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.+ *+ * This program 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 <https://www.gnu.org/licenses/>.+ */++package dev.davidv.translator++import android.util.Log+import kotlinx.coroutines.Dispatchers+import kotlinx.coroutines.withContext+import uniffi.bindings.CatalogException++class TranslationService(+ private val settingsManager: SettingsManager,+ private val filePathManager: FilePathManager,+) {+ companion object {+ fun cleanup() {+ // cache now lives in the native catalog translation layer+ }+ }++ private val transliterateBinding = TransliterateBinding()++ // / Requires the translation pairs to be available+ suspend fun preloadModel(+ from: Language,+ to: Language,+ ) = withContext(Dispatchers.IO) {+ if (from == to) return@withContext++ val catalog = filePathManager.loadCatalog() ?: return@withContext+ catalog.warmTranslationModels(from, to)+ }++ suspend fun translateHtmlFragments(+ from: Language,+ to: Language,+ fragments: List<String>,+ ): List<String> =+ withContext(Dispatchers.IO) {+ if (fragments.isEmpty() || from == to) return@withContext fragments+ val catalog = filePathManager.loadCatalog() ?: return@withContext fragments+ try {+ catalog.translateHtmlFragments(from, to, fragments)+ } catch (e: CatalogException) {+ Log.w("TranslationService", "translateHtmlFragments failed", e)+ fragments+ }+ }++ suspend fun translateMixedTexts(+ inputs: List<String>,+ forcedSourceLanguage: Language?,+ targetLanguage: Language,+ availableLanguages: List<Language>,+ ): BatchTextTranslationOutput =+ withContext(Dispatchers.IO) {+ val catalog =+ filePathManager.loadCatalog()+ ?: return@withContext BatchTextTranslationOutput.NothingToTranslate(NothingReason.NO_TRANSLATABLE_TEXT)++ val result =+ catalog.translateMixedTexts(inputs, forcedSourceLanguage, targetLanguage, availableLanguages)++ val nothingReason = result.nothingReason+ if (nothingReason != null && result.translations.isEmpty()) {+ return@withContext BatchTextTranslationOutput.NothingToTranslate(nothingReason)+ }++ val translatedByText = linkedMapOf<String, String>()+ result.translations.forEach { translation ->+ translatedByText[translation.sourceText] = translation.translatedText+ }+ BatchTextTranslationOutput.Translated(translatedByText)+ }++ suspend fun translate(+ from: Language,+ to: Language,+ text: String,+ ): TranslationResult =+ withContext(Dispatchers.IO) {+ val catalog =+ filePathManager.loadCatalog()+ ?: return@withContext TranslationResult.Error("Catalog unavailable")+ val withAlternatives =+ try {+ catalog.translateTextWithAlternatives(from, to, text)+ } catch (e: CatalogException.MissingAsset) {+ return@withContext TranslationResult.Error("Language pair ${from.code} -> ${to.code} not installed")+ } catch (e: CatalogException.Other) {+ Log.e("TranslationService", "Translation failed", e)+ return@withContext TranslationResult.Error("Translation failed: ${e.message}")+ }+ val result = withAlternatives.translatedText++ val transliterated =+ if (settingsManager.settings.value.enableOutputTransliteration) {+ transliterate(result, to)+ } else {+ null+ }+ TranslationResult.Success(+ TranslatedText(result, transliterated, source = text, alternatives = withAlternatives.alternatives),+ )+ }++ /**+ * Re-translate [source] forcing [forcedPrefix] as the start of the output+ * (the confirmed target text up to and including a user-picked word), then+ * free-run the rest. Returns the steered translation with fresh alternatives.+ */+ suspend fun steer(+ from: Language,+ to: Language,+ source: String,+ forcedPrefix: String,+ ): TranslationResult =+ withContext(Dispatchers.IO) {+ val catalog =+ filePathManager.loadCatalog()+ ?: return@withContext TranslationResult.Error("Catalog unavailable")+ val steered =+ try {+ catalog.steer(from, to, source, forcedPrefix)+ } catch (e: CatalogException.MissingAsset) {+ return@withContext TranslationResult.Error("Language pair ${from.code} -> ${to.code} not installed")+ } catch (e: CatalogException.Other) {+ Log.e("TranslationService", "Steer failed", e)+ return@withContext TranslationResult.Error("Steer failed: ${e.message}")+ }+ val result = steered.translatedText+ val transliterated =+ if (settingsManager.settings.value.enableOutputTransliteration) {+ transliterate(result, to)+ } else {+ null+ }+ TranslationResult.Success(+ TranslatedText(result, transliterated, source = source, alternatives = steered.alternatives),+ )+ }++ /**+ * Abort the in-flight document translation. Non-suspending so the cancel+ * button can call it directly; the cached catalog is the same instance+ * running the translation, so slimt's workers stop within ~one batch.+ */+ fun cancelOngoingWork() {+ filePathManager.loadCatalog()?.cancelOngoingWork()+ }++ suspend fun translateDocumentPath(+ inputPath: String,+ outputPath: String,+ from: Language,+ to: Language,+ translatePdfImages: Boolean,+ txtLayout: TxtLayoutChoice,+ onProgress: (DocumentTranslationProgress) -> Unit = {},+ isCancelled: () -> Boolean = { false },+ ): Result<String> =+ withContext(Dispatchers.IO) {+ val catalog =+ filePathManager.loadCatalog()+ ?: return@withContext Result.failure(IllegalStateException("Catalog unavailable"))+ try {+ Result.success(+ catalog.translateDocumentPath(inputPath, outputPath, from, to, translatePdfImages, txtLayout, onProgress, isCancelled),+ )+ } catch (e: CatalogException.MissingAsset) {+ Result.failure(IllegalStateException("Language pair ${from.code} -> ${to.code} not installed", e))+ } catch (e: CatalogException.Cancelled) {+ // User-initiated cancel — not an error, no stack trace logged.+ Result.failure(kotlinx.coroutines.CancellationException("translation cancelled"))+ } catch (e: CatalogException.Other) {+ Log.e("TranslationService", "Document translation failed", e)+ Result.failure(IllegalStateException("Document translation failed: ${e.message}", e))+ }+ }++ fun transliterate(+ text: String,+ from: Language,+ ): String? {+ val settings = settingsManager.settings.value+ val mucabPath = filePathManager.getMucabFile().takeIf { it.exists() }?.absolutePath+ return try {+ transliterateBinding.transliterate(+ text = text,+ languageCode = from.code,+ writingSystem = from.writingSystem,+ japaneseDictPath = mucabPath,+ japaneseSpaced = settings.addSpacesForJapaneseTransliteration,+ )+ } catch (e: Exception) {+ Log.w("TranslationService", "Failed to transliterate text for $from", e)+ null+ }+ }+}++sealed class TranslationResult {+ data class Success(+ val result: TranslatedText,+ ) : TranslationResult()++ data class Error(+ val message: String,+ ) : TranslationResult()+}diff --git a/OCR-translation/src/main/java/dev/davidv/translator/TranslatorApplication.kt b/OCR-translation/src/main/java/dev/davidv/translator/TranslatorApplication.ktnew file mode 100644index 0000000..5824e04--- /dev/null+++ b/OCR-translation/src/main/java/dev/davidv/translator/TranslatorApplication.kt@@ -0,0 +1,134 @@+/*+ * Copyright (C) 2024 David V+ *+ * This program 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.+ *+ * This program 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 <https://www.gnu.org/licenses/>.+ */++package dev.davidv.translator++import android.app.Application+import android.content.BroadcastReceiver+import android.content.Context+import android.content.Intent+import android.content.IntentFilter+import android.os.Build+import android.os.UserManager+import android.util.Log+import dev.davidv.translator.adblock.AdblockManager++class TranslatorApplication : Application() {+ lateinit var settingsManager: SettingsManager+ lateinit var languageMetadataManager: LanguageMetadataManager+ lateinit var filePathManager: FilePathManager+ lateinit var imageProcessor: ImageProcessor+ lateinit var translationService: TranslationService+ lateinit var speechService: SpeechService+ lateinit var languageDetector: LanguageDetector+ lateinit var translationCoordinator: TranslationCoordinator+ lateinit var adblockManager: AdblockManager+ val languagesFlow = kotlinx.coroutines.flow.MutableStateFlow<List<Language>>(emptyList())+ var languageCatalog: LanguageCatalog? = null+ private set++ /** Re-open the app-level catalog after on-disk model files change (e.g. the+ * ONNX→MNN migration), so gates like doc-align see the new state. */+ fun reloadLanguageCatalog() {+ languageCatalog = filePathManager.reloadCatalog()+ languagesFlow.value = languageCatalog?.languageList ?: emptyList()+ }++ private var servicesInitialized = false++ override fun onCreate() {+ super.onCreate()++ // The assistant VoiceInteractionService is directBootAware, so the system starts+ // this process before the user unlocks. Service init below touches credential-encrypted+ // SharedPreferences, which throw until unlock — so defer it until the user is unlocked.+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N && !isUserUnlocked()) {+ Log.d("TranslatorApplication", "User locked (direct boot); deferring service init until unlock")+ registerUnlockReceiver()+ return+ }++ initializeServices()+ }++ private fun isUserUnlocked(): Boolean = getSystemService(UserManager::class.java).isUserUnlocked++ private fun registerUnlockReceiver() {+ val receiver =+ object : BroadcastReceiver() {+ override fun onReceive(+ context: Context,+ intent: Intent,+ ) {+ Log.d("TranslatorApplication", "User unlocked; running deferred service init")+ initializeServices()+ unregisterReceiver(this)+ }+ }+ registerReceiver(receiver, IntentFilter(Intent.ACTION_USER_UNLOCKED))+ }++ private fun initializeServices() {+ if (servicesInitialized) {+ return+ }+ servicesInitialized = true+ Log.d("TranslatorApplication", "Initializing application services")++ settingsManager = SettingsManager(this)+ filePathManager = FilePathManager(this, settingsManager.settings)++ if (isTtsEngineProcess()) {+ Log.d("TranslatorApplication", "Initialized lightweight TTS engine process")+ return+ }++ languageCatalog = filePathManager.loadCatalog()+ languagesFlow.value = languageCatalog?.languageList ?: emptyList()+ languageMetadataManager = LanguageMetadataManager(this, languagesFlow)+ imageProcessor = ImageProcessor(this, filePathManager)+ translationService = TranslationService(settingsManager, filePathManager)+ speechService = SpeechService(settingsManager, filePathManager)+ languageDetector = LanguageDetector { code -> languageCatalog?.languageByCode(code) }+ translationCoordinator =+ TranslationCoordinator(translationService, speechService, languageDetector, imageProcessor, settingsManager)+ adblockManager = AdblockManager(filePathManager)++ if (settingsManager.settings.value.tapToTranslateEnabled) {+ TapToTranslateNotification.show(this)+ }++ if (settingsManager.settings.value.httpServerEnabled) {+ settingsManager.applyHttpServerState(settingsManager.settings.value)+ }++ settingsManager.applyBrowserAliasState(settingsManager.settings.value.registerAsBrowser)+ }++ private fun isTtsEngineProcess(): Boolean = currentProcessName().endsWith(":tts")++ private fun currentProcessName(): String =+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {+ getProcessName()+ } else {+ try {+ java.io.File("/proc/self/cmdline").readText().trimEnd('\u0000')+ } catch (_: Exception) {+ packageName+ }+ }+}diff --git a/OCR-translation/src/main/java/dev/davidv/translator/TranslatorMessage.kt b/OCR-translation/src/main/java/dev/davidv/translator/TranslatorMessage.ktnew file mode 100644index 0000000..3d2214e--- /dev/null+++ b/OCR-translation/src/main/java/dev/davidv/translator/TranslatorMessage.kt@@ -0,0 +1,106 @@+/*+ * Copyright (C) 2024 David V+ *+ * This program 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.+ *+ * This program 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 <https://www.gnu.org/licenses/>.+ */++package dev.davidv.translator++import android.net.Uri++enum class FromLangChange {+ KeepTarget,+ MovePreviousToTarget,+}++sealed class TranslatorMessage {+ data class TextInput(+ val text: String,+ ) : TranslatorMessage()++ data class FromLang(+ val language: Language,+ val change: FromLangChange = FromLangChange.KeepTarget,+ ) : TranslatorMessage()++ data class ToLang(+ val language: Language,+ ) : TranslatorMessage()++ data class AddTab(+ val language: Language,+ ) : TranslatorMessage()++ data class RemoveTab(+ val language: Language,+ ) : TranslatorMessage()++ data class SetImageUri(+ val uri: Uri,+ val deleteAfterLoad: Boolean = false,+ ) : TranslatorMessage()++ data class SetDocumentPath(+ val path: String,+ val displayName: String,+ val sizeBytes: Long,+ val deleteAfterLoad: Boolean = false,+ ) : TranslatorMessage()++ data object ShareTranslatedImage : TranslatorMessage()++ data object ToggleJapaneseOcrMode : TranslatorMessage()++ data object SwapLanguages : TranslatorMessage()++ data object EnableAutoSource : TranslatorMessage()++ data object ClearInput : TranslatorMessage()++ data class InitializeLanguages(+ val from: Language,+ val to: Language,+ ) : TranslatorMessage()++ data class ImageTextDetected(+ val extractedText: String,+ ) : TranslatorMessage()++ data class DictionaryLookup(+ val str: String,+ val language: Language,+ ) : TranslatorMessage()++ data class SpeakTranslatedText(+ val text: String,+ val language: Language,+ ) : TranslatorMessage()++ /**+ * Re-translate the current output forcing [forcedPrefix] as the start of the+ * translation — used when the user picks a word alternative. The source and+ * languages come from current state.+ */+ data class Steer(+ val forcedPrefix: String,+ ) : TranslatorMessage()++ data object PopDictionary : TranslatorMessage()++ data object ClearDictionaryStack : TranslatorMessage()++ data class ChangeLaunchMode(+ val newLaunchMode: LaunchMode,+ ) : TranslatorMessage()+}diff --git a/OCR-translation/src/main/java/dev/davidv/translator/TranslatorTtsEngine.kt b/OCR-translation/src/main/java/dev/davidv/translator/TranslatorTtsEngine.ktnew file mode 100644index 0000000..970e295--- /dev/null+++ b/OCR-translation/src/main/java/dev/davidv/translator/TranslatorTtsEngine.kt@@ -0,0 +1,561 @@+/*+ * Copyright (C) 2024 David V+ *+ * This program 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.+ *+ * This program 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 <https://www.gnu.org/licenses/>.+ */++package dev.davidv.translator++import android.app.Activity+import android.content.Context+import android.content.Intent+import android.media.AudioFormat+import android.os.Bundle+import android.speech.tts.SynthesisCallback+import android.speech.tts.SynthesisRequest+import android.speech.tts.TextToSpeech+import android.speech.tts.TextToSpeechService+import android.speech.tts.Voice+import android.util.Log+import java.util.Locale++class TranslatorTtsService : TextToSpeechService() {+ @Volatile+ private var stopped = false++ @Volatile+ private var currentVoice: TranslatorTtsVoice? = null++ override fun onGetVoices(): List<Voice> {+ val ttsVoices = TranslatorTtsEngine.systemTtsVoices(this)+ Log.i(+ "TranslatorTtsService",+ "onGetVoices: returning ${ttsVoices.size} voices: " ++ ttsVoices.joinToString { "${it.androidName}@${it.locale}" },+ )+ return ttsVoices.map { ttsVoice ->+ Voice(+ ttsVoice.androidName,+ ttsVoice.locale,+ ttsVoice.quality,+ Voice.LATENCY_NORMAL,+ false,+ setOf(TextToSpeech.Engine.KEY_FEATURE_EMBEDDED_SYNTHESIS),+ )+ }+ }++ override fun onIsValidVoiceName(voiceName: String): Int =+ if (TranslatorTtsEngine.isBootstrapVoiceName(voiceName) || TranslatorTtsEngine.isCatalogVoiceName(voiceName)) {+ TextToSpeech.SUCCESS+ } else {+ TextToSpeech.ERROR+ }++ override fun onLoadVoice(voiceName: String): Int {+ val voice = TranslatorTtsEngine.voiceFromAndroidName(voiceName) ?: return TextToSpeech.ERROR+ currentVoice = voice+ return TextToSpeech.SUCCESS+ }++ override fun onGetDefaultVoiceNameFor(+ lang: String,+ country: String,+ variant: String,+ ): String? {+ TranslatorTtsEngine.resolveUserPreferredVoice(this, lang)?.let { return it.androidName }+ val voices = TranslatorTtsEngine.systemTtsVoices(this)+ val match =+ voices.firstOrNull {+ it.locale.safeIso3Language() == lang && it.locale.safeIso3Country() == country+ }+ ?: voices.firstOrNull { it.locale.safeIso3Language() == lang }+ return match?.androidName+ }++ override fun onIsLanguageAvailable(+ lang: String,+ country: String,+ variant: String,+ ): Int = languageAvailability(lang, country)++ override fun onLoadLanguage(+ lang: String,+ country: String,+ variant: String,+ ): Int {+ currentVoice =+ TranslatorTtsEngine.resolveUserPreferredVoice(this, lang)+ ?: TranslatorTtsEngine.bootstrapVoice(lang, country)+ return languageAvailability(lang, country)+ }++ override fun onGetLanguage(): Array<String> {+ val locale = currentVoice?.locale ?: Locale.ENGLISH+ return arrayOf(+ locale.safeIso3Language(),+ locale.safeIso3Country(),+ locale.variant.orEmpty(),+ )+ }++ override fun onSynthesizeText(+ request: SynthesisRequest,+ callback: SynthesisCallback,+ ) {+ stopped = false+ val text = request.charSequenceText?.toString().orEmpty()+ if (text.isBlank()) {+ callback.error()+ callback.done()+ return+ }++ val explicitVoice =+ request.voiceName+ ?.takeIf(TranslatorTtsEngine::isCatalogVoiceName)+ ?.let(TranslatorTtsEngine::voiceFromAndroidName)+ val voice =+ explicitVoice+ ?: TranslatorTtsEngine.resolveUserPreferredVoice(this, request.language.orEmpty())+ ?: currentVoice+ ?: TranslatorTtsEngine.bootstrapVoice(request.language.orEmpty(), request.country.orEmpty())++ val settings = (application as TranslatorApplication).settingsManager.settings.value+ val baseSpeed =+ voice.catalogVoiceName+ ?.let { vname -> settings.ttsPlaybackSpeedOverrides["${voice.languageCode}:$vname"] }+ ?: settings.ttsPlaybackSpeed+ val finalSpeed = (baseSpeed * (request.speechRate / 100f)).coerceIn(0.5f, 2.0f)++ try {+ synthesizeVoice(+ voice = voice,+ text = text,+ speechSpeed = finalSpeed,+ callback = callback,+ )+ } catch (error: Exception) {+ Log.e("TranslatorTtsService", "System TTS synthesis failed", error)+ callback.error()+ } finally {+ callback.done()+ }+ }++ override fun onStop() {+ stopped = true+ }++ private fun synthesizeVoice(+ voice: TranslatorTtsVoice,+ text: String,+ speechSpeed: Float,+ callback: SynthesisCallback,+ ) {+ val catalog = applicationServices().filePathManager.loadCatalog() ?: error("Catalog unavailable")+ val readUrlsAndHashtags = applicationServices().settingsManager.settings.value.ttsReadUrlsAndHashtags+ val chunks = catalog.planSpeechChunks(voice.languageCode, text, voice.packId, readUrlsAndHashtags)+ if (chunks.isEmpty()) {+ error("No speech chunks planned")+ }++ var started = false+ var sampleRate: Int? = null+ for (chunk in chunks) {+ if (stopped) return+ val audio =+ catalog.synthesizeSpeechPcm(+ languageCode = voice.languageCode,+ text = chunk.content,+ speechSpeed = speechSpeed,+ voiceName = voice.catalogVoiceName?.takeIf(String::isNotBlank),+ isPhonemes = chunk.isPhonemes,+ packId = voice.packId,+ )++ if (!started) {+ callback.start(audio.sampleRate, AudioFormat.ENCODING_PCM_16BIT, 1)+ started = true+ sampleRate = audio.sampleRate+ } else if (sampleRate != audio.sampleRate) {+ error("TTS sample rate changed from $sampleRate to ${audio.sampleRate}")+ }++ if (!writePcm(audio.pcmSamples, callback)) return++ val pause = chunk.pauseAfterMs+ if (pause != null && pause > 0) {+ val silence = PcmAudio.silence(audio.sampleRate, pause)+ if (!writePcm(silence.pcmSamples, callback)) return+ }+ }+ }++ private fun writePcm(+ samples: ShortArray,+ callback: SynthesisCallback,+ ): Boolean {+ val maxSamples = (callback.maxBufferSize / Short.SIZE_BYTES).coerceAtLeast(1)+ var offset = 0+ while (offset < samples.size) {+ if (stopped) return false+ val count = minOf(maxSamples, samples.size - offset)+ val buffer = ByteArray(count * Short.SIZE_BYTES)+ var byteIndex = 0+ for (sampleIndex in offset until offset + count) {+ val sample = samples[sampleIndex].toInt()+ buffer[byteIndex++] = sample.toByte()+ buffer[byteIndex++] = (sample shr 8).toByte()+ }+ if (callback.audioAvailable(buffer, 0, buffer.size) != TextToSpeech.SUCCESS) {+ return false+ }+ offset += count+ }+ return true+ }++ private fun languageAvailability(+ lang: String,+ country: String,+ ): Int = TranslatorTtsEngine.languageAvailability(lang, country)++ private fun applicationServices(): TranslatorApplication = application as TranslatorApplication+}++class TranslatorTtsDataActivity : Activity() {+ override fun onCreate(savedInstanceState: Bundle?) {+ super.onCreate(savedInstanceState)+ when (intent?.action) {+ TextToSpeech.Engine.ACTION_CHECK_TTS_DATA -> finishCheckTtsData()+ TextToSpeech.Engine.ACTION_GET_SAMPLE_TEXT -> finishSampleText()+ TextToSpeech.Engine.ACTION_INSTALL_TTS_DATA -> finishInstallTtsData()+ else -> finish()+ }+ }++ private fun finishCheckTtsData() {+ val installedLanguages =+ TranslatorTtsEngine.installedTtsLocales(this).map { it.language }.distinct()+ val systemDefault = Locale.getDefault()+ val voices =+ installedLanguages+ .mapNotNull { language ->+ if (language == systemDefault.language) {+ systemDefault.toTtsDataVoiceName()+ } else {+ Locale(language).toTtsDataVoiceName()+ }+ }+ .distinct()+ .let(::ArrayList)++ val data =+ Intent()+ .putStringArrayListExtra(TextToSpeech.Engine.EXTRA_AVAILABLE_VOICES, voices)+ .putStringArrayListExtra(TextToSpeech.Engine.EXTRA_UNAVAILABLE_VOICES, arrayListOf())+ setResult(+ if (voices.isEmpty()) TextToSpeech.Engine.CHECK_VOICE_DATA_FAIL else TextToSpeech.Engine.CHECK_VOICE_DATA_PASS,+ data,+ )+ finish()+ }++ private fun finishSampleText() {+ val iso3Lang = intent?.getStringExtra("language").orEmpty()+ val sample =+ TranslatorTtsEngine.sampleText(this, iso3Lang)+ ?: getString(R.string.tts_sample_fallback)+ val data = Intent().putExtra(TextToSpeech.Engine.EXTRA_SAMPLE_TEXT, sample)+ setResult(TextToSpeech.LANG_AVAILABLE, data)+ finish()+ }++ private fun finishInstallTtsData() {+ val intent =+ Intent(this, MainActivity::class.java)+ .addFlags(+ Intent.FLAG_ACTIVITY_NEW_TASK or+ Intent.FLAG_ACTIVITY_CLEAR_TOP or+ Intent.FLAG_ACTIVITY_SINGLE_TOP,+ ).putExtra(MainActivity.EXTRA_OPEN_LANGUAGE_MANAGER, true)+ startActivity(intent)+ setResult(Activity.RESULT_OK)+ finish()+ }+}++class TranslatorTtsSettingsRelayActivity : Activity() {+ override fun onCreate(savedInstanceState: Bundle?) {+ super.onCreate(savedInstanceState)+ startActivity(+ Intent(this, MainActivity::class.java)+ .addFlags(+ Intent.FLAG_ACTIVITY_NEW_TASK or+ Intent.FLAG_ACTIVITY_CLEAR_TOP or+ Intent.FLAG_ACTIVITY_SINGLE_TOP,+ ).putExtra(MainActivity.EXTRA_OPEN_LANGUAGE_MANAGER, true),+ )+ finish()+ }+}++data class TranslatorTtsVoice(+ val androidName: String,+ val languageCode: String,+ val packId: String?,+ val catalogVoiceName: String?,+ val locale: Locale,+ val quality: Int,+)++object TranslatorTtsEngine {+ private const val BOOTSTRAP_VOICE_PREFIX = "default|"+ private const val VOICE_SEPARATOR = "|"++ @Volatile+ private var cachedInstalledLocales: List<Locale>? = null++ fun sampleText(+ context: Context,+ iso3Language: String,+ ): String? {+ val app = context.applicationContext as? TranslatorApplication ?: return null+ val catalog = app.filePathManager.loadCatalog() ?: return null+ val iso2 = iso3LanguageToIso2(iso3Language).ifBlank { iso3Language }+ return catalog.ttsSampleText(iso2)+ }++ fun installedTtsLocales(context: Context): List<Locale> {+ cachedInstalledLocales?.let { return it }+ val app = context.applicationContext as? TranslatorApplication ?: return emptyList()+ val catalog = app.filePathManager.loadCatalog() ?: return emptyList()+ val result = mutableListOf<Locale>()+ for (row in catalog.languageRows) {+ if (!row.availability.ttsFiles) continue+ val installedRegions = catalog.installedTtsVoicePickerRegions(row.language.code)+ if (installedRegions.isEmpty()) {+ result += Locale(row.language.code)+ } else {+ for (region in installedRegions) {+ result += Locale(row.language.code, region.code)+ }+ }+ }+ cachedInstalledLocales = result+ return result+ }++ fun invalidateInstalledLocales() {+ cachedInstalledLocales = null+ }++ fun notifyVoiceDataChanged(context: Context) {+ cachedInstalledLocales = null+ context.applicationContext.sendBroadcast(+ android.content.Intent(TextToSpeech.Engine.ACTION_TTS_DATA_INSTALLED),+ )+ }++ fun bootstrapVoices(context: Context): List<TranslatorTtsVoice> {+ val seenLanguages = mutableSetOf<String>()+ return installedTtsLocales(context).mapNotNull { locale ->+ val iso3Language = locale.safeIso3Language()+ if (iso3Language.isBlank() || !seenLanguages.add(iso3Language)) return@mapNotNull null++ TranslatorTtsVoice(+ androidName = bootstrapVoiceName(iso3Language, "") ?: return@mapNotNull null,+ languageCode = locale.language,+ packId = null,+ catalogVoiceName = null,+ locale = Locale(locale.language),+ quality = Voice.QUALITY_NORMAL,+ )+ }+ }++ fun systemTtsVoices(context: Context): List<TranslatorTtsVoice> {+ val app = context.applicationContext as? TranslatorApplication ?: return emptyList()+ val catalog = app.filePathManager.loadCatalog() ?: return emptyList()+ val voices = mutableListOf<TranslatorTtsVoice>()+ for (row in catalog.languageRows) {+ if (!row.availability.ttsFiles) continue+ val lang = row.language.code+ val packs = catalog.installedTtsVoices(lang)+ if (packs.isEmpty()) continue+ val locale = localeFor(lang, null)+ for (pack in packs) {+ for (speaker in pack.voices) {+ voices +=+ TranslatorTtsVoice(+ androidName = androidVoiceName(lang, pack.packId, speaker.name),+ languageCode = lang,+ packId = pack.packId,+ catalogVoiceName = speaker.name,+ locale = locale,+ quality = qualityFor(speaker.name),+ )+ }+ }+ }+ return voices+ }++ fun resolveUserPreferredVoice(+ context: Context,+ language: String,+ ): TranslatorTtsVoice? {+ if (language.isBlank()) return null+ val app = context.applicationContext as? TranslatorApplication ?: return null+ val catalog = app.filePathManager.loadCatalog() ?: return null+ val iso2 = iso3LanguageToIso2(language).ifBlank { language }+ val packs = catalog.installedTtsVoices(iso2)+ if (packs.isEmpty()) return null++ val override = parseVoiceOverride(app.settingsManager.settings.value.ttsVoiceOverrides[iso2])+ val chosenPack =+ override?.packId?.let { pid -> packs.firstOrNull { it.packId == pid } }+ ?: override?.voiceName?.let { vn -> packs.firstOrNull { p -> p.voices.any { it.name == vn } } }+ ?: packs.first()+ val chosenSpeaker =+ override?.voiceName?.let { vn -> chosenPack.voices.firstOrNull { it.name == vn } }+ ?: chosenPack.voices.firstOrNull()+ ?: return null++ return TranslatorTtsVoice(+ androidName = androidVoiceName(iso2, chosenPack.packId, chosenSpeaker.name),+ languageCode = iso2,+ packId = chosenPack.packId,+ catalogVoiceName = chosenSpeaker.name,+ locale = localeFor(iso2, null),+ quality = qualityFor(chosenSpeaker.name),+ )+ }++ fun languageAvailability(+ lang: String,+ country: String,+ ): Int {+ if (country.isBlank()) {+ return TextToSpeech.LANG_AVAILABLE+ }+ return TextToSpeech.LANG_COUNTRY_AVAILABLE+ }++ fun bootstrapVoiceName(+ lang: String,+ country: String,+ ): String? {+ if (lang.isBlank()) return null+ return "$BOOTSTRAP_VOICE_PREFIX$lang"+ }++ fun isBootstrapVoiceName(voiceName: String): Boolean = voiceName.startsWith(BOOTSTRAP_VOICE_PREFIX)++ fun isCatalogVoiceName(voiceName: String): Boolean = voiceName.count { it == '|' } == 2++ fun voiceFromAndroidName(voiceName: String): TranslatorTtsVoice? {+ if (isBootstrapVoiceName(voiceName)) {+ return bootstrapVoice(voiceName.removePrefix(BOOTSTRAP_VOICE_PREFIX), "")+ }+ if (!isCatalogVoiceName(voiceName)) return null+ val parts = voiceName.split(VOICE_SEPARATOR)+ val languageCode = parts[0]+ val packId = parts[1].takeIf(String::isNotBlank)+ val catalogVoiceName = parts[2]+ if (languageCode.isBlank() || catalogVoiceName.isBlank()) return null+ return TranslatorTtsVoice(+ androidName = voiceName,+ languageCode = languageCode,+ packId = packId,+ catalogVoiceName = catalogVoiceName,+ locale = localeFor(languageCode, null),+ quality = qualityFor(catalogVoiceName),+ )+ }++ fun bootstrapVoice(+ lang: String,+ country: String,+ ): TranslatorTtsVoice {+ val languageCode = iso3LanguageToIso2(lang).ifBlank { lang }+ val countryCode = iso3CountryToIso2(country).ifBlank { country }+ return TranslatorTtsVoice(+ androidName = bootstrapVoiceName(lang, country) ?: "${BOOTSTRAP_VOICE_PREFIX}und$VOICE_SEPARATOR",+ languageCode = languageCode,+ packId = null,+ catalogVoiceName = null,+ locale = localeFor(languageCode, countryCode),+ quality = Voice.QUALITY_NORMAL,+ )+ }++ private fun androidVoiceName(+ languageCode: String,+ packId: String?,+ catalogVoiceName: String,+ ): String = "$languageCode$VOICE_SEPARATOR${packId.orEmpty()}$VOICE_SEPARATOR$catalogVoiceName"++ private fun localeFor(+ languageCode: String,+ regionCode: String?,+ ): Locale {+ val languageTag = languageCode.replace('_', '-')+ val tag = listOfNotNull(languageTag, regionCode?.takeIf(String::isNotBlank)).joinToString("-")+ return Locale.forLanguageTag(tag)+ }++ private fun qualityFor(voiceName: String): Int =+ when {+ voiceName.contains("-high") -> Voice.QUALITY_HIGH+ voiceName.contains("-x-low") -> Voice.QUALITY_LOW+ else -> Voice.QUALITY_NORMAL+ }++ private fun iso3LanguageToIso2(iso3Language: String): String =+ Locale.getISOLanguages().firstOrNull { language ->+ Locale(language).safeIso3Language() == iso3Language+ }.orEmpty()++ private fun iso3CountryToIso2(iso3Country: String): String =+ Locale.getISOCountries().firstOrNull { country ->+ Locale("", country).safeIso3Country() == iso3Country+ }.orEmpty()+}++private fun Locale.safeIso3Language(): String =+ try {+ getISO3Language().orEmpty()+ } catch (_: Exception) {+ ""+ }++private fun Locale.safeIso3Country(): String =+ try {+ getISO3Country().orEmpty()+ } catch (_: Exception) {+ ""+ }++private fun Locale.toTtsDataVoiceName(): String? {+ val language = safeIso3Language()+ if (language.isBlank()) return null++ val country = safeIso3Country()+ val variant = variant.orEmpty()+ return listOf(language, country, variant)+ .filter(String::isNotBlank)+ .joinToString("-")+}diff --git a/OCR-translation/src/main/java/dev/davidv/translator/TransliterateBinding.kt b/OCR-translation/src/main/java/dev/davidv/translator/TransliterateBinding.ktnew file mode 100644index 0000000..74b36e5--- /dev/null+++ b/OCR-translation/src/main/java/dev/davidv/translator/TransliterateBinding.kt@@ -0,0 +1,20 @@+package dev.davidv.translator++import uniffi.bindings.transliterateWithPolicyRecord++class TransliterateBinding {+ fun transliterate(+ text: String,+ languageCode: String,+ writingSystem: WritingSystem,+ japaneseDictPath: String? = null,+ japaneseSpaced: Boolean = true,+ ): String? =+ transliterateWithPolicyRecord(+ text,+ languageCode,+ writingSystem,+ japaneseDictPath,+ japaneseSpaced,+ )+}diff --git a/OCR-translation/src/main/java/dev/davidv/translator/UiExportRecorder.kt b/OCR-translation/src/main/java/dev/davidv/translator/UiExportRecorder.ktnew file mode 100644index 0000000..5fd19f1--- /dev/null+++ b/OCR-translation/src/main/java/dev/davidv/translator/UiExportRecorder.kt@@ -0,0 +1,106 @@+/*+ * Copyright (C) 2024 David V+ *+ * This program 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.+ *+ * This program 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 <https://www.gnu.org/licenses/>.+ */++package dev.davidv.translator++import android.content.Context+import android.content.ContextWrapper+import android.content.res.Resources+import java.util.concurrent.ConcurrentHashMap++/**+ * Records resolved string-resource lookups during the UI-export instrumented run, so the SVG exporter+ * can stamp each label with the exact R.string name it came from instead of recovering it by matching+ * the rendered text (which can't tell apart two ids with the same English, and has to reverse-engineer+ * format/plural substitutions).+ *+ * Inert in production: nothing wraps and nothing records until [active] is set true, which only the+ * export test does, before the activity is created. When inactive, [wrap] returns the context unchanged.+ */+object UiExportRecorder {+ @Volatile var active = false+ private val byValue = ConcurrentHashMap<String, String>()+ private val ambiguous = ConcurrentHashMap.newKeySet<String>()++ fun reset() {+ byValue.clear()+ ambiguous.clear()+ }++ fun record(+ entry: String,+ value: String,+ ) {+ if (value.isEmpty()) return+ val prev = byValue.putIfAbsent(value, entry)+ if (prev != null && prev != entry) ambiguous.add(value)+ }++ /** The R.string name that produced [value] exactly, or null if unknown or produced by several ids. */+ fun idFor(value: String): String? = if (ambiguous.contains(value)) null else byValue[value]++ /** Wrap [base] so its Resources record every string lookup; the identity context when not [active]. */+ fun wrap(base: Context): Context =+ if (!active) {+ base+ } else {+ object : ContextWrapper(base) {+ private val res by lazy { RecordingResources(base.resources) }++ override fun getResources(): Resources = res+ }+ }+}++@Suppress("DEPRECATION")+private class RecordingResources(base: Resources) :+ Resources(base.assets, base.displayMetrics, base.configuration) {+ private fun <T : CharSequence> T.record(id: Int): T {+ if (UiExportRecorder.active) {+ try {+ UiExportRecorder.record(getResourceEntryName(id), toString())+ } catch (_: NotFoundException) {+ }+ }+ return this+ }++ override fun getString(id: Int): String = super.getString(id).record(id)++ override fun getString(+ id: Int,+ vararg formatArgs: Any?,+ ): String = super.getString(id, *formatArgs).record(id)++ override fun getText(id: Int): CharSequence = super.getText(id).record(id)++ override fun getQuantityString(+ id: Int,+ quantity: Int,+ ): String = super.getQuantityString(id, quantity).record(id)++ override fun getQuantityString(+ id: Int,+ quantity: Int,+ vararg formatArgs: Any?,+ ): String = super.getQuantityString(id, quantity, *formatArgs).record(id)++ override fun getQuantityText(+ id: Int,+ quantity: Int,+ ): CharSequence = super.getQuantityText(id, quantity).record(id)+}diff --git a/OCR-translation/src/main/java/dev/davidv/translator/UniffiTypeAliases.kt b/OCR-translation/src/main/java/dev/davidv/translator/UniffiTypeAliases.ktnew file mode 100644index 0000000..05f47c6--- /dev/null+++ b/OCR-translation/src/main/java/dev/davidv/translator/UniffiTypeAliases.kt@@ -0,0 +1,39 @@+package dev.davidv.translator++import androidx.annotation.StringRes++typealias ReadingOrder = uniffi.translator_core.ReadingOrder+typealias Script = uniffi.translator_core.Script+typealias WritingSystem = uniffi.translator_core.WritingSystem++// A typealias does not expose the nested classifiers of what it points at, so+// `WritingSystem.Single` cannot be reached through the alias above the way+// `Script.LATIN` can -- enum entries resolve through an alias, nested classes do not.+fun singleScript(script: Script): WritingSystem = uniffi.translator_core.WritingSystem.Single(script)+typealias SelectionView = uniffi.translator_core.SelectionView+typealias WritingAxis = uniffi.translator_core.WritingAxis+typealias Point = uniffi.translator_core.Point+typealias UrlsAndHashtags = uniffi.translator_core.UrlsAndHashtags+typealias NothingReason = uniffi.translator_translate.NothingReason+typealias BackgroundMode = uniffi.translator_core.BackgroundMode+typealias PreparedImageOverlay = uniffi.translator_core.PreparedImageOverlay+typealias TokenAlignment = uniffi.translator_translate.TokenAlignment+typealias TranslationWithAlignment = uniffi.translator_translate.TranslationWithAlignment+typealias WordAlternative = uniffi.translator_translate.WordAlternative+typealias WordAlternatives = uniffi.translator_translate.WordAlternatives+typealias TranslationWithAlternatives = uniffi.translator_translate.TranslationWithAlternatives+typealias Feature = uniffi.translator.Feature+typealias DownloadPlan = uniffi.translator_core.DownloadPlan+typealias DownloadTask = uniffi.translator_core.DownloadTask+typealias DeletePlan = uniffi.translator_core.DeletePlan+typealias TtsVoicePackInfo = uniffi.translator_core.TtsVoicePackInfo+typealias TtsVoicePickerRegion = uniffi.translator_core.TtsVoicePickerRegion++@get:StringRes+val BackgroundMode.labelRes: Int+ get() =+ when (this) {+ BackgroundMode.WHITE_ON_BLACK -> R.string.background_mode_white_on_black+ BackgroundMode.BLACK_ON_WHITE -> R.string.background_mode_black_on_white+ BackgroundMode.AUTO_DETECT -> R.string.background_mode_auto_detect+ }diff --git a/OCR-translation/src/main/java/dev/davidv/translator/accessibilityOverlay/OverlayUI.kt b/OCR-translation/src/main/java/dev/davidv/translator/accessibilityOverlay/OverlayUI.ktnew file mode 100644index 0000000..718858c--- /dev/null+++ b/OCR-translation/src/main/java/dev/davidv/translator/accessibilityOverlay/OverlayUI.kt@@ -0,0 +1,521 @@+package dev.davidv.translator.accessibilityOverlay++import android.app.Dialog+import android.content.Intent+import android.graphics.Bitmap+import android.graphics.Color+import android.graphics.PixelFormat+import android.graphics.Rect+import android.graphics.drawable.GradientDrawable+import android.os.Handler+import android.os.Looper+import android.util.TypedValue+import android.view.Gravity+import android.view.MotionEvent+import android.view.View+import android.view.WindowManager+import android.widget.ImageView+import android.widget.TextView+import androidx.compose.foundation.layout.fillMaxSize+import androidx.compose.ui.Modifier+import dev.davidv.translator.Language+import dev.davidv.translator.MainActivity+import dev.davidv.translator.ReadingOrder+import dev.davidv.translator.SettingsManager+import dev.davidv.translator.assistantOverlay.BorderWaveView+import dev.davidv.translator.overlayChrome.FloatingBubble+import dev.davidv.translator.overlayChrome.OverlayChromeFactory+import dev.davidv.translator.overlayChrome.OverlayInsets+import dev.davidv.translator.overlayChrome.OverlayMenuHost+import dev.davidv.translator.overlayChrome.OverlayMenuManager+import dev.davidv.translator.overlayChrome.spanFullDisplay+import dev.davidv.translator.ui.components.ScanAnimationOverlay+import dev.davidv.translator.ui.components.SelectionSurface+import dev.davidv.translator.ui.components.SelectionSurfaceState+import dev.davidv.translator.ui.components.WindowComposeHost++class OverlayUI(+ private val service: TranslatorAccessibilityService,+ private val windowManager: WindowManager,+ private val settingsManager: SettingsManager,+) {+ private val handler = Handler(Looper.getMainLooper())+ private var launcherBubble: FloatingBubble? = null+ private var toolbarView: View? = null+ private var sourceLabelView: TextView? = null+ private var targetLabelView: TextView? = null+ private var readingOrderButtonView: View? = null+ private var readingOrderIconView: ImageView? = null+ private var selectIconView: ImageView? = null+ private var refreshButtonView: View? = null+ private var flipButtonView: View? = null+ private var flipIconView: ImageView? = null+ private val translationOverlays = mutableListOf<View>()+ private var touchWatcher: View? = null+ private var borderView: BorderWaveView? = null+ private var selectDialog: Dialog? = null+ private var selectHost: WindowComposeHost? = null+ private var scanHost: WindowComposeHost? = null++ private val menuManager =+ OverlayMenuManager(+ service,+ ::dpToPx,+ object : OverlayMenuHost {+ override fun addDismissLayer(view: View) {+ val params =+ WindowManager.LayoutParams(+ WindowManager.LayoutParams.MATCH_PARENT,+ WindowManager.LayoutParams.MATCH_PARENT,+ WindowManager.LayoutParams.TYPE_ACCESSIBILITY_OVERLAY,+ WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE or WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN,+ PixelFormat.TRANSLUCENT,+ )+ params.windowAnimations = 0+ windowManager.addView(view, params)+ }++ override fun addMenuView(view: View) {+ val params =+ WindowManager.LayoutParams(+ dpToPx(180),+ WindowManager.LayoutParams.WRAP_CONTENT,+ WindowManager.LayoutParams.TYPE_ACCESSIBILITY_OVERLAY,+ WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE,+ PixelFormat.TRANSLUCENT,+ )+ params.gravity = Gravity.TOP or Gravity.END+ params.x = dpToPx(8)+ params.y = dpToPx(48)+ params.windowAnimations = 0+ windowManager.addView(view, params)+ }++ override fun addPickerView(view: View) {+ val params =+ WindowManager.LayoutParams(+ dpToPx(250),+ dpToPx(400),+ WindowManager.LayoutParams.TYPE_ACCESSIBILITY_OVERLAY,+ WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE,+ PixelFormat.TRANSLUCENT,+ )+ params.gravity = Gravity.CENTER+ params.windowAnimations = 0+ windowManager.addView(view, params)+ }++ override fun removeMenuChild(view: View) {+ windowManager.removeView(view)+ }+ },+ )++ fun showFloatingButton() {+ val bubble = launcherBubble+ if (bubble == null) {+ launcherBubble =+ FloatingBubble(service, windowManager, WindowManager.LayoutParams.TYPE_ACCESSIBILITY_OVERLAY, ::dpToPx) {+ service.activate()+ }.also { it.show() }+ } else {+ bubble.setShown(true)+ }+ }++ fun removeFloatingButton() {+ launcherBubble?.setShown(false)+ }++ fun restoreFloatingButton() {+ showFloatingButton()+ }++ fun showToolbar(+ forcedSourceLanguage: Language?,+ forcedTargetLanguage: Language?,+ readingOrder: ReadingOrder?,+ isAutoSource: Boolean,+ ) {+ if (toolbarView != null) return++ val toolbarViews =+ OverlayChromeFactory.createLanguageToolbar(+ context = service,+ dpToPx = ::dpToPx,+ forcedSourceLanguage = forcedSourceLanguage,+ forcedTargetLanguage = forcedTargetLanguage,+ defaultTargetLanguage = service.langStateManager.languageByCode(settingsManager.settings.value.defaultTargetLanguageCode) ?: return,+ onClose = { service.deactivate() },+ onSelectModeClick = { service.toggleSelectMode() },+ onSourceClick = { service.showLanguagePicker(true) },+ onSwap = { service.swapLanguages() },+ onTargetClick = { service.showLanguagePicker(false) },+ showReadingOrderButton = forcedSourceLanguage?.code == "ja",+ readingOrder = readingOrder,+ onReadingOrderClick = { service.toggleJapaneseOcrMode() },+ onRefreshClick = { service.handleFullScreenOcr() },+ onFlipOriginal = { service.toggleFlipOriginal() },+ onMenuClick = { service.showDotsMenu() },+ isAutoSource = isAutoSource,+ )+ val toolbar = toolbarViews.root+ sourceLabelView = toolbarViews.sourceLabel+ targetLabelView = toolbarViews.targetLabel+ readingOrderButtonView = toolbarViews.readingOrderButton+ readingOrderIconView = toolbarViews.readingOrderIcon+ selectIconView = toolbarViews.selectIcon+ refreshButtonView = toolbarViews.refreshButton+ flipButtonView = toolbarViews.flipButton+ flipIconView = toolbarViews.flipIcon+ flipButtonView?.visibility = View.GONE++ val params =+ WindowManager.LayoutParams(+ WindowManager.LayoutParams.MATCH_PARENT,+ WindowManager.LayoutParams.WRAP_CONTENT,+ WindowManager.LayoutParams.TYPE_ACCESSIBILITY_OVERLAY,+ WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE or WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN,+ PixelFormat.TRANSLUCENT,+ )+ params.gravity = Gravity.TOP or Gravity.START+ params.x = 0+ params.y = getStatusBarHeight()+ params.windowAnimations = 0++ windowManager.addView(toolbar, params)+ toolbarView = toolbar+ }++ fun removeToolbar() {+ toolbarView?.let {+ windowManager.removeView(it)+ toolbarView = null+ sourceLabelView = null+ targetLabelView = null+ readingOrderButtonView = null+ readingOrderIconView = null+ selectIconView = null+ refreshButtonView = null+ flipButtonView = null+ flipIconView = null+ }+ }++ /** Swap the mode-dependent toolbar slot: refresh drives the live screen, flip the frozen one. */+ fun setSelectModeUi(active: Boolean) {+ selectIconView?.setColorFilter(if (active) OverlayChromeFactory.ACTIVE_ICON_TINT else Color.WHITE)+ refreshButtonView?.visibility = if (active) View.GONE else View.VISIBLE+ flipButtonView?.visibility = if (active) View.VISIBLE else View.GONE+ if (!active) flipIconView?.setColorFilter(Color.WHITE)+ }++ fun setFlipActive(active: Boolean) {+ flipIconView?.setColorFilter(if (active) OverlayChromeFactory.ACTIVE_ICON_TINT else Color.WHITE)+ }++ fun updateToolbarState(+ forcedSourceLanguage: Language?,+ forcedTargetLanguage: Language?,+ readingOrder: ReadingOrder?,+ isAutoSource: Boolean,+ ) {+ sourceLabelView?.text = OverlayChromeFactory.formatSourceLabel(forcedSourceLanguage, isAutoSource)+ val currentTarget = forcedTargetLanguage ?: service.langStateManager.languageByCode(settingsManager.settings.value.defaultTargetLanguageCode)+ targetLabelView?.text = currentTarget?.shortDisplayName ?: "?"+ OverlayChromeFactory.updateReadingOrderButtonState(+ readingButton = readingOrderButtonView,+ readingIcon = readingOrderIconView,+ visible = forcedSourceLanguage?.code == "ja",+ readingOrder = readingOrder,+ )+ }++ fun showDotsMenu() {+ menuManager.showDotsMenu(+ listOf(+ "Open App" to {+ service.deactivate()+ val intent = Intent(service, MainActivity::class.java)+ intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)+ service.startActivity(intent)+ },+ "Disable Service" to {+ service.deactivate()+ service.disableSelf()+ },+ ),+ )+ }++ fun showLanguagePicker(+ isSource: Boolean,+ availableLangs: List<Language>,+ onPick: (Language?) -> Unit,+ ) {+ menuManager.showLanguagePicker(isSource, availableLangs) { lang ->+ onPick(lang)+ }+ }++ fun dismissMenu() {+ menuManager.dismiss()+ }++ fun showBitmapOverlay(+ bitmap: Bitmap,+ bounds: Rect,+ ) {+ val imageView = ImageView(service)+ imageView.setImageBitmap(bitmap)+ imageView.scaleType = ImageView.ScaleType.FIT_XY++ // Non-touchable so taps and swipes pass straight through to the app underneath;+ // the overlay clears itself off the next scroll/click via onAccessibilityEvent.+ val params =+ WindowManager.LayoutParams(+ bounds.width(),+ bounds.height(),+ WindowManager.LayoutParams.TYPE_ACCESSIBILITY_OVERLAY,+ WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE or+ WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE or+ WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN,+ PixelFormat.TRANSLUCENT,+ )+ params.gravity = Gravity.TOP or Gravity.START+ params.x = bounds.left+ params.y = bounds.top+ params.spanFullDisplay()++ windowManager.addView(imageView, params)+ translationOverlays.add(imageView)+ ensureTouchWatcher()+ }++ /**+ * The frozen select-text surface: one touchable window over the translated region hosting the+ * same Compose selection stack as the assistant. A Dialog rather than a raw WindowManager view+ * because the word-selection action bar needs `startActionMode(TYPE_FLOATING)`, which only a+ * DecorView provides; NOT_TOUCH_MODAL keeps the toolbar's own window clickable, and the back key+ * cancels the dialog (the service then exits select mode via `onDismiss`).+ */+ fun showSelectSurface(+ state: SelectionSurfaceState,+ region: Rect,+ onDismiss: () -> Unit,+ ) {+ if (selectDialog != null) return+ val dialog = Dialog(service, android.R.style.Theme_Material_NoActionBar)+ val host = WindowComposeHost(service)+ host.setContent { SelectionSurface(state) }+ dialog.setContentView(host.view)+ dialog.setCanceledOnTouchOutside(false)+ dialog.window?.apply {+ setType(WindowManager.LayoutParams.TYPE_ACCESSIBILITY_OVERLAY)+ addFlags(+ WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL or+ WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN,+ )+ clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND)+ setWindowAnimations(0)+ setGravity(Gravity.TOP or Gravity.START)+ attributes =+ attributes.apply {+ x = region.left+ y = region.top+ width = region.width()+ height = region.height()+ spanFullDisplay()+ }+ decorView.setPadding(0, 0, 0, 0)+ host.installOn(decorView)+ }+ dialog.setOnCancelListener { onDismiss() }+ dialog.show()+ selectDialog = dialog+ selectHost = host+ }++ fun removeSelectSurface() {+ val dialog = selectDialog ?: return+ selectDialog = null+ dialog.setOnCancelListener(null)+ dialog.dismiss()+ selectHost?.dispose()+ selectHost = null+ }++ fun hasSelectSurface(): Boolean = selectDialog != null++ /** A 1×1 watcher window: WATCH_OUTSIDE_TOUCH fires ACTION_OUTSIDE on the *down* of+ * any touch anywhere on screen, and NOT_TOUCH_MODAL lets that same touch reach the+ * app — so a tap or swipe both clear the result instantly and pass straight through. */+ @android.annotation.SuppressLint("ClickableViewAccessibility")+ private fun ensureTouchWatcher() {+ if (touchWatcher != null) return+ val watcher = View(service)+ watcher.setOnTouchListener { _, event ->+ // The system zeroes ACTION_OUTSIDE coordinates unless the touched window belongs to our+ // own UID: real coordinates mean the touch landed on our chrome (toolbar, menus, their+ // dismiss layer), which can't change the screen underneath — keep the overlays up.+ if (event.action == MotionEvent.ACTION_OUTSIDE && event.rawX == 0f && event.rawY == 0f) {+ removeTranslationOverlays()+ }+ false+ }+ val params =+ WindowManager.LayoutParams(+ 1,+ 1,+ WindowManager.LayoutParams.TYPE_ACCESSIBILITY_OVERLAY,+ WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE or+ WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL or+ WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH or+ WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN,+ PixelFormat.TRANSLUCENT,+ )+ params.gravity = Gravity.TOP or Gravity.START+ params.windowAnimations = 0+ windowManager.addView(watcher, params)+ touchWatcher = watcher+ }++ private fun removeTouchWatcher() {+ touchWatcher?.let {+ try {+ windowManager.removeView(it)+ } catch (_: Exception) {+ }+ }+ touchWatcher = null+ }++ /** The detect-pass progress animation, drawn over the live screen itself: a transparent+ * non-touchable window whose scan pills appear once the detector reports regions. */+ fun showScanOverlay(+ state: SelectionSurfaceState,+ region: Rect,+ ) {+ if (scanHost != null) return+ val host = WindowComposeHost(service)+ host.setContent {+ state.regions.value?.let {+ ScanAnimationOverlay(regions = it, modifier = Modifier.fillMaxSize())+ }+ }+ val params =+ WindowManager.LayoutParams(+ region.width(),+ region.height(),+ WindowManager.LayoutParams.TYPE_ACCESSIBILITY_OVERLAY,+ WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE or+ WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE or+ WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN,+ PixelFormat.TRANSLUCENT,+ )+ params.gravity = Gravity.TOP or Gravity.START+ params.x = region.left+ params.y = region.top+ params.spanFullDisplay()+ params.windowAnimations = 0+ windowManager.addView(host.view, params)+ scanHost = host+ }++ private fun removeScanOverlay() {+ scanHost?.let {+ try {+ windowManager.removeView(it.view)+ } catch (_: Exception) {+ }+ it.dispose()+ }+ scanHost = null+ }++ fun showOverlayMessage(message: String) {+ val textView = TextView(service)+ textView.text = message+ textView.setTextColor(Color.WHITE)+ textView.setTextSize(TypedValue.COMPLEX_UNIT_SP, 14f)+ val pad = dpToPx(16)+ textView.setPadding(pad, pad, pad, pad)+ val bg = GradientDrawable()+ bg.setColor(Color.parseColor("#DD333333"))+ bg.cornerRadius = dpToPx(8).toFloat()+ textView.background = bg++ val params =+ WindowManager.LayoutParams(+ WindowManager.LayoutParams.WRAP_CONTENT,+ WindowManager.LayoutParams.WRAP_CONTENT,+ WindowManager.LayoutParams.TYPE_ACCESSIBILITY_OVERLAY,+ WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE or WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE,+ PixelFormat.TRANSLUCENT,+ )+ params.gravity = Gravity.BOTTOM or Gravity.CENTER_HORIZONTAL+ params.y = dpToPx(80)++ windowManager.addView(textView, params)+ handler.postDelayed({+ try {+ windowManager.removeView(textView)+ } catch (_: Exception) {+ }+ }, 3000)+ }++ fun hasToolbar(): Boolean = toolbarView != null++ fun removeTranslationOverlays() {+ for (view in translationOverlays) {+ try {+ windowManager.removeView(view)+ } catch (_: Exception) {+ }+ }+ translationOverlays.clear()+ removeScanOverlay()+ removeTouchWatcher()+ }++ fun getStatusBarHeight(): Int = OverlayInsets.topInset(windowManager, service.resources)++ fun showBorderWave() {+ if (borderView != null) return+ val view = BorderWaveView.create(service)+ val params =+ WindowManager.LayoutParams(+ WindowManager.LayoutParams.MATCH_PARENT,+ WindowManager.LayoutParams.MATCH_PARENT,+ WindowManager.LayoutParams.TYPE_ACCESSIBILITY_OVERLAY,+ WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE or+ WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE or+ WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN,+ PixelFormat.TRANSLUCENT,+ )+ params.spanFullDisplay()+ windowManager.addView(view, params)+ borderView = view+ view.startAnimation()+ }++ fun removeBorderWave() {+ borderView?.stopAnimation()+ borderView?.let {+ try {+ windowManager.removeView(it)+ } catch (_: Exception) {+ }+ }+ borderView = null+ }++ fun cleanup() {+ handler.removeCallbacksAndMessages(null)+ launcherBubble?.remove()+ launcherBubble = null+ }++ internal fun dpToPx(dp: Int): Int = (dp * service.resources.displayMetrics.density).toInt()+}diff --git a/OCR-translation/src/main/java/dev/davidv/translator/accessibilityOverlay/TranslatorAccessibilityService.kt b/OCR-translation/src/main/java/dev/davidv/translator/accessibilityOverlay/TranslatorAccessibilityService.ktnew file mode 100644index 0000000..3f0db0e--- /dev/null+++ b/OCR-translation/src/main/java/dev/davidv/translator/accessibilityOverlay/TranslatorAccessibilityService.kt@@ -0,0 +1,459 @@+package dev.davidv.translator.accessibilityOverlay++import android.accessibilityservice.AccessibilityService+import android.content.BroadcastReceiver+import android.content.Context+import android.content.Intent+import android.content.IntentFilter+import android.graphics.Bitmap+import android.graphics.Rect+import android.os.Build+import android.util.Log+import android.view.Display+import android.view.WindowManager+import android.view.accessibility.AccessibilityEvent+import dev.davidv.translator.FilePathManager+import dev.davidv.translator.ImageProcessor+import dev.davidv.translator.Language+import dev.davidv.translator.LanguageDetector+import dev.davidv.translator.LanguageMetadataManager+import dev.davidv.translator.LanguageStateManager+import dev.davidv.translator.OverlayTextTranslationHelper+import dev.davidv.translator.R+import dev.davidv.translator.ReadingOrder+import dev.davidv.translator.SettingsManager+import dev.davidv.translator.SpeechService+import dev.davidv.translator.TranslationCoordinator+import dev.davidv.translator.TranslationService+import dev.davidv.translator.overlayChrome.OverlayInsets+import dev.davidv.translator.screenTranslate.ScreenTranslateService+import dev.davidv.translator.ui.components.DetectedRegions+import dev.davidv.translator.ui.components.ImageWordSelection+import dev.davidv.translator.ui.components.SelectionSurfaceState+import kotlinx.coroutines.CoroutineScope+import kotlinx.coroutines.Dispatchers+import kotlinx.coroutines.SupervisorJob+import kotlinx.coroutines.cancel+import kotlinx.coroutines.launch+import kotlinx.coroutines.withContext++class TranslatorAccessibilityService : AccessibilityService() {+ private val tag = "TranslatorA11y"+ private lateinit var windowManager: WindowManager+ private var active = false+ var forcedSourceLanguage: Language? = null+ var forcedTargetLanguage: Language? = null+ var isAutoSource: Boolean = true+ private val serviceScope = CoroutineScope(SupervisorJob() + Dispatchers.Main)++ private data class TranslatedScreen(+ val original: Bitmap,+ val translated: Bitmap,+ val words: ImageWordSelection,+ val region: Rect,+ )++ private var selectMode = false+ private var lastResult: TranslatedScreen? = null+ private val surfaceState = SelectionSurfaceState()++ private lateinit var settingsManager: SettingsManager+ private lateinit var imageProcessor: ImageProcessor+ private lateinit var translationCoordinator: TranslationCoordinator+ private var ocrReadingOrder: ReadingOrder? = null+ private lateinit var overlayTextTranslationHelper: OverlayTextTranslationHelper+ lateinit var langStateManager: LanguageStateManager+ private set++ lateinit var ui: OverlayUI+ private set++ private val disableReceiver =+ object : BroadcastReceiver() {+ override fun onReceive(+ context: Context?,+ intent: Intent?,+ ) {+ deactivate()+ disableSelf()+ }+ }++ // Hide the launcher bubble while live screen-translate runs so we don't stack+ // two bubbles; restore it when live stops (unless a still capture is active).+ private val liveStateReceiver =+ object : BroadcastReceiver() {+ override fun onReceive(+ context: Context?,+ intent: Intent?,+ ) {+ val live = intent?.getBooleanExtra(ScreenTranslateService.EXTRA_LIVE_ACTIVE, false) ?: false+ if (live) {+ ui.removeFloatingButton()+ } else if (!active) {+ ui.restoreFloatingButton()+ }+ }+ }++ companion object {+ const val ACTION_DISABLE = "dev.davidv.translator.DISABLE_ACCESSIBILITY"+ private const val SCREENSHOT_RENDER_DELAY_MS = 120L+ }++ override fun onServiceConnected() {+ super.onServiceConnected()+ Log.d(tag, "Service connected")+ windowManager = getSystemService(WINDOW_SERVICE) as WindowManager++ settingsManager = SettingsManager(this)+ val filePathManager = FilePathManager(this, settingsManager.settings)+ langStateManager = LanguageStateManager(serviceScope, filePathManager, null)+ val languageDetector = LanguageDetector(langStateManager::languageByCode)+ imageProcessor = ImageProcessor(this, filePathManager)++ serviceScope.launch {+ langStateManager.catalog.collect { catalog ->+ if (catalog == null) return@collect+ val translationService = TranslationService(settingsManager, filePathManager)+ val speechService = SpeechService(settingsManager, filePathManager)+ translationCoordinator = TranslationCoordinator(translationService, speechService, languageDetector, imageProcessor, settingsManager)+ val languagesFlow = kotlinx.coroutines.flow.MutableStateFlow(catalog.languageList)+ overlayTextTranslationHelper =+ OverlayTextTranslationHelper(+ langStateManager = langStateManager,+ languageMetadataManager = LanguageMetadataManager(this@TranslatorAccessibilityService, languagesFlow),+ )+ }+ }++ ui = OverlayUI(this, windowManager, settingsManager)++ androidx.core.content.ContextCompat.registerReceiver(+ this,+ disableReceiver,+ IntentFilter(ACTION_DISABLE),+ androidx.core.content.ContextCompat.RECEIVER_NOT_EXPORTED,+ )+ androidx.core.content.ContextCompat.registerReceiver(+ this,+ liveStateReceiver,+ IntentFilter(ScreenTranslateService.ACTION_LIVE_STATE),+ androidx.core.content.ContextCompat.RECEIVER_NOT_EXPORTED,+ )++ serviceInfo = serviceInfo.apply { eventTypes = 0 }++ ui.showFloatingButton()+ }++ // Scroll/click events from other packages mean the screen content actually changed, so the+ // stored capture is stale. The touch watcher's clear is visual-only (a touch-down on our own+ // toolbar also triggers it) and must not invalidate `lastResult` — select mode reuses it.+ override fun onAccessibilityEvent(event: AccessibilityEvent?) {+ if (event == null || event.packageName == packageName) return+ when (event.eventType) {+ AccessibilityEvent.TYPE_VIEW_SCROLLED,+ AccessibilityEvent.TYPE_VIEW_CLICKED,+ -> {+ lastResult = null+ ui.removeTranslationOverlays()+ }+ }+ }++ override fun onInterrupt() {+ Log.d(tag, "Service interrupted")+ }++ override fun onDestroy() {+ try {+ unregisterReceiver(disableReceiver)+ } catch (_: Exception) {+ }+ try {+ unregisterReceiver(liveStateReceiver)+ } catch (_: Exception) {+ }+ deactivate()+ ui.removeFloatingButton()+ ui.dismissMenu()+ ui.cleanup()+ serviceScope.cancel()+ super.onDestroy()+ }++ fun activate() {+ if (active) return+ active = true+ serviceInfo = serviceInfo.apply { eventTypes = liveEventTypes() }+ langStateManager.refreshLanguageAvailability()+ ui.removeFloatingButton()+ ui.removeTranslationOverlays()+ ui.showBorderWave()+ ui.showToolbar(forcedSourceLanguage, forcedTargetLanguage, currentReadingOrderFor(forcedSourceLanguage), isAutoSource)+ android.os.Handler(android.os.Looper.getMainLooper()).post {+ if (active) {+ handleFullScreenOcr()+ }+ }+ }++ fun deactivate() {+ active = false+ selectMode = false+ serviceInfo = serviceInfo.apply { eventTypes = 0 }+ ui.removeSelectSurface()+ surfaceState.clear()+ lastResult = null+ ui.removeBorderWave()+ ui.removeToolbar()+ ui.removeTranslationOverlays()+ ui.dismissMenu()+ ui.restoreFloatingButton()+ }++ fun toggleSelectMode() {+ if (selectMode) {+ exitSelectMode()+ return+ }+ selectMode = true+ serviceInfo = serviceInfo.apply { eventTypes = 0 }+ ui.setSelectModeUi(true)+ val res = lastResult+ if (res != null) {+ ui.removeTranslationOverlays()+ surfaceState.showResult(res.translated, res.original, res.words)+ ui.showSelectSurface(surfaceState, res.region) { onSelectSurfaceDismissed() }+ } else {+ handleFullScreenOcr()+ }+ }++ // The live overlay goes up before the frozen dialog comes down: later-added windows stack on+ // top, so the swap happens under an always-covered region instead of flashing the app through.+ private fun exitSelectMode() {+ selectMode = false+ if (active) {+ serviceInfo = serviceInfo.apply { eventTypes = liveEventTypes() }+ lastResult?.let { ui.showBitmapOverlay(it.translated, it.region) }+ }+ ui.removeSelectSurface()+ surfaceState.clear()+ ui.setSelectModeUi(false)+ }++ private fun liveEventTypes(): Int = AccessibilityEvent.TYPE_VIEW_SCROLLED or AccessibilityEvent.TYPE_VIEW_CLICKED++ private fun onSelectSurfaceDismissed() {+ if (selectMode) exitSelectMode()+ }++ fun toggleFlipOriginal() {+ if (!selectMode) return+ ui.setFlipActive(surfaceState.toggleShowOriginal())+ }++ fun swapLanguages() {+ val oldSource = forcedSourceLanguage ?: return+ val oldTarget = forcedTargetLanguage ?: langStateManager.languageByCode(settingsManager.settings.value.defaultTargetLanguageCode) ?: return+ if (!langStateManager.canSwapLanguages(oldSource, oldTarget)) return+ isAutoSource = false+ forcedSourceLanguage = oldTarget+ forcedTargetLanguage = oldSource+ syncReadingOrderForSource()+ ui.updateToolbarState(forcedSourceLanguage, forcedTargetLanguage, currentReadingOrderFor(forcedSourceLanguage), isAutoSource)+ if (active) {+ handleFullScreenOcr()+ }+ }++ fun showLanguagePicker(isSource: Boolean) {+ serviceScope.launch {+ langStateManager.refreshLanguageAvailability()+ val availableLangs = overlayTextTranslationHelper.awaitAvailableLanguages(isSource)+ ui.showLanguagePicker(isSource, availableLangs) { lang ->+ if (isSource) {+ if (lang == null) {+ isAutoSource = true+ } else {+ isAutoSource = false+ forcedSourceLanguage = lang+ }+ syncReadingOrderForSource()+ } else {+ forcedTargetLanguage = lang+ }+ ui.updateToolbarState(forcedSourceLanguage, forcedTargetLanguage, currentReadingOrderFor(forcedSourceLanguage), isAutoSource)+ if (active) {+ handleFullScreenOcr()+ }+ }+ }+ }++ fun toggleJapaneseOcrMode() {+ if (forcedSourceLanguage?.code != "ja") return+ ocrReadingOrder =+ when (ocrReadingOrder) {+ null -> ReadingOrder.TOP_TO_BOTTOM_RIGHT_TO_LEFT+ ReadingOrder.TOP_TO_BOTTOM_RIGHT_TO_LEFT -> ReadingOrder.LEFT_TO_RIGHT+ ReadingOrder.LEFT_TO_RIGHT -> null+ }+ ui.updateToolbarState(forcedSourceLanguage, forcedTargetLanguage, ocrReadingOrder, isAutoSource)+ if (active) {+ handleFullScreenOcr()+ }+ }++ fun showDotsMenu() {+ ui.showDotsMenu()+ }++ fun handleFullScreenOcr() {+ if (Build.VERSION.SDK_INT < Build.VERSION_CODES.R) return++ // In select mode the frozen surface covers the screen, so a fresh screenshot would capture+ // ourselves — retranslate the stored capture instead (language/reading-order changes).+ val res = lastResult+ if (selectMode && ui.hasSelectSurface() && res != null) {+ surfaceState.showProcessing(res.original)+ serviceScope.launch {+ translateRegionBitmap(res.original, res.region)+ }+ return+ }+ ui.removeTranslationOverlays()++ val sourceLang = ocrSourceLanguage()+ if (!isAutoSource && sourceLang == null) {+ ui.showOverlayMessage("Set source language first")+ return+ }++ val content = OverlayInsets.contentBounds(windowManager)+ val region =+ Rect(+ content.left,+ content.top + ui.dpToPx(48),+ content.right,+ content.bottom,+ )++ // Let any open picker/menu finish dismissing before grabbing the screen,+ // otherwise the popup lands in the screenshot.+ ui.dismissMenu()+ android.os.Handler(android.os.Looper.getMainLooper()).postDelayed({+ captureFullScreen(region)+ }, SCREENSHOT_RENDER_DELAY_MS)+ }++ private fun captureFullScreen(region: Rect) {+ takeScreenshot(+ Display.DEFAULT_DISPLAY,+ mainExecutor,+ object : TakeScreenshotCallback {+ override fun onSuccess(screenshot: ScreenshotResult) {+ val hwBitmap = Bitmap.wrapHardwareBuffer(screenshot.hardwareBuffer, screenshot.colorSpace)+ screenshot.hardwareBuffer.close()+ if (hwBitmap == null) return+ val fullBitmap = hwBitmap.copy(Bitmap.Config.ARGB_8888, false)+ hwBitmap.recycle()++ val cropLeft = region.left.coerceIn(0, fullBitmap.width - 1)+ val cropTop = region.top.coerceIn(0, fullBitmap.height - 1)+ val cropWidth = region.width().coerceAtMost(fullBitmap.width - cropLeft)+ val cropHeight = region.height().coerceAtMost(fullBitmap.height - cropTop)+ if (cropWidth <= 0 || cropHeight <= 0) {+ fullBitmap.recycle()+ return+ }++ val croppedBitmap = Bitmap.createBitmap(fullBitmap, cropLeft, cropTop, cropWidth, cropHeight)+ fullBitmap.recycle()++ surfaceState.regions.value = null+ ui.showScanOverlay(surfaceState, region)+ serviceScope.launch {+ translateRegionBitmap(croppedBitmap, region)+ }+ }++ override fun onFailure(errorCode: Int) {+ Log.w(tag, "Screenshot failed: $errorCode")+ }+ },+ )+ }++ private suspend fun translateRegionBitmap(+ bitmap: Bitmap,+ region: Rect,+ ) {+ val sourceLang = ocrSourceLanguage()+ val targetLang = forcedTargetLanguage ?: langStateManager.languageByCode(settingsManager.settings.value.defaultTargetLanguageCode) ?: return+ val ocrSourceLang = sourceLang ?: targetLang++ var ocrUnavailable = false+ val result =+ withContext(Dispatchers.IO) {+ translationCoordinator.translateImageWithOverlay(+ ocrSourceLang,+ targetLang,+ bitmap,+ onMessage = {},+ readingOrder = currentReadingOrderFor(sourceLang),+ isAutoSource = isAutoSource,+ onOcrUnavailable = { ocrUnavailable = true },+ onDetectedRegions = { boxes, w, h ->+ surfaceState.regions.value = DetectedRegions(w, h, boxes)+ },+ )+ }++ ui.removeTranslationOverlays()+ if (result == null) {+ if (selectMode) surfaceState.processing.value = false+ if (ocrUnavailable) {+ ui.showOverlayMessage(getString(R.string.ocr_models_missing))+ }+ return+ }++ val words =+ ImageWordSelection(+ imageWidth = result.metadata.width.toInt(),+ imageHeight = result.metadata.height.toInt(),+ sourceWords = result.metadata.sourceWords,+ translatedWords = result.translatedWords,+ )+ lastResult = TranslatedScreen(original = bitmap, translated = result.correctedBitmap, words = words, region = region)+ if (selectMode) {+ surfaceState.showResult(result.correctedBitmap, bitmap, words)+ if (!ui.hasSelectSurface()) {+ ui.showSelectSurface(surfaceState, region) { onSelectSurfaceDismissed() }+ }+ } else {+ ui.showBitmapOverlay(result.correctedBitmap, region)+ }+ }++ private fun ocrSourceLanguage(): Language? =+ forcedSourceLanguage ?: settingsManager.settings.value.defaultSourceLanguageCode?.let {+ langStateManager.languageByCode(it)+ }++ private fun currentReadingOrderFor(language: Language?): ReadingOrder? =+ if (language?.code == "ja") {+ ocrReadingOrder+ } else {+ null+ }++ private fun syncReadingOrderForSource() {+ if (forcedSourceLanguage?.code != "ja") {+ ocrReadingOrder = null+ }+ }+}diff --git a/OCR-translation/src/main/java/dev/davidv/translator/adblock/AdblockManager.kt b/OCR-translation/src/main/java/dev/davidv/translator/adblock/AdblockManager.ktnew file mode 100644index 0000000..8eedf91--- /dev/null+++ b/OCR-translation/src/main/java/dev/davidv/translator/adblock/AdblockManager.kt@@ -0,0 +1,168 @@+/*+ * Copyright (C) 2024 David V+ *+ * This program 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.+ *+ * This program 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 <https://www.gnu.org/licenses/>.+ */++package dev.davidv.translator.adblock++import android.util.Log+import dev.davidv.translator.FilePathManager+import kotlinx.coroutines.CoroutineScope+import kotlinx.coroutines.Dispatchers+import kotlinx.coroutines.SupervisorJob+import kotlinx.coroutines.flow.MutableStateFlow+import kotlinx.coroutines.flow.StateFlow+import kotlinx.coroutines.flow.asStateFlow+import kotlinx.coroutines.launch+import kotlinx.coroutines.withContext+import uniffi.bindings.AdblockCosmetic+import uniffi.bindings.AdblockEngine+import uniffi.bindings.AdblockRequestType+import uniffi.bindings.AdblockVerdict+import java.io.File++class AdblockManager(+ private val filePathManager: FilePathManager,+) {+ companion object {+ private const val TAG = "AdblockManager"+ private const val CACHE_FILE = "engine.bin"+ }++ private val scope = CoroutineScope(SupervisorJob() + Dispatchers.IO)++ @Volatile+ private var engine: AdblockEngine? = null++ private val _ready = MutableStateFlow(false)+ val ready: StateFlow<Boolean> = _ready.asStateFlow()++ init {+ scope.launch { tryLoad() }+ }++ fun reload() {+ scope.launch {+ clearEngineCache()+ tryLoad()+ }+ }++ private fun clearEngineCache() {+ val cacheFile = File(filePathManager.getAdblockDir(), CACHE_FILE)+ if (cacheFile.exists()) cacheFile.delete()+ }++ private suspend fun tryLoad() =+ withContext(Dispatchers.IO) {+ val dir = filePathManager.getAdblockDir()+ val cacheFile = File(dir, CACHE_FILE)+ val ruleFiles = listRuleFiles(dir)+ Log.i(+ TAG,+ "adblock dir=${dir.absolutePath} engine.exists=${cacheFile.exists()} rules=${ruleFiles.map { it.name }}",+ )++ val loaded =+ loadFromCache(cacheFile)+ ?: loadFromRules(ruleFiles, cacheFile)++ if (loaded != null) {+ engine = loaded+ _ready.value = true+ Log.i(TAG, "adblock engine loaded")+ } else {+ engine = null+ _ready.value = false+ Log.i(TAG, "no adblock rules in ${dir.absolutePath}; pass-through")+ }+ }++ private fun listRuleFiles(dir: File): List<File> =+ dir.listFiles { f -> f.isFile && f.name.endsWith(".txt") }?.sortedBy { it.name } ?: emptyList()++ private fun loadFromCache(cacheFile: File): AdblockEngine? {+ if (!cacheFile.exists()) return null+ return try {+ val t0 = System.currentTimeMillis()+ val bytes = cacheFile.readBytes()+ val readMs = System.currentTimeMillis() - t0+ val t1 = System.currentTimeMillis()+ val eng = AdblockEngine.deserialize(bytes)+ val deserMs = System.currentTimeMillis() - t1+ Log.i(TAG, "cache load: ${bytes.size} bytes read ${readMs}ms, deserialize ${deserMs}ms")+ eng+ } catch (t: Throwable) {+ Log.w(TAG, "cache load failed; will re-parse rules", t)+ cacheFile.delete()+ null+ }+ }++ private fun loadFromRules(+ ruleFiles: List<File>,+ cacheFile: File,+ ): AdblockEngine? {+ if (ruleFiles.isEmpty()) return null+ return try {+ val tRead = System.currentTimeMillis()+ val text =+ buildString {+ for (file in ruleFiles) {+ append(file.readText())+ if (!endsWith('\n')) append('\n')+ }+ }+ val readMs = System.currentTimeMillis() - tRead+ val ruleCount = text.count { it == '\n' }+ val tParse = System.currentTimeMillis()+ val eng = AdblockEngine.fromRules(text)+ val parseMs = System.currentTimeMillis() - tParse+ val tSer = System.currentTimeMillis()+ val serialized =+ runCatching {+ val bytes = eng.serialize()+ cacheFile.parentFile?.mkdirs()+ cacheFile.writeBytes(bytes)+ bytes.size+ }.onFailure { Log.w(TAG, "engine cache write failed", it) }+ .getOrDefault(-1)+ val serMs = System.currentTimeMillis() - tSer+ Log.i(+ TAG,+ "rule parse: ${ruleFiles.size} files, ~$ruleCount lines, read ${readMs}ms, " ++ "compile ${parseMs}ms, serialize+write ${serMs}ms (cache=${serialized}B)",+ )+ eng+ } catch (t: Throwable) {+ Log.w(TAG, "rule parse failed", t)+ null+ }+ }++ fun checkRequest(+ url: String,+ sourceUrl: String,+ requestType: AdblockRequestType,+ ): AdblockVerdict? = engine?.checkRequest(url, sourceUrl, requestType)++ fun cosmeticResources(url: String): AdblockCosmetic? = engine?.cosmeticResources(url)++ fun hiddenClassIdSelectors(+ classes: List<String>,+ ids: List<String>,+ exceptions: List<String>,+ ): List<String> = engine?.hiddenClassIdSelectors(classes, ids, exceptions) ?: emptyList()+}diff --git a/OCR-translation/src/main/java/dev/davidv/translator/adblock/RequestTypeMapper.kt b/OCR-translation/src/main/java/dev/davidv/translator/adblock/RequestTypeMapper.ktnew file mode 100644index 0000000..cafe12e--- /dev/null+++ b/OCR-translation/src/main/java/dev/davidv/translator/adblock/RequestTypeMapper.kt@@ -0,0 +1,84 @@+/*+ * Copyright (C) 2024 David V+ *+ * This program 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.+ *+ * This program 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 <https://www.gnu.org/licenses/>.+ */++package dev.davidv.translator.adblock++import android.webkit.WebResourceRequest+import uniffi.bindings.AdblockRequestType++private val IMAGE_EXTS = setOf("png", "jpg", "jpeg", "gif", "webp", "svg", "ico", "bmp", "avif")+private val FONT_EXTS = setOf("woff", "woff2", "ttf", "otf", "eot")+private val MEDIA_EXTS = setOf("mp4", "webm", "mp3", "ogg", "wav", "m4a", "m4v", "mov", "flac")++fun mapRequestType(request: WebResourceRequest): AdblockRequestType {+ if (request.isForMainFrame) return AdblockRequestType.DOCUMENT++ val headers = caseInsensitive(request.requestHeaders)+ val accept = headers["accept"]?.lowercase() ?: ""+ val secFetchDest = headers["sec-fetch-dest"]?.lowercase()+ val xRequestedWith = headers["x-requested-with"]++ if (xRequestedWith == "XMLHttpRequest") return AdblockRequestType.XHR++ when (secFetchDest) {+ "document" -> return AdblockRequestType.DOCUMENT+ "iframe", "frame" -> return AdblockRequestType.SUBDOCUMENT+ "script" -> return AdblockRequestType.SCRIPT+ "style" -> return AdblockRequestType.STYLESHEET+ "image" -> return AdblockRequestType.IMAGE+ "font" -> return AdblockRequestType.FONT+ "video", "audio", "track" -> return AdblockRequestType.MEDIA+ "object", "embed" -> return AdblockRequestType.OBJECT+ "manifest" -> return AdblockRequestType.OTHER+ "empty" -> return AdblockRequestType.FETCH+ "report" -> return AdblockRequestType.PING+ }++ if (accept.contains("text/css")) return AdblockRequestType.STYLESHEET+ if (accept.contains("javascript")) return AdblockRequestType.SCRIPT+ if (accept.contains("image/")) return AdblockRequestType.IMAGE+ if (accept.contains("font/")) return AdblockRequestType.FONT++ val ext = extensionOf(request.url.toString())+ return when {+ ext == "css" -> AdblockRequestType.STYLESHEET+ ext == "js" || ext == "mjs" -> AdblockRequestType.SCRIPT+ ext in IMAGE_EXTS -> AdblockRequestType.IMAGE+ ext in FONT_EXTS -> AdblockRequestType.FONT+ ext in MEDIA_EXTS -> AdblockRequestType.MEDIA+ else -> AdblockRequestType.OTHER+ }+}++private fun caseInsensitive(headers: Map<String, String>?): Map<String, String> {+ if (headers.isNullOrEmpty()) return emptyMap()+ val out = HashMap<String, String>(headers.size)+ for ((k, v) in headers) out[k.lowercase()] = v+ return out+}++fun refererOf(request: WebResourceRequest): String? = caseInsensitive(request.requestHeaders)["referer"]++private fun extensionOf(url: String): String? {+ val q = url.indexOfAny(charArrayOf('?', '#')).let { if (it < 0) url.length else it }+ val path = url.substring(0, q)+ val slash = path.lastIndexOf('/')+ val name = if (slash >= 0) path.substring(slash + 1) else path+ val dot = name.lastIndexOf('.')+ if (dot < 0 || dot == name.length - 1) return null+ return name.substring(dot + 1).lowercase()+}diff --git a/OCR-translation/src/main/java/dev/davidv/translator/assistantOverlay/BorderWaveView.kt b/OCR-translation/src/main/java/dev/davidv/translator/assistantOverlay/BorderWaveView.ktnew file mode 100644index 0000000..a0d9146--- /dev/null+++ b/OCR-translation/src/main/java/dev/davidv/translator/assistantOverlay/BorderWaveView.kt@@ -0,0 +1,77 @@+package dev.davidv.translator.assistantOverlay++import android.content.Context+import android.graphics.Color+import android.graphics.drawable.GradientDrawable+import android.view.Gravity+import android.view.View+import android.widget.FrameLayout++class BorderWaveView private constructor(+ context: Context,+ private val borderColor: Int,+ private val gradientWidthPx: Int,+) : FrameLayout(context) {+ companion object {+ private const val COLOR = "#E08050"+ private const val GRADIENT_DP = 6++ fun create(context: Context): BorderWaveView {+ val density = context.resources.displayMetrics.density+ return BorderWaveView(context, Color.parseColor(COLOR), (GRADIENT_DP * density).toInt().coerceAtLeast(1))+ }+ }++ private val topEdge = View(context)+ private val rightEdge = View(context)+ private val bottomEdge = View(context)+ private val leftEdge = View(context)++ init {+ setWillNotDraw(true)+ clipChildren = false+ clipToPadding = false++ addView(+ topEdge,+ LayoutParams(LayoutParams.MATCH_PARENT, gradientWidthPx, Gravity.TOP),+ )+ addView(+ rightEdge,+ LayoutParams(gradientWidthPx, LayoutParams.MATCH_PARENT, Gravity.END),+ )+ addView(+ bottomEdge,+ LayoutParams(LayoutParams.MATCH_PARENT, gradientWidthPx, Gravity.BOTTOM),+ )+ addView(+ leftEdge,+ LayoutParams(gradientWidthPx, LayoutParams.MATCH_PARENT, Gravity.START),+ )++ topEdge.background = edgeDrawable(GradientDrawable.Orientation.TOP_BOTTOM)+ rightEdge.background = edgeDrawable(GradientDrawable.Orientation.RIGHT_LEFT)+ bottomEdge.background = edgeDrawable(GradientDrawable.Orientation.BOTTOM_TOP)+ leftEdge.background = edgeDrawable(GradientDrawable.Orientation.LEFT_RIGHT)++ visibility = GONE+ }++ fun startAnimation() {+ visibility = VISIBLE+ }++ fun stopAnimation() {+ visibility = GONE+ }++ private fun edgeDrawable(orientation: GradientDrawable.Orientation): GradientDrawable =+ GradientDrawable(+ orientation,+ intArrayOf(withAlpha(255), withAlpha(0)),+ ).apply {+ shape = GradientDrawable.RECTANGLE+ }++ private fun withAlpha(alpha: Int): Int = (borderColor and 0x00FFFFFF) or (alpha shl 24)+}diff --git a/OCR-translation/src/main/java/dev/davidv/translator/assistantOverlay/TranslatorRecognitionService.kt b/OCR-translation/src/main/java/dev/davidv/translator/assistantOverlay/TranslatorRecognitionService.ktnew file mode 100644index 0000000..089cfce--- /dev/null+++ b/OCR-translation/src/main/java/dev/davidv/translator/assistantOverlay/TranslatorRecognitionService.kt@@ -0,0 +1,21 @@+package dev.davidv.translator.assistantOverlay++import android.content.Intent+import android.speech.RecognitionService+import android.speech.SpeechRecognizer++class TranslatorRecognitionService : RecognitionService() {+ override fun onStartListening(+ recognizerIntent: Intent,+ listener: Callback,+ ) {+ listener.error(SpeechRecognizer.ERROR_CLIENT)+ }++ override fun onStopListening(listener: Callback) {+ listener.error(SpeechRecognizer.ERROR_CLIENT)+ }++ override fun onCancel(listener: Callback) {+ }+}diff --git a/OCR-translation/src/main/java/dev/davidv/translator/assistantOverlay/TranslatorVoiceInteractionService.kt b/OCR-translation/src/main/java/dev/davidv/translator/assistantOverlay/TranslatorVoiceInteractionService.ktnew file mode 100644index 0000000..5558cfe--- /dev/null+++ b/OCR-translation/src/main/java/dev/davidv/translator/assistantOverlay/TranslatorVoiceInteractionService.kt@@ -0,0 +1,30 @@+package dev.davidv.translator.assistantOverlay++import android.os.Bundle+import android.service.voice.VoiceInteractionService+import android.service.voice.VoiceInteractionSession+import android.util.Log++class TranslatorVoiceInteractionService : VoiceInteractionService() {+ private val tag = "TranslatorAssistant"++ override fun onReady() {+ super.onReady()+ Log.d(tag, "VoiceInteractionService ready")+ }++ override fun onPrepareToShowSession(+ args: Bundle,+ flags: Int,+ ) {+ super.onPrepareToShowSession(args, flags)+ Log.d(tag, "Preparing session with flags=$flags")+ }++ override fun onLaunchVoiceAssistFromKeyguard() {+ showSession(+ Bundle(),+ VoiceInteractionSession.SHOW_WITH_ASSIST or VoiceInteractionSession.SHOW_WITH_SCREENSHOT,+ )+ }+}diff --git a/OCR-translation/src/main/java/dev/davidv/translator/assistantOverlay/TranslatorVoiceInteractionSession.kt b/OCR-translation/src/main/java/dev/davidv/translator/assistantOverlay/TranslatorVoiceInteractionSession.ktnew file mode 100644index 0000000..50449f0--- /dev/null+++ b/OCR-translation/src/main/java/dev/davidv/translator/assistantOverlay/TranslatorVoiceInteractionSession.kt@@ -0,0 +1,727 @@+package dev.davidv.translator.assistantOverlay++import android.content.Context+import android.content.Intent+import android.graphics.Bitmap+import android.graphics.Color+import android.graphics.Rect+import android.graphics.drawable.GradientDrawable+import android.os.Bundle+import android.provider.Settings+import android.service.voice.VoiceInteractionSession+import android.util.Log+import android.util.TypedValue+import android.view.Gravity+import android.view.View+import android.view.WindowManager+import android.widget.FrameLayout+import android.widget.ImageView+import android.widget.TextView+import androidx.core.view.WindowInsetsCompat+import dev.davidv.translator.Language+import dev.davidv.translator.LanguageStateManager+import dev.davidv.translator.MainActivity+import dev.davidv.translator.OverlayTextTranslationHelper+import dev.davidv.translator.R+import dev.davidv.translator.ReadingOrder+import dev.davidv.translator.SettingsManager+import dev.davidv.translator.TranslationCoordinator+import dev.davidv.translator.overlayChrome.OverlayChromeFactory+import dev.davidv.translator.overlayChrome.OverlayInsets+import dev.davidv.translator.overlayChrome.OverlayMenuHost+import dev.davidv.translator.overlayChrome.OverlayMenuManager+import dev.davidv.translator.overlayChrome.spanFullDisplay+import dev.davidv.translator.screenTranslate.ScreenCaptureRequestActivity+import dev.davidv.translator.ui.components.DetectedRegions+import dev.davidv.translator.ui.components.ImageWordSelection+import dev.davidv.translator.ui.components.SelectionSurface+import dev.davidv.translator.ui.components.SelectionSurfaceState+import dev.davidv.translator.ui.components.WindowComposeHost+import kotlinx.coroutines.CoroutineScope+import kotlinx.coroutines.Dispatchers+import kotlinx.coroutines.Job+import kotlinx.coroutines.SupervisorJob+import kotlinx.coroutines.cancel+import kotlinx.coroutines.delay+import kotlinx.coroutines.ensureActive+import kotlinx.coroutines.launch+import kotlinx.coroutines.withContext+import androidx.core.graphics.Insets as ContentInsets++class TranslatorVoiceInteractionSession(+ context: Context,+ private val settingsManager: SettingsManager,+ private val translationCoordinator: TranslationCoordinator,+ private val overlayTextTranslationHelper: OverlayTextTranslationHelper,+ private val langStateManager: LanguageStateManager,+) : VoiceInteractionSession(context) {+ companion object {+ private const val ASSIST_SCREENSHOT_ENABLED_SETTING = "assist_screenshot_enabled"+ private const val CAPTURE_TIMEOUT_MS = 1500L+ }++ private val tag = "TranslatorAssistant"+ private val sessionScope = CoroutineScope(SupervisorJob() + Dispatchers.Main)++ private lateinit var rootView: FrameLayout+ private lateinit var screenshotView: ImageView+ private lateinit var overlayContainer: FrameLayout+ private lateinit var statusView: TextView+ private lateinit var topBarView: View+ private var sourceLabelView: TextView? = null+ private var targetLabelView: TextView? = null+ private var readingOrderButtonView: View? = null+ private var readingOrderIconView: ImageView? = null+ private var flipIconView: ImageView? = null+ private var flipButtonView: View? = null+ private var menuManager: OverlayMenuManager? = null+ private var contentInsets = ContentInsets.NONE++ private var pendingScreenshot: Bitmap? = null+ private var screenshotBitmap: Bitmap? = null+ private var croppedBitmap: Bitmap? = null+ private var processing = false+ private var translationJob: Job? = null+ private var captureTimeoutJob: Job? = null+ private var statusHideJob: Job? = null+ private var forcedSourceLanguage: Language? = null+ private var isAutoSource: Boolean = true+ private var forcedTargetLanguage: Language? = null+ private var ocrReadingOrder: ReadingOrder? = null++ // The interactive image surface, hosted in a ComposeView over the screenshot backdrop: it shows+ // the screenshot with the scan animation while OCR runs, then the translated image with the+ // word-selection overlay. An empty state keeps the layer hidden/pass-through.+ private val surfaceState = SelectionSurfaceState()+ private var resultHost: WindowComposeHost? = null++ override fun onCreate() {+ super.onCreate()+ configureSessionWindow()+ langStateManager.refreshLanguageAvailability()+ }++ override fun onCreateContentView(): View {+ rootView = FrameLayout(context)+ rootView.setBackgroundColor(Color.TRANSPARENT)+ // The screenshot backdrop replaces the whole screen, so the toolbar lives in+ // the status-bar strip — but it still has to clear a display cutout.+ rootView.setOnApplyWindowInsetsListener { _, insets ->+ val current =+ WindowInsetsCompat+ .toWindowInsetsCompat(insets, rootView)+ .getInsets(WindowInsetsCompat.Type.systemBars() or WindowInsetsCompat.Type.displayCutout())+ if (current != contentInsets) {+ contentInsets = current+ applyContentGeometry()+ consumePendingScreenshot()+ }+ insets+ }+ rootView.addOnLayoutChangeListener { _, _, _, _, _, _, _, _, _ ->+ applyContentGeometry()+ consumePendingScreenshot()+ }+ menuManager =+ OverlayMenuManager(+ context,+ ::dpToPx,+ object : OverlayMenuHost {+ override fun addDismissLayer(view: View) {+ rootView.addView(+ view,+ FrameLayout.LayoutParams(+ FrameLayout.LayoutParams.MATCH_PARENT,+ FrameLayout.LayoutParams.MATCH_PARENT,+ ),+ )+ }++ override fun addMenuView(view: View) {+ rootView.addView(+ view,+ FrameLayout+ .LayoutParams(+ dpToPx(180),+ FrameLayout.LayoutParams.WRAP_CONTENT,+ ).apply {+ gravity = Gravity.TOP or Gravity.END+ topMargin = contentInsets.top + dpToPx(48)+ marginEnd = contentInsets.right + dpToPx(8)+ },+ )+ }++ override fun addPickerView(view: View) {+ rootView.addView(+ view,+ FrameLayout+ .LayoutParams(+ dpToPx(250),+ dpToPx(400),+ ).apply { gravity = Gravity.CENTER },+ )+ }++ override fun removeMenuChild(view: View) {+ rootView.removeView(view)+ }+ },+ )++ screenshotView =+ ImageView(context).apply {+ scaleType = ImageView.ScaleType.FIT_XY+ setBackgroundColor(Color.TRANSPARENT)+ }+ rootView.addView(+ screenshotView,+ FrameLayout.LayoutParams(+ FrameLayout.LayoutParams.MATCH_PARENT,+ FrameLayout.LayoutParams.MATCH_PARENT,+ ),+ )++ overlayContainer = FrameLayout(context)+ rootView.addView(+ overlayContainer,+ FrameLayout.LayoutParams(+ FrameLayout.LayoutParams.MATCH_PARENT,+ FrameLayout.LayoutParams.MATCH_PARENT,+ ),+ )++ // Interactive image layer: the scan animation while OCR runs, then the translated image with+ // word selection. Stays transparent (pass-through) until there's something to show.+ resultHost =+ WindowComposeHost(context).apply {+ view.visibility = View.GONE+ setContent {+ SelectionSurface(surfaceState)+ }+ }+ rootView.addView(+ resultHost!!.view,+ FrameLayout.LayoutParams(+ FrameLayout.LayoutParams.MATCH_PARENT,+ FrameLayout.LayoutParams.MATCH_PARENT,+ ),+ )++ topBarView = buildTopBar()+ rootView.addView(+ topBarView,+ FrameLayout+ .LayoutParams(+ FrameLayout.LayoutParams.MATCH_PARENT,+ FrameLayout.LayoutParams.WRAP_CONTENT,+ ).apply {+ gravity = Gravity.TOP or Gravity.START+ topMargin = contentInsets.top+ leftMargin = contentInsets.left+ rightMargin = contentInsets.right+ },+ )++ statusView =+ TextView(context).apply {+ setTextColor(Color.WHITE)+ setTextSize(TypedValue.COMPLEX_UNIT_SP, 14f)+ gravity = Gravity.CENTER+ setPadding(dpToPx(20), dpToPx(12), dpToPx(20), dpToPx(12))+ background =+ GradientDrawable().apply {+ shape = GradientDrawable.RECTANGLE+ cornerRadius = dpToPx(12).toFloat()+ setColor(Color.parseColor("#CC202020"))+ }+ }+ val statusParams =+ FrameLayout+ .LayoutParams(+ FrameLayout.LayoutParams.WRAP_CONTENT,+ FrameLayout.LayoutParams.WRAP_CONTENT,+ ).apply {+ gravity = Gravity.BOTTOM or Gravity.CENTER_HORIZONTAL+ bottomMargin = contentInsets.bottom + dpToPx(24)+ }+ rootView.addView(statusView, statusParams)++ resultHost!!.installOn(rootView)++ showStatus(context.getString(R.string.assistant_invoke_prompt))+ updateBackdrop()+ return rootView+ }++ override fun onShow(+ args: Bundle?,+ showFlags: Int,+ ) {+ super.onShow(args, showFlags)+ configureSessionWindow()+ clearCapture()+ overlayContainer.removeAllViews()+ dismissMenu()+ updateBackdrop()++ if (settingsManager.settings.value.assistantAction == dev.davidv.translator.AssistantAction.LIVE_SCREEN) {+ launchLiveScreen()+ return+ }++ showStatus(context.getString(R.string.assistant_collecting_context))++ if (!isAssistScreenshotEnabled()) {+ Log.w(tag, "Assistant screenshot capture is disabled in system settings")+ showStatus(context.getString(R.string.assistant_screenshot_disabled))+ return+ }++ captureTimeoutJob =+ sessionScope.launch {+ delay(CAPTURE_TIMEOUT_MS)+ if (screenshotBitmap == null && !processing) {+ showStatus(context.getString(R.string.assistant_no_screen_data))+ }+ }+ }++ override fun onComputeInsets(outInsets: Insets) {+ outInsets.contentInsets.set(0, 0, 0, 0)+ outInsets.touchableInsets = Insets.TOUCHABLE_INSETS_FRAME+ }++ override fun onHide() {+ super.onHide()+ clearCapture()+ clearResultOverlay()+ overlayContainer.removeAllViews()+ dismissMenu()+ screenshotView.setImageDrawable(null)+ updateBackdrop()+ }++ override fun onDestroy() {+ sessionScope.cancel()+ clearCapture()+ clearResultOverlay()+ resultHost?.dispose()+ resultHost = null+ super.onDestroy()+ }++ /** Drop the interactive image layer and recycle the flip's original-image copy. */+ private fun clearResultOverlay() {+ surfaceState.original.value?.recycle()+ surfaceState.clear()+ setFlipButtonVisible(false)+ flipIconView?.setColorFilter(Color.WHITE)+ resultHost?.view?.visibility = View.GONE+ }++ override fun onHandleScreenshot(screenshot: Bitmap?) {+ super.onHandleScreenshot(screenshot)+ // In live mode onShow already handed off to the projection flow; the system+ // still delivers the screenshot (we asked for it), but we must not run the+ // still OCR or it would override the live action.+ if (settingsManager.settings.value.assistantAction == dev.davidv.translator.AssistantAction.LIVE_SCREEN) return+ captureTimeoutJob?.cancel()+ captureTimeoutJob = null+ Log.d(tag, "Screenshot callback received bitmap=${screenshot?.width}x${screenshot?.height}")+ if (screenshot == null) {+ showStatus(context.getString(R.string.assistant_no_screenshot))+ return+ }+ // The capture can beat the window's first traversal, and until that has happened the insets+ // this crop needs have not been delivered. Park the frame and let layout drive it instead.+ pendingScreenshot?.recycle()+ pendingScreenshot = screenshot.copy(Bitmap.Config.ARGB_8888, false)+ consumePendingScreenshot()+ }++ private fun consumePendingScreenshot() {+ val full = pendingScreenshot ?: return+ if (rootView.width == 0 || rootView.height == 0) return+ pendingScreenshot = null++ val crop = contentCrop(full.width, full.height)+ val cropped =+ if (crop.left == 0 && crop.top == 0 && crop.width() == full.width && crop.height() == full.height) {+ full+ } else {+ Bitmap.createBitmap(full, crop.left, crop.top, crop.width(), crop.height()).also { full.recycle() }+ }++ val oldSs = screenshotBitmap+ val oldCr = croppedBitmap+ oldSs?.recycle()+ if (oldCr != null && oldCr !== oldSs) oldCr.recycle()+ // `screenshotBitmap` is the cropped, lockable source of truth (reused by retranslate);+ // `croppedBitmap` is the currently-displayed bitmap (this source during the scan, then the+ // translated result), so they start as the same object.+ screenshotBitmap = cropped+ croppedBitmap = cropped+ screenshotView.setImageBitmap(croppedBitmap)+ updateBackdrop()+ runFullScreenOcr()+ }++ private fun runFullScreenOcr() {+ val screenshot = screenshotBitmap ?: return+ overlayContainer.removeAllViews()+ hideStatus()+ val sourceLanguage = ocrSourceLanguage()+ if (!isAutoSource && sourceLanguage == null) {+ processing = false+ showStatus(context.getString(R.string.assistant_set_source_ocr))+ return+ }++ val targetLanguage = forcedTargetLanguage ?: langStateManager.languageByCode(settingsManager.settings.value.defaultTargetLanguageCode)+ if (targetLanguage == null) {+ processing = false+ showStatus(context.getString(R.string.assistant_langs_not_ready))+ return+ }+ val ocrSourceLanguage = sourceLanguage ?: targetLanguage+ // `screenshot` is already the cropped software source; copy it so the A/B original survives+ // independently of `croppedBitmap` (which gets reassigned to the translated result).+ val workingBitmap = screenshot.copy(Bitmap.Config.ARGB_8888, false)++ // Show the screenshot with the scan animation while OCR/translation run; the detection callback+ // fills in the regions the scan sweeps over, then the result swaps in the translated image with+ // the word-selection overlay. `workingBitmap` doubles as the flip's original and is not recycled+ // by the pipeline, so it stays alive until the next clear.+ clearResultOverlay()+ processing = true+ surfaceState.showProcessing(workingBitmap)+ resultHost?.view?.visibility = View.VISIBLE++ translationJob =+ sessionScope.launch {+ var ocrUnavailable = false+ val result =+ withContext(Dispatchers.IO) {+ translationCoordinator.translateImageWithOverlay(+ ocrSourceLanguage,+ targetLanguage,+ workingBitmap,+ onMessage = {},+ readingOrder = currentReadingOrderFor(sourceLanguage),+ isAutoSource = isAutoSource,+ onOcrUnavailable = { ocrUnavailable = true },+ onDetectedRegions = { boxes, w, h ->+ surfaceState.regions.value = DetectedRegions(w, h, boxes)+ },+ )+ }+ ensureActive()+ processing = false+ if (result == null) {+ val statusRes = if (ocrUnavailable) R.string.ocr_models_missing else R.string.assistant_ocr_failed+ showStatus(context.getString(statusRes))+ clearResultOverlay()+ return@launch+ }+ val display = result.correctedBitmap+ val oldCropped = croppedBitmap+ if (oldCropped != null && oldCropped !== screenshotBitmap) oldCropped.recycle()+ croppedBitmap = display+ screenshotView.setImageBitmap(croppedBitmap)+ val selection =+ ImageWordSelection(+ imageWidth = result.metadata.width.toInt(),+ imageHeight = result.metadata.height.toInt(),+ sourceWords = result.metadata.sourceWords,+ translatedWords = result.translatedWords,+ )+ surfaceState.showResult(display, workingBitmap, selection)+ setFlipButtonVisible(true)+ resultHost?.view?.visibility = View.VISIBLE+ updateBackdrop()+ hideStatus()+ }+ }++ private fun setFlipButtonVisible(visible: Boolean) {+ flipButtonView?.visibility = if (visible) View.VISIBLE else View.GONE+ }++ private fun toggleAssistantOriginal() {+ if (surfaceState.display.value == null) return+ val show = surfaceState.toggleShowOriginal()+ flipIconView?.setColorFilter(if (show) OverlayChromeFactory.ACTIVE_ICON_TINT else Color.WHITE)+ }++ @Suppress("DEPRECATION")+ private fun configureSessionWindow() {+ val dialog = window ?: return+ val win = dialog.window ?: return+ win.setLayout(+ WindowManager.LayoutParams.MATCH_PARENT,+ WindowManager.LayoutParams.MATCH_PARENT,+ )+ win.setGravity(Gravity.TOP or Gravity.START)+ win.attributes = win.attributes.apply { spanFullDisplay() }+ win.setBackgroundDrawable(null)+ win.decorView.setBackgroundColor(Color.TRANSPARENT)+ win.decorView.setPadding(0, 0, 0, 0)+ win.setWindowAnimations(0)+ val contentFrame = win.decorView.findViewById<View>(android.R.id.content)+ contentFrame?.setBackgroundColor(Color.TRANSPARENT)+ (contentFrame?.parent as? View)?.setBackgroundColor(Color.TRANSPARENT)+ }++ private fun showStatus(+ message: String,+ autoHideAfterMs: Long? = null,+ ) {+ if (!::statusView.isInitialized) return+ statusHideJob?.cancel()+ statusHideJob = null+ statusView.text = message+ statusView.visibility = View.VISIBLE+ if (autoHideAfterMs != null) {+ statusHideJob =+ sessionScope.launch {+ delay(autoHideAfterMs)+ hideStatus()+ }+ }+ }++ private fun hideStatus() {+ if (!::statusView.isInitialized) return+ statusHideJob?.cancel()+ statusHideJob = null+ statusView.visibility = View.GONE+ }++ // Screenshot pixels and window coordinates are the same space once the session window spans the+ // physical display, so one rect drives both the crop and where the layers that show it sit.+ private fun contentCrop(+ width: Int,+ height: Int,+ ): Rect = OverlayInsets.contentBounds(Rect(0, 0, width, height), contentInsets)++ private fun applyContentGeometry() {+ if (rootView.width == 0 || rootView.height == 0) return+ val crop = contentCrop(rootView.width, rootView.height)+ var changed = false+ for (layer in listOfNotNull(screenshotView, overlayContainer, resultHost?.view)) {+ val lp = layer.layoutParams as FrameLayout.LayoutParams+ if (lp.width == crop.width() && lp.height == crop.height() &&+ lp.leftMargin == crop.left && lp.topMargin == crop.top+ ) {+ continue+ }+ lp.gravity = Gravity.TOP or Gravity.START+ lp.width = crop.width()+ lp.height = crop.height()+ lp.leftMargin = crop.left+ lp.topMargin = crop.top+ changed = true+ }+ val bar = topBarView.layoutParams as FrameLayout.LayoutParams+ if (bar.topMargin != crop.top || bar.leftMargin != crop.left || bar.rightMargin != contentInsets.right) {+ bar.topMargin = crop.top+ bar.leftMargin = crop.left+ bar.rightMargin = contentInsets.right+ changed = true+ }+ val status = statusView.layoutParams as FrameLayout.LayoutParams+ val statusBottom = contentInsets.bottom + dpToPx(24)+ if (status.bottomMargin != statusBottom) {+ status.bottomMargin = statusBottom+ changed = true+ }+ if (changed) rootView.requestLayout()+ }++ private fun clearCapture() {+ translationJob?.cancel()+ translationJob = null+ captureTimeoutJob?.cancel()+ captureTimeoutJob = null+ statusHideJob?.cancel()+ statusHideJob = null+ pendingScreenshot?.recycle()+ pendingScreenshot = null+ val ss = screenshotBitmap+ val cr = croppedBitmap+ ss?.recycle()+ if (cr != null && cr !== ss) cr.recycle()+ screenshotBitmap = null+ croppedBitmap = null+ processing = false+ }++ private fun dpToPx(dp: Int): Int = (dp * context.resources.displayMetrics.density).toInt()++ private fun updateBackdrop() {+ rootView.setBackgroundColor(Color.TRANSPARENT)+ screenshotView.setBackgroundColor(Color.TRANSPARENT)+ }++ private fun isAssistScreenshotEnabled(): Boolean =+ Settings.Secure.getInt(context.contentResolver, ASSIST_SCREENSHOT_ENABLED_SETTING, 1) != 0++ private fun ocrSourceLanguage(): Language? =+ forcedSourceLanguage ?: settingsManager.settings.value.defaultSourceLanguageCode?.let {+ langStateManager.languageByCode(it)+ }++ private fun buildTopBar(): View {+ val toolbarViews =+ OverlayChromeFactory.createLanguageToolbar(+ context = context,+ dpToPx = ::dpToPx,+ forcedSourceLanguage = forcedSourceLanguage,+ forcedTargetLanguage = forcedTargetLanguage,+ defaultTargetLanguage = langStateManager.languageByCode(settingsManager.settings.value.defaultTargetLanguageCode) ?: langStateManager.languageByCode("en")!!,+ onClose = { hide() },+ onSourceClick = { showLanguagePicker(true) },+ onSwap = { swapLanguages() },+ onTargetClick = { showLanguagePicker(false) },+ onFlipOriginal = { toggleAssistantOriginal() },+ showReadingOrderButton = forcedSourceLanguage?.code == "ja",+ readingOrder = currentReadingOrderFor(forcedSourceLanguage),+ onReadingOrderClick = { toggleJapaneseOcrMode() },+ onMenuClick = { showDotsMenu() },+ isAutoSource = isAutoSource,+ )+ sourceLabelView = toolbarViews.sourceLabel+ targetLabelView = toolbarViews.targetLabel+ readingOrderButtonView = toolbarViews.readingOrderButton+ readingOrderIconView = toolbarViews.readingOrderIcon+ flipIconView = toolbarViews.flipIcon+ flipButtonView = toolbarViews.flipButton+ flipButtonView?.visibility = View.GONE+ return toolbarViews.root+ }++ /** Live screen translate set as the assistant-invocation action: skip the still+ * overlay entirely, launch the consent flow with the default languages from+ * settings, and dismiss this session. Needs a fixed default source language+ * (live can't run the per-frame script classifier). The language *codes* are+ * passed straight through — [ScreenTranslateService] resolves them against the+ * app catalog, which is always loaded, unlike this session's lazy catalog. */+ private fun launchLiveScreen() {+ val settings = settingsManager.settings.value+ val sourceCode = settings.defaultSourceLanguageCode+ if (sourceCode == null) {+ showStatus(context.getString(R.string.assistant_set_source_live))+ return+ }+ runCatching {+ context.startActivity(+ ScreenCaptureRequestActivity.intent(context, sourceCode, settings.defaultTargetLanguageCode, isAutoSource = false),+ )+ }.onFailure { Log.w(tag, "failed to launch live screen translate", it) }+ hide()+ }++ private fun swapLanguages() {+ val oldSource = forcedSourceLanguage+ val oldTarget = forcedTargetLanguage ?: langStateManager.languageByCode(settingsManager.settings.value.defaultTargetLanguageCode) ?: return+ isAutoSource = false+ forcedSourceLanguage = oldTarget+ forcedTargetLanguage = oldSource+ syncReadingOrderForSource()+ updateToolbarLabels()+ retranslate()+ }++ private fun retranslate() {+ translationJob?.cancel()+ translationJob = null+ processing = false+ if (screenshotBitmap != null) {+ runFullScreenOcr()+ } else {+ overlayContainer.removeAllViews()+ hideStatus()+ }+ }++ private fun updateToolbarLabels() {+ sourceLabelView?.text = OverlayChromeFactory.formatSourceLabel(forcedSourceLanguage, isAutoSource)+ val currentTarget = forcedTargetLanguage ?: langStateManager.languageByCode(settingsManager.settings.value.defaultTargetLanguageCode)+ targetLabelView?.text = currentTarget?.shortDisplayName ?: "?"+ OverlayChromeFactory.updateReadingOrderButtonState(+ readingButton = readingOrderButtonView,+ readingIcon = readingOrderIconView,+ visible = forcedSourceLanguage?.code == "ja",+ readingOrder = currentReadingOrderFor(forcedSourceLanguage),+ )+ }++ private fun showLanguagePicker(isSource: Boolean) {+ sessionScope.launch {+ langStateManager.refreshLanguageAvailability()+ val availableLangs = overlayTextTranslationHelper.awaitAvailableLanguages(isSource)+ menuManager?.showLanguagePicker(+ isSource = isSource,+ availableLangs = availableLangs,+ ) { language ->+ if (isSource) {+ if (language == null) {+ isAutoSource = true+ } else {+ isAutoSource = false+ forcedSourceLanguage = language+ }+ syncReadingOrderForSource()+ } else {+ forcedTargetLanguage = language+ }+ updateToolbarLabels()+ retranslate()+ }+ }+ }++ private fun toggleJapaneseOcrMode() {+ if (forcedSourceLanguage?.code != "ja") return+ ocrReadingOrder =+ when (ocrReadingOrder) {+ null -> ReadingOrder.TOP_TO_BOTTOM_RIGHT_TO_LEFT+ ReadingOrder.TOP_TO_BOTTOM_RIGHT_TO_LEFT -> ReadingOrder.LEFT_TO_RIGHT+ ReadingOrder.LEFT_TO_RIGHT -> null+ }+ updateToolbarLabels()+ retranslate()+ }++ private fun currentReadingOrderFor(language: Language?): ReadingOrder? =+ if (language?.code == "ja") {+ ocrReadingOrder+ } else {+ null+ }++ private fun syncReadingOrderForSource() {+ if (forcedSourceLanguage?.code != "ja") {+ ocrReadingOrder = null+ }+ }++ private fun showDotsMenu() {+ menuManager?.showDotsMenu(+ // Copy is handled by the selection action bar; the flip button swaps original/translated.+ listOf(+ "Open App" to { openMainApp() },+ ),+ )+ }++ private fun openMainApp() {+ startAssistantActivity(Intent(context, MainActivity::class.java))+ hide()+ }++ private fun dismissMenu() {+ menuManager?.dismiss()+ }+}diff --git a/OCR-translation/src/main/java/dev/davidv/translator/assistantOverlay/TranslatorVoiceInteractionSessionService.kt b/OCR-translation/src/main/java/dev/davidv/translator/assistantOverlay/TranslatorVoiceInteractionSessionService.ktnew file mode 100644index 0000000..8038d5e--- /dev/null+++ b/OCR-translation/src/main/java/dev/davidv/translator/assistantOverlay/TranslatorVoiceInteractionSessionService.kt@@ -0,0 +1,70 @@+package dev.davidv.translator.assistantOverlay++import android.os.Bundle+import android.service.voice.VoiceInteractionSession+import android.service.voice.VoiceInteractionSessionService+import dev.davidv.translator.FilePathManager+import dev.davidv.translator.ImageProcessor+import dev.davidv.translator.LanguageDetector+import dev.davidv.translator.LanguageMetadataManager+import dev.davidv.translator.LanguageStateManager+import dev.davidv.translator.OverlayTextTranslationHelper+import dev.davidv.translator.SettingsManager+import dev.davidv.translator.SpeechService+import dev.davidv.translator.TranslationCoordinator+import dev.davidv.translator.TranslationService+import kotlinx.coroutines.CoroutineScope+import kotlinx.coroutines.Dispatchers+import kotlinx.coroutines.SupervisorJob+import kotlinx.coroutines.cancel++class TranslatorVoiceInteractionSessionService : VoiceInteractionSessionService() {+ private val serviceScope = CoroutineScope(SupervisorJob() + Dispatchers.Main)++ private lateinit var settingsManager: SettingsManager+ private lateinit var filePathManager: FilePathManager+ private lateinit var languageMetadataManager: LanguageMetadataManager+ private lateinit var imageProcessor: ImageProcessor+ private lateinit var translationCoordinator: TranslationCoordinator+ private lateinit var overlayTextTranslationHelper: OverlayTextTranslationHelper+ private lateinit var langStateManager: LanguageStateManager++ override fun onCreate() {+ super.onCreate()+ settingsManager = SettingsManager(this)+ filePathManager = FilePathManager(this, settingsManager.settings)+ langStateManager = LanguageStateManager(serviceScope, filePathManager, null)+ val catalog = filePathManager.loadCatalog()+ val languagesFlow = kotlinx.coroutines.flow.MutableStateFlow(catalog?.languageList ?: emptyList())+ languageMetadataManager = LanguageMetadataManager(this, languagesFlow)+ imageProcessor = ImageProcessor(this, filePathManager)+ val translationService = TranslationService(settingsManager, filePathManager)+ translationCoordinator =+ TranslationCoordinator(+ translationService = translationService,+ speechService = SpeechService(settingsManager, filePathManager),+ languageDetector = LanguageDetector(langStateManager::languageByCode),+ imageProcessor = imageProcessor,+ settingsManager = settingsManager,+ )+ overlayTextTranslationHelper =+ OverlayTextTranslationHelper(+ langStateManager = langStateManager,+ languageMetadataManager = languageMetadataManager,+ )+ }++ override fun onNewSession(args: Bundle?): VoiceInteractionSession =+ TranslatorVoiceInteractionSession(+ context = this,+ settingsManager = settingsManager,+ translationCoordinator = translationCoordinator,+ overlayTextTranslationHelper = overlayTextTranslationHelper,+ langStateManager = langStateManager,+ )++ override fun onDestroy() {+ serviceScope.cancel()+ super.onDestroy()+ }+}diff --git a/OCR-translation/src/main/java/dev/davidv/translator/browser/AdblockJsBridge.kt b/OCR-translation/src/main/java/dev/davidv/translator/browser/AdblockJsBridge.ktnew file mode 100644index 0000000..be4eae4--- /dev/null+++ b/OCR-translation/src/main/java/dev/davidv/translator/browser/AdblockJsBridge.kt@@ -0,0 +1,81 @@+/*+ * Copyright (C) 2024 David V+ *+ * This program 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.+ *+ * This program 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 <https://www.gnu.org/licenses/>.+ */++package dev.davidv.translator.browser++import android.webkit.JavascriptInterface+import dev.davidv.translator.adblock.AdblockManager++class AdblockJsBridge(+ private val adblockManager: AdblockManager,+ private val bridgeToken: String,+) {+ companion object {+ private const val MAX_VALUES = 5000+ private const val MAX_PAYLOAD_CHARS = 200_000+ private const val MAX_ITEM_CHARS = 4_000+ }++ @JavascriptInterface+ fun lookupGenericSelectors(+ classesPayload: String,+ idsPayload: String,+ exceptionsPayload: String,+ token: String,+ ): String {+ if (token != bridgeToken) return ""+ val classes = decodeWire(classesPayload) ?: return ""+ val ids = decodeWire(idsPayload) ?: return ""+ val exceptions = decodeWire(exceptionsPayload) ?: return ""+ val selectors = adblockManager.hiddenClassIdSelectors(classes, ids, exceptions)+ return encodeWire(selectors)+ }++ // Wire format: length-prefixed records `<len>:<text><len>:<text>...`+ // (UTF-16 code-unit counts; matches JS String.length).+ private fun decodeWire(payload: String): List<String>? {+ if (payload.isEmpty()) return emptyList()+ if (payload.length > MAX_PAYLOAD_CHARS) return null+ val items = ArrayList<String>()+ var i = 0+ val n = payload.length+ while (i < n) {+ val colon = payload.indexOf(':', i)+ if (colon < 0) return null+ val len =+ try {+ payload.substring(i, colon).toInt()+ } catch (_: NumberFormatException) {+ return null+ }+ if (len < 0 || len > MAX_ITEM_CHARS) return null+ val start = colon + 1+ val end = start + len+ if (end > n) return null+ items.add(payload.substring(start, end))+ if (items.size > MAX_VALUES) return null+ i = end+ }+ return items+ }++ private fun encodeWire(values: List<String>): String {+ val sb = StringBuilder()+ for (v in values) sb.append(v.length).append(':').append(v)+ return sb.toString()+ }+}diff --git a/OCR-translation/src/main/java/dev/davidv/translator/browser/BrowserActivity.kt b/OCR-translation/src/main/java/dev/davidv/translator/browser/BrowserActivity.ktnew file mode 100644index 0000000..bf0ea3b--- /dev/null+++ b/OCR-translation/src/main/java/dev/davidv/translator/browser/BrowserActivity.kt@@ -0,0 +1,679 @@+/*+ * Copyright (C) 2024 David V+ *+ * This program 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.+ *+ * This program 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 <https://www.gnu.org/licenses/>.+ */++package dev.davidv.translator.browser++import android.annotation.SuppressLint+import android.content.Intent+import android.graphics.Bitmap+import android.os.Bundle+import android.util.Log+import android.view.ContextThemeWrapper+import android.view.MotionEvent+import android.view.ViewGroup+import android.webkit.ConsoleMessage+import android.webkit.CookieManager+import android.webkit.WebChromeClient+import android.webkit.WebResourceRequest+import android.webkit.WebResourceResponse+import android.webkit.WebStorage+import android.webkit.WebView+import android.webkit.WebViewClient+import android.widget.Toast+import androidx.activity.ComponentActivity+import androidx.activity.compose.BackHandler+import androidx.activity.compose.setContent+import androidx.activity.enableEdgeToEdge+import androidx.compose.animation.AnimatedVisibility+import androidx.compose.animation.slideInVertically+import androidx.compose.animation.slideOutVertically+import androidx.compose.foundation.clickable+import androidx.compose.foundation.isSystemInDarkTheme+import androidx.compose.foundation.layout.Box+import androidx.compose.foundation.layout.Column+import androidx.compose.foundation.layout.WindowInsets+import androidx.compose.foundation.layout.fillMaxSize+import androidx.compose.foundation.layout.padding+import androidx.compose.foundation.layout.safeDrawing+import androidx.compose.foundation.layout.windowInsetsPadding+import androidx.compose.foundation.shape.RoundedCornerShape+import androidx.compose.material3.MaterialTheme+import androidx.compose.material3.Surface+import androidx.compose.material3.Text+import androidx.compose.runtime.Composable+import androidx.compose.runtime.DisposableEffect+import androidx.compose.runtime.LaunchedEffect+import androidx.compose.runtime.getValue+import androidx.compose.runtime.key+import androidx.compose.runtime.mutableStateOf+import androidx.compose.runtime.remember+import androidx.compose.runtime.rememberUpdatedState+import androidx.compose.runtime.setValue+import androidx.compose.ui.Alignment+import androidx.compose.ui.Modifier+import androidx.compose.ui.platform.LocalContext+import androidx.compose.ui.res.stringResource+import androidx.compose.ui.unit.IntOffset+import androidx.compose.ui.unit.dp+import androidx.compose.ui.viewinterop.AndroidView+import androidx.compose.ui.window.Popup+import androidx.lifecycle.ViewModelProvider+import androidx.lifecycle.compose.collectAsStateWithLifecycle+import dev.davidv.translator.Language+import dev.davidv.translator.R+import dev.davidv.translator.TranslationCoordinator+import dev.davidv.translator.TranslationService+import dev.davidv.translator.TranslatorApplication+import dev.davidv.translator.adblock.AdblockManager+import dev.davidv.translator.adblock.mapRequestType+import dev.davidv.translator.adblock.refererOf+import dev.davidv.translator.isWebUrl+import dev.davidv.translator.ui.components.LanguageSelectionRow+import dev.davidv.translator.ui.theme.TranslatorTheme+import kotlinx.coroutines.CoroutineScope+import kotlinx.coroutines.Dispatchers+import kotlinx.coroutines.launch+import kotlinx.coroutines.withContext+import org.json.JSONObject+import java.util.UUID++class BrowserActivity : ComponentActivity() {+ companion object {+ const val EXTRA_URL = "url"+ const val EXTRA_SOURCE_LANG = "source_lang"+ const val EXTRA_TARGET_LANG = "target_lang"+ private const val DEFAULT_HOME = "about:blank"+ private const val TAG = "BrowserActivity"+ }++ private lateinit var viewModel: BrowserViewModel++ override fun onCreate(savedInstanceState: Bundle?) {+ super.onCreate(savedInstanceState)+ enableEdgeToEdge()+ val app = application as TranslatorApplication++ val initialUrl = extractUrl(intent) ?: DEFAULT_HOME+ val sourceCode = intent.getStringExtra(EXTRA_SOURCE_LANG)+ val targetCode = intent.getStringExtra(EXTRA_TARGET_LANG)++ viewModel =+ ViewModelProvider(+ this,+ BrowserViewModelFactory(+ settingsManager = app.settingsManager,+ filePathManager = app.filePathManager,+ languageMetadataManager = app.languageMetadataManager,+ translationService = app.translationService,+ initialUrl = initialUrl,+ initialSourceCode = sourceCode,+ initialTargetCode = targetCode,+ ),+ )[BrowserViewModel::class.java]++ val contentScript = assets.open("translator.js").bufferedReader().use { it.readText() }+ val readabilityScript = assets.open("Readability.js").bufferedReader().use { it.readText() }+ val readerModeScript = assets.open("reader-mode.js").bufferedReader().use { it.readText() }+ val adblockCosmeticScript =+ assets.open("adblock-cosmetic.js").bufferedReader().use { it.readText() }++ setContent {+ TranslatorTheme {+ Surface(+ color = MaterialTheme.colorScheme.background,+ modifier = Modifier.fillMaxSize().windowInsetsPadding(WindowInsets.safeDrawing),+ ) {+ BrowserScreen(+ viewModel = viewModel,+ contentScript = contentScript,+ readabilityScript = readabilityScript,+ readerModeScript = readerModeScript,+ adblockCosmeticScript = adblockCosmeticScript,+ translationService = app.translationService,+ translationCoordinator = app.translationCoordinator,+ adblockManager = app.adblockManager,+ onFinish = { finish() },+ )+ }+ }+ }+ }++ private fun extractUrl(intent: Intent?): String? {+ if (intent == null) return null+ val fromExtra = intent.getStringExtra(EXTRA_URL)+ if (!fromExtra.isNullOrBlank()) return fromExtra+ if (intent.action == Intent.ACTION_SEND) {+ val shared = intent.getStringExtra(Intent.EXTRA_TEXT)?.trim()+ if (!shared.isNullOrBlank()) {+ if (isWebUrl(shared)) return shared+ Log.d(TAG, "ACTION_SEND had no URL; using full text as query target: $shared")+ return shared+ }+ }+ intent.data?.let { return it.toString() }+ return null+ }+}++private const val TOPBAR_SCROLL_THRESHOLD_PX = 8+private const val TOPBAR_HIDE_SCROLL_DISTANCE_PX = 56+private const val TOPBAR_SHOW_SCROLL_DISTANCE_PX = 72+private const val TOPBAR_TOP_SHOW_PX = 50++@SuppressLint("SetJavaScriptEnabled")+@Composable+private fun BrowserScreen(+ viewModel: BrowserViewModel,+ contentScript: String,+ readabilityScript: String,+ readerModeScript: String,+ adblockCosmeticScript: String,+ translationService: TranslationService,+ translationCoordinator: TranslationCoordinator,+ adblockManager: AdblockManager,+ onFinish: () -> Unit,+) {+ val context = LocalContext.current+ val from by viewModel.from.collectAsStateWithLifecycle()+ val to by viewModel.to.collectAsStateWithLifecycle()+ val languageState by viewModel.languageState.collectAsStateWithLifecycle()+ val languageMetadata by viewModel.languageMetadata.collectAsStateWithLifecycle()+ val url by viewModel.url.collectAsStateWithLifecycle()+ val settings by viewModel.settings.collectAsStateWithLifecycle()+ val darkTheme = isSystemInDarkTheme()++ if (to == null) return++ if (from == null) {+ Column(modifier = Modifier.fillMaxSize().padding(16.dp)) {+ Text(+ text = stringResource(R.string.browser_no_source_language),+ color = MaterialTheme.colorScheme.onBackground,+ )+ }+ return+ }++ var topBarVisible by remember { mutableStateOf(true) }+ var topBarScrollAccumulator by remember { mutableStateOf(0) }+ val readerController = remember { ReaderController(readabilityScript, readerModeScript) }+ val readerPageState by readerController.state.collectAsStateWithLifecycle()+ val readerActive = readerPageState.reader is ReaderState.Active+ val readerVisible = readerPageState.reader != ReaderState.Idle+ val webViewRef = remember { arrayOfNulls<WebView>(1) }++ BackHandler {+ val wv = webViewRef[0]+ if (wv != null && wv.canGoBack()) {+ wv.goBack()+ } else {+ onFinish()+ }+ }++ Box(modifier = Modifier.fillMaxSize()) {+ BrowserWebView(+ url = url,+ sourceLang = from!!,+ targetLang = to!!,+ contentScript = contentScript,+ adblockCosmeticScript = adblockCosmeticScript,+ translationService = translationService,+ translationCoordinator = translationCoordinator,+ adblockManager = adblockManager,+ clearDataOnClose = settings.clearWebTranslatorDataOnClose,+ darkTheme = darkTheme,+ onScrollDelta = { y, dy ->+ if (y < TOPBAR_TOP_SHOW_PX) {+ topBarVisible = true+ topBarScrollAccumulator = 0+ } else if (kotlin.math.abs(dy) > TOPBAR_SCROLL_THRESHOLD_PX) {+ val continuedSameDirection =+ (topBarScrollAccumulator >= 0 && dy > 0) ||+ (topBarScrollAccumulator <= 0 && dy < 0)+ topBarScrollAccumulator =+ if (continuedSameDirection) {+ topBarScrollAccumulator + dy+ } else {+ dy+ }++ when {+ topBarVisible && topBarScrollAccumulator >= TOPBAR_HIDE_SCROLL_DISTANCE_PX -> {+ topBarVisible = false+ topBarScrollAccumulator = 0+ }+ !topBarVisible && topBarScrollAccumulator <= -TOPBAR_SHOW_SCROLL_DISTANCE_PX -> {+ topBarVisible = true+ topBarScrollAccumulator = 0+ }+ }+ }+ },+ onWebViewReady = { webViewRef[0] = it },+ readerController = readerController,+ )++ AnimatedVisibility(+ visible = topBarVisible,+ enter = slideInVertically { -it },+ exit = slideOutVertically { -it },+ modifier = Modifier.align(Alignment.TopCenter),+ ) {+ Surface(+ color = MaterialTheme.colorScheme.background,+ ) {+ Box(modifier = Modifier.padding(horizontal = 16.dp)) {+ LanguageSelectionRow(+ from = from!!,+ to = to!!,+ canSwap = viewModel.canSwapLanguages(from!!, to!!),+ languageState = languageState,+ languageMetadata = languageMetadata,+ onMessage = viewModel::onMessage,+ drawable =+ Pair(+ if (readerActive) "Exit reader mode" else "Reader mode",+ R.drawable.chrome_reader_mode,+ ),+ onSettings =+ if (readerVisible) {+ {+ val webView = webViewRef[0]+ if (webView != null) {+ readerController.toggle(webView) {+ Toast.makeText(context, context.getString(R.string.browser_reader_unavailable), Toast.LENGTH_SHORT).show()+ }+ }+ }+ } else {+ null+ },+ )+ }+ }+ }+ }+}++@SuppressLint("SetJavaScriptEnabled")+@Composable+private fun BrowserWebView(+ url: String,+ sourceLang: Language,+ targetLang: Language,+ contentScript: String,+ adblockCosmeticScript: String,+ translationService: TranslationService,+ translationCoordinator: TranslationCoordinator,+ adblockManager: AdblockManager,+ clearDataOnClose: Boolean,+ darkTheme: Boolean,+ onScrollDelta: (y: Int, dy: Int) -> Unit,+ onWebViewReady: (WebView) -> Unit,+ readerController: ReaderController,+) {+ val scope = androidx.compose.runtime.rememberCoroutineScope()+ val bridgeRef = remember { arrayOfNulls<TranslatorJsBridge>(1) }+ val webViewRef = remember { arrayOfNulls<WebView>(1) }+ val currentPageUrlRef = remember { java.util.concurrent.atomic.AtomicReference<String?>(null) }+ val currentPageSerialRef = remember { java.util.concurrent.atomic.AtomicInteger(0) }+ val adblockReady by adblockManager.ready.collectAsStateWithLifecycle()+ val bridgeToken = remember { UUID.randomUUID().toString() }+ val translatorBridgeName = remember { "__translatorBridge_${bridgeToken.filter { it != '-' }}" }+ val adblockBridgeName = remember { "__adblockBridge_${bridgeToken.filter { it != '-' }}" }+ val clearDataOnCloseState = rememberUpdatedState(clearDataOnClose)+ val touchCoords = remember { intArrayOf(0, 0) }+ var imageMenuOffset by remember { mutableStateOf<IntOffset?>(null) }++ DisposableEffect(Unit) {+ onDispose {+ if (clearDataOnCloseState.value) clearWebTranslatorData(webViewRef[0])+ }+ }++ LaunchedEffect(adblockReady) {+ if (!adblockReady) return@LaunchedEffect+ val webView = webViewRef[0] ?: return@LaunchedEffect+ val pageSerial = currentPageSerialRef.get()+ if (pageSerial == 0) return@LaunchedEffect+ val currentUrl = webView.url ?: currentPageUrlRef.get() ?: return@LaunchedEffect+ applyCosmeticFiltersAsync(+ scope,+ webView,+ adblockManager,+ currentUrl,+ pageSerial,+ currentPageSerialRef,+ adblockBridgeName,+ bridgeToken,+ adblockCosmeticScript,+ )+ }++ Box(modifier = Modifier.fillMaxSize()) {+ key(darkTheme) {+ AndroidView(+ modifier = Modifier.fillMaxSize(),+ factory = { ctx ->+ val webViewContext =+ ContextThemeWrapper(+ ctx,+ if (darkTheme) {+ R.style.Theme_Translator_WebView_Dark+ } else {+ R.style.Theme_Translator_WebView_Light+ },+ )+ val webView =+ WebView(webViewContext).apply {+ layoutParams =+ ViewGroup.LayoutParams(+ ViewGroup.LayoutParams.MATCH_PARENT,+ ViewGroup.LayoutParams.MATCH_PARENT,+ )+ settings.javaScriptEnabled = true+ settings.domStorageEnabled = true+ }++ webView.webChromeClient =+ object : WebChromeClient() {+ override fun onConsoleMessage(message: ConsoleMessage): Boolean {+ Log.i(+ "BrowserConsole",+ "[${message.messageLevel()}] ${message.message()} (${message.sourceId()}:${message.lineNumber()})",+ )+ return true+ }+ }++ webView.setOnScrollChangeListener { _, _, y, _, oldY ->+ onScrollDelta(y, y - oldY)+ }++ webView.setOnTouchListener { _, event ->+ if (event.actionMasked == MotionEvent.ACTION_DOWN) {+ touchCoords[0] = event.x.toInt()+ touchCoords[1] = event.y.toInt()+ }+ false+ }++ webView.setOnLongClickListener {+ val r = webView.hitTestResult+ val isImage =+ r.type == WebView.HitTestResult.IMAGE_TYPE ||+ r.type == WebView.HitTestResult.SRC_IMAGE_ANCHOR_TYPE+ if (isImage) {+ imageMenuOffset = IntOffset(touchCoords[0], touchCoords[1])+ true+ } else {+ false+ }+ }++ val bridge =+ TranslatorJsBridge(+ scope = scope,+ webView = webView,+ translationService = translationService,+ translationCoordinator = translationCoordinator,+ bridgeToken = bridgeToken,+ sourceLanguage = sourceLang,+ targetLanguage = targetLang,+ )+ bridgeRef[0] = bridge+ webViewRef[0] = webView+ webView.addJavascriptInterface(bridge, translatorBridgeName)+ webView.addJavascriptInterface(AdblockJsBridge(adblockManager, bridgeToken), adblockBridgeName)++ webView.webViewClient =+ object : WebViewClient() {+ override fun onPageStarted(+ view: WebView?,+ url: String?,+ favicon: Bitmap?,+ ) {+ Log.i("AdblockManager", "onPageStarted view=$view url=$url")+ readerController.onPageStarted()+ currentPageUrlRef.set(url)+ val pageSerial = currentPageSerialRef.incrementAndGet()+ // Inject the translator content script as early as possible.+ // The script self-defers its DOM scan until DOMContentLoaded+ view?.evaluateJavascript(+ buildTranslatorContentJs(contentScript, translatorBridgeName, bridgeToken),+ null,+ )+ if (view != null && url != null) {+ applyCosmeticFiltersAsync(+ scope,+ view,+ adblockManager,+ url,+ pageSerial,+ currentPageSerialRef,+ adblockBridgeName,+ bridgeToken,+ adblockCosmeticScript,+ )+ }+ }++ override fun onPageFinished(+ view: WebView?,+ url: String?,+ ) {+ val pageSerial = currentPageSerialRef.get()+ if (view != null && url != null) {+ applyCosmeticFiltersAsync(+ scope,+ view,+ adblockManager,+ url,+ pageSerial,+ currentPageSerialRef,+ adblockBridgeName,+ bridgeToken,+ adblockCosmeticScript,+ )+ }+ if (view != null) readerController.probeOnPageFinished(view)+ }++ override fun shouldInterceptRequest(+ view: WebView?,+ request: WebResourceRequest?,+ ): WebResourceResponse? {+ if (request == null) return null+ val topUrl = currentPageUrlRef.get() ?: return null+ val sourceUrl =+ if (request.isForMainFrame) topUrl else refererOf(request) ?: topUrl+ val verdict =+ adblockManager.checkRequest(+ url = request.url.toString(),+ sourceUrl = sourceUrl,+ requestType = mapRequestType(request),+ ) ?: return null+ if (!verdict.matched || verdict.exception) return null+ return WebResourceResponse("text/plain", "utf-8", ByteArray(0).inputStream())+ }+ }++ onWebViewReady(webView)+ webView.loadUrl(url)+ webView+ },+ update = { webView ->+ val b = bridgeRef[0] ?: return@AndroidView+ val langsChanged = b.sourceLanguage != sourceLang || b.targetLanguage != targetLang+ b.sourceLanguage = sourceLang+ b.targetLanguage = targetLang+ if (langsChanged) {+ webView.evaluateJavascript(+ "window.__translator && window.__translator.reset && window.__translator.reset();",+ ) { result ->+ if (result != "true") webView.reload()+ }+ }+ },+ )+ }++ imageMenuOffset?.let { offset ->+ Popup(+ offset = offset,+ onDismissRequest = { imageMenuOffset = null },+ ) {+ Surface(+ color = MaterialTheme.colorScheme.surface,+ shape = RoundedCornerShape(8.dp),+ tonalElevation = 4.dp,+ shadowElevation = 8.dp,+ ) {+ Text(+ text = stringResource(R.string.browser_translate_image),+ color = MaterialTheme.colorScheme.onSurface,+ modifier =+ Modifier+ .clickable {+ webViewRef[0]?.evaluateJavascript(+ "window.__translator && window.__translator.translateTouchedImage && window.__translator.translateTouchedImage();",+ null,+ )+ imageMenuOffset = null+ }.padding(horizontal = 16.dp, vertical = 12.dp),+ )+ }+ }+ }+ }+}++private fun clearWebTranslatorData(webView: WebView?) {+ webView?.clearCache(true)+ CookieManager.getInstance().apply {+ removeAllCookies(null)+ flush()+ }+ WebStorage.getInstance().deleteAllData()+}++private fun buildTranslatorContentJs(+ contentScript: String,+ bridgeName: String,+ bridgeToken: String,+): String =+ "(function(){\n" ++ "var __translatorBridgeName = ${JSONObject.quote(bridgeName)};\n" ++ "var __translatorBridgeToken = ${JSONObject.quote(bridgeToken)};\n" ++ contentScript ++ "\n})();"++private fun applyCosmeticFiltersAsync(+ scope: CoroutineScope,+ webView: WebView,+ adblockManager: AdblockManager,+ url: String,+ pageSerial: Int,+ currentPageSerialRef: java.util.concurrent.atomic.AtomicInteger,+ adblockBridgeName: String,+ bridgeToken: String,+ adblockCosmeticScript: String,+) {+ Log.i("AdblockManager", "url=$url scheduling cosmetic lookup")+ scope.launch {+ val tFetch = System.currentTimeMillis()+ val cosmetic = withContext(Dispatchers.IO) { adblockManager.cosmeticResources(url) }+ val fetchMs = System.currentTimeMillis() - tFetch+ if (cosmetic == null) {+ Log.i("AdblockManager", "url=$url cosmetic=null (engine not loaded?) fetch=${fetchMs}ms")+ return@launch+ }+ val sdaPresent = cosmetic.hideSelectors.any { it == ".sdaContainer" }+ Log.i(+ "AdblockManager",+ "url=$url hide=${cosmetic.hideSelectors.size} style=${cosmetic.styleRules.size} " ++ "procedural=${cosmetic.proceduralFilters.size} script=${cosmetic.injectedScript.length}B " ++ "exc=${cosmetic.exceptions.size} generichide=${cosmetic.generichide} " ++ "hasSdaContainer=$sdaPresent fetch=${fetchMs}ms",+ )+ val js =+ buildCosmeticJs(+ cosmetic.hideSelectors,+ cosmetic.styleRules,+ cosmetic.proceduralFilters,+ cosmetic.exceptions,+ cosmetic.generichide,+ cosmetic.injectedScript,+ adblockBridgeName,+ bridgeToken,+ adblockCosmeticScript,+ )+ if (js.isEmpty()) {+ Log.i("AdblockManager", "url=$url empty cosmetic, skipping")+ return@launch+ }+ withContext(Dispatchers.Main) {+ if (currentPageSerialRef.get() != pageSerial) {+ Log.i("AdblockManager", "url=$url stale cosmetic result, skipping")+ return@withContext+ }+ webView.evaluateJavascript(js, null)+ }+ }+}++private fun buildCosmeticJs(+ hideSelectors: List<String>,+ styleRules: List<String>,+ proceduralFilters: List<String>,+ exceptions: List<String>,+ generichide: Boolean,+ injectedScript: String,+ adblockBridgeName: String,+ bridgeToken: String,+ adblockCosmeticScript: String,+): String {+ if (hideSelectors.isEmpty() && styleRules.isEmpty() &&+ proceduralFilters.isEmpty() && injectedScript.isBlank() && generichide+ ) {+ return ""+ }+ val cssParts = mutableListOf<String>()+ cssParts.add(+ "[data-adblock-hide] { display: none !important; min-height: 0 !important; min-width: 0 !important; height: 0 !important; }",+ )+ if (styleRules.isNotEmpty()) {+ cssParts.addAll(styleRules)+ }+ val config =+ JSONObject()+ .put("baseCss", cssParts.joinToString("\n"))+ .put("hideSelectors", org.json.JSONArray().apply { hideSelectors.forEach { put(it) } })+ .put(+ "proceduralFilters",+ org.json.JSONArray().apply { proceduralFilters.forEach { put(it) } },+ )+ .put("exceptions", org.json.JSONArray().apply { exceptions.forEach { put(it) } })+ .put("generichide", generichide)+ .put("injectedScript", injectedScript)+ .put("adblockBridgeName", adblockBridgeName)+ .put("bridgeToken", bridgeToken)+ .toString()+ return "window.__translatorAdblockConfig = $config;\n$adblockCosmeticScript"+}diff --git a/OCR-translation/src/main/java/dev/davidv/translator/browser/BrowserViewModel.kt b/OCR-translation/src/main/java/dev/davidv/translator/browser/BrowserViewModel.ktnew file mode 100644index 0000000..62949db--- /dev/null+++ b/OCR-translation/src/main/java/dev/davidv/translator/browser/BrowserViewModel.kt@@ -0,0 +1,155 @@+/*+ * Copyright (C) 2024 David V+ *+ * This program 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.+ *+ * This program 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 <https://www.gnu.org/licenses/>.+ */++package dev.davidv.translator.browser++import androidx.lifecycle.ViewModel+import androidx.lifecycle.ViewModelProvider+import androidx.lifecycle.viewModelScope+import dev.davidv.translator.FilePathManager+import dev.davidv.translator.Language+import dev.davidv.translator.LanguageAvailabilityState+import dev.davidv.translator.LanguageMetadata+import dev.davidv.translator.LanguageMetadataManager+import dev.davidv.translator.LanguageStateManager+import dev.davidv.translator.SettingsManager+import dev.davidv.translator.TranslationService+import dev.davidv.translator.TranslatorMessage+import kotlinx.coroutines.flow.MutableStateFlow+import kotlinx.coroutines.flow.StateFlow+import kotlinx.coroutines.flow.asStateFlow+import kotlinx.coroutines.flow.combine+import kotlinx.coroutines.launch++class BrowserViewModel(+ settingsManager: SettingsManager,+ filePathManager: FilePathManager,+ languageMetadataManager: LanguageMetadataManager,+ private val translationService: TranslationService,+ initialUrl: String,+ initialSourceCode: String?,+ initialTargetCode: String?,+) : ViewModel() {+ val settings = settingsManager.settings+ val languageStateManager = LanguageStateManager(viewModelScope, filePathManager)++ val languageState: StateFlow<LanguageAvailabilityState> = languageStateManager.languageState+ val languageMetadata: StateFlow<Map<Language, LanguageMetadata>> = languageMetadataManager.metadata++ private val _from = MutableStateFlow<Language?>(null)+ val from: StateFlow<Language?> = _from.asStateFlow()++ private val _to = MutableStateFlow<Language?>(null)+ val to: StateFlow<Language?> = _to.asStateFlow()++ private val _url = MutableStateFlow(initialUrl)+ val url: StateFlow<String> = _url.asStateFlow()++ init {+ viewModelScope.launch {+ combine(languageStateManager.catalog, languageStateManager.languageState) { catalog, state ->+ catalog to state+ }.collect { (catalog, state) ->+ if (catalog == null) return@collect+ val settings = settingsManager.settings.value+ if (_to.value == null) {+ val tgtCode = initialTargetCode ?: settings.defaultTargetLanguageCode+ _to.value = catalog.languageByCode(tgtCode) ?: catalog.english+ }+ if (_from.value == null) {+ val srcCode = initialSourceCode ?: settings.defaultSourceLanguageCode+ val byCode = srcCode?.let { catalog.languageByCode(it) }+ _from.value = byCode ?: firstAvailableSourceLanguage(state, _to.value)+ }+ val fromLang = _from.value+ val toLang = _to.value+ if (fromLang != null && toLang != null && fromLang != toLang) {+ translationService.preloadModel(fromLang, toLang)+ }+ }+ }+ }++ private fun firstAvailableSourceLanguage(+ state: LanguageAvailabilityState,+ target: Language?,+ ): Language? =+ state.allLanguages().firstOrNull { lang ->+ lang != target &&+ (lang.isEnglish || state.availabilityFor(lang)?.hasToEnglish == true)+ }++ fun onMessage(message: TranslatorMessage) {+ when (message) {+ is TranslatorMessage.FromLang -> _from.value = message.language+ is TranslatorMessage.ToLang -> _to.value = message.language+ is TranslatorMessage.SwapLanguages -> {+ val prevFrom = _from.value+ val prevTo = _to.value+ if (prevFrom != null && prevTo != null && canSwapLanguages(prevFrom, prevTo)) {+ _from.value = prevTo+ _to.value = prevFrom+ }+ }+ else -> {}+ }+ val fromLang = _from.value+ val toLang = _to.value+ if (fromLang != null && toLang != null && fromLang != toLang) {+ viewModelScope.launch { translationService.preloadModel(fromLang, toLang) }+ }+ }++ fun loadUrl(value: String) {+ val normalized =+ when {+ value.startsWith("http://") || value.startsWith("https://") -> value+ value == "about:blank" -> value+ value.isBlank() -> return+ else -> "https://$value"+ }+ _url.value = normalized+ }++ fun canSwapLanguages(+ from: Language,+ to: Language,+ ): Boolean = languageStateManager.canSwapLanguages(from, to)+}++class BrowserViewModelFactory(+ private val settingsManager: SettingsManager,+ private val filePathManager: FilePathManager,+ private val languageMetadataManager: LanguageMetadataManager,+ private val translationService: TranslationService,+ private val initialUrl: String,+ private val initialSourceCode: String?,+ private val initialTargetCode: String?,+) : ViewModelProvider.Factory {+ override fun <T : ViewModel> create(modelClass: Class<T>): T {+ @Suppress("UNCHECKED_CAST")+ return BrowserViewModel(+ settingsManager = settingsManager,+ filePathManager = filePathManager,+ languageMetadataManager = languageMetadataManager,+ translationService = translationService,+ initialUrl = initialUrl,+ initialSourceCode = initialSourceCode,+ initialTargetCode = initialTargetCode,+ ) as T+ }+}diff --git a/OCR-translation/src/main/java/dev/davidv/translator/browser/ReaderController.kt b/OCR-translation/src/main/java/dev/davidv/translator/browser/ReaderController.ktnew file mode 100644index 0000000..2338a4a--- /dev/null+++ b/OCR-translation/src/main/java/dev/davidv/translator/browser/ReaderController.kt@@ -0,0 +1,121 @@+/*+ * Copyright (C) 2024 David V+ *+ * This program 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.+ *+ * This program 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 <https://www.gnu.org/licenses/>.+ */++package dev.davidv.translator.browser++import android.webkit.WebView+import kotlinx.coroutines.flow.MutableStateFlow+import kotlinx.coroutines.flow.StateFlow+import kotlinx.coroutines.flow.asStateFlow+import org.json.JSONObject+import org.json.JSONTokener++sealed class ReaderState {+ data object Idle : ReaderState()++ data object Available : ReaderState()++ data class Active(val originalUrl: String) : ReaderState()+}++data class ReaderPageState(+ val reader: ReaderState = ReaderState.Idle,+ val pendingActivation: Boolean = false,+)++class ReaderController(+ private val readabilityScript: String,+ private val readerModeScript: String,+) {+ private val _state = MutableStateFlow(ReaderPageState())+ val state: StateFlow<ReaderPageState> = _state.asStateFlow()++ fun onPageStarted() {+ val current = _state.value+ if (current.pendingActivation) {+ _state.value = current.copy(pendingActivation = false)+ return+ }+ if (current != ReaderPageState()) _state.value = ReaderPageState()+ }++ fun probeOnPageFinished(webView: WebView) {+ if (_state.value.reader is ReaderState.Active) return+ webView.evaluateJavascript(buildReaderModeJs(probeOnly = true)) { result ->+ val cur = _state.value+ if (cur.reader is ReaderState.Active) return@evaluateJavascript+ val available = result == "true"+ _state.value =+ cur.copy(+ reader = if (available) ReaderState.Available else ReaderState.Idle,+ )+ }+ }++ fun toggle(+ webView: WebView,+ onUnavailable: () -> Unit,+ ) {+ when (val r = _state.value.reader) {+ ReaderState.Idle -> {}+ ReaderState.Available -> activate(webView, onUnavailable)+ is ReaderState.Active -> deactivate(webView, r.originalUrl)+ }+ }++ private fun activate(+ webView: WebView,+ onUnavailable: () -> Unit,+ ) {+ val originalUrl = webView.url ?: return+ webView.evaluateJavascript(buildReaderModeJs(probeOnly = false)) { result ->+ val html = decodeJavascriptString(result)+ if (html == null) {+ _state.value = _state.value.copy(reader = ReaderState.Idle)+ onUnavailable()+ return@evaluateJavascript+ }+ _state.value =+ ReaderPageState(+ reader = ReaderState.Active(originalUrl),+ pendingActivation = true,+ )+ webView.loadDataWithBaseURL(originalUrl, html, "text/html", "UTF-8", originalUrl)+ }+ }++ private fun deactivate(+ webView: WebView,+ originalUrl: String,+ ) {+ _state.value = ReaderPageState()+ if (webView.canGoBack()) webView.goBack() else webView.loadUrl(originalUrl)+ }++ private fun buildReaderModeJs(probeOnly: Boolean): String {+ val readabilityLiteral = JSONObject.quote(readabilityScript)+ val readerModeLiteral = JSONObject.quote(readerModeScript)+ return "window.__translatorReadabilityScript = $readabilityLiteral;\n" ++ "window.__translatorReaderModeProbe = $probeOnly;\n" ++ "(0, eval)($readerModeLiteral);"+ }++ private fun decodeJavascriptString(value: String): String? {+ if (value == "null") return null+ return runCatching { JSONTokener(value).nextValue() as? String }.getOrNull()+ }+}diff --git a/OCR-translation/src/main/java/dev/davidv/translator/browser/TranslatorJsBridge.kt b/OCR-translation/src/main/java/dev/davidv/translator/browser/TranslatorJsBridge.ktnew file mode 100644index 0000000..fa23385--- /dev/null+++ b/OCR-translation/src/main/java/dev/davidv/translator/browser/TranslatorJsBridge.kt@@ -0,0 +1,241 @@+/*+ * Copyright (C) 2024 David V+ *+ * This program 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.+ *+ * This program 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 <https://www.gnu.org/licenses/>.+ */++package dev.davidv.translator.browser++import android.graphics.Bitmap+import android.graphics.BitmapFactory+import android.util.Base64+import android.util.Log+import android.webkit.JavascriptInterface+import android.webkit.WebView+import dev.davidv.translator.Language+import dev.davidv.translator.TranslationCoordinator+import dev.davidv.translator.TranslationService+import kotlinx.coroutines.CoroutineScope+import kotlinx.coroutines.Dispatchers+import kotlinx.coroutines.launch+import kotlinx.coroutines.withContext+import org.json.JSONObject+import java.io.ByteArrayOutputStream++class TranslatorJsBridge(+ private val scope: CoroutineScope,+ private val webView: WebView,+ private val translationService: TranslationService,+ private val translationCoordinator: TranslationCoordinator,+ private val bridgeToken: String,+ @Volatile var sourceLanguage: Language,+ @Volatile var targetLanguage: Language,+) {+ companion object {+ private const val MAX_BATCH_ITEMS = 50+ private const val MAX_TOTAL_CHARS = 100_000+ private const val MAX_ITEM_CHARS = 20_000+ }++ @JavascriptInterface+ fun translateHtmlFragments(+ requestId: Int,+ fragmentsPayload: String,+ token: String,+ nonce: String,+ ) {+ if (token != bridgeToken) return+ scope.launch {+ val fragments = decodeWire(fragmentsPayload)+ if (fragments == null) {+ resolveOnJs(requestId, emptyList(), nonce)+ return@launch+ }+ val translated =+ try {+ translationService.translateHtmlFragments(sourceLanguage, targetLanguage, fragments)+ } catch (t: Throwable) {+ Log.w("TranslatorJsBridge", "translateHtmlFragments failed", t)+ fragments+ }+ resolveOnJs(requestId, translated, nonce)+ }+ }++ @JavascriptInterface+ fun translateTexts(+ requestId: Int,+ textsPayload: String,+ token: String,+ nonce: String,+ ) {+ if (token != bridgeToken) return+ scope.launch {+ val texts = decodeWire(textsPayload)+ if (texts == null) {+ resolveOnJs(requestId, emptyList(), nonce)+ return@launch+ }+ val translated =+ try {+ val result =+ translationService.translateMixedTexts(+ texts,+ sourceLanguage,+ targetLanguage,+ listOf(sourceLanguage, targetLanguage),+ )+ mapMixedTextsToInputOrder(texts, result)+ } catch (t: Throwable) {+ Log.w("TranslatorJsBridge", "translateTexts failed", t)+ texts+ }+ resolveOnJs(requestId, translated, nonce)+ }+ }++ @JavascriptInterface+ fun translateImage(+ requestId: Int,+ dataUri: String,+ token: String,+ nonce: String,+ ) {+ if (token != bridgeToken) return+ Log.d("TranslatorJsBridge", "translateImage requestId=$requestId payload=${dataUri.length}B")+ scope.launch {+ val output =+ if (dataUri.isEmpty()) {+ ""+ } else {+ try {+ translateImageDataUri(dataUri)+ } catch (t: Throwable) {+ Log.w("TranslatorJsBridge", "translateImage failed", t)+ ""+ }+ }+ Log.d("TranslatorJsBridge", "translateImage requestId=$requestId result=${output.length}B")+ resolveRawOnJs(requestId, output, nonce)+ }+ }++ private suspend fun translateImageDataUri(dataUri: String): String {+ if (!dataUri.startsWith("data:")) return ""+ val comma = dataUri.indexOf(',')+ if (comma < 0) return ""+ val header = dataUri.substring(5, comma)+ if (!header.contains("base64")) return ""+ val bytes =+ withContext(Dispatchers.Default) {+ Base64.decode(dataUri.substring(comma + 1), Base64.DEFAULT)+ }+ val source = BitmapFactory.decodeByteArray(bytes, 0, bytes.size) ?: return ""+ val result =+ translationCoordinator.translateImageWithOverlay(+ from = sourceLanguage,+ to = targetLanguage,+ finalBitmap = source,+ onMessage = {},+ )+ if (!source.isRecycled) source.recycle()+ if (result == null) return ""+ return withContext(Dispatchers.Default) { encodeBitmapAsDataUri(result.correctedBitmap) }+ }++ private fun encodeBitmapAsDataUri(bitmap: Bitmap): String {+ val baos = ByteArrayOutputStream()+ bitmap.compress(Bitmap.CompressFormat.JPEG, 90, baos)+ val b64 = Base64.encodeToString(baos.toByteArray(), Base64.NO_WRAP)+ return "data:image/jpeg;base64,$b64"+ }++ private fun mapMixedTextsToInputOrder(+ inputs: List<String>,+ result: dev.davidv.translator.BatchTextTranslationOutput,+ ): List<String> =+ when (result) {+ is dev.davidv.translator.BatchTextTranslationOutput.Translated ->+ inputs.map { result.results[it] ?: it }+ is dev.davidv.translator.BatchTextTranslationOutput.NothingToTranslate -> inputs+ }++ private suspend fun resolveOnJs(+ requestId: Int,+ translated: List<String>,+ nonce: String,+ ) {+ val payload = JSONObject.quote(encodeWire(translated))+ val jsNonce = JSONObject.quote(nonce)+ withContext(Dispatchers.Main) {+ webView.evaluateJavascript(+ "window.__translator && window.__translator.resolve($requestId, $payload, $jsNonce);",+ null,+ )+ }+ }++ private suspend fun resolveRawOnJs(+ requestId: Int,+ payload: String,+ nonce: String,+ ) {+ val jsPayload = JSONObject.quote(payload)+ val jsNonce = JSONObject.quote(nonce)+ withContext(Dispatchers.Main) {+ webView.evaluateJavascript(+ "window.__translator && window.__translator.resolveRaw($requestId, $jsPayload, $jsNonce);",+ null,+ )+ }+ }++ // Wire format: length-prefixed records `<len>:<text><len>:<text>...`+ // where `len` is the UTF-16 code-unit count (matches String.length on+ // both sides). Robust to any content; cheaper than JSON because no+ // per-char escape work.+ private fun decodeWire(payload: String): List<String>? {+ if (payload.isEmpty()) return emptyList()+ if (payload.length > MAX_TOTAL_CHARS + MAX_BATCH_ITEMS * 8) return null+ val items = ArrayList<String>()+ var i = 0+ val n = payload.length+ while (i < n) {+ val colon = payload.indexOf(':', i)+ if (colon < 0) return null+ val len =+ try {+ payload.substring(i, colon).toInt()+ } catch (_: NumberFormatException) {+ return null+ }+ if (len < 0 || len > MAX_ITEM_CHARS) return null+ val start = colon + 1+ val end = start + len+ if (end > n) return null+ items.add(payload.substring(start, end))+ if (items.size > MAX_BATCH_ITEMS) return null+ i = end+ }+ return items+ }++ private fun encodeWire(values: List<String>): String {+ val sb = StringBuilder()+ for (v in values) {+ sb.append(v.length).append(':').append(v)+ }+ return sb.toString()+ }+}diff --git a/OCR-translation/src/main/java/dev/davidv/translator/overlayChrome/FloatingBubble.kt b/OCR-translation/src/main/java/dev/davidv/translator/overlayChrome/FloatingBubble.ktnew file mode 100644index 0000000..8c602ea--- /dev/null+++ b/OCR-translation/src/main/java/dev/davidv/translator/overlayChrome/FloatingBubble.kt@@ -0,0 +1,229 @@+/*+ * Copyright (C) 2024 David V+ *+ * This program 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.+ *+ * This program 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 <https://www.gnu.org/licenses/>.+ */++package dev.davidv.translator.overlayChrome++import android.animation.ValueAnimator+import android.content.Context+import android.graphics.Color+import android.graphics.PixelFormat+import android.graphics.drawable.GradientDrawable+import android.os.Handler+import android.os.Looper+import android.view.Gravity+import android.view.MotionEvent+import android.view.View+import android.view.WindowManager+import android.widget.FrameLayout+import android.widget.ImageView+import dev.davidv.translator.R++/**+ * Draggable, auto-semi-hidden control bubble for the overlay services. Lives in+ * its own touchable overlay window (the render overlay stays pass-through), so a+ * single implementation serves whichever service supplies the [windowManager] and+ * [overlayType]. Idle behaviour: snap to the nearest horizontal edge, then slide+ * half off-screen and dim; any touch restores it, a tap (no drag) fires [onTap].+ */+class FloatingBubble(+ private val context: Context,+ private val windowManager: WindowManager,+ private val overlayType: Int,+ private val dpToPx: (Int) -> Int,+ private val onTap: () -> Unit,+) {+ private val handler = Handler(Looper.getMainLooper())+ private var view: View? = null+ private var params: WindowManager.LayoutParams? = null+ private var hidden = false+ private var snapAnimator: ValueAnimator? = null++ private val idleRunnable = Runnable { hideToEdge() }++ fun show() {+ if (view != null) return++ val size = dpToPx(48)+ val pad = dpToPx(10)+ val icon =+ ImageView(context).apply {+ setImageResource(R.drawable.ic_translate_button)+ setPadding(pad, pad, pad, pad)+ }+ val bg =+ GradientDrawable().apply {+ shape = GradientDrawable.OVAL+ setColor(Color.parseColor("#F1AB7F"))+ }+ val container =+ FrameLayout(context).apply {+ background = bg+ addView(icon, FrameLayout.LayoutParams(size, size))+ }++ val lp =+ WindowManager.LayoutParams(+ size,+ size,+ overlayType,+ // NO_LIMITS so the idle bubble can slide half past the screen edge —+ // without it the window is clamped on-screen and only dims in place.+ WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE or+ WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS,+ PixelFormat.TRANSLUCENT,+ )+ lp.gravity = Gravity.TOP or Gravity.START+ lp.x = screenWidth() - size - dpToPx(8)+ lp.y = dpToPx(120)+ params = lp++ var initialX = 0+ var initialY = 0+ var touchX = 0f+ var touchY = 0f+ var moved = false++ container.setOnTouchListener { _, event ->+ when (event.action) {+ MotionEvent.ACTION_DOWN -> {+ cancelIdle()+ restore()+ initialX = lp.x+ initialY = lp.y+ touchX = event.rawX+ touchY = event.rawY+ moved = false+ true+ }+ MotionEvent.ACTION_MOVE -> {+ val dx = (event.rawX - touchX).toInt()+ val dy = (event.rawY - touchY).toInt()+ if (Math.abs(dx) > dpToPx(4) || Math.abs(dy) > dpToPx(4)) moved = true+ lp.x = initialX + dx+ lp.y = initialY + dy+ windowManager.updateViewLayout(container, lp)+ true+ }+ MotionEvent.ACTION_UP -> {+ if (!moved) {+ onTap()+ } else {+ snapToEdge()+ }+ scheduleIdle()+ true+ }+ else -> false+ }+ }++ windowManager.addView(container, lp)+ view = container+ scheduleIdle()+ }++ fun remove() {+ cancelIdle()+ snapAnimator?.cancel()+ view?.let { runCatching { windowManager.removeView(it) } }+ view = null+ params = null+ }++ /** True when the bubble sits on the right half of the screen — the menu opens on+ * that side so it doesn't overlap the bubble. */+ fun isOnRightSide(): Boolean {+ val lp = params ?: return true+ return lp.x + lp.width / 2 >= screenWidth() / 2+ }++ /** The bubble's current top in px, for vertically aligning the menu near it. */+ fun anchorTop(): Int = params?.y ?: dpToPx(120)++ /** Hide/show the bubble view without losing its dragged position — used while+ * the expanded toolbar is open (the toolbar is the un-collapsed form). */+ fun setShown(shown: Boolean) {+ view?.visibility = if (shown) View.VISIBLE else View.GONE+ }++ /** Bring the bubble fully back on-screen at full opacity (e.g. when the menu opens). */+ fun restore() {+ val v = view ?: return+ val lp = params ?: return+ if (!hidden) return+ hidden = false+ v.alpha = 1f+ lp.x = lp.x.coerceIn(0, maxX())+ windowManager.updateViewLayout(v, lp)+ }++ private fun scheduleIdle() {+ cancelIdle()+ handler.postDelayed(idleRunnable, IDLE_DELAY_MS)+ }++ private fun cancelIdle() = handler.removeCallbacks(idleRunnable)++ private fun snapToEdge() {+ val v = view ?: return+ val lp = params ?: return+ val target = if (lp.x + lp.width / 2 < screenWidth() / 2) 0 else maxX()+ lp.y = lp.y.coerceIn(0, maxY())+ animateX(v, lp, target)+ }++ private fun hideToEdge() {+ val v = view ?: return+ val lp = params ?: return+ hidden = true+ val onRight = lp.x + lp.width / 2 >= screenWidth() / 2+ val target = if (onRight) screenWidth() - lp.width / 2 else -lp.width / 2+ v.alpha = 0.6f+ animateX(v, lp, target)+ }++ private fun animateX(+ v: View,+ lp: WindowManager.LayoutParams,+ target: Int,+ ) {+ snapAnimator?.cancel()+ val from = lp.x+ if (from == target) return+ snapAnimator =+ ValueAnimator.ofInt(from, target).apply {+ duration = 180+ addUpdateListener {+ lp.x = it.animatedValue as Int+ runCatching { windowManager.updateViewLayout(v, lp) }+ }+ start()+ }+ }++ private fun screenWidth(): Int = context.resources.displayMetrics.widthPixels++ private fun screenHeight(): Int = context.resources.displayMetrics.heightPixels++ private fun maxX(): Int = (screenWidth() - (params?.width ?: 0) - dpToPx(8)).coerceAtLeast(0)++ private fun maxY(): Int = (screenHeight() - (params?.height ?: 0) - dpToPx(8)).coerceAtLeast(0)++ companion object {+ private const val IDLE_DELAY_MS = 1250L+ }+}diff --git a/OCR-translation/src/main/java/dev/davidv/translator/overlayChrome/OverlayChromeFactory.kt b/OCR-translation/src/main/java/dev/davidv/translator/overlayChrome/OverlayChromeFactory.ktnew file mode 100644index 0000000..da168c3--- /dev/null+++ b/OCR-translation/src/main/java/dev/davidv/translator/overlayChrome/OverlayChromeFactory.kt@@ -0,0 +1,401 @@+package dev.davidv.translator.overlayChrome++import android.content.Context+import android.graphics.Color+import android.graphics.drawable.GradientDrawable+import android.text.TextUtils+import android.util.TypedValue+import android.view.Gravity+import android.view.View+import android.widget.FrameLayout+import android.widget.ImageView+import android.widget.LinearLayout+import android.widget.ScrollView+import android.widget.TextView+import dev.davidv.translator.Language+import dev.davidv.translator.R+import dev.davidv.translator.ReadingOrder+import dev.davidv.translator.localizedName++data class LanguageToolbarViews(+ val root: View,+ val sourceLabel: TextView,+ val targetLabel: TextView,+ val readingOrderButton: View? = null,+ val readingOrderIcon: ImageView? = null,+ val pauseIcon: ImageView? = null,+ val flipIcon: ImageView? = null,+ val flipButton: View? = null,+ val refreshButton: View? = null,+ val selectIcon: ImageView? = null,+)++object OverlayChromeFactory {+ val ACTIVE_ICON_TINT: Int = Color.parseColor("#8AB4F8")++ fun formatSourceLabel(+ forcedSourceLanguage: Language?,+ isAutoSource: Boolean,+ ): String =+ when {+ isAutoSource && forcedSourceLanguage != null -> "✨ ${forcedSourceLanguage.shortDisplayName}"+ isAutoSource -> "✨ Auto"+ else -> forcedSourceLanguage?.shortDisplayName ?: "?"+ }++ fun createLanguageToolbar(+ context: Context,+ dpToPx: (Int) -> Int,+ forcedSourceLanguage: Language?,+ forcedTargetLanguage: Language?,+ defaultTargetLanguage: Language,+ onClose: () -> Unit,+ onSelectModeClick: (() -> Unit)? = null,+ onSourceClick: () -> Unit,+ onSwap: () -> Unit,+ onTargetClick: () -> Unit,+ showReadingOrderButton: Boolean = false,+ readingOrder: ReadingOrder? = null,+ onReadingOrderClick: (() -> Unit)? = null,+ onRefreshClick: (() -> Unit)? = null,+ onRegionClick: (() -> Unit)? = null,+ onFlipOriginal: (() -> Unit)? = null,+ onPauseClick: (() -> Unit)? = null,+ isPaused: Boolean = false,+ onMenuClick: (() -> Unit)? = null,+ isAutoSource: Boolean = false,+ ): LanguageToolbarViews {+ val toolbar = FrameLayout(context)+ val pad = dpToPx(6)+ toolbar.setPadding(pad, pad, pad, pad)++ val btnSize = dpToPx(32)+ val iconPad = dpToPx(6)+ val closeBtn = ImageView(context)+ closeBtn.setImageResource(R.drawable.cancel)+ closeBtn.setPadding(iconPad, iconPad, iconPad, iconPad)+ closeBtn.setOnClickListener { onClose() }+ val closePill = makePill(context, dpToPx, closeBtn)+ toolbar.addView(+ closePill,+ FrameLayout.LayoutParams(btnSize, btnSize).apply {+ gravity = Gravity.START or Gravity.CENTER_VERTICAL+ },+ )++ val hasSelectMode = onSelectModeClick != null+ var selectIcon: ImageView? = null+ onSelectModeClick?.let {+ val selectBtn =+ ImageView(context).apply {+ setImageResource(R.drawable.text_select_start)+ setColorFilter(Color.WHITE)+ setPadding(iconPad, iconPad, iconPad, iconPad)+ setOnClickListener { onSelectModeClick() }+ contentDescription = context.getString(R.string.a11y_select_text)+ }+ selectIcon = selectBtn+ val selectPill = makePill(context, dpToPx, selectBtn)+ toolbar.addView(+ selectPill,+ FrameLayout.LayoutParams(btnSize, btnSize).apply {+ gravity = Gravity.START or Gravity.CENTER_VERTICAL+ leftMargin = btnSize + dpToPx(6)+ },+ )+ }++ var readingOrderIcon: ImageView? = null+ val readingOrderPill =+ onReadingOrderClick?.let {+ val readingBtn =+ ImageView(context).apply {+ setPadding(iconPad, iconPad, iconPad, iconPad)+ setOnClickListener { onReadingOrderClick() }+ }+ readingOrderIcon = readingBtn+ updateReadingOrderButtonState(+ readingButton = null,+ readingIcon = readingBtn,+ visible = showReadingOrderButton,+ readingOrder = readingOrder,+ )+ makePill(context, dpToPx, readingBtn).also { pill ->+ pill.visibility = if (showReadingOrderButton) View.VISIBLE else View.GONE+ toolbar.addView(+ pill,+ FrameLayout.LayoutParams(btnSize, btnSize).apply {+ gravity = Gravity.START or Gravity.CENTER_VERTICAL+ leftMargin = (btnSize + dpToPx(6)) * (if (hasSelectMode) 2 else 1)+ },+ )+ }+ }++ val langRow = LinearLayout(context)+ langRow.orientation = LinearLayout.HORIZONTAL+ langRow.gravity = Gravity.CENTER_VERTICAL+ langRow.setPadding(dpToPx(12), dpToPx(8), dpToPx(12), dpToPx(8))++ val sourceLabel = TextView(context)+ sourceLabel.text = formatSourceLabel(forcedSourceLanguage, isAutoSource)+ sourceLabel.setTextColor(Color.WHITE)+ sourceLabel.setTextSize(TypedValue.COMPLEX_UNIT_SP, 14f)+ sourceLabel.gravity = Gravity.CENTER+ sourceLabel.maxLines = 1+ sourceLabel.ellipsize = TextUtils.TruncateAt.END+ sourceLabel.setOnClickListener { onSourceClick() }+ langRow.addView(sourceLabel, LinearLayout.LayoutParams(0, LinearLayout.LayoutParams.MATCH_PARENT, 1f))++ val swapBtn = ImageView(context)+ swapBtn.setImageResource(R.drawable.compare)+ swapBtn.setColorFilter(Color.WHITE)+ val swapSize = dpToPx(20)+ val swapPad = dpToPx(6)+ swapBtn.setPadding(swapPad, 0, swapPad, 0)+ swapBtn.setOnClickListener { onSwap() }+ langRow.addView(swapBtn, LinearLayout.LayoutParams(swapSize + swapPad * 2, swapSize))++ val currentTarget = forcedTargetLanguage ?: defaultTargetLanguage+ val targetLabel = TextView(context)+ targetLabel.text = currentTarget.shortDisplayName+ targetLabel.setTextColor(Color.WHITE)+ targetLabel.setTextSize(TypedValue.COMPLEX_UNIT_SP, 14f)+ targetLabel.gravity = Gravity.CENTER+ targetLabel.maxLines = 1+ targetLabel.ellipsize = TextUtils.TruncateAt.END+ targetLabel.setOnClickListener { onTargetClick() }+ langRow.addView(targetLabel, LinearLayout.LayoutParams(0, LinearLayout.LayoutParams.MATCH_PARENT, 1f))++ val langPill = makePill(context, dpToPx, langRow)+ toolbar.addView(+ langPill,+ FrameLayout.LayoutParams(dpToPx(200), FrameLayout.LayoutParams.WRAP_CONTENT).apply {+ gravity = Gravity.CENTER+ },+ )++ val rightActions =+ LinearLayout(context).apply {+ orientation = LinearLayout.HORIZONTAL+ gravity = Gravity.CENTER_VERTICAL+ }++ var refreshButton: View? = null+ onRefreshClick?.let {+ val refreshBtn =+ ImageView(context).apply {+ setImageResource(R.drawable.refresh)+ setColorFilter(Color.WHITE)+ setPadding(iconPad, iconPad, iconPad, iconPad)+ setOnClickListener { onRefreshClick() }+ contentDescription = context.getString(R.string.a11y_refresh)+ }+ val refreshPill = makePill(context, dpToPx, refreshBtn)+ refreshButton = refreshPill+ rightActions.addView(+ refreshPill,+ LinearLayout.LayoutParams(btnSize, btnSize).apply {+ marginEnd = dpToPx(6)+ },+ )+ }++ onRegionClick?.let {+ val regionBtn =+ ImageView(context).apply {+ setImageResource(R.drawable.activity_zone)+ setColorFilter(Color.WHITE)+ setPadding(iconPad, iconPad, iconPad, iconPad)+ setOnClickListener { onRegionClick() }+ contentDescription = context.getString(R.string.a11y_set_translation_area)+ }+ val regionPill = makePill(context, dpToPx, regionBtn)+ rightActions.addView(+ regionPill,+ LinearLayout.LayoutParams(btnSize, btnSize).apply {+ marginEnd = dpToPx(6)+ },+ )+ }++ var flipIcon: ImageView? = null+ var flipButton: View? = null+ onFlipOriginal?.let {+ val flipBtn =+ ImageView(context).apply {+ setImageResource(R.drawable.flip)+ setColorFilter(Color.WHITE)+ setPadding(iconPad, iconPad, iconPad, iconPad)+ setOnClickListener { onFlipOriginal() }+ contentDescription = context.getString(R.string.a11y_show_original)+ }+ flipIcon = flipBtn+ val flipPill = makePill(context, dpToPx, flipBtn)+ flipButton = flipPill+ rightActions.addView(+ flipPill,+ LinearLayout.LayoutParams(btnSize, btnSize).apply {+ marginEnd = dpToPx(6)+ },+ )+ }++ var pauseIcon: ImageView? = null+ onPauseClick?.let {+ val pauseBtn =+ ImageView(context).apply {+ setImageResource(if (isPaused) R.drawable.play_arrow else R.drawable.pause)+ setColorFilter(Color.WHITE)+ setPadding(iconPad, iconPad, iconPad, iconPad)+ setOnClickListener { onPauseClick() }+ contentDescription = context.getString(R.string.a11y_pause_resume)+ }+ pauseIcon = pauseBtn+ val pausePill = makePill(context, dpToPx, pauseBtn)+ rightActions.addView(+ pausePill,+ LinearLayout.LayoutParams(btnSize, btnSize).apply {+ marginEnd = dpToPx(6)+ },+ )+ }++ onMenuClick?.let {+ val menuBtn = ImageView(context)+ menuBtn.setImageResource(R.drawable.more_vert)+ menuBtn.setPadding(iconPad, iconPad, iconPad, iconPad)+ menuBtn.setOnClickListener { onMenuClick() }+ val menuPill = makePill(context, dpToPx, menuBtn)+ rightActions.addView(menuPill, LinearLayout.LayoutParams(btnSize, btnSize))+ }+ toolbar.addView(+ rightActions,+ FrameLayout.LayoutParams(FrameLayout.LayoutParams.WRAP_CONTENT, FrameLayout.LayoutParams.WRAP_CONTENT).apply {+ gravity = Gravity.END or Gravity.CENTER_VERTICAL+ },+ )++ return LanguageToolbarViews(+ root = toolbar,+ sourceLabel = sourceLabel,+ targetLabel = targetLabel,+ readingOrderButton = readingOrderPill,+ readingOrderIcon = readingOrderIcon,+ pauseIcon = pauseIcon,+ flipIcon = flipIcon,+ flipButton = flipButton,+ refreshButton = refreshButton,+ selectIcon = selectIcon,+ )+ }++ fun setPauseIconState(+ pauseIcon: ImageView?,+ isPaused: Boolean,+ ) {+ pauseIcon?.setImageResource(if (isPaused) R.drawable.play_arrow else R.drawable.pause)+ pauseIcon?.setColorFilter(Color.WHITE)+ }++ fun updateReadingOrderButtonState(+ readingButton: View?,+ readingIcon: ImageView?,+ visible: Boolean,+ readingOrder: ReadingOrder?,+ ) {+ readingButton?.visibility = if (visible) View.VISIBLE else View.GONE+ readingIcon?.apply {+ val (iconRes, description) =+ when (readingOrder) {+ null -> R.drawable.text_rotation_auto to "Japanese OCR auto mode"+ ReadingOrder.TOP_TO_BOTTOM_RIGHT_TO_LEFT -> R.drawable.text_rotate_vertical to "Japanese OCR vertical mode"+ ReadingOrder.LEFT_TO_RIGHT -> R.drawable.text_rotation_none to "Japanese OCR horizontal mode"+ }+ setImageResource(iconRes)+ setColorFilter(Color.WHITE)+ contentDescription = description+ }+ }++ fun createLanguagePicker(+ context: Context,+ dpToPx: (Int) -> Int,+ isSource: Boolean,+ availableLangs: List<Language>,+ allowAuto: Boolean = true,+ onPick: (Language?) -> Unit,+ ): ScrollView {+ val scroll = ScrollView(context)+ val list = LinearLayout(context)+ list.orientation = LinearLayout.VERTICAL+ val bg = GradientDrawable()+ bg.setColor(Color.parseColor("#E0303030"))+ bg.cornerRadius = dpToPx(12).toFloat()+ list.background = bg+ val listPad = dpToPx(8)+ list.setPadding(listPad, listPad, listPad, listPad)++ if (isSource && allowAuto) {+ addMenuItem(context, list, dpToPx, "\u2728 Auto-detect") {+ onPick(null)+ }+ }++ for (lang in availableLangs) {+ addMenuItem(context, list, dpToPx, lang.localizedName()) {+ onPick(lang)+ }+ }++ scroll.addView(list)+ return scroll+ }++ fun createMenuContainer(+ context: Context,+ dpToPx: (Int) -> Int,+ ): LinearLayout {+ val container = LinearLayout(context)+ container.orientation = LinearLayout.VERTICAL+ val bg = GradientDrawable()+ bg.setColor(Color.parseColor("#E0303030"))+ bg.cornerRadius = dpToPx(12).toFloat()+ container.background = bg+ val pad = dpToPx(8)+ container.setPadding(pad, pad, pad, pad)+ return container+ }++ fun makePill(+ context: Context,+ dpToPx: (Int) -> Int,+ view: View,+ ): FrameLayout {+ val pill = FrameLayout(context)+ val bg = GradientDrawable()+ bg.setColor(Color.parseColor("#CC303030"))+ bg.cornerRadius = dpToPx(20).toFloat()+ pill.background = bg+ pill.addView(view)+ return pill+ }++ fun addMenuItem(+ context: Context,+ parent: LinearLayout,+ dpToPx: (Int) -> Int,+ label: String,+ enabled: Boolean = true,+ onClick: () -> Unit,+ ) {+ val item = TextView(context)+ item.text = label+ item.setTextColor(if (enabled) Color.WHITE else Color.parseColor("#60FFFFFF"))+ item.setTextSize(TypedValue.COMPLEX_UNIT_SP, 15f)+ val pad = dpToPx(12)+ item.setPadding(pad, pad, pad, pad)+ item.setOnClickListener { onClick() }+ parent.addView(item)+ }+}diff --git a/OCR-translation/src/main/java/dev/davidv/translator/overlayChrome/OverlayInsets.kt b/OCR-translation/src/main/java/dev/davidv/translator/overlayChrome/OverlayInsets.ktnew file mode 100644index 0000000..9fa2917--- /dev/null+++ b/OCR-translation/src/main/java/dev/davidv/translator/overlayChrome/OverlayInsets.kt@@ -0,0 +1,72 @@+package dev.davidv.translator.overlayChrome++import android.content.res.Resources+import android.graphics.Rect+import android.os.Build+import android.view.WindowInsets+import android.view.WindowManager+import androidx.annotation.RequiresApi+import androidx.core.graphics.Insets++object OverlayInsets {+ /** Top offset that clears both the status bar and any display cutout. The+ * status_bar_height resource alone undershoots on notched devices where the+ * cutout is taller than the reported status bar. */+ fun topInset(+ windowManager: WindowManager,+ resources: Resources,+ ): Int {+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {+ return windowManager.currentWindowMetrics.windowInsets+ .getInsets(WindowInsets.Type.statusBars() or WindowInsets.Type.displayCutout())+ .top+ }+ val cutoutTop =+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {+ @Suppress("DEPRECATION")+ windowManager.defaultDisplay.cutout?.safeInsetTop ?: 0+ } else {+ 0+ }+ return maxOf(statusBarHeight(resources), cutoutTop)+ }++ fun contentBounds(+ bounds: Rect,+ insets: Insets,+ ): Rect =+ Rect(+ bounds.left + insets.left,+ bounds.top + insets.top,+ bounds.right - insets.right,+ bounds.bottom - insets.bottom,+ )++ @RequiresApi(Build.VERSION_CODES.R)+ fun contentBounds(windowManager: WindowManager): Rect {+ val metrics = windowManager.currentWindowMetrics+ val insets =+ metrics.windowInsets.getInsets(+ WindowInsets.Type.systemBars() or WindowInsets.Type.displayCutout(),+ )+ return contentBounds(metrics.bounds, Insets.of(insets.left, insets.top, insets.right, insets.bottom))+ }++ fun statusBarHeight(resources: Resources): Int {+ val id = resources.getIdentifier("status_bar_height", "dimen", "android")+ return if (id > 0) {+ resources.getDimensionPixelSize(id)+ } else {+ (24 * resources.displayMetrics.density).toInt()+ }+ }+}++fun WindowManager.LayoutParams.spanFullDisplay() {+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {+ layoutInDisplayCutoutMode = WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS+ }+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {+ setFitInsetsTypes(0)+ }+}diff --git a/OCR-translation/src/main/java/dev/davidv/translator/overlayChrome/OverlayMenuManager.kt b/OCR-translation/src/main/java/dev/davidv/translator/overlayChrome/OverlayMenuManager.ktnew file mode 100644index 0000000..7638ce4--- /dev/null+++ b/OCR-translation/src/main/java/dev/davidv/translator/overlayChrome/OverlayMenuManager.kt@@ -0,0 +1,89 @@+package dev.davidv.translator.overlayChrome++import android.content.Context+import android.graphics.Color+import android.view.View+import dev.davidv.translator.Language++interface OverlayMenuHost {+ fun addDismissLayer(view: View)++ fun addMenuView(view: View)++ fun addPickerView(view: View)++ fun removeMenuChild(view: View)+}++class OverlayMenuManager(+ private val context: Context,+ private val dpToPx: (Int) -> Int,+ private val host: OverlayMenuHost,+) {+ private var dismissLayer: View? = null+ private var menuView: View? = null++ fun showDotsMenu(menuItems: List<Pair<String, () -> Unit>>) {+ dismiss()++ val dismissView =+ View(context).apply {+ setBackgroundColor(Color.TRANSPARENT)+ setOnClickListener { dismiss() }+ }+ host.addDismissLayer(dismissView)+ dismissLayer = dismissView++ val menuContainer = OverlayChromeFactory.createMenuContainer(context, dpToPx)+ for ((label, action) in menuItems) {+ OverlayChromeFactory.addMenuItem(context, menuContainer, dpToPx, label) {+ dismiss()+ action()+ }+ }+ host.addMenuView(menuContainer)+ menuView = menuContainer+ }++ fun showLanguagePicker(+ isSource: Boolean,+ availableLangs: List<Language>,+ allowAuto: Boolean = true,+ onPick: (Language?) -> Unit,+ ) {+ dismiss()++ val dismissView =+ View(context).apply {+ setBackgroundColor(Color.parseColor("#80000000"))+ setOnClickListener { dismiss() }+ }+ host.addDismissLayer(dismissView)+ dismissLayer = dismissView++ val picker =+ OverlayChromeFactory.createLanguagePicker(+ context = context,+ dpToPx = dpToPx,+ isSource = isSource,+ availableLangs = availableLangs,+ allowAuto = allowAuto,+ ) { language ->+ onPick(language)+ dismiss()+ }+ host.addPickerView(picker)+ menuView = picker+ }++ fun dismiss() {+ dismissLayer?.let {+ host.removeMenuChild(it)+ dismissLayer = null+ }+ menuView?.let {+ host.removeMenuChild(it)+ menuView = null+ }+ }+}diff --git a/OCR-translation/src/main/java/dev/davidv/translator/overlayChrome/RegionSelectView.kt b/OCR-translation/src/main/java/dev/davidv/translator/overlayChrome/RegionSelectView.ktnew file mode 100644index 0000000..c3fe40a--- /dev/null+++ b/OCR-translation/src/main/java/dev/davidv/translator/overlayChrome/RegionSelectView.kt@@ -0,0 +1,267 @@+/*+ * Copyright (C) 2024 David V+ *+ * This program 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.+ *+ * This program 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 <https://www.gnu.org/licenses/>.+ */++package dev.davidv.translator.overlayChrome++import android.content.Context+import android.graphics.Canvas+import android.graphics.Color+import android.graphics.DashPathEffect+import android.graphics.Paint+import android.graphics.Path+import android.graphics.RectF+import android.view.Gravity+import android.view.MotionEvent+import android.view.View+import android.widget.FrameLayout+import android.widget.ImageView+import android.widget.LinearLayout+import dev.davidv.translator.R++/** Normalized `[0,1]` region (origin top-left), the shape [LiveScreenTracker.setRegion] wants. */+data class NormalizedRegion(+ val left: Float,+ val top: Float,+ val right: Float,+ val bottom: Float,+)++/**+ * Full-screen region editor: a draggable / resizable rectangle with corner and+ * edge handles (the rest of the screen dimmed), plus a confirm / reset / cancel+ * control row. Reports the chosen area in normalized coordinates so it is+ * independent of the capture resolution. Shared by the overlay services.+ */+class RegionSelectView(+ context: Context,+ private val dpToPx: (Int) -> Int,+ initial: NormalizedRegion?,+ private val onConfirm: (NormalizedRegion) -> Unit,+ private val onReset: () -> Unit,+ private val onCancel: () -> Unit,+) : FrameLayout(context) {+ private val canvas = EditCanvas(context, initial)++ init {+ addView(canvas, LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT))++ val controls =+ LinearLayout(context).apply {+ orientation = LinearLayout.HORIZONTAL+ gravity = Gravity.CENTER+ }+ controls.addView(controlPill(R.drawable.cancel, context.getString(R.string.a11y_cancel)) { onCancel() })+ controls.addView(controlPill(R.drawable.delete, context.getString(R.string.a11y_region_reset)) { onReset() })+ controls.addView(+ controlPill(R.drawable.check_plain, context.getString(R.string.a11y_region_confirm)) { onConfirm(canvas.normalized()) },+ )+ addView(+ controls,+ LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT).apply {+ gravity = Gravity.BOTTOM or Gravity.CENTER_HORIZONTAL+ bottomMargin = dpToPx(40)+ },+ )+ }++ private fun controlPill(+ iconRes: Int,+ description: String,+ onClick: () -> Unit,+ ): View {+ val size = dpToPx(52)+ val pad = dpToPx(13)+ val icon =+ ImageView(context).apply {+ setImageResource(iconRes)+ setColorFilter(Color.WHITE)+ setPadding(pad, pad, pad, pad)+ contentDescription = description+ setOnClickListener { onClick() }+ }+ val pill = OverlayChromeFactory.makePill(context, dpToPx, icon)+ pill.layoutParams = LinearLayout.LayoutParams(size, size).apply { marginEnd = dpToPx(12) }+ return pill+ }++ /** The drawing + touch surface. Coordinates are pixels within this view (full screen). */+ private inner class EditCanvas(+ context: Context,+ initial: NormalizedRegion?,+ ) : View(context) {+ private val rect = RectF()+ private var pendingInit: NormalizedRegion? = initial+ private var mode = Mode.NONE+ private var lastX = 0f+ private var lastY = 0f+ private val handleR = dpToPx(9).toFloat()+ private val hitR = dpToPx(22).toFloat()+ private val minSize = dpToPx(48).toFloat()++ private val dimPaint =+ Paint().apply {+ color = Color.parseColor("#99000000")+ style = Paint.Style.FILL+ }+ private val borderPaint =+ Paint(Paint.ANTI_ALIAS_FLAG).apply {+ color = Color.parseColor("#F1AB7F")+ style = Paint.Style.STROKE+ strokeWidth = dpToPx(2).toFloat()+ pathEffect = DashPathEffect(floatArrayOf(dpToPx(8).toFloat(), dpToPx(6).toFloat()), 0f)+ }+ private val handleFill =+ Paint(Paint.ANTI_ALIAS_FLAG).apply {+ color = Color.WHITE+ style = Paint.Style.FILL+ }+ private val handleStroke =+ Paint(Paint.ANTI_ALIAS_FLAG).apply {+ color = Color.parseColor("#F1AB7F")+ style = Paint.Style.STROKE+ strokeWidth = dpToPx(2).toFloat()+ }++ override fun onSizeChanged(+ w: Int,+ h: Int,+ oldw: Int,+ oldh: Int,+ ) {+ val init = pendingInit+ if (init != null) {+ rect.set(init.left * w, init.top * h, init.right * w, init.bottom * h)+ } else {+ rect.set(w * 0.15f, h * 0.25f, w * 0.85f, h * 0.7f)+ }+ pendingInit = null+ }++ fun normalized(): NormalizedRegion {+ val w = width.coerceAtLeast(1).toFloat()+ val h = height.coerceAtLeast(1).toFloat()+ return NormalizedRegion(+ (rect.left / w).coerceIn(0f, 1f),+ (rect.top / h).coerceIn(0f, 1f),+ (rect.right / w).coerceIn(0f, 1f),+ (rect.bottom / h).coerceIn(0f, 1f),+ )+ }++ override fun onDraw(c: Canvas) {+ // Dim everything outside the rect (even-odd: whole view minus the rect).+ val dim =+ Path().apply {+ fillType = Path.FillType.EVEN_ODD+ addRect(0f, 0f, width.toFloat(), height.toFloat(), Path.Direction.CW)+ addRect(rect, Path.Direction.CW)+ }+ c.drawPath(dim, dimPaint)+ c.drawRect(rect, borderPaint)+ for ((hx, hy) in handlePoints()) {+ c.drawCircle(hx, hy, handleR, handleFill)+ c.drawCircle(hx, hy, handleR, handleStroke)+ }+ }++ private fun handlePoints(): List<Pair<Float, Float>> {+ val cx = (rect.left + rect.right) / 2+ val cy = (rect.top + rect.bottom) / 2+ return listOf(+ rect.left to rect.top,+ cx to rect.top,+ rect.right to rect.top,+ rect.left to cy,+ rect.right to cy,+ rect.left to rect.bottom,+ cx to rect.bottom,+ rect.right to rect.bottom,+ )+ }++ override fun onTouchEvent(event: MotionEvent): Boolean {+ when (event.action) {+ MotionEvent.ACTION_DOWN -> {+ mode = pickMode(event.x, event.y)+ lastX = event.x+ lastY = event.y+ return mode != Mode.NONE+ }+ MotionEvent.ACTION_MOVE -> {+ val dx = event.x - lastX+ val dy = event.y - lastY+ applyDrag(dx, dy)+ lastX = event.x+ lastY = event.y+ invalidate()+ return true+ }+ }+ return false+ }++ private fun pickMode(+ x: Float,+ y: Float,+ ): Mode {+ val near = { a: Float, b: Float -> Math.abs(a - b) <= hitR }+ val onLeft = near(x, rect.left)+ val onRight = near(x, rect.right)+ val onTop = near(y, rect.top)+ val onBottom = near(y, rect.bottom)+ val inX = x >= rect.left - hitR && x <= rect.right + hitR+ val inY = y >= rect.top - hitR && y <= rect.bottom + hitR+ return when {+ onLeft && onTop -> Mode.TL+ onRight && onTop -> Mode.TR+ onLeft && onBottom -> Mode.BL+ onRight && onBottom -> Mode.BR+ onLeft && inY -> Mode.L+ onRight && inY -> Mode.R+ onTop && inX -> Mode.T+ onBottom && inX -> Mode.B+ rect.contains(x, y) -> Mode.MOVE+ else -> Mode.NONE+ }+ }++ private fun applyDrag(+ dx: Float,+ dy: Float,+ ) {+ val w = width.toFloat()+ val h = height.toFloat()+ when (mode) {+ Mode.MOVE -> {+ val nx = (rect.left + dx).coerceIn(0f, w - rect.width())+ val ny = (rect.top + dy).coerceIn(0f, h - rect.height())+ rect.offsetTo(nx, ny)+ }+ Mode.L, Mode.TL, Mode.BL -> rect.left = (rect.left + dx).coerceIn(0f, rect.right - minSize)+ Mode.R, Mode.TR, Mode.BR -> rect.right = (rect.right + dx).coerceIn(rect.left + minSize, w)+ else -> {}+ }+ when (mode) {+ Mode.T, Mode.TL, Mode.TR -> rect.top = (rect.top + dy).coerceIn(0f, rect.bottom - minSize)+ Mode.B, Mode.BL, Mode.BR -> rect.bottom = (rect.bottom + dy).coerceIn(rect.top + minSize, h)+ else -> {}+ }+ }+ }++ private enum class Mode { NONE, MOVE, L, R, T, B, TL, TR, BL, BR }+}diff --git a/OCR-translation/src/main/java/dev/davidv/translator/screenTranslate/GpuOverlayTextureView.kt b/OCR-translation/src/main/java/dev/davidv/translator/screenTranslate/GpuOverlayTextureView.ktnew file mode 100644index 0000000..32fcf11--- /dev/null+++ b/OCR-translation/src/main/java/dev/davidv/translator/screenTranslate/GpuOverlayTextureView.kt@@ -0,0 +1,69 @@+/*+ * Copyright (C) 2024 David V+ *+ * This program 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.+ *+ * This program 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 <https://www.gnu.org/licenses/>.+ */++package dev.davidv.translator.screenTranslate++import android.content.Context+import android.graphics.SurfaceTexture+import android.view.TextureView++/**+ * Output surface for the GPU screen overlay. A TextureView composites its GL+ * content *through the window* (unlike a SurfaceView, which is a separate+ * full-opacity SurfaceFlinger layer), so the window's sub-cap alpha dims it and+ * Android 12+'s obscured-touch rule lets taps fall through to the app below —+ * validated on device. The [ScreenCaptureGlWorker] owns all GL: it creates an+ * EGL window surface from this view's SurfaceTexture and presents the overlay+ * straight into it. This view only forwards the SurfaceTexture's lifecycle.+ */+class GpuOverlayTextureView(context: Context) :+ TextureView(context),+ TextureView.SurfaceTextureListener {+ /** Invoked on the UI thread with the live SurfaceTexture when it becomes+ * available, and with `null` when it is destroyed. */+ var onSurfaceTexture: ((SurfaceTexture?) -> Unit)? = null++ init {+ isOpaque = false+ surfaceTextureListener = this+ }++ override fun onSurfaceTextureAvailable(+ surface: SurfaceTexture,+ width: Int,+ height: Int,+ ) {+ onSurfaceTexture?.invoke(surface)+ }++ override fun onSurfaceTextureDestroyed(surface: SurfaceTexture): Boolean {+ onSurfaceTexture?.invoke(null)+ return true+ }++ override fun onSurfaceTextureSizeChanged(+ surface: SurfaceTexture,+ width: Int,+ height: Int,+ ) {+ // On rotation the window (MATCH_PARENT) resizes; re-hand the surface so the GL+ // worker recreates its EGL window surface at the new size and presents correctly.+ onSurfaceTexture?.invoke(surface)+ }++ override fun onSurfaceTextureUpdated(surface: SurfaceTexture) {}+}diff --git a/OCR-translation/src/main/java/dev/davidv/translator/screenTranslate/LiveScreenTileService.kt b/OCR-translation/src/main/java/dev/davidv/translator/screenTranslate/LiveScreenTileService.ktnew file mode 100644index 0000000..e269c8a--- /dev/null+++ b/OCR-translation/src/main/java/dev/davidv/translator/screenTranslate/LiveScreenTileService.kt@@ -0,0 +1,66 @@+/*+ * Copyright (C) 2024 David V+ *+ * This program 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.+ *+ * This program 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 <https://www.gnu.org/licenses/>.+ */++package dev.davidv.translator.screenTranslate++import android.app.PendingIntent+import android.os.Build+import android.service.quicksettings.TileService+import android.widget.Toast+import androidx.annotation.RequiresApi+import dev.davidv.translator.R+import dev.davidv.translator.SettingsManager++/**+ * Quick Settings tile that starts live screen translation with the user's+ * default languages — needs only the overlay grant + MediaProjection consent+ * (handled by [ScreenCaptureRequestActivity]), no accessibility or assistant.+ * Live can't run the per-frame script classifier, so a default source language+ * must be set.+ */+@RequiresApi(Build.VERSION_CODES.N)+class LiveScreenTileService : TileService() {+ override fun onClick() {+ super.onClick()+ val settings = SettingsManager(this).settings.value+ val sourceCode = settings.defaultSourceLanguageCode+ if (sourceCode == null) {+ Toast.makeText(this, getString(R.string.screen_translate_needs_source), Toast.LENGTH_LONG).show()+ return+ }+ val intent =+ ScreenCaptureRequestActivity.intent(+ this,+ sourceCode = sourceCode,+ targetCode = settings.defaultTargetLanguageCode,+ isAutoSource = false,+ )+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE) {+ val pi =+ PendingIntent.getActivity(+ this,+ 0,+ intent,+ PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE,+ )+ startActivityAndCollapse(pi)+ } else {+ @Suppress("DEPRECATION")+ startActivityAndCollapse(intent)+ }+ }+}diff --git a/OCR-translation/src/main/java/dev/davidv/translator/screenTranslate/ScreenCaptureGlWorker.kt b/OCR-translation/src/main/java/dev/davidv/translator/screenTranslate/ScreenCaptureGlWorker.ktnew file mode 100644index 0000000..b945efb--- /dev/null+++ b/OCR-translation/src/main/java/dev/davidv/translator/screenTranslate/ScreenCaptureGlWorker.kt@@ -0,0 +1,576 @@+/*+ * Copyright (C) 2024 David V+ *+ * This program 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.+ *+ * This program 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 <https://www.gnu.org/licenses/>.+ */++package dev.davidv.translator.screenTranslate++import android.graphics.SurfaceTexture+import android.opengl.EGL14+import android.opengl.EGLConfig+import android.opengl.EGLContext+import android.opengl.EGLDisplay+import android.opengl.EGLSurface+import android.opengl.GLES20+import android.util.Log+import android.view.Surface+import dev.davidv.translator.GlEgl+import dev.davidv.translator.LivePipelineJni++/**+ * Off-screen GPU worker for screen-translate. A `VirtualDisplay` writes the+ * captured screen into a `GL_TEXTURE_EXTERNAL_OES`; per frame this drives the+ * same native overlay-only `GlesRenderer` the camera path uses to read back the+ * monitor gray / OCR inputs. When the overlay updates it is composited **on the+ * GPU straight into the overlay TextureView's EGL window surface** — no CPU+ * canvas readback, no Canvas view. See [GpuOverlayTextureView] for why a+ * TextureView (in-window, dimmed by the window alpha, taps pass through) and not+ * a SurfaceView (separate full-opacity layer that blocks taps).+ *+ * The GL context is created on a PBuffer surface so it is valid before the+ * TextureView's SurfaceTexture exists; the window surface is created lazily from+ * [setOutputSurfaceTexture] and kept current once available (the monitor+ * readbacks render to their own FBOs, so the bound surface is irrelevant to+ * them — only present/clear touch the window's back buffer and swap).+ */+class ScreenCaptureGlWorker(+ displayWidth: Int,+ displayHeight: Int,+) {+ @Volatile+ var pipelinePtr: Long = 0L++ // OCR canonical is half the display: read_camera_rgba renders into a half-res+ // FBO (cheap ~4.6MB readback) which rec crops from (det downsamples further).+ // The overlay PRESENT runs at full display res (pw/ph): the canvas rasterizes+ // glyphs at oversample=2 and is drawn 1:1, so present canonical=cw/ch and+ // surface=pw/ph (the canvas origin is in canonical coords, scaled to display).+ // `@Volatile var` (not val): a rotation resizes these in place via [resize] —+ // the GL loop reads them fresh each iteration. (The VirtualDisplay can't be+ // recreated on Android 14+, so resize is the only path; the loop also passes+ // these to the native present/readback, so updating them is sufficient.)+ @Volatile+ private var cw = (displayWidth / 2).coerceAtLeast(1)++ @Volatile+ private var ch = (displayHeight / 2).coerceAtLeast(1)++ @Volatile+ private var pw = displayWidth.coerceAtLeast(1)++ @Volatile+ private var ph = displayHeight.coerceAtLeast(1)++ private var glThread: GlThread? = null++ @Volatile+ private var sourceSurface: Surface? = null+ private val sourceSurfaceLock = Object()++ // The overlay TextureView's SurfaceTexture, handed off to the GL thread which+ // turns it into an EGL window surface. `dirty` is consumed once per change.+ private val outputLock = Object()+ private var pendingOutputSt: SurfaceTexture? = null+ private var outputDirty = false++ fun start() {+ glThread = GlThread().also { it.start() }+ }++ fun stop() {+ glThread?.shutdown()+ glThread = null+ }++ fun awaitSourceSurface(timeoutMs: Long = 5_000): Surface? {+ val deadline = System.currentTimeMillis() + timeoutMs+ synchronized(sourceSurfaceLock) {+ while (sourceSurface == null) {+ val remaining = deadline - System.currentTimeMillis()+ if (remaining <= 0) return null+ try {+ sourceSurfaceLock.wait(remaining)+ } catch (_: InterruptedException) {+ return null+ }+ }+ return sourceSurface+ }+ }++ fun setSourceBufferSize(+ width: Int,+ height: Int,+ ) {+ glThread?.setSourceBufferSize(width, height)+ }++ /** Pause/resume OCR + translation without tearing down the capture (used while+ * the region editor is open, or for a manual pause). */+ fun setPaused(paused: Boolean) {+ glThread?.setPaused(paused)+ }++ /** Clear the on-screen overlay window once (used when manually pausing). */+ fun clearOverlayOutput() {+ glThread?.requestClearOutput()+ }++ /** Rotation / display resize: update the canonical (OCR) and present (surface)+ * dimensions in place and resize the capture buffer. The GL loop reads the new+ * dims on its next iteration and passes them to the native present/readback;+ * the EGL window surface is recreated separately when the overlay TextureView+ * re-hands its (now-resized) SurfaceTexture. The caller resizes the+ * VirtualDisplay to match. */+ fun resize(+ displayWidth: Int,+ displayHeight: Int,+ ) {+ cw = (displayWidth / 2).coerceAtLeast(1)+ ch = (displayHeight / 2).coerceAtLeast(1)+ pw = displayWidth.coerceAtLeast(1)+ ph = displayHeight.coerceAtLeast(1)+ setSourceBufferSize(displayWidth, displayHeight)+ }++ /** Hand the overlay TextureView's SurfaceTexture (or `null` on destroy) to the+ * GL thread, which (re)creates the EGL window surface it presents into. */+ fun setOutputSurfaceTexture(st: SurfaceTexture?) {+ synchronized(outputLock) {+ pendingOutputSt = st+ outputDirty = true+ }+ glThread?.wake()+ }++ private fun publishSourceSurface(s: Surface) {+ synchronized(sourceSurfaceLock) {+ sourceSurface = s+ sourceSurfaceLock.notifyAll()+ }+ }++ private inner class GlThread : Thread("screen-translate-gl") {+ private var eglDisplay: EGLDisplay = EGL14.EGL_NO_DISPLAY+ private var eglContext: EGLContext = EGL14.EGL_NO_CONTEXT+ private var eglConfig: EGLConfig? = null+ private var eglPbuffer: EGLSurface = EGL14.EGL_NO_SURFACE+ private var eglWindowSurface: EGLSurface = EGL14.EGL_NO_SURFACE+ private var rendererPtr: Long = 0L+ private var sourceTexId: Int = 0++ private val stLock = Object()+ private var surfaceTexture: SurfaceTexture? = null++ @Volatile+ private var running = true++ // Pause OCR/translation (e.g. while the region editor is up) without tearing+ // the capture down: the loop keeps draining frames but skips monitor/dispatch/+ // present, so the overlay freezes and we don't OCR our own editor UI.+ @Volatile+ private var paused = false++ // One-shot: clear the overlay window on the GL thread even while paused (a+ // manual pause clears the on-screen overlays without resuming OCR).+ @Volatile+ private var clearRequested = false++ @Volatile+ private var srcBufW = 0++ @Volatile+ private var srcBufH = 0++ private val lock = Object()+ private var frameAvailable = false+ private val stMatrix = FloatArray(16)++ fun setSourceBufferSize(+ w: Int,+ h: Int,+ ) {+ synchronized(stLock) {+ srcBufW = w+ srcBufH = h+ surfaceTexture?.setDefaultBufferSize(w, h)+ }+ }++ /** Wake the loop from an idle `wait` (a new output surface, or shutdown). */+ fun wake() {+ synchronized(lock) {+ lock.notifyAll()+ }+ }++ fun setPaused(p: Boolean) {+ paused = p+ synchronized(lock) {+ lock.notifyAll()+ }+ }++ fun requestClearOutput() {+ clearRequested = true+ synchronized(lock) {+ lock.notifyAll()+ }+ }++ fun shutdown() {+ synchronized(lock) {+ running = false+ lock.notifyAll()+ }+ try {+ join(500)+ } catch (_: InterruptedException) {+ }+ }++ override fun run() {+ android.os.Process.setThreadPriority(android.os.Process.THREAD_PRIORITY_URGENT_DISPLAY)+ if (!setupEgl()) {+ Log.e(TAG, "EGL setup failed")+ return+ }+ rendererPtr = LivePipelineJni.createGlRenderer()+ if (rendererPtr == 0L) {+ Log.e(TAG, "createGlRenderer failed")+ teardownEgl()+ return+ }+ LivePipelineJni.setRendererOverlayOnly(rendererPtr)+ // Modal overlay opacity for the screen path. On-screen opacity is+ // OVERLAY_ALPHA × window-alpha; 1.0 keeps pills as opaque as the window+ // allows. Lower it for a more see-through overlay.+ LivePipelineJni.setRendererOverlayAlpha(rendererPtr, OVERLAY_ALPHA)+ sourceTexId = GlEgl.createExternalOesTexture()+ if (sourceTexId == 0) {+ Log.e(TAG, "createExternalOesTexture failed")+ LivePipelineJni.destroyGlRenderer(rendererPtr)+ rendererPtr = 0L+ teardownEgl()+ return+ }+ val st = SurfaceTexture(sourceTexId)+ synchronized(stLock) {+ surfaceTexture = st+ if (srcBufW > 0 && srcBufH > 0) st.setDefaultBufferSize(srcBufW, srcBufH)+ }+ st.setOnFrameAvailableListener {+ synchronized(lock) {+ frameAvailable = true+ lock.notifyAll()+ }+ }+ publishSourceSurface(Surface(st))+ Log.i(TAG, "screen-translate GL ready, canonical ${cw}x$ch, pipelinePtr=$pipelinePtr")++ // Auto change detection (SCREEN_CHANGE_DETECTION.md): per captured frame the+ // native monitor computes a coarse-gray diff (pill regions masked out) and+ // decides hide (movement) / acquire (settled) / nothing. On settle we+ // *dispatch* OCR to a background worker (non-blocking) and poll for results,+ // presenting provisional pills the instant detection lands and the full+ // translation when ready. The monitor keeps running during the acquire, so+ // movement aborts the in-flight OCR. `wantsTick`/`acquiring` drive timed+ // polling (the mirror stops emitting frames once the screen is static).+ var wantsTick = false+ var acquiring = false+ var lastVersion = 0L+ while (true) {+ var hadFrame = false+ synchronized(lock) {+ if (wantsTick || acquiring) {+ if (running && !frameAvailable) {+ try {+ lock.wait(POLL_MS)+ } catch (_: InterruptedException) {+ }+ }+ } else {+ while (running && !frameAvailable) {+ try {+ lock.wait()+ } catch (_: InterruptedException) {+ }+ }+ }+ if (!running) return@synchronized+ hadFrame = frameAvailable+ frameAvailable = false+ }+ if (!running) break++ // Pick up a new/destroyed output surface before touching it below.+ applyPendingOutputSurface()++ // Always drain the producer so its BufferQueue keeps flowing.+ if (hadFrame) {+ st.updateTexImage()+ st.getTransformMatrix(stMatrix)+ }+ val pipeline = pipelinePtr+ if (pipeline == 0L) continue++ // Honour a one-shot output clear even while paused (a manual pause wipes the+ // on-screen overlays without resuming OCR).+ if (clearRequested) {+ clearRequested = false+ clearOutput()+ lastVersion = LivePipelineJni.screenAcquireState(pipeline) and 0xFFFFFFFFL+ }++ // Paused (region editor up, or a manual pause): drained the frame above to+ // keep the queue flowing, now skip all OCR/present and abort anything in+ // flight so the overlay freezes. Frames from the editor add/remove still wake+ // the loop; it resumes on the next frame after unpausing.+ if (paused) {+ if (acquiring) {+ LivePipelineJni.screenAbortAcquire(pipeline)+ acquiring = false+ }+ continue+ }++ // Monitor movement/settle — runs even while acquiring, so movement during+ // an in-flight OCR aborts it.+ val now = System.nanoTime()+ val ret =+ if (hadFrame) {+ val uv = uvFromSurfaceTexture(stMatrix)+ LivePipelineJni.screenMonitorFrameGl(+ pipeline,+ rendererPtr,+ sourceTexId,+ cw,+ ch,+ uv,+ now,+ )+ } else {+ LivePipelineJni.screenMonitorTick(pipeline, now)+ }+ wantsTick = (ret and MONITOR_WANTS_TICK) != 0+ when (ret and MONITOR_ACTION_MASK) {+ MONITOR_ACTION_HIDE -> {+ clearOutput()+ if (acquiring) {+ LivePipelineJni.screenAbortAcquire(pipeline)+ acquiring = false+ Log.i(TAG, "movement during acquire → abort")+ }+ }+ MONITOR_ACTION_ACQUIRE -> {+ // Settled: dispatch OCR to the worker (non-blocking). The monitor only+ // returns Acquire once any post-drop settle has elapsed, so dropped+ // pills have left the captured frame; resident pills that stayed are+ // masked out of detection natively by their strip rects.+ val uv = uvFromSurfaceTexture(stMatrix)+ val dispatched =+ LivePipelineJni.screenDispatchAcquire(+ pipeline,+ rendererPtr,+ sourceTexId,+ cw,+ ch,+ pw,+ ph,+ uv,+ )+ if (dispatched != 0) {+ acquiring = true+ lastVersion = LivePipelineJni.screenAcquireState(pipeline) and 0xFFFFFFFFL+ } else {+ Log.w(TAG, "screenDispatchAcquire dropped (worker busy)")+ }+ }+ }++ // Present any overlay content change — the streamed provisional/full+ // overlays during an acquire, *and* a drop/clear the monitor made with no+ // acquire in flight. Gating this behind `acquiring` stranded a dropped pill+ // (never re-presented), so it must run on every version bump.+ val state = LivePipelineJni.screenAcquireState(pipeline)+ val version = state and 0xFFFFFFFFL+ val busy = (state ushr 32) != 0L+ if (version != lastVersion) {+ val tPresent = System.nanoTime()+ // An emptied overlay (last pill dropped) draws nothing — clear the window+ // so the stale pill leaves the screen.+ val drawn = presentOverlay(pipeline)+ if (!drawn) clearOutput()+ Log.i(TAG, "present v=$version drawn=$drawn (${(System.nanoTime() - tPresent) / 1_000_000}ms)")+ lastVersion = version+ }+ if (acquiring && !busy) acquiring = false+ }++ releaseWindowSurface()+ surfaceTexture?.release()+ surfaceTexture = null+ if (sourceTexId != 0) {+ GLES20.glDeleteTextures(1, intArrayOf(sourceTexId), 0)+ sourceTexId = 0+ }+ if (rendererPtr != 0L) {+ LivePipelineJni.destroyGlRenderer(rendererPtr)+ rendererPtr = 0L+ }+ teardownEgl()+ }++ /** Render the resident overlay into the window surface and swap it on. */+ private fun presentOverlay(pipeline: Long): Boolean {+ if (eglWindowSurface == EGL14.EGL_NO_SURFACE || pipeline == 0L) return false+ val drawn = LivePipelineJni.screenPresentOverlayGl(pipeline, rendererPtr, cw, ch, pw, ph)+ if (drawn != 0) {+ EGL14.eglSwapBuffers(eglDisplay, eglWindowSurface)+ return true+ }+ return false+ }++ /** Clear the window surface to transparent (the screen behind shows through)+ * and swap — the GPU equivalent of dropping the Canvas overlay on movement. */+ private fun clearOutput() {+ if (eglWindowSurface == EGL14.EGL_NO_SURFACE) return+ GLES20.glBindFramebuffer(GLES20.GL_FRAMEBUFFER, 0)+ GLES20.glViewport(0, 0, pw, ph)+ GLES20.glClearColor(0f, 0f, 0f, 0f)+ GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT)+ EGL14.eglSwapBuffers(eglDisplay, eglWindowSurface)+ }++ private fun applyPendingOutputSurface() {+ val st: SurfaceTexture?+ synchronized(outputLock) {+ if (!outputDirty) return+ outputDirty = false+ st = pendingOutputSt+ }+ updateOutputSurface(st)+ }++ private fun updateOutputSurface(st: SurfaceTexture?) {+ releaseWindowSurface()+ val cfg = eglConfig ?: return+ if (st == null) return+ val ws =+ EGL14.eglCreateWindowSurface(eglDisplay, cfg, st, intArrayOf(EGL14.EGL_NONE), 0)+ if (ws == EGL14.EGL_NO_SURFACE) {+ Log.e(TAG, "eglCreateWindowSurface failed: ${EGL14.eglGetError()}")+ return+ }+ eglWindowSurface = ws+ EGL14.eglMakeCurrent(eglDisplay, ws, ws, eglContext)+ // Initial transparent frame so the TextureView never composites an+ // undefined back buffer, then show whatever overlay is already resident.+ clearOutput()+ presentOverlay(pipelinePtr)+ Log.i(TAG, "output window surface ready ${pw}x$ph")+ }++ /** Destroy the window surface (if any), making the PBuffer current again so+ * the context stays valid for monitor readbacks. */+ private fun releaseWindowSurface() {+ if (eglWindowSurface == EGL14.EGL_NO_SURFACE) return+ EGL14.eglMakeCurrent(eglDisplay, eglPbuffer, eglPbuffer, eglContext)+ EGL14.eglDestroySurface(eglDisplay, eglWindowSurface)+ eglWindowSurface = EGL14.EGL_NO_SURFACE+ }++ private fun setupEgl(): Boolean {+ // One config serving both the startup PBuffer (context-current before the+ // TextureView exists) and the window surface we present into; alpha for the+ // translucent overlay layer.+ val core =+ GlEgl.initContext(+ intArrayOf(+ EGL14.EGL_RENDERABLE_TYPE, GlEgl.EGL_OPENGL_ES3_BIT,+ EGL14.EGL_SURFACE_TYPE, EGL14.EGL_WINDOW_BIT or EGL14.EGL_PBUFFER_BIT,+ EGL14.EGL_RED_SIZE, 8,+ EGL14.EGL_GREEN_SIZE, 8,+ EGL14.EGL_BLUE_SIZE, 8,+ EGL14.EGL_ALPHA_SIZE, 8,+ EGL14.EGL_NONE,+ ),+ ) ?: return false+ eglDisplay = core.display+ eglContext = core.context+ eglConfig = core.config+ eglPbuffer =+ EGL14.eglCreatePbufferSurface(+ eglDisplay,+ core.config,+ intArrayOf(EGL14.EGL_WIDTH, pw, EGL14.EGL_HEIGHT, ph, EGL14.EGL_NONE),+ 0,+ )+ if (eglPbuffer == EGL14.EGL_NO_SURFACE) return false+ return EGL14.eglMakeCurrent(eglDisplay, eglPbuffer, eglPbuffer, eglContext)+ }++ private fun teardownEgl() {+ if (eglDisplay != EGL14.EGL_NO_DISPLAY) {+ EGL14.eglMakeCurrent(+ eglDisplay,+ EGL14.EGL_NO_SURFACE,+ EGL14.EGL_NO_SURFACE,+ EGL14.EGL_NO_CONTEXT,+ )+ if (eglWindowSurface != EGL14.EGL_NO_SURFACE) {+ EGL14.eglDestroySurface(eglDisplay, eglWindowSurface)+ }+ if (eglPbuffer != EGL14.EGL_NO_SURFACE) EGL14.eglDestroySurface(eglDisplay, eglPbuffer)+ GlEgl.destroyContext(eglDisplay, eglContext)+ }+ eglWindowSurface = EGL14.EGL_NO_SURFACE+ eglPbuffer = EGL14.EGL_NO_SURFACE+ eglDisplay = EGL14.EGL_NO_DISPLAY+ eglContext = EGL14.EGL_NO_CONTEXT+ eglConfig = null+ }+ }++ companion object {+ private const val TAG = "ScreenCaptureGlWorker"++ /** Overlay opacity multiplier for the screen path (× the window alpha).+ * 1.0 = as opaque as the window allows; lower for see-through. */+ private const val OVERLAY_ALPHA = 1.0f++ /** Poll interval while a settle deadline is armed (the monitor wants ticks):+ * the mirror stops emitting frames once motion stops, so we wake on a timer+ * to hit the deadline. */+ private const val POLL_MS = 30L++ // Packed result of the native screen monitor (see LivePipelineJni).+ private const val MONITOR_ACTION_MASK = 0x3+ private const val MONITOR_ACTION_HIDE = 1+ private const val MONITOR_ACTION_ACQUIRE = 2+ private const val MONITOR_WANTS_TICK = 0x100++ /** Row-major 3×3 unit-quad → sensor-uv from a `SurfaceTexture`+ * 4×4 transform (column-major): the capture has no rotation, just the+ * producer's crop + the conventional vertical flip. */+ fun uvFromSurfaceTexture(m: FloatArray): FloatArray =+ floatArrayOf(+ m[0], m[4], m[12],+ m[1], m[5], m[13],+ 0f, 0f, 1f,+ )+ }+}diff --git a/OCR-translation/src/main/java/dev/davidv/translator/screenTranslate/ScreenCaptureRequestActivity.kt b/OCR-translation/src/main/java/dev/davidv/translator/screenTranslate/ScreenCaptureRequestActivity.ktnew file mode 100644index 0000000..59f0aef--- /dev/null+++ b/OCR-translation/src/main/java/dev/davidv/translator/screenTranslate/ScreenCaptureRequestActivity.kt@@ -0,0 +1,129 @@+/*+ * Copyright (C) 2024 David V+ *+ * This program 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.+ *+ * This program 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 <https://www.gnu.org/licenses/>.+ */++package dev.davidv.translator.screenTranslate++import android.app.Activity+import android.content.Context+import android.content.Intent+import android.media.projection.MediaProjectionManager+import android.net.Uri+import android.os.Build+import android.os.Bundle+import android.provider.Settings+import android.util.Log+import androidx.core.content.ContextCompat++/**+ * Transient, invisible activity that turns the screen-translate button into a+ * running [ScreenTranslateService]. A `VoiceInteractionSession` can't itself+ * ask for the SYSTEM_ALERT_WINDOW grant or the MediaProjection consent (both+ * need an Activity result), so the button launches this; once both are+ * granted it hands the projection token to the service and finishes.+ */+class ScreenCaptureRequestActivity : Activity() {+ private val tag = "ScreenCaptureRequest"++ override fun onCreate(savedInstanceState: Bundle?) {+ super.onCreate(savedInstanceState)+ if (!canDrawOverlays()) {+ requestOverlayPermission()+ return+ }+ requestProjection()+ }++ private fun canDrawOverlays(): Boolean = Build.VERSION.SDK_INT < Build.VERSION_CODES.M || Settings.canDrawOverlays(this)++ private fun requestOverlayPermission() {+ val intent =+ Intent(+ Settings.ACTION_MANAGE_OVERLAY_PERMISSION,+ Uri.parse("package:$packageName"),+ )+ startActivityForResult(intent, REQ_OVERLAY)+ }++ private fun requestProjection() {+ val pm = getSystemService(Context.MEDIA_PROJECTION_SERVICE) as MediaProjectionManager+ // On Android 14+ force whole-display capture, skipping the "single app vs+ // entire screen" picker.+ val intent =+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE) {+ pm.createScreenCaptureIntent(+ android.media.projection.MediaProjectionConfig.createConfigForDefaultDisplay(),+ )+ } else {+ pm.createScreenCaptureIntent()+ }+ startActivityForResult(intent, REQ_PROJECTION)+ }++ override fun onActivityResult(+ requestCode: Int,+ resultCode: Int,+ data: Intent?,+ ) {+ super.onActivityResult(requestCode, resultCode, data)+ when (requestCode) {+ REQ_OVERLAY -> {+ if (canDrawOverlays()) {+ requestProjection()+ } else {+ Log.i(tag, "Overlay permission denied")+ finishAndRemoveTask()+ }+ }+ REQ_PROJECTION -> {+ if (resultCode == RESULT_OK && data != null) {+ ContextCompat.startForegroundService(+ this,+ ScreenTranslateService.startIntent(+ this,+ resultCode,+ data,+ sourceCode = intent.getStringExtra(ScreenTranslateService.EXTRA_SOURCE_LANG),+ targetCode = intent.getStringExtra(ScreenTranslateService.EXTRA_TARGET_LANG),+ isAutoSource = intent.getBooleanExtra(ScreenTranslateService.EXTRA_AUTO_SOURCE, true),+ ),+ )+ } else {+ Log.i(tag, "Screen capture consent denied")+ }+ finish()+ }+ }+ }++ companion object {+ private const val REQ_OVERLAY = 1+ private const val REQ_PROJECTION = 2++ fun intent(+ context: Context,+ sourceCode: String?,+ targetCode: String?,+ isAutoSource: Boolean,+ ): Intent =+ Intent(context, ScreenCaptureRequestActivity::class.java).apply {+ addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)+ sourceCode?.let { putExtra(ScreenTranslateService.EXTRA_SOURCE_LANG, it) }+ targetCode?.let { putExtra(ScreenTranslateService.EXTRA_TARGET_LANG, it) }+ putExtra(ScreenTranslateService.EXTRA_AUTO_SOURCE, isAutoSource)+ }+ }+}diff --git a/OCR-translation/src/main/java/dev/davidv/translator/screenTranslate/ScreenTranslateService.kt b/OCR-translation/src/main/java/dev/davidv/translator/screenTranslate/ScreenTranslateService.ktnew file mode 100644index 0000000..b28c832--- /dev/null+++ b/OCR-translation/src/main/java/dev/davidv/translator/screenTranslate/ScreenTranslateService.kt@@ -0,0 +1,736 @@+/*+ * Copyright (C) 2024 David V+ *+ * This program 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.+ *+ * This program 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 <https://www.gnu.org/licenses/>.+ */++package dev.davidv.translator.screenTranslate++import android.app.Notification+import android.app.NotificationChannel+import android.app.NotificationManager+import android.app.Service+import android.content.Context+import android.content.Intent+import android.content.pm.ServiceInfo+import android.graphics.PixelFormat+import android.hardware.display.DisplayManager+import android.hardware.display.VirtualDisplay+import android.media.projection.MediaProjection+import android.media.projection.MediaProjectionManager+import android.os.Build+import android.os.Handler+import android.os.IBinder+import android.os.Looper+import android.util.DisplayMetrics+import android.util.Log+import android.view.Display+import android.view.Gravity+import android.view.MotionEvent+import android.view.View+import android.view.WindowManager+import android.widget.ImageView+import android.widget.TextView+import android.widget.Toast+import dev.davidv.translator.Language+import dev.davidv.translator.LanguageStateManager+import dev.davidv.translator.R+import dev.davidv.translator.TranslatorApplication+import dev.davidv.translator.languageNameComparator+import dev.davidv.translator.localizedName+import dev.davidv.translator.overlayChrome.FloatingBubble+import dev.davidv.translator.overlayChrome.NormalizedRegion+import dev.davidv.translator.overlayChrome.OverlayChromeFactory+import dev.davidv.translator.overlayChrome.OverlayInsets+import dev.davidv.translator.overlayChrome.OverlayMenuHost+import dev.davidv.translator.overlayChrome.OverlayMenuManager+import dev.davidv.translator.overlayChrome.RegionSelectView+import kotlinx.coroutines.CoroutineScope+import kotlinx.coroutines.Dispatchers+import kotlinx.coroutines.SupervisorJob+import kotlinx.coroutines.flow.first+import kotlinx.coroutines.launch+import kotlinx.coroutines.withContext++/**+ * Foreground service for "translate screen": holds the [MediaProjection],+ * mirrors the display into a [ScreenCaptureGlWorker]'s capture surface, and+ * floats a translucent overlay window. The overlay is a hardware Canvas+ * [ScreenOverlayView] (not a SurfaceView) at α≈0.79 so it composites through+ * the window — which both dims it under the untrusted-touch cap (taps fall+ * through to the app underneath) and is non-secure (so the capture isn't+ * blacked out). Stop is a notification action. Feedback (the overlay landing+ * in the capture) is accepted for this iteration.+ */+class ScreenTranslateService : Service() {+ private val scope = CoroutineScope(Dispatchers.Main + SupervisorJob())++ private var projection: MediaProjection? = null+ private var virtualDisplay: VirtualDisplay? = null+ private var screenTracker: uniffi.bindings.LiveScreenTracker? = null+ private var overlayView: GpuOverlayTextureView? = null+ private var worker: ScreenCaptureGlWorker? = null+ private var windowManager: WindowManager? = null+ private var stopped = false++ private var displayManager: DisplayManager? = null++ // Live control state, mutated from the bubble menu and re-applied to the tracker.+ private var currentFrom: Language? = null+ private var currentTo: Language? = null+ private var currentIsAutoSource = true+ private var currentRegion: NormalizedRegion? = null+ private var userPaused = false++ private var langStateManager: LanguageStateManager? = null+ private var menuManager: OverlayMenuManager? = null+ private var bubble: FloatingBubble? = null+ private var regionView: View? = null+ private var toolbarView: View? = null+ private var sourceLabelView: TextView? = null+ private var targetLabelView: TextView? = null+ private var pauseIconView: ImageView? = null++ // Display size the current capture was built for; a rotation changes these and+ // triggers an in-place resize (the VirtualDisplay is fixed to its creation+ // dimensions, so a stale portrait capture letterboxes a landscape screen to an+ // unreadable strip — but on Android 14+ it can't be recreated, only resized).+ private var lastW = 0+ private var lastH = 0++ private val displayListener =+ object : DisplayManager.DisplayListener {+ override fun onDisplayAdded(displayId: Int) {}++ override fun onDisplayRemoved(displayId: Int) {}++ override fun onDisplayChanged(displayId: Int) {+ if (stopped || displayId != Display.DEFAULT_DISPLAY) return+ val wm = windowManager ?: return+ val metrics = DisplayMetrics()+ @Suppress("DEPRECATION")+ wm.defaultDisplay.getRealMetrics(metrics)+ val w = metrics.widthPixels+ val h = metrics.heightPixels+ if (w == lastW && h == lastH) return+ Log.i(TAG, "display changed (${lastW}x$lastH → ${w}x$h) → resize capture")+ resizeCapture(w, h, metrics.densityDpi)+ }+ }++ private val projectionCallback =+ object : MediaProjection.Callback() {+ override fun onStop() {+ Log.i(TAG, "MediaProjection stopped")+ stopEverything()+ }+ }++ override fun onBind(intent: Intent?): IBinder? = null++ override fun onStartCommand(+ intent: Intent?,+ flags: Int,+ startId: Int,+ ): Int {+ if (intent == null || intent.action == ACTION_STOP) {+ stopEverything()+ return START_NOT_STICKY+ }++ val resultCode = intent.getIntExtra(EXTRA_RESULT_CODE, 0)+ val data = intent.getParcelableExtra<Intent>(EXTRA_DATA)+ if (resultCode == 0 || data == null) {+ Log.e(TAG, "Missing projection token; stopping")+ stopEverything()+ return START_NOT_STICKY+ }++ startForegroundNotification()++ val app = applicationContext as TranslatorApplication+ val catalog = app.languageCatalog+ if (catalog == null) {+ Log.e(TAG, "No language catalog; stopping")+ stopEverything()+ return START_NOT_STICKY+ }+ if (!catalog.ocrEngineReady()) {+ // Without the detector pack every frame fails OCR and the overlay just+ // sits there empty — refuse to start and say why (issue #246).+ Log.e(TAG, "OCR detector pack not installed; stopping")+ Toast.makeText(this, getString(R.string.ocr_models_missing), Toast.LENGTH_LONG).show()+ stopEverything()+ return START_NOT_STICKY+ }++ val pm = getSystemService(Context.MEDIA_PROJECTION_SERVICE) as MediaProjectionManager+ val proj = pm.getMediaProjection(resultCode, data)+ if (proj == null) {+ Log.e(TAG, "getMediaProjection returned null; stopping")+ stopEverything()+ return START_NOT_STICKY+ }+ proj.registerCallback(projectionCallback, null)+ projection = proj++ val tracker = uniffi.bindings.LiveScreenTracker(catalog.planarHandle())+ screenTracker = tracker+ configureLanguages(+ tracker,+ app,+ sourceCode = intent.getStringExtra(EXTRA_SOURCE_LANG),+ targetCode = intent.getStringExtra(EXTRA_TARGET_LANG),+ isAutoSource = intent.getBooleanExtra(EXTRA_AUTO_SOURCE, true),+ )++ setupOverlayAndCapture(tracker, proj)+ broadcastLiveState(active = true)++ if (displayManager == null) {+ val dm = getSystemService(Context.DISPLAY_SERVICE) as DisplayManager+ displayManager = dm+ dm.registerDisplayListener(displayListener, Handler(Looper.getMainLooper()))+ }++ return START_NOT_STICKY+ }++ private fun configureLanguages(+ tracker: uniffi.bindings.LiveScreenTracker,+ app: TranslatorApplication,+ sourceCode: String?,+ targetCode: String?,+ isAutoSource: Boolean,+ ) {+ val catalog = app.languageCatalog ?: return+ val settings = app.settingsManager.settings.value+ // Target: the caller's choice (assistant selection) → app default → en.+ val to =+ catalog.languageByCode(targetCode ?: settings.defaultTargetLanguageCode)+ ?: catalog.languageByCode("en")+ ?: return+ currentTo = to+ currentIsAutoSource = isAutoSource+ // A forced source skips the script classifier; auto leaves it off (the `from`+ // value is then just a hint, so we keep it null and fall back to `to`).+ currentFrom = if (isAutoSource) null else sourceCode?.let { catalog.languageByCode(it) }+ applyLanguages()+ }++ /** Push the current language selection into the tracker (live, no restart). */+ private fun applyLanguages() {+ val tracker = screenTracker ?: return+ val to = currentTo ?: return+ val from = if (currentIsAutoSource) to else (currentFrom ?: to)+ tracker.setLanguages(from.code, to.code, currentIsAutoSource)+ Log.i(TAG, "languages: from=${from.code} to=${to.code} auto=$currentIsAutoSource")+ }++ private fun overlayWindowType(): Int =+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {+ WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY+ } else {+ @Suppress("DEPRECATION")+ WindowManager.LayoutParams.TYPE_PHONE+ }++ private fun dpToPx(dp: Int): Int = (dp * resources.displayMetrics.density).toInt()++ private fun setupOverlayAndCapture(+ tracker: uniffi.bindings.LiveScreenTracker,+ proj: MediaProjection,+ ) {+ val wm = getSystemService(Context.WINDOW_SERVICE) as WindowManager+ windowManager = wm++ val metrics = DisplayMetrics()+ @Suppress("DEPRECATION")+ wm.defaultDisplay.getRealMetrics(metrics)+ val w = metrics.widthPixels+ val h = metrics.heightPixels+ val dpi = metrics.densityDpi+ lastW = w+ lastH = h++ val view = GpuOverlayTextureView(this)+ overlayView = view++ val params =+ WindowManager.LayoutParams(+ WindowManager.LayoutParams.MATCH_PARENT,+ WindowManager.LayoutParams.MATCH_PARENT,+ overlayWindowType(),+ WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE or+ WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE or+ WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL or+ WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN or+ WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED,+ PixelFormat.TRANSLUCENT,+ )+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {+ params.layoutInDisplayCutoutMode =+ WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS+ }+ // Android 12+ untrusted-touch rule: a tap passing through an overlay owned+ // by another app is discarded if the overlay's opacity exceeds ~0.8+ // (maximum_obscuring_opacity_for_touch). Sit just under the cap — and+ // because the TextureView composites through the window (not a SurfaceView,+ // a separate full-opacity layer), the window alpha governs it, so taps fall+ // through. With an accessibility service the app is trusted and the cap+ // lifts; the only change is raising WINDOW_ALPHA — the GPU render path is+ // identical, so there is no second code path for that state.+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {+ params.alpha = WINDOW_ALPHA+ }+ wm.addView(view, params)+ setupControls()++ val pipelinePtr = tracker.rawAddressForJni().toLong()+ val captureWorker = ScreenCaptureGlWorker(w, h)+ captureWorker.pipelinePtr = pipelinePtr+ worker = captureWorker+ // The worker turns the TextureView's SurfaceTexture into the EGL window+ // surface it presents into; hand each lifecycle edge straight to it.+ view.onSurfaceTexture = { st -> captureWorker.setOutputSurfaceTexture(st) }+ captureWorker.start()+ Log.i(TAG, "setup: ${w}x$h @${dpi}dpi, pipelinePtr=$pipelinePtr")++ scope.launch {+ val surface = withContext(Dispatchers.IO) { captureWorker.awaitSourceSurface() }+ if (stopped) return@launch+ if (surface == null) {+ Log.e(TAG, "GL capture surface never became ready; stopping")+ stopEverything()+ return@launch+ }+ // Size the SurfaceTexture now that it exists; a VirtualDisplay won't+ // produce frames into a 0×0 buffer.+ captureWorker.setSourceBufferSize(w, h)+ virtualDisplay =+ proj.createVirtualDisplay(+ "translator-screen",+ w,+ h,+ dpi,+ DisplayManager.VIRTUAL_DISPLAY_FLAG_AUTO_MIRROR,+ surface,+ null,+ null,+ )+ Log.i(TAG, "VirtualDisplay created ${w}x$h, surface=$surface")+ }+ }++ /** The draggable bubble + its popup menu, pickers and region editor. One shared+ * control surface (the `overlayChrome` widgets) over touchable overlay windows;+ * the render overlay stays pass-through. */+ private fun setupControls() {+ val wm = windowManager ?: return+ val type = overlayWindowType()++ menuManager =+ OverlayMenuManager(+ this,+ ::dpToPx,+ object : OverlayMenuHost {+ override fun addDismissLayer(view: View) {+ val params =+ WindowManager.LayoutParams(+ WindowManager.LayoutParams.MATCH_PARENT,+ WindowManager.LayoutParams.MATCH_PARENT,+ type,+ WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE or WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN,+ PixelFormat.TRANSLUCENT,+ )+ params.windowAnimations = 0+ wm.addView(view, params)+ }++ override fun addMenuView(view: View) {+ // Open on the bubble's side, vertically near it (the window manager+ // clamps it back on-screen if the bubble sits near an edge).+ val onRight = bubble?.isOnRightSide() ?: true+ val params =+ WindowManager.LayoutParams(+ dpToPx(200),+ WindowManager.LayoutParams.WRAP_CONTENT,+ type,+ WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE,+ PixelFormat.TRANSLUCENT,+ )+ params.gravity = Gravity.TOP or (if (onRight) Gravity.END else Gravity.START)+ params.x = dpToPx(8)+ params.y = ((bubble?.anchorTop() ?: dpToPx(120)) - dpToPx(20)).coerceAtLeast(dpToPx(8))+ params.windowAnimations = 0+ wm.addView(view, params)+ }++ override fun addPickerView(view: View) {+ val params =+ WindowManager.LayoutParams(+ dpToPx(250),+ dpToPx(400),+ type,+ WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE,+ PixelFormat.TRANSLUCENT,+ )+ params.gravity = Gravity.CENTER+ params.windowAnimations = 0+ wm.addView(view, params)+ }++ override fun removeMenuChild(view: View) {+ runCatching { wm.removeView(view) }+ }+ },+ )++ bubble = FloatingBubble(this, wm, type, ::dpToPx) { showToolbar() }.also { it.show() }++ val app = applicationContext as TranslatorApplication+ langStateManager = LanguageStateManager(scope, app.filePathManager)+ }++ /** Tap-the-bubble expands the collapsed dot into the shared flat toolbar (the+ * same widget the still paths use): both language pills, region, pause, and ✕+ * (stop). Tapping outside collapses back to the dot without stopping. */+ private fun showToolbar() {+ val wm = windowManager ?: return+ if (toolbarView != null) return+ val to = currentTo ?: return+ bubble?.setShown(false)++ val views =+ OverlayChromeFactory.createLanguageToolbar(+ context = this,+ dpToPx = ::dpToPx,+ forcedSourceLanguage = currentFrom,+ forcedTargetLanguage = currentTo,+ defaultTargetLanguage = to,+ onClose = { stopEverything() },+ onSourceClick = { showPicker(isSource = true) },+ onSwap = { swapLiveLanguages() },+ onTargetClick = { showPicker(isSource = false) },+ onRegionClick = {+ hideToolbar()+ showRegionEditor()+ },+ onPauseClick = {+ toggleUserPause()+ OverlayChromeFactory.setPauseIconState(pauseIconView, userPaused)+ },+ isPaused = userPaused,+ isAutoSource = false,+ )+ sourceLabelView = views.sourceLabel+ targetLabelView = views.targetLabel+ pauseIconView = views.pauseIcon++ // A touch outside the toolbar strip collapses it back to the dot AND still+ // reaches the app underneath (WATCH_OUTSIDE_TOUCH + the implied NOT_TOUCH_MODAL),+ // so the user can keep scrolling/dragging — no full-screen catcher that would+ // swallow the gesture.+ views.root.setOnTouchListener { _, event ->+ if (event.action == MotionEvent.ACTION_OUTSIDE) {+ hideToolbar()+ true+ } else {+ false+ }+ }++ val params =+ WindowManager.LayoutParams(+ WindowManager.LayoutParams.MATCH_PARENT,+ WindowManager.LayoutParams.WRAP_CONTENT,+ overlayWindowType(),+ WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE or+ WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN or+ WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH,+ PixelFormat.TRANSLUCENT,+ )+ params.gravity = Gravity.TOP or Gravity.START+ params.y = statusBarHeight()+ params.windowAnimations = 0+ wm.addView(views.root, params)+ toolbarView = views.root+ }++ private fun hideToolbar() {+ toolbarView?.let { runCatching { windowManager?.removeView(it) } }+ toolbarView = null+ sourceLabelView = null+ targetLabelView = null+ pauseIconView = null+ bubble?.setShown(true)+ }++ private fun swapLiveLanguages() {+ val from = currentFrom ?: return+ val to = currentTo ?: return+ currentFrom = to+ currentTo = from+ applyLanguages()+ updateLiveToolbarLabels()+ }++ private fun updateLiveToolbarLabels() {+ sourceLabelView?.text = OverlayChromeFactory.formatSourceLabel(currentFrom, isAutoSource = false)+ targetLabelView?.text = currentTo?.shortDisplayName ?: "?"+ }++ private fun statusBarHeight(): Int {+ val wm = windowManager ?: getSystemService(Context.WINDOW_SERVICE) as WindowManager+ return OverlayInsets.topInset(wm, resources)+ }++ /** Manual pause/resume: freezes OCR + clears the on-screen overlays, without+ * changing region/languages. Resuming re-acquires from scratch. */+ private fun toggleUserPause() {+ userPaused = !userPaused+ if (userPaused) {+ screenTracker?.clearOverlay()+ worker?.setPaused(true)+ worker?.clearOverlayOutput()+ } else {+ worker?.setPaused(false)+ }+ }++ private fun showPicker(isSource: Boolean) {+ val mm = menuManager ?: return+ val lsm = langStateManager ?: return+ scope.launch {+ lsm.refreshLanguageAvailability()+ lsm.languageState.first { !it.isChecking }+ val langs =+ lsm.languageState.value+ .translatorLanguages(requireOcr = isSource)+ .sortedWith(compareBy(languageNameComparator()) { it.localizedName() })+ // Live screen translate never runs in auto-source mode, so no Auto option.+ mm.showLanguagePicker(isSource, langs, allowAuto = false) { lang ->+ if (isSource) {+ if (lang != null) currentFrom = lang+ } else if (lang != null) {+ currentTo = lang+ }+ applyLanguages()+ updateLiveToolbarLabels()+ }+ }+ }++ private fun showRegionEditor() {+ val wm = windowManager ?: return+ if (regionView != null) return+ // Freeze live translation while picking the area — otherwise OCR runs on the+ // dimmed editor + our own UI.+ worker?.setPaused(true)+ val view =+ RegionSelectView(+ this,+ ::dpToPx,+ currentRegion,+ onConfirm = { r ->+ currentRegion = r+ screenTracker?.setRegion(uniffi.bindings.ScreenRegion(r.left, r.top, r.right, r.bottom))+ removeRegionEditor()+ },+ onReset = {+ currentRegion = null+ screenTracker?.setRegion(null)+ removeRegionEditor()+ },+ onCancel = { removeRegionEditor() },+ )+ val params =+ WindowManager.LayoutParams(+ WindowManager.LayoutParams.MATCH_PARENT,+ WindowManager.LayoutParams.MATCH_PARENT,+ overlayWindowType(),+ WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE or WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN,+ PixelFormat.TRANSLUCENT,+ )+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {+ params.layoutInDisplayCutoutMode =+ WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS+ }+ params.windowAnimations = 0+ wm.addView(view, params)+ regionView = view+ }++ private fun removeRegionEditor() {+ regionView?.let { runCatching { windowManager?.removeView(it) } }+ regionView = null+ // Resume unless a manual pause is in effect (then stay paused).+ worker?.setPaused(userPaused)+ }++ private fun teardownControls() {+ runCatching { menuManager?.dismiss() }+ menuManager = null+ hideToolbar()+ bubble?.remove()+ bubble = null+ removeRegionEditor()+ }++ private fun startForegroundNotification() {+ val channelId = "screen_translate"+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {+ val nm = getSystemService(NotificationManager::class.java)+ if (nm.getNotificationChannel(channelId) == null) {+ nm.createNotificationChannel(+ NotificationChannel(+ channelId,+ getString(R.string.app_name),+ NotificationManager.IMPORTANCE_LOW,+ ),+ )+ }+ }+ val stopIntent =+ Intent(this, ScreenTranslateService::class.java).apply { action = ACTION_STOP }+ val stopPending =+ android.app.PendingIntent.getService(+ this,+ 0,+ stopIntent,+ android.app.PendingIntent.FLAG_IMMUTABLE or android.app.PendingIntent.FLAG_UPDATE_CURRENT,+ )+ val notification: Notification =+ androidx.core.app.NotificationCompat.Builder(this, channelId)+ .setContentTitle(getString(R.string.app_name))+ .setContentText(getString(R.string.screen_translating_notification))+ .setSmallIcon(R.drawable.ic_translate_button)+ .setOngoing(true)+ .addAction(R.drawable.cancel, "Stop", stopPending)+ .build()+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {+ startForeground(+ NOTIFICATION_ID,+ notification,+ ServiceInfo.FOREGROUND_SERVICE_TYPE_MEDIA_PROJECTION,+ )+ } else {+ startForeground(NOTIFICATION_ID, notification)+ }+ }++ /** Rotation / display-geometry change: resize the capture **in place**. On+ * Android 14+ a [MediaProjection] permits only one `createVirtualDisplay`, so+ * the VirtualDisplay must never be recreated — `resize` it and the worker+ * instead. The overlay window is MATCH_PARENT, so it follows the rotation and+ * re-hands its SurfaceTexture (→ the worker recreates its present surface).+ * Old portrait overlays are dropped; the native monitor rebuilds its lattice+ * when the canonical dimensions change. */+ private fun resizeCapture(+ w: Int,+ h: Int,+ dpi: Int,+ ) {+ worker?.resize(w, h)+ runCatching { virtualDisplay?.resize(w, h, dpi) }+ runCatching { screenTracker?.clearOverlay() }+ lastW = w+ lastH = h+ Log.i(TAG, "capture resized to ${w}x$h @${dpi}dpi")+ }++ private fun broadcastLiveState(active: Boolean) {+ val intent =+ Intent(ACTION_LIVE_STATE).apply {+ setPackage(packageName)+ putExtra(EXTRA_LIVE_ACTIVE, active)+ }+ sendBroadcast(intent)+ }++ private fun stopEverything() {+ if (stopped) return+ stopped = true+ broadcastLiveState(active = false)+ teardownControls()+ runCatching { displayManager?.unregisterDisplayListener(displayListener) }+ displayManager = null+ runCatching { virtualDisplay?.release() }+ virtualDisplay = null+ runCatching {+ projection?.unregisterCallback(projectionCallback)+ projection?.stop()+ }+ projection = null+ runCatching { worker?.stop() }+ worker = null+ val wm = windowManager+ overlayView?.let { runCatching { wm?.removeView(it) } }+ overlayView = null+ runCatching { screenTracker?.clearOverlay() }+ runCatching { screenTracker?.destroy() }+ screenTracker = null+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {+ stopForeground(STOP_FOREGROUND_REMOVE)+ } else {+ @Suppress("DEPRECATION")+ stopForeground(true)+ }+ stopSelf()+ }++ override fun onDestroy() {+ stopEverything()+ scope.coroutineContext[kotlinx.coroutines.Job]?.cancel()+ super.onDestroy()+ }++ companion object {+ private const val TAG = "ScreenTranslateSvc"+ private const val NOTIFICATION_ID = 0x5C12++ /** Overlay window opacity. Sits just under the Android 12+ untrusted-touch+ * cap (~0.8) so taps fall through to the app below; the GPU overlay is+ * dimmed by this. With an accessibility service the cap lifts and this can+ * go to 1.0 — the only change for that state, no separate render path. */+ private const val WINDOW_ALPHA = 0.79f+ const val EXTRA_RESULT_CODE = "result_code"+ const val EXTRA_DATA = "data"+ const val EXTRA_SOURCE_LANG = "source_lang"+ const val EXTRA_TARGET_LANG = "target_lang"+ const val EXTRA_AUTO_SOURCE = "auto_source"+ const val ACTION_STOP = "dev.davidv.translator.STOP_SCREEN_TRANSLATE"++ /** Broadcast (in-package) so the accessibility service can hide its launcher+ * bubble while live translate runs — otherwise two bubbles stack. */+ const val ACTION_LIVE_STATE = "dev.davidv.translator.LIVE_STATE"+ const val EXTRA_LIVE_ACTIVE = "live_active"++ fun startIntent(+ context: Context,+ resultCode: Int,+ data: Intent,+ sourceCode: String?,+ targetCode: String?,+ isAutoSource: Boolean,+ ): Intent =+ Intent(context, ScreenTranslateService::class.java).apply {+ putExtra(EXTRA_RESULT_CODE, resultCode)+ putExtra(EXTRA_DATA, data)+ sourceCode?.let { putExtra(EXTRA_SOURCE_LANG, it) }+ targetCode?.let { putExtra(EXTRA_TARGET_LANG, it) }+ putExtra(EXTRA_AUTO_SOURCE, isAutoSource)+ }+ }+}diff --git a/OCR-translation/src/main/java/dev/davidv/translator/ui/TranslatorViewModel.kt b/OCR-translation/src/main/java/dev/davidv/translator/ui/TranslatorViewModel.ktnew file mode 100644index 0000000..e7dca7c--- /dev/null+++ b/OCR-translation/src/main/java/dev/davidv/translator/ui/TranslatorViewModel.kt@@ -0,0 +1,1166 @@+/*+ * Copyright (C) 2024 David V+ *+ * This program 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.+ *+ * This program 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 <https://www.gnu.org/licenses/>.+ */++package dev.davidv.translator.ui++import android.content.Context+import android.graphics.Bitmap+import android.net.Uri+import android.util.Log+import androidx.annotation.StringRes+import androidx.lifecycle.ViewModel+import androidx.lifecycle.ViewModelProvider+import androidx.lifecycle.viewModelScope+import dev.davidv.translator.DocumentTranslationService+import dev.davidv.translator.DocumentTranslationServiceState+import dev.davidv.translator.DownloadService+import dev.davidv.translator.FileEvent+import dev.davidv.translator.FilePathManager+import dev.davidv.translator.FromLangChange+import dev.davidv.translator.InputType+import dev.davidv.translator.Language+import dev.davidv.translator.LanguageMetadataManager+import dev.davidv.translator.LanguageStateManager+import dev.davidv.translator.LaunchMode+import dev.davidv.translator.PcmAudio+import dev.davidv.translator.PdfPhaseProgress+import dev.davidv.translator.PreparedImageOverlay+import dev.davidv.translator.R+import dev.davidv.translator.ReadingOrder+import dev.davidv.translator.Script+import dev.davidv.translator.SettingsManager+import dev.davidv.translator.SpeechError+import dev.davidv.translator.SpeechSynthesisResult+import dev.davidv.translator.TargetTabs+import dev.davidv.translator.TranslatedText+import dev.davidv.translator.TranslationCoordinator+import dev.davidv.translator.TranslationResult+import dev.davidv.translator.TranslatorMessage+import dev.davidv.translator.TxtLayoutChoice+import dev.davidv.translator.WordWithTaggedEntries+import dev.davidv.translator.copyDocumentUriToCache+import dev.davidv.translator.displayNameForUri+import dev.davidv.translator.localizedName+import dev.davidv.translator.sizeBytesForUri+import dev.davidv.translator.ui.components.DetectedRegions+import dev.davidv.translator.ui.components.ImageWordSelection+import kotlinx.coroutines.Dispatchers+import kotlinx.coroutines.ExperimentalCoroutinesApi+import kotlinx.coroutines.Job+import kotlinx.coroutines.channels.Channel+import kotlinx.coroutines.flow.Flow+import kotlinx.coroutines.flow.MutableSharedFlow+import kotlinx.coroutines.flow.MutableStateFlow+import kotlinx.coroutines.flow.SharedFlow+import kotlinx.coroutines.flow.SharingStarted+import kotlinx.coroutines.flow.StateFlow+import kotlinx.coroutines.flow.asSharedFlow+import kotlinx.coroutines.flow.asStateFlow+import kotlinx.coroutines.flow.combine+import kotlinx.coroutines.flow.distinctUntilChanged+import kotlinx.coroutines.flow.map+import kotlinx.coroutines.flow.mapLatest+import kotlinx.coroutines.flow.receiveAsFlow+import kotlinx.coroutines.flow.stateIn+import kotlinx.coroutines.flow.update+import kotlinx.coroutines.launch+import kotlinx.coroutines.withContext+import java.io.File++class TranslatorViewModel(+ private val appContext: Context,+ val translationCoordinator: TranslationCoordinator,+ val settingsManager: SettingsManager,+ val filePathManager: FilePathManager,+ val languageMetadataManager: LanguageMetadataManager,+ initialText: String,+ initialLaunchMode: LaunchMode,+) : ViewModel() {+ val languageStateManager = LanguageStateManager(viewModelScope, filePathManager)++ // Navigation state derived from language availability and from/to selection+ // This eliminates the need for from!! force-unwraps in the composable+ enum class NavigationState { LOADING, NO_LANGUAGES, READY }++ // UI state+ private val _input = MutableStateFlow(initialText)+ val input: StateFlow<String> = _input.asStateFlow()++ private val _output = MutableStateFlow<TranslatedText?>(null)+ val output: StateFlow<TranslatedText?> = _output.asStateFlow()++ private val _from = MutableStateFlow<Language?>(null)+ val from: StateFlow<Language?> = _from.asStateFlow()++ private val _targets = MutableStateFlow<TargetTabs?>(null)+ val targets: StateFlow<TargetTabs?> = _targets.asStateFlow()++ // Active target, derived from the tab zipper. Everything that just needs "the+ // current target" reads this; the tab list is only for the multi-target header.+ val to: StateFlow<Language?> =+ _targets.map { it?.active }.stateIn(viewModelScope, SharingStarted.Eagerly, null)++ private val activeTo: Language? get() = _targets.value?.active++ private val _displayImage = MutableStateFlow<Bitmap?>(null)+ val displayImage: StateFlow<Bitmap?> = _displayImage.asStateFlow()++ private val _originalImage = MutableStateFlow<Bitmap?>(null)+ val originalImage: StateFlow<Bitmap?> = _originalImage.asStateFlow()++ private val _imageWordSelection = MutableStateFlow<ImageWordSelection?>(null)+ val imageWordSelection: StateFlow<ImageWordSelection?> = _imageWordSelection.asStateFlow()++ private val _detectedRegions = MutableStateFlow<DetectedRegions?>(null)+ val detectedRegions: StateFlow<DetectedRegions?> = _detectedRegions.asStateFlow()++ private data class OcrCacheEntry(+ val plan: PreparedImageOverlay,+ val imageRef: Bitmap,+ val sourceCode: String,+ val sourceScript: Script,+ val readingOrder: ReadingOrder?,+ // Owns the source pixels rust-side so a language switch re-renders without re-OCR or any+ // image copy across the FFI. Null for images translated via the legacy copying path.+ val ocrImage: uniffi.bindings.OcrImage?,+ )++ private var ocrCache: OcrCacheEntry? = null++ private val _ocrReadingOrder = MutableStateFlow<ReadingOrder?>(null)+ val ocrReadingOrder: StateFlow<ReadingOrder?> = _ocrReadingOrder.asStateFlow()++ private val _inputType = MutableStateFlow(InputType.TEXT)+ val inputType: StateFlow<InputType> = _inputType.asStateFlow()++ // japaneseSpaced is read by TranslationService itself; it is carried here only so+ // toggling the setting invalidates the request and re-runs the transliteration.+ private data class TransliterationRequest(+ val text: String,+ val from: Language,+ val japaneseSpaced: Boolean,+ )++ @OptIn(ExperimentalCoroutinesApi::class)+ val inputTransliterated: StateFlow<String?> =+ combine(_input, _from, _inputType, settingsManager.settings) { text, fromLang, inputType, settings ->+ val enabled = settings.showTransliterationOnInput && inputType == InputType.TEXT+ if (!enabled || fromLang == null || text.isBlank()) {+ null+ } else {+ TransliterationRequest(text, fromLang, settings.addSpacesForJapaneseTransliteration)+ }+ }.distinctUntilChanged()+ .mapLatest { request ->+ if (request == null) {+ null+ } else {+ withContext(Dispatchers.Default) { translationCoordinator.transliterate(request.text, request.from) }+ }+ }.stateIn(viewModelScope, SharingStarted.Eagerly, null)++ // A text detection only stays valid while the input is at least as long as+ // the text that produced it; deleting below that point drops the detection+ // so a stale suggestion can't outlive the words it was based on.+ private data class LanguageDetection(+ val language: Language,+ val inputLength: Int,+ )++ private val _currentDetectedLanguage = MutableStateFlow<LanguageDetection?>(null)+ val currentDetectedLanguage: StateFlow<Language?> =+ _currentDetectedLanguage+ .map { it?.language }+ .stateIn(viewModelScope, SharingStarted.Eagerly, null)++ private val _isAutoSource = MutableStateFlow(false)+ val isAutoSource: StateFlow<Boolean> = _isAutoSource.asStateFlow()++ private val _currentLaunchMode = MutableStateFlow(initialLaunchMode)+ val currentLaunchMode: StateFlow<LaunchMode> = _currentLaunchMode.asStateFlow()++ private val _modalVisible = MutableStateFlow(initialLaunchMode == LaunchMode.Normal)+ val modalVisible: StateFlow<Boolean> = _modalVisible.asStateFlow()++ private val _dictionaryWord = MutableStateFlow<WordWithTaggedEntries?>(null)+ val dictionaryWord: StateFlow<WordWithTaggedEntries?> = _dictionaryWord.asStateFlow()++ private val _dictionaryStack = MutableStateFlow<List<WordWithTaggedEntries>>(emptyList())+ val dictionaryStack: StateFlow<List<WordWithTaggedEntries>> = _dictionaryStack.asStateFlow()++ private val _dictionaryLookupLanguage = MutableStateFlow<Language?>(null)+ val dictionaryLookupLanguage: StateFlow<Language?> = _dictionaryLookupLanguage.asStateFlow()++ private val _ttsVoices = MutableStateFlow<Map<String, List<uniffi.translator_core.InstalledTtsPack>>>(emptyMap())+ val ttsVoices: StateFlow<Map<String, List<uniffi.translator_core.InstalledTtsPack>>> = _ttsVoices.asStateFlow()++ private val _documentTranslation = MutableStateFlow<DocumentTranslationUiState?>(null)+ val documentTranslation: StateFlow<DocumentTranslationUiState?> = _documentTranslation.asStateFlow()+ private var dismissedInProgressDocumentTaskId: Long? = null++ // Picked-but-not-yet-started document. Drives the Configure sheet+ // (source/dest + per-type options) before the translation service is+ // launched; cleared once the user confirms or cancels.+ private val _pendingDocument = MutableStateFlow<PendingDocument?>(null)+ val pendingDocument: StateFlow<PendingDocument?> = _pendingDocument.asStateFlow()++ // One-shot UI events (Toast, errors, etc.)+ private val _uiEvents = MutableSharedFlow<UiEvent>()+ val uiEvents: SharedFlow<UiEvent> = _uiEvents.asSharedFlow()++ private val _pendingSharedImage = MutableSharedFlow<Uri>(replay = 1, extraBufferCapacity = 1)+ val pendingSharedImage: SharedFlow<Uri> = _pendingSharedImage.asSharedFlow()++ // Deep link from the system TTS settings ("install voice data"). Conflated so a+ // request raised before the UI is listening is still delivered, exactly once.+ private val _languageManagerRequests = Channel<Unit>(Channel.CONFLATED)+ val languageManagerRequests: Flow<Unit> = _languageManagerRequests.receiveAsFlow()++ val navigationState: StateFlow<NavigationState> =+ combine(languageStateManager.languageState, _from, to) { langState, fromLang, toLang ->+ when {+ langState.isChecking -> NavigationState.LOADING+ !langState.hasLanguages -> NavigationState.NO_LANGUAGES+ fromLang != null && toLang != null -> NavigationState.READY+ else -> NavigationState.LOADING+ }+ }.stateIn(viewModelScope, SharingStarted.Eagerly, NavigationState.LOADING)++ init {+ if (initialLaunchMode != LaunchMode.Normal) {+ _modalVisible.value = true+ }++ viewModelScope.launch {+ languageStateManager.fileEvents.collect { event ->+ handleFileEvent(event)+ }+ }++ viewModelScope.launch {+ DocumentTranslationService.documentTranslationState.collect { state ->+ if (state == null) {+ dismissedInProgressDocumentTaskId = null+ _documentTranslation.value = null+ return@collect+ }+ if (state.isTranslating && dismissedInProgressDocumentTaskId == state.taskId) {+ _documentTranslation.value = null+ return@collect+ }+ if (!state.isTranslating && dismissedInProgressDocumentTaskId == state.taskId) {+ dismissedInProgressDocumentTaskId = null+ }+ _documentTranslation.value = state.toUiState()+ }+ }++ viewModelScope.launch {+ languageStateManager.catalog.collect { catalog ->+ if (catalog == null) return@collect+ if (_targets.value != null) return@collect+ val settings = settingsManager.settings.value+ _targets.value = TargetTabs.of(catalog.languageByCode(settings.defaultTargetLanguageCode) ?: catalog.english)+ }+ }++ viewModelScope.launch {+ languageStateManager.languageState.collect { languageState ->+ if (!languageState.hasLanguages) return@collect+ val catalog = languageStateManager.catalog.value ?: return@collect+ val curSettings = settingsManager.settings.value+ val targetLang = catalog.languageByCode(curSettings.defaultTargetLanguageCode)+ if (targetLang != null && languageState.availabilityFor(targetLang)?.translatorFiles != true) {+ _targets.value = TargetTabs.of(catalog.english)+ settingsManager.updateSettings(curSettings.copy(defaultTargetLanguageCode = "en"))+ }+ val sourceLang = curSettings.defaultSourceLanguageCode?.let { catalog.languageByCode(it) }+ if (sourceLang != null && languageState.availabilityFor(sourceLang)?.translatorFiles != true) {+ _from.value = catalog.english+ settingsManager.updateSettings(curSettings.copy(defaultSourceLanguageCode = "en"))+ }+ }+ }++ viewModelScope.launch {+ languageStateManager.languageState.collect { languageState ->+ if (!languageState.hasLanguages) return@collect+ val catalog = languageStateManager.catalog.value ?: return@collect+ val curSettings = settingsManager.settings.value+ val preferredSource = curSettings.defaultSourceLanguageCode?.let { catalog.languageByCode(it) }+ val preferredAvail = preferredSource != null && languageState.availabilityFor(preferredSource)?.translatorFiles == true++ if (_from.value == null) {+ val currentTo = activeTo+ val sourceLanguage =+ if (preferredSource != null &&+ preferredAvail &&+ preferredSource != currentTo &&+ (currentTo == null || languageStateManager.canTranslate(preferredSource, currentTo))+ ) {+ preferredSource+ } else {+ if (currentTo != null) {+ languageStateManager.getFirstAvailableSourceLanguage(currentTo, excluding = currentTo)+ } else {+ languageStateManager.getFirstAvailableFromLanguage(excluding = currentTo)+ }+ }+ if (sourceLanguage != null) {+ _from.value = sourceLanguage+ }+ }+ }+ }++ // Auto-translate initial text+ if (initialText.isNotBlank()) {+ viewModelScope.launch {+ // Wait for languages to load+ languageStateManager.languageState.collect { languageState ->+ if (languageState.isChecking) return@collect+ if (!languageState.hasLanguages) return@collect+ autoTranslateInitialText(initialText, languageState)+ // Only run once+ return@collect+ }+ }+ }++ // Run pending image OCR once both languages become available+ viewModelScope.launch {+ combine(_from, to) { f, t -> f to t }.collect { (f, t) ->+ if (f == null || t == null) return@collect+ if (_inputType.value != InputType.IMAGE) return@collect+ if (originalImage.value == null) return@collect+ if (_output.value != null) return@collect+ if (translationCoordinator.isTranslating.value) return@collect+ triggerTranslation()+ }+ }++ // Preload model when languages change+ viewModelScope.launch {+ var prevFrom: Language? = null+ var prevTo: Language? = null+ from.collect { fromLang ->+ val toLang = activeTo+ if (fromLang != null && (fromLang != prevFrom || toLang != prevTo)) {+ prevFrom = fromLang+ prevTo = toLang+ translationCoordinator.preloadModel(fromLang, toLang!!)+ }+ }+ }+ viewModelScope.launch {+ var prevTo: Language? = null+ to.collect { toLang ->+ val fromLang = _from.value+ if (fromLang != null && toLang != null && toLang != prevTo) {+ prevTo = toLang+ translationCoordinator.preloadModel(fromLang, toLang)+ }+ }+ }+ }++ fun connectDownloadService(service: DownloadService) {+ languageStateManager.connectToDownloadEvents(service.downloadEvents)+ }++ fun handleMessage(message: TranslatorMessage) {+ if (message !is TranslatorMessage.TextInput) {+ Log.d("HandleMessage", "Handle: $message")+ }++ when (message) {+ is TranslatorMessage.TextInput -> {+ if (_inputType.value == InputType.TEXT && _input.value == message.text) {+ return+ }+ if (_inputType.value != InputType.TEXT) {+ _displayImage.value = null+ _originalImage.value = null+ ocrCache = null+ _inputType.value = InputType.TEXT+ }+ _input.value = message.text+ if (message.text.isBlank()) {+ _currentDetectedLanguage.value = null+ }+ triggerTranslation()+ }++ is TranslatorMessage.FromLang -> {+ _isAutoSource.value = false+ val newFrom = message.language+ val carriedTarget = previousSourceAsTarget(newFrom, message.change)+ if (carriedTarget != null) _targets.update { it?.select(carriedTarget) }+ _from.value = newFrom+ _output.value = null+ triggerTranslation()+ }++ TranslatorMessage.EnableAutoSource -> {+ _isAutoSource.value = true+ _output.value = null+ triggerTranslation()+ }++ is TranslatorMessage.ToLang -> {+ _targets.update { it?.select(message.language) }+ _output.value = null+ triggerTranslation()+ }++ is TranslatorMessage.AddTab -> {+ _targets.update { it?.add(message.language) }+ _output.value = null+ triggerTranslation()+ }++ is TranslatorMessage.RemoveTab -> {+ val cur = _targets.value ?: return+ if (message.language !in cur.tabs || cur.tabs.size <= 1) return+ val wasActive = cur.active == message.language+ _targets.value = cur.remove(message.language)+ if (wasActive) {+ _output.value = null+ triggerTranslation()+ }+ }++ is TranslatorMessage.SetImageUri -> {+ translationJob?.cancel()+ translationJob =+ viewModelScope.launch {+ val bm = translationCoordinator.correctBitmap(message.uri, message.deleteAfterLoad)+ ocrCache = null+ _originalImage.value = bm+ _displayImage.value = bm+ _inputType.value = InputType.IMAGE+ _currentDetectedLanguage.value = null+ _output.value = null+ val fromLang = _from.value+ val toLang = activeTo+ if (fromLang != null && toLang != null) {+ runImageTranslation(bm, fromLang, toLang)+ }+ }+ }++ is TranslatorMessage.SetDocumentPath -> {+ handleDocumentPath(+ path = message.path,+ displayName = message.displayName,+ sizeBytes = message.sizeBytes,+ deleteAfterLoad = message.deleteAfterLoad,+ )+ }++ TranslatorMessage.SwapLanguages -> {+ val oldFrom = _from.value ?: return+ val oldTo = activeTo ?: return+ if (!languageStateManager.canSwapLanguages(oldFrom, oldTo)) return+ _isAutoSource.value = false+ _from.value = oldTo+ _targets.update { it?.select(oldFrom) }+ _output.value = null+ triggerTranslation()+ }++ TranslatorMessage.ClearInput -> {+ _displayImage.value = null+ _output.value = null+ _input.value = ""+ _inputType.value = InputType.TEXT+ _originalImage.value = null+ ocrCache = null+ _currentDetectedLanguage.value = null+ }++ TranslatorMessage.ToggleJapaneseOcrMode -> {+ _ocrReadingOrder.value =+ when (_ocrReadingOrder.value) {+ null -> ReadingOrder.TOP_TO_BOTTOM_RIGHT_TO_LEFT+ ReadingOrder.TOP_TO_BOTTOM_RIGHT_TO_LEFT -> ReadingOrder.LEFT_TO_RIGHT+ ReadingOrder.LEFT_TO_RIGHT -> null+ }+ val fromLang = _from.value+ if (_inputType.value == InputType.IMAGE && fromLang?.code == "ja") {+ triggerTranslation()+ }+ }++ is TranslatorMessage.InitializeLanguages -> {+ _from.value = message.from+ _targets.value = TargetTabs.of(message.to)+ }++ is TranslatorMessage.ImageTextDetected -> {+ _input.value = message.extractedText+ }++ is TranslatorMessage.DictionaryLookup -> {+ handleDictionaryLookup(message.str, message.language)+ }++ is TranslatorMessage.Steer -> {+ val fromLang = _from.value ?: return+ val toLang = activeTo ?: return+ val src = _output.value?.source+ if (src.isNullOrBlank()) return+ viewModelScope.launch {+ when (val r = translationCoordinator.steer(fromLang, toLang, src, message.forcedPrefix)) {+ is TranslationResult.Success -> _output.value = r.result+ is TranslationResult.Error -> Log.e("Steer", r.message)+ }+ }+ }++ is TranslatorMessage.SpeakTranslatedText -> {+ viewModelScope.launch {+ _uiEvents.emit(UiEvent.AudioLoadingStarted)+ when (val result = translationCoordinator.synthesizeSpeech(message.language, message.text)) {+ is SpeechSynthesisResult.Success -> _uiEvents.emit(UiEvent.PlayAudio(result.audioChunks))+ is SpeechSynthesisResult.Error -> {+ _uiEvents.emit(UiEvent.AudioLoadingStopped)+ _uiEvents.emit(UiEvent.ShowToast(speechErrorMessage(appContext, result.reason)))+ }+ }+ }+ }++ is TranslatorMessage.PopDictionary -> {+ if (_dictionaryStack.value.size > 1) {+ _dictionaryStack.value = _dictionaryStack.value.dropLast(1)+ _dictionaryWord.value = _dictionaryStack.value.lastOrNull()+ } else {+ _dictionaryStack.value = emptyList()+ _dictionaryWord.value = null+ _dictionaryLookupLanguage.value = null+ }+ Log.d("PopDictionary", "Popped dictionary, stack size: ${_dictionaryStack.value.size}")+ }++ TranslatorMessage.ClearDictionaryStack -> {+ _dictionaryStack.value = emptyList()+ _dictionaryWord.value = null+ _dictionaryLookupLanguage.value = null+ Log.d("ClearDictionaryStack", "Cleared dictionary stack")+ }++ is TranslatorMessage.ChangeLaunchMode -> {+ _currentLaunchMode.value = message.newLaunchMode+ _modalVisible.value = message.newLaunchMode == LaunchMode.Normal+ Log.d("ChangeLaunchMode", "Changed launch mode to: ${message.newLaunchMode}")+ }++ TranslatorMessage.ShareTranslatedImage -> {+ val di = _displayImage.value+ if (di != null) {+ viewModelScope.launch {+ _uiEvents.emit(UiEvent.ShareImage(di))+ }+ }+ }+ }+ }++ fun setSharedImageUri(uri: Uri) {+ _pendingSharedImage.tryEmit(uri)+ }++ fun requestLanguageManager() {+ _languageManagerRequests.trySend(Unit)+ }++ // A shared document (pdf/odt/txt/epub) reaches the same drawer as a picked one:+ // copy the content URI into cache off the main thread, then drive the pending+ // document state the file picker also feeds.+ fun setSharedDocumentUri(uri: Uri) {+ viewModelScope.launch {+ try {+ val file = withContext(Dispatchers.IO) { copyDocumentUriToCache(appContext, uri) }+ handleDocumentPath(+ path = file.absolutePath,+ displayName = displayNameForUri(appContext, uri) ?: file.name,+ sizeBytes = sizeBytesForUri(appContext, uri) ?: file.length(),+ deleteAfterLoad = true,+ )+ } catch (e: Exception) {+ Log.e("SharedDocument", "Failed to import shared document: $uri", e)+ }+ }+ }++ fun setModalVisible(visible: Boolean) {+ _modalVisible.value = visible+ }++ fun refreshTtsVoices(language: Language) {+ viewModelScope.launch {+ _ttsVoices.value = _ttsVoices.value + (language.code to translationCoordinator.installedTtsVoices(language))+ }+ }++ fun clearTtsVoices(languageCode: String) {+ _ttsVoices.value = _ttsVoices.value - languageCode+ }++ fun dismissDocumentTranslation() {+ val current = _documentTranslation.value+ if (current?.isTranslating == true) {+ dismissedInProgressDocumentTaskId = current.taskId+ }+ _documentTranslation.value = null+ }++ fun cancelDocumentTranslation() {+ DocumentTranslationService.cancel(appContext)+ dismissedInProgressDocumentTaskId = null+ _documentTranslation.value = null+ _inputType.value = InputType.TEXT+ }++ private var translationJob: Job? = null++ private fun triggerTranslation() {+ if (activeTo == null) return++ translationJob?.cancel()+ translationJob =+ viewModelScope.launch {+ val settings = settingsManager.settings.value+ if (!settings.disableCLD) {+ val text = _input.value+ if (text.isBlank()) {+ _currentDetectedLanguage.value = null+ } else {+ val prior = _currentDetectedLanguage.value?.takeIf { text.length >= it.inputLength }+ val detected =+ translationCoordinator.detectLanguageRobust(+ text,+ _from.value,+ languageStateManager.languageState.value.allLanguages(),+ )+ _currentDetectedLanguage.value = detected?.let { LanguageDetection(it, text.length) } ?: prior+ }+ if (_isAutoSource.value) {+ val detected = _currentDetectedLanguage.value?.language+ if (detected != null && languageStateManager.languageState.value.availabilityFor(detected)?.translatorFiles == true) {+ if (detected != activeTo) {+ _from.value = detected+ }+ }+ }+ }+ reconcileTabsWithSource()+ val fromLang = _from.value ?: return@launch+ val toLang = activeTo ?: return@launch+ translateWithLanguages(fromLang, toLang)+ }+ }++ // A source language can never also be a target tab (it would translate to+ // itself). Whenever the source changes — manual pick, swap, or auto-detected —+ // drop it from the tabs; if it was the sole tab, replace it with an alternate.+ private fun reconcileTabsWithSource() {+ val from = _from.value ?: return+ val cur = _targets.value ?: return+ if (from !in cur.tabs) return+ _targets.value =+ if (cur.tabs.size == 1) {+ pickAlternateTarget(from)?.let { TargetTabs.of(it) } ?: cur+ } else {+ cur.remove(from)+ }+ }++ /**+ * Run a steer without committing it, for previewing what an alternative would+ * produce. Returns the fully re-decoded translation (not a spliced tail).+ */+ suspend fun steerPreview(forcedPrefix: String): String? {+ val fromLang = _from.value ?: return null+ val toLang = activeTo ?: return null+ val src = _output.value?.source+ if (src.isNullOrBlank()) return null+ return when (val r = translationCoordinator.steer(fromLang, toLang, src, forcedPrefix)) {+ is TranslationResult.Success -> r.result.translated+ is TranslationResult.Error -> null+ }+ }++ fun retranslateIfNeeded() {+ if (_inputType.value != InputType.TEXT) return+ val fromLang = _from.value ?: return+ val toLang = activeTo ?: return+ if (translationCoordinator.isTranslating.value) return+ val current = _input.value.trim()+ if (translationCoordinator.lastTranslatedInput == current) return++ viewModelScope.launch {+ translationCoordinator.translateText(fromLang, toLang, current).let {+ _output.value =+ when (it) {+ is TranslationResult.Success -> it.result+ is TranslationResult.Error -> null+ }+ }+ }+ }++ private fun isAutoSourceActive() = _isAutoSource.value && !settingsManager.settings.value.disableCLD++ private suspend fun runImageTranslation(+ bitmap: Bitmap,+ fromLang: Language,+ toLang: Language,+ ) {+ _imageWordSelection.value = null+ _detectedRegions.value = null+ val readingOrder = currentReadingOrderFor(fromLang)+ val cached =+ ocrCache?.takeIf { entry ->+ !_isAutoSource.value &&+ entry.imageRef === bitmap &&+ entry.readingOrder == readingOrder &&+ entry.sourceScript == fromLang.script+ }+ val onMessage: (TranslatorMessage.ImageTextDetected) -> Unit = { msg ->+ _input.value = msg.extractedText+ }+ val result =+ if (cached != null) {+ Log.d("OCR", "reusing OCR result for source=${fromLang.code} (script=${fromLang.script})")+ translationCoordinator.retranslateImageWithOverlay(+ cached.plan,+ fromLang,+ toLang,+ onMessage = onMessage,+ ocrImage = cached.ocrImage,+ )+ } else {+ translationCoordinator.translateImageWithOverlay(+ fromLang,+ toLang,+ bitmap,+ onMessage = onMessage,+ readingOrder = readingOrder,+ isAutoSource = isAutoSourceActive(),+ onMissingDetectedLanguage = { detected ->+ _currentDetectedLanguage.value = LanguageDetection(detected, 0)+ },+ onDetectedRegions = { boxes, w, h ->+ _detectedRegions.value = DetectedRegions(w, h, boxes)+ },+ )+ }+ _detectedRegions.value = null+ result?.let {+ _displayImage.value = it.correctedBitmap+ _output.value = TranslatedText(it.translatedText, null)+ _imageWordSelection.value =+ ImageWordSelection(+ imageWidth = it.metadata.width.toInt(),+ imageHeight = it.metadata.height.toInt(),+ sourceWords = it.metadata.sourceWords,+ translatedWords = it.translatedWords,+ )+ ocrCache =+ OcrCacheEntry(+ plan = it.metadata,+ imageRef = bitmap,+ sourceCode = fromLang.code,+ sourceScript = fromLang.script,+ readingOrder = readingOrder,+ ocrImage = it.ocrImage,+ )+ }+ }++ private suspend fun translateWithLanguages(+ fromLang: Language,+ toLang: Language,+ ) {+ when (_inputType.value) {+ InputType.TEXT -> {+ val result = translationCoordinator.translateText(fromLang, toLang, _input.value.trim())+ when (result) {+ is TranslationResult.Success -> _output.value = result.result+ is TranslationResult.Error -> {+ _output.value = null+ _uiEvents.emit(UiEvent.ShowToast(appContext.getString(R.string.translation_error, result.message)))+ }+ }+ }++ InputType.IMAGE -> {+ originalImage.value?.let { bm ->+ runImageTranslation(bm, fromLang, toLang)+ }+ }++ InputType.FILE -> {+ _output.value = null+ }+ }+ }++ private fun translatedDocumentOutputFile(+ inputName: String,+ from: Language,+ to: Language,+ ): File {+ val inputFile = File(inputName)+ val extension = inputFile.extension.ifBlank { "txt" }+ val baseName = inputFile.nameWithoutExtension.ifBlank { "document" }+ val safeBaseName = baseName.replace(Regex("[^A-Za-z0-9._-]+"), "_").trim('_').ifBlank { "document" }+ return File(filePathManager.getTranslatedDocumentsDir(), "$safeBaseName.${from.code}-${to.code}.$extension")+ }++ private fun handleDocumentPath(+ path: String,+ displayName: String,+ sizeBytes: Long,+ deleteAfterLoad: Boolean,+ ) {+ Log.d("SetDocumentPath", "Selected document for translation: $displayName ($path)")+ _pendingDocument.value =+ PendingDocument(+ path = path,+ displayName = displayName,+ sizeBytes = sizeBytes,+ deleteAfterLoad = deleteAfterLoad,+ extension = File(path).extension.lowercase(),+ )+ }++ fun dismissPendingDocument() {+ val pending = _pendingDocument.value ?: return+ if (pending.deleteAfterLoad) {+ runCatching { File(pending.path).delete() }+ }+ _pendingDocument.value = null+ }++ fun startPendingDocumentTranslation(+ from: Language,+ to: Language,+ txtLayout: TxtLayoutChoice,+ translatePdfImages: Boolean,+ ) {+ val pending = _pendingDocument.value ?: return+ _pendingDocument.value = null++ _displayImage.value = null+ _originalImage.value = null+ ocrCache = null+ _output.value = null+ _input.value = ""+ _inputType.value = InputType.FILE+ _currentDetectedLanguage.value = null++ val outputFile = translatedDocumentOutputFile(pending.displayName, from, to)+ DocumentTranslationService.startTranslation(+ context = appContext,+ inputPath = pending.path,+ outputPath = outputFile.absolutePath,+ displayName = pending.displayName,+ sizeBytes = pending.sizeBytes,+ from = from,+ to = to,+ deleteAfterLoad = pending.deleteAfterLoad,+ translatePdfImages = translatePdfImages,+ txtLayout = txtLayout,+ )+ }++ private fun currentReadingOrderFor(fromLang: Language): ReadingOrder? =+ if (fromLang.code == "ja") {+ _ocrReadingOrder.value+ } else {+ null+ }++ private suspend fun autoTranslateInitialText(+ initialText: String,+ languageState: dev.davidv.translator.LanguageAvailabilityState,+ ) {+ val settings = settingsManager.settings.value+ val detected =+ if (!settings.disableCLD) {+ translationCoordinator.detectLanguageRobust(initialText, _from.value, languageState.allLanguages())+ } else {+ null+ }+ _currentDetectedLanguage.value = detected?.let { LanguageDetection(it, initialText.length) }+ val translated: TranslationResult?++ if (detected != null) {+ if (languageState.availabilityFor(detected)?.translatorFiles == true) {+ _from.value = detected+ var actualTo = activeTo!!+ if (actualTo == detected) {+ val other = languageStateManager.getFirstAvailableTargetLanguage(detected, excluding = detected)+ if (other != null) {+ _targets.update { it?.select(other) }+ actualTo = other+ }+ }+ translated = translationCoordinator.translateText(detected, actualTo, initialText)+ } else {+ translated = null+ }+ } else {+ translated =+ if (_from.value != null) {+ translationCoordinator.translateText(_from.value!!, activeTo!!, initialText)+ } else {+ null+ }+ }+ translated?.let {+ _output.value =+ when (it) {+ is TranslationResult.Success -> it.result+ is TranslationResult.Error -> null+ }+ }+ }++ private fun handleDictionaryLookup(+ str: String,+ language: Language,+ ) {+ Log.i("DictionaryLookup", "Looking up $str for $language")+ val catalog = languageStateManager.catalog.value+ val foundWord =+ try {+ catalog?.lookupDictionary(language, str)+ } catch (e: uniffi.bindings.CatalogException.MissingAsset) {+ viewModelScope.launch {+ _uiEvents.emit(UiEvent.ShowToast("No ${language.localizedName()} dictionary installed"))+ }+ return+ } catch (e: uniffi.bindings.CatalogException.Other) {+ Log.w("DictionaryLookup", "Lookup failed for ${language.displayName}", e)+ null+ }+ if (foundWord != null) {+ _dictionaryWord.value = foundWord+ _dictionaryLookupLanguage.value = language+ _dictionaryStack.value = _dictionaryStack.value + foundWord+ Log.d("DictionaryLookup", "From lookup got $foundWord")+ } else {+ viewModelScope.launch {+ _uiEvents.emit(UiEvent.ShowToast("'$str' not found in ${language.code} dictionary"))+ }+ Log.w("DictionaryLookup", "Lookup failed for ${language.displayName}")+ }+ }++ private fun handleFileEvent(event: FileEvent) {+ when (event) {+ is FileEvent.LanguageDeleted -> {+ val catalog = languageStateManager.catalog.value+ val langs = languageStateManager.languageState.value.translatorLanguages().filter { it != event.language }+ val currentFrom = _from.value+ val currentTo = activeTo+ if (currentFrom == event.language || currentFrom == null) {+ _from.value =+ when {+ currentTo != null -> firstAvailableSourceLanguage(currentTo, langs, excluding = currentTo)+ else -> langs.firstOrNull()+ }+ }+ val cur = _targets.value+ if (cur != null && event.language in cur.tabs) {+ if (cur.tabs.size > 1) {+ _targets.value = cur.remove(event.language)+ } else {+ val actualFrom = _from.value+ val fallback =+ actualFrom?.let { firstAvailableTargetLanguage(it, langs, excluding = actualFrom) }+ ?: catalog?.english+ if (fallback != null) _targets.value = TargetTabs.of(fallback)+ }+ }+ Log.d("TranslatorViewModel", "Language deleted: ${event.language}")+ }+ is FileEvent.Error -> {+ viewModelScope.launch {+ _uiEvents.emit(UiEvent.ShowToast(event.message))+ }+ Log.w("TranslatorViewModel", "Error event: ${event.message}")+ }+ }+ }++ override fun onCleared() {+ super.onCleared()+ // Recycle bitmaps+ _displayImage.value?.let { if (!it.isRecycled) it.recycle() }+ originalImage.value?.let { if (!it.isRecycled) it.recycle() }+ }++ private fun previousSourceAsTarget(+ newFrom: Language,+ change: FromLangChange,+ ): Language? {+ if (change != FromLangChange.MovePreviousToTarget) return null+ val oldFrom = _from.value ?: return null+ if (oldFrom == newFrom) return null+ if (!languageStateManager.canTranslate(newFrom, oldFrom)) return null+ return oldFrom+ }++ private fun pickAlternateTarget(newFrom: Language): Language? {+ val state = languageStateManager.languageState.value+ val catalog = languageStateManager.catalog.value+ val settings = settingsManager.settings.value+ val candidates =+ state.allLanguages().filter { it != newFrom && languageStateManager.canTranslate(newFrom, it) }+ val defaultTarget = catalog?.languageByCode(settings.defaultTargetLanguageCode)+ if (defaultTarget != null && defaultTarget in candidates) {+ return defaultTarget+ }+ val metadata = languageMetadataManager.metadata.value+ val starred = candidates.firstOrNull { metadata[it]?.favorite == true }+ if (starred != null) return starred+ return candidates.minByOrNull { it.displayName }+ }++ private fun firstAvailableSourceLanguage(+ target: Language,+ availableLanguages: List<Language>,+ excluding: Language? = null,+ ): Language? =+ availableLanguages+ .asSequence()+ .filterNot { it == excluding }+ .filter { languageStateManager.canTranslate(it, target) }+ .firstOrNull()++ private fun firstAvailableTargetLanguage(+ source: Language,+ availableLanguages: List<Language>,+ excluding: Language? = null,+ ): Language? =+ availableLanguages+ .asSequence()+ .filterNot { it == excluding }+ .filter { languageStateManager.canTranslate(source, it) }+ .firstOrNull()+}++sealed class UiEvent {+ data class ShowToast(val message: String) : UiEvent()++ data class ShareImage(val bitmap: Bitmap) : UiEvent()++ data object AudioLoadingStarted : UiEvent()++ data object AudioLoadingStopped : UiEvent()++ data class PlayAudio(val audioChunks: Flow<PcmAudio>) : UiEvent()+}++data class PendingDocument(+ val path: String,+ val displayName: String,+ val sizeBytes: Long,+ val deleteAfterLoad: Boolean,+ val extension: String,+)++data class DocumentTranslationUiState(+ val taskId: Long,+ val fileName: String,+ val fileSizeBytes: Long,+ val outputPath: String? = null,+ val outputFileName: String? = null,+ val outputMimeType: String? = null,+ val errorMessage: String? = null,+ @StringRes val progressLabelRes: Int = R.string.doc_progress_preparing,+ val pdfPhases: PdfPhaseProgress? = null,+ val progressFraction: Float? = null,+) {+ val isTranslating: Boolean+ get() = outputPath == null && errorMessage == null+}++private fun DocumentTranslationServiceState.toUiState(): DocumentTranslationUiState =+ DocumentTranslationUiState(+ taskId = taskId,+ fileName = fileName,+ fileSizeBytes = fileSizeBytes,+ outputPath = outputPath,+ outputFileName = outputPath?.let { File(it).name },+ outputMimeType = outputPath?.let { mimeTypeForDocumentPath(it) },+ errorMessage = errorMessage,+ progressLabelRes = progressLabelRes,+ pdfPhases = pdfPhases,+ progressFraction = progressFraction,+ )++private fun mimeTypeForDocumentPath(path: String): String =+ when (File(path).extension.lowercase()) {+ "pdf" -> "application/pdf"+ "odt" -> "application/vnd.oasis.opendocument.text"+ "epub" -> "application/epub+zip"+ "txt" -> "text/plain"+ else -> "application/octet-stream"+ }++class TranslatorViewModelFactory(+ private val appContext: Context,+ private val translationCoordinator: TranslationCoordinator,+ private val settingsManager: SettingsManager,+ private val filePathManager: FilePathManager,+ private val languageMetadataManager: LanguageMetadataManager,+ private val initialText: String,+ private val initialLaunchMode: LaunchMode,+) : ViewModelProvider.Factory {+ @Suppress("UNCHECKED_CAST")+ override fun <T : ViewModel> create(modelClass: Class<T>): T =+ TranslatorViewModel(+ appContext = appContext,+ translationCoordinator = translationCoordinator,+ settingsManager = settingsManager,+ filePathManager = filePathManager,+ languageMetadataManager = languageMetadataManager,+ initialText = initialText,+ initialLaunchMode = initialLaunchMode,+ ) as T+}++private fun speechErrorMessage(+ context: android.content.Context,+ reason: SpeechError,+): String =+ when (reason) {+ SpeechError.NothingToSpeak -> context.getString(R.string.tts_nothing_to_speak)+ SpeechError.CatalogUnavailable -> context.getString(R.string.tts_catalog_unavailable)+ is SpeechError.NoVoiceInstalled ->+ context.getString(R.string.tts_no_voice, reason.language.localizedName())+ is SpeechError.SynthesisFailed ->+ context.getString(R.string.tts_synthesis_failed, reason.language.localizedName())+ is SpeechError.SynthesisError ->+ context.getString(R.string.tts_synthesis_error, reason.language.localizedName(), reason.reason)+ }diff --git a/OCR-translation/src/main/java/dev/davidv/translator/ui/components/ActionButtons.kt b/OCR-translation/src/main/java/dev/davidv/translator/ui/components/ActionButtons.ktnew file mode 100644index 0000000..7d9a549--- /dev/null+++ b/OCR-translation/src/main/java/dev/davidv/translator/ui/components/ActionButtons.kt@@ -0,0 +1,307 @@+/*+ * Copyright (C) 2024 David V+ *+ * This program 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.+ *+ * This program 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 <https://www.gnu.org/licenses/>.+ */++package dev.davidv.translator.ui.components++import android.app.Activity+import android.content.ClipDescription+import android.content.ClipboardManager+import android.content.Context+import android.content.Intent+import android.speech.RecognizerIntent+import android.view.ViewTreeObserver+import android.widget.Toast+import androidx.activity.compose.rememberLauncherForActivityResult+import androidx.activity.result.contract.ActivityResultContracts+import androidx.compose.foundation.background+import androidx.compose.foundation.clickable+import androidx.compose.foundation.layout.Box+import androidx.compose.foundation.layout.size+import androidx.compose.foundation.shape.CircleShape+import androidx.compose.foundation.shape.RoundedCornerShape+import androidx.compose.material3.Icon+import androidx.compose.material3.IconButton+import androidx.compose.material3.MaterialTheme+import androidx.compose.material3.Surface+import androidx.compose.runtime.Composable+import androidx.compose.runtime.DisposableEffect+import androidx.compose.runtime.getValue+import androidx.compose.runtime.mutableStateOf+import androidx.compose.runtime.remember+import androidx.compose.runtime.setValue+import androidx.compose.ui.Alignment+import androidx.compose.ui.Modifier+import androidx.compose.ui.draw.clip+import androidx.compose.ui.graphics.Color+import androidx.compose.ui.platform.LocalContext+import androidx.compose.ui.platform.LocalView+import androidx.compose.ui.res.painterResource+import androidx.compose.ui.res.stringResource+import androidx.compose.ui.semantics.Role+import androidx.compose.ui.unit.dp+import dev.davidv.translator.Language+import dev.davidv.translator.R+import dev.davidv.translator.ReadingOrder+import dev.davidv.translator.TranslatorMessage+import dev.davidv.translator.browser.BrowserActivity+import dev.davidv.translator.isSupportedDocumentUrl+import dev.davidv.translator.isWebUrl++@Composable+fun ShareImage(onMessage: (TranslatorMessage) -> Unit) {+ ActionPillButton(+ iconRes = R.drawable.share,+ contentDescription = stringResource(R.string.a11y_share_image),+ showBackdrop = true,+ onClick = { onMessage(TranslatorMessage.ShareTranslatedImage) },+ )+}++@Composable+fun JapaneseOcrModeToggle(+ readingOrder: ReadingOrder?,+ onMessage: (TranslatorMessage) -> Unit,+) {+ val (iconRes, description) =+ when (readingOrder) {+ null -> R.drawable.text_rotation_auto to "Japanese OCR auto mode"+ ReadingOrder.TOP_TO_BOTTOM_RIGHT_TO_LEFT -> R.drawable.text_rotate_vertical to "Japanese OCR vertical mode"+ ReadingOrder.LEFT_TO_RIGHT -> R.drawable.text_rotation_none to "Japanese OCR horizontal mode"+ }+ ActionPillButton(+ iconRes = iconRes,+ contentDescription = description,+ showBackdrop = true,+ onClick = { onMessage(TranslatorMessage.ToggleJapaneseOcrMode) },+ )+}++@Composable+fun ClearInput(+ onMessage: (TranslatorMessage) -> Unit,+ showBackdrop: Boolean = false,+) {+ ActionPillButton(+ iconRes = R.drawable.cancel,+ contentDescription = stringResource(R.string.a11y_clear_input),+ showBackdrop = showBackdrop,+ onClick = { onMessage(TranslatorMessage.ClearInput) },+ )+}++// Paste the clipboard into the input. A pasted web URL opens the browser+// instead (unsupported document URLs toast); everything else becomes input text.+fun pasteFromClipboard(+ context: Context,+ onMessage: (TranslatorMessage) -> Unit,+) {+ val clipboardManager = context.getSystemService(Context.CLIPBOARD_SERVICE) as ClipboardManager+ val clipData = clipboardManager.primaryClip ?: return+ if (clipData.itemCount == 0) return+ val text = clipData.getItemAt(0).text?.toString() ?: ""+ val trimmed = text.trim()+ if (!isWebUrl(trimmed)) {+ onMessage(TranslatorMessage.TextInput(text))+ return+ }+ if (isSupportedDocumentUrl(trimmed)) {+ Toast.makeText(context, context.getString(R.string.doc_url_unsupported), Toast.LENGTH_LONG).show()+ return+ }+ val browserIntent =+ Intent(context, BrowserActivity::class.java).apply {+ putExtra(BrowserActivity.EXTRA_URL, trimmed)+ }+ context.startActivity(browserIntent)+}++// Tracks whether the clipboard currently holds pasteable text, so a paste+// button can be hidden when there's nothing to paste. Only reads the clip+// description (MIME types), never the content, so it never trips the+// Android 12+ clipboard-access toast.+@Composable+fun rememberClipboardHasText(): Boolean {+ val context = LocalContext.current+ val view = LocalView.current+ val clipboardManager = remember { context.getSystemService(Context.CLIPBOARD_SERVICE) as ClipboardManager }+ var hasText by remember { mutableStateOf(clipboardManager.clipboardHasText()) }++ DisposableEffect(clipboardManager, view) {+ val refresh = { hasText = clipboardManager.clipboardHasText() }+ val clipListener = ClipboardManager.OnPrimaryClipChangedListener { refresh() }+ clipboardManager.addPrimaryClipChangedListener(clipListener)+ // Clipboard reads are blocked until the window regains focus (Android 10+),+ // and a copy done in another app while we were backgrounded doesn't deliver+ // a clip-changed event. Re-read on focus gain, when access is permitted.+ val focusListener =+ ViewTreeObserver.OnWindowFocusChangeListener { hasFocus ->+ if (hasFocus) {+ refresh()+ }+ }+ view.viewTreeObserver.addOnWindowFocusChangeListener(focusListener)+ onDispose {+ clipboardManager.removePrimaryClipChangedListener(clipListener)+ view.viewTreeObserver.removeOnWindowFocusChangeListener(focusListener)+ }+ }+ return hasText+}++private fun ClipboardManager.clipboardHasText(): Boolean {+ if (!hasPrimaryClip()) return false+ val description = primaryClipDescription ?: return false+ return description.hasMimeType(ClipDescription.MIMETYPE_TEXT_PLAIN) ||+ description.hasMimeType(ClipDescription.MIMETYPE_TEXT_HTML)+}++@Composable+fun SpeechInputButton(+ input: String,+ from: Language,+ onMessage: (TranslatorMessage) -> Unit,+ modifier: Modifier = Modifier,+) {+ val context = LocalContext.current+ val isAvailable =+ remember {+ Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH).resolveActivity(context.packageManager) != null+ }+ if (!isAvailable) {+ return+ }++ val launcher =+ rememberLauncherForActivityResult(ActivityResultContracts.StartActivityForResult()) { result ->+ if (result.resultCode != Activity.RESULT_OK) {+ return@rememberLauncherForActivityResult+ }+ val spoken =+ result.data+ ?.getStringArrayListExtra(RecognizerIntent.EXTRA_RESULTS)+ ?.firstOrNull()+ if (!spoken.isNullOrBlank()) {+ val appended = if (input.isBlank()) spoken else "${input.trimEnd()} $spoken"+ onMessage(TranslatorMessage.TextInput(appended))+ }+ }++ ActionPillButton(+ iconRes = R.drawable.mic,+ contentDescription = stringResource(R.string.a11y_voice_input),+ modifier = modifier,+ onClick = {+ val intent =+ Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH).apply {+ putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL, RecognizerIntent.LANGUAGE_MODEL_FREE_FORM)+ putExtra(RecognizerIntent.EXTRA_LANGUAGE, from.code)+ }+ launcher.launch(intent)+ },+ )+}++@Composable+fun ActionPillButton(+ iconRes: Int,+ contentDescription: String,+ showBackdrop: Boolean = false,+ modifier: Modifier = Modifier,+ enabled: Boolean = true,+ onClick: () -> Unit,+) {+ if (showBackdrop) {+ Surface(+ modifier = modifier,+ shape = CircleShape,+ color = Color(0xCC303030),+ ) {+ IconButton(+ onClick = onClick,+ enabled = enabled,+ modifier = Modifier.size(36.dp),+ ) {+ Icon(+ painterResource(id = iconRes),+ contentDescription = contentDescription,+ tint = Color.White,+ )+ }+ }+ } else {+ IconButton(+ onClick = onClick,+ enabled = enabled,+ modifier = modifier.size(36.dp),+ ) {+ Icon(+ painterResource(id = iconRes),+ contentDescription = contentDescription,+ tint =+ if (enabled) {+ MaterialTheme.colorScheme.onSurface.copy(alpha = 0.7f)+ } else {+ MaterialTheme.colorScheme.onSurface.copy(alpha = 0.3f)+ },+ )+ }+ }+}++// A card-header tool button. The active state is shown as a soft squircle+// background behind the icon rather than by tinting the glyph.+@Composable+fun ToolIconButton(+ iconRes: Int,+ contentDescription: String,+ onClick: () -> Unit,+ modifier: Modifier = Modifier,+ active: Boolean = false,+ enabled: Boolean = true,+ // Renders greyed-out like a disabled button but stays clickable, so the tap+ // can explain why the feature is unavailable (e.g. a toast).+ available: Boolean = true,+) {+ val background =+ if (active) MaterialTheme.colorScheme.primary.copy(alpha = 0.14f) else Color.Transparent+ val tint =+ when {+ !enabled || !available -> MaterialTheme.colorScheme.onSurface.copy(alpha = 0.3f)+ active -> MaterialTheme.colorScheme.primary+ else -> MaterialTheme.colorScheme.onSurfaceVariant+ }+ Box(+ modifier =+ modifier+ .size(40.dp)+ .clip(RoundedCornerShape(12.dp))+ .background(background)+ .clickable(+ enabled = enabled,+ role = Role.Button,+ onClick = onClick,+ ),+ contentAlignment = Alignment.Center,+ ) {+ Icon(+ painterResource(id = iconRes),+ contentDescription = contentDescription,+ tint = tint,+ modifier = Modifier.size(24.dp),+ )+ }+}diff --git a/OCR-translation/src/main/java/dev/davidv/translator/ui/components/AlternativesDrawer.kt b/OCR-translation/src/main/java/dev/davidv/translator/ui/components/AlternativesDrawer.ktnew file mode 100644index 0000000..619f0a1--- /dev/null+++ b/OCR-translation/src/main/java/dev/davidv/translator/ui/components/AlternativesDrawer.kt@@ -0,0 +1,292 @@+/*+ * Copyright (C) 2024 David V+ *+ * This program 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.+ *+ * This program 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 <https://www.gnu.org/licenses/>.+ */++package dev.davidv.translator.ui.components++import androidx.compose.foundation.clickable+import androidx.compose.foundation.layout.Arrangement+import androidx.compose.foundation.layout.Column+import androidx.compose.foundation.layout.Row+import androidx.compose.foundation.layout.fillMaxWidth+import androidx.compose.foundation.layout.heightIn+import androidx.compose.foundation.layout.padding+import androidx.compose.foundation.layout.size+import androidx.compose.foundation.rememberScrollState+import androidx.compose.foundation.shape.RoundedCornerShape+import androidx.compose.foundation.verticalScroll+import androidx.compose.material3.Icon+import androidx.compose.material3.IconButton+import androidx.compose.material3.MaterialTheme+import androidx.compose.material3.OutlinedTextField+import androidx.compose.material3.Surface+import androidx.compose.material3.Text+import androidx.compose.material3.TextButton+import androidx.compose.runtime.Composable+import androidx.compose.runtime.LaunchedEffect+import androidx.compose.runtime.getValue+import androidx.compose.runtime.mutableStateMapOf+import androidx.compose.runtime.mutableStateOf+import androidx.compose.runtime.remember+import androidx.compose.runtime.setValue+import androidx.compose.ui.Alignment+import androidx.compose.ui.Modifier+import androidx.compose.ui.res.painterResource+import androidx.compose.ui.res.stringResource+import androidx.compose.ui.text.AnnotatedString+import androidx.compose.ui.text.SpanStyle+import androidx.compose.ui.text.buildAnnotatedString+import androidx.compose.ui.text.font.FontWeight+import androidx.compose.ui.text.style.TextAlign+import androidx.compose.ui.text.withStyle+import androidx.compose.ui.unit.dp+import androidx.compose.ui.window.Dialog+import androidx.compose.ui.window.Popup+import androidx.compose.ui.window.PopupProperties+import dev.davidv.translator.R+import kotlinx.coroutines.delay++private val WS = Regex("\\s+")++/**+ * A window of `[before]` words, the word at [boldIndex] in bold, and `[after]`+ * words — with ellipses when the sentence extends past the window. Only the+ * single swapped word is bolded; any downstream cascade is shown plain.+ */+private fun window(+ sentence: String,+ boldIndex: Int,+ before: Int = 3,+ after: Int = 3,+): AnnotatedString {+ val words = sentence.split(WS).filter { it.isNotBlank() }+ if (boldIndex !in words.indices) return AnnotatedString(sentence)+ val start = (boldIndex - before).coerceAtLeast(0)+ val end = (boldIndex + after).coerceAtMost(words.size - 1)+ return buildAnnotatedString {+ if (start > 0) append("… ")+ for (i in start until boldIndex) append(words[i] + " ")+ withStyle(SpanStyle(fontWeight = FontWeight.Bold)) { append(words[boldIndex]) }+ for (i in boldIndex + 1..end) append(" " + words[i])+ if (end < words.size - 1) append(" …")+ }+}++/** The last `[before]` words of the confirmed prefix, shown before anything is+ * typed so the box has context instead of a bare ellipsis. */+private fun headContext(+ head: String,+ before: Int = 3,+): AnnotatedString {+ val words = head.split(WS).filter { it.isNotBlank() }+ val start = (words.size - before).coerceAtLeast(0)+ return buildAnnotatedString {+ if (start > 0) append("… ")+ for (i in start until words.size) append(words[i] + " ")+ }+}++/**+ * A non-blocking bottom drawer for the tapped word. It sits over the bottom of+ * the screen without a scrim, so the sentence stays visible and other words stay+ * tappable — tapping another word just re-points the drawer. Each alternative is+ * run to the end of the sentence (a steer with the forced prefix) so the option+ * shows the *actual* re-decoded sentence, windowed around the swap. Tapping an+ * option commits it; "Type your own…" opens a box to force a hand-typed word.+ * [onCommit] takes the forced prefix (confirmed text up to and including the new+ * word); the close button dismisses without leaving the mode.+ */+@Composable+fun AlternativesDrawer(+ target: AlternativesTarget,+ fullText: String,+ steerPreview: suspend (String) -> String?,+ onCommit: (String) -> Unit,+ onDismiss: () -> Unit,+) {+ val begin = target.wordBegin.coerceIn(0, fullText.length)+ val head = fullText.substring(0, begin)+ // The swapped word sits right after the confirmed prefix, so its word index+ // (in both the original and every re-decoded sentence) is the prefix's word+ // count.+ val boldIndex = head.split(WS).filter { it.isNotBlank() }.size++ var showCustom by remember(target) { mutableStateOf(false) }++ // option text -> re-decoded sentence (null while loading / on failure).+ val previews = remember(target) { mutableStateMapOf<String, String?>() }+ LaunchedEffect(target) {+ for (option in target.options) {+ previews[option.text] = steerPreview(head + option.text)+ }+ }++ Popup(+ alignment = Alignment.BottomCenter,+ properties = PopupProperties(focusable = false),+ ) {+ Surface(+ modifier = Modifier.fillMaxWidth(),+ shape = RoundedCornerShape(topStart = 16.dp, topEnd = 16.dp),+ color = MaterialTheme.colorScheme.surface,+ tonalElevation = 8.dp,+ shadowElevation = 8.dp,+ ) {+ Column(+ modifier = Modifier.padding(horizontal = 16.dp, vertical = 8.dp).fillMaxWidth(),+ ) {+ Row(+ modifier = Modifier.fillMaxWidth(),+ horizontalArrangement = Arrangement.End,+ ) {+ IconButton(onClick = onDismiss, modifier = Modifier.size(28.dp)) {+ Icon(+ painterResource(id = R.drawable.cancel),+ contentDescription = stringResource(R.string.a11y_close_alternatives),+ tint = MaterialTheme.colorScheme.onSurfaceVariant,+ )+ }+ }+ Column(+ modifier = Modifier.heightIn(max = 280.dp).verticalScroll(rememberScrollState()),+ verticalArrangement = Arrangement.spacedBy(4.dp),+ ) {+ for (option in target.options) {+ val preview = previews[option.text]+ Text(+ // Before the steer returns, show the swap in place with no tail.+ text = window(preview ?: (head + option.text), boldIndex),+ style = MaterialTheme.typography.bodyLarge,+ color =+ if (preview == null) {+ MaterialTheme.colorScheme.onSurfaceVariant+ } else {+ MaterialTheme.colorScheme.onSurface+ },+ modifier =+ Modifier+ .fillMaxWidth()+ .clickable { onCommit(head + option.text) }+ .padding(vertical = 12.dp),+ )+ }+ Text(+ text = stringResource(R.string.alt_custom_entry),+ style = MaterialTheme.typography.bodyLarge,+ color = MaterialTheme.colorScheme.primary,+ textAlign = TextAlign.Center,+ modifier =+ Modifier+ .fillMaxWidth()+ .clickable { showCustom = true }+ .padding(vertical = 12.dp),+ )+ }+ }+ }+ }++ if (showCustom) {+ CustomAlternativeDialog(+ head = head,+ boldIndex = boldIndex,+ steerPreview = steerPreview,+ onCommit = onCommit,+ onDismiss = { showCustom = false },+ )+ }+}++/**+ * A small modal to force a hand-typed word at the tapped position. The preview+ * re-decodes the sentence from `head + typed` (debounced) so the user sees the+ * actual result before committing. OK forces exactly what was typed.+ */+@Composable+private fun CustomAlternativeDialog(+ head: String,+ boldIndex: Int,+ steerPreview: suspend (String) -> String?,+ onCommit: (String) -> Unit,+ onDismiss: () -> Unit,+) {+ var typed by remember { mutableStateOf("") }+ var preview by remember { mutableStateOf<String?>(null) }+ LaunchedEffect(typed) {+ if (typed.isBlank()) {+ preview = null+ return@LaunchedEffect+ }+ preview = null+ delay(300)+ preview = steerPreview(head + typed)+ }++ Dialog(onDismissRequest = onDismiss) {+ Surface(+ shape = MaterialTheme.shapes.large,+ color = MaterialTheme.colorScheme.surface,+ tonalElevation = 6.dp,+ ) {+ Column(+ modifier = Modifier.padding(16.dp).fillMaxWidth(),+ verticalArrangement = Arrangement.spacedBy(12.dp),+ ) {+ OutlinedTextField(+ value = typed,+ onValueChange = { typed = it },+ singleLine = true,+ label = { Text(stringResource(R.string.alt_custom_label)) },+ modifier = Modifier.fillMaxWidth(),+ )+ Text(+ text = stringResource(R.string.alt_custom_preview_label),+ style = MaterialTheme.typography.labelMedium,+ color = MaterialTheme.colorScheme.onSurfaceVariant,+ )+ Text(+ text =+ if (typed.isBlank()) {+ headContext(head)+ } else {+ window(preview ?: (head + typed), boldIndex)+ },+ style = MaterialTheme.typography.bodyLarge,+ color =+ if (preview == null) {+ MaterialTheme.colorScheme.onSurfaceVariant+ } else {+ MaterialTheme.colorScheme.onSurface+ },+ )+ Row(+ modifier = Modifier.fillMaxWidth(),+ horizontalArrangement = Arrangement.End,+ ) {+ TextButton(onClick = onDismiss) {+ Text(stringResource(R.string.common_cancel))+ }+ TextButton(+ onClick = { onCommit(head + typed) },+ enabled = typed.isNotBlank(),+ ) {+ Text(stringResource(R.string.common_ok))+ }+ }+ }+ }+ }+}diff --git a/OCR-translation/src/main/java/dev/davidv/translator/ui/components/AlternativesTarget.kt b/OCR-translation/src/main/java/dev/davidv/translator/ui/components/AlternativesTarget.ktnew file mode 100644index 0000000..416361e--- /dev/null+++ b/OCR-translation/src/main/java/dev/davidv/translator/ui/components/AlternativesTarget.kt@@ -0,0 +1,29 @@+/*+ * Copyright (C) 2024 David V+ *+ * This program 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.+ *+ * This program 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 <https://www.gnu.org/licenses/>.+ */++package dev.davidv.translator.ui.components++import dev.davidv.translator.WordAlternative++// A tapped word the alternatives drawer acts on. Carries the word's char range+// in the current translation plus the model's alternatives (empty when the+// model had none — only "Type your own…" is offered then).+data class AlternativesTarget(+ val wordBegin: Int,+ val wordEnd: Int,+ val options: List<WordAlternative>,+)diff --git a/OCR-translation/src/main/java/dev/davidv/translator/ui/components/AppCard.kt b/OCR-translation/src/main/java/dev/davidv/translator/ui/components/AppCard.ktnew file mode 100644index 0000000..54cbcc6--- /dev/null+++ b/OCR-translation/src/main/java/dev/davidv/translator/ui/components/AppCard.kt@@ -0,0 +1,43 @@+/*+ * Copyright (C) 2024 David V+ *+ * This program 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.+ *+ * This program 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 <https://www.gnu.org/licenses/>.+ */++package dev.davidv.translator.ui.components++import androidx.compose.foundation.shape.RoundedCornerShape+import androidx.compose.material3.MaterialTheme+import androidx.compose.material3.Surface+import androidx.compose.runtime.Composable+import androidx.compose.ui.Modifier+import androidx.compose.ui.unit.dp++// The shared card surface used across the app (input/output cards, settings and+// how-to sections): a rounded, near-white surface lifted off the tinted+// background by a soft shadow. Callers supply their own inner padding.+@Composable+fun AppCard(+ modifier: Modifier = Modifier,+ content: @Composable () -> Unit,+) {+ Surface(+ modifier = modifier,+ shape = RoundedCornerShape(14.dp),+ color = MaterialTheme.colorScheme.surfaceContainerLowest,+ shadowElevation = 1.dp,+ ) {+ content()+ }+}diff --git a/OCR-translation/src/main/java/dev/davidv/translator/ui/components/AppCropActivity.kt b/OCR-translation/src/main/java/dev/davidv/translator/ui/components/AppCropActivity.ktnew file mode 100644index 0000000..88e08ac--- /dev/null+++ b/OCR-translation/src/main/java/dev/davidv/translator/ui/components/AppCropActivity.kt@@ -0,0 +1,381 @@+/*+ * Copyright (C) 2024 David V+ *+ * This program 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.+ *+ * This program 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 <https://www.gnu.org/licenses/>.+ */++package dev.davidv.translator.ui.components++import android.animation.Animator+import android.animation.AnimatorListenerAdapter+import android.animation.ValueAnimator+import android.app.Activity+import android.content.Intent+import android.graphics.Rect+import android.graphics.RectF+import android.os.Build+import android.os.Bundle+import android.util.TypedValue+import android.view.Gravity+import android.view.View+import android.view.ViewGroup+import android.view.animation.DecelerateInterpolator+import android.widget.ImageButton+import android.widget.ImageView+import android.widget.LinearLayout+import android.widget.RelativeLayout+import android.widget.TextView+import androidx.core.view.ViewCompat+import androidx.core.view.WindowCompat+import androidx.core.view.WindowInsetsCompat+import com.yalantis.ucrop.R+import com.yalantis.ucrop.UCrop+import com.yalantis.ucrop.UCropActivity+import com.yalantis.ucrop.callback.OverlayViewChangeListener+import com.yalantis.ucrop.view.OverlayView+import com.yalantis.ucrop.view.UCropView+import kotlin.math.abs+import kotlin.math.min+import kotlin.math.pow++class AppCropActivity : UCropActivity() {+ private var inAutoZoom = false+ private var ucropView: UCropView? = null+ private var lastCropRect: RectF? = null++ override fun onCreate(savedInstanceState: Bundle?) {+ super.onCreate(savedInstanceState)++ WindowCompat.getInsetsController(window, window.decorView).isAppearanceLightStatusBars = false++ findViewById<View>(R.id.toolbar)?.visibility = View.GONE+ findViewById<View>(R.id.state_rotate)?.performClick()+ findViewById<View>(R.id.wrapper_states)?.visibility = View.GONE++ findViewById<View>(R.id.ucrop_photobox)?.let { root ->+ ViewCompat.setOnApplyWindowInsetsListener(root) { v, insets ->+ val sys = insets.getInsets(WindowInsetsCompat.Type.systemBars())+ v.setPadding(sys.left, sys.top, sys.right, sys.bottom)+ insets+ }+ }++ val toolbarColor =+ intent.getIntExtra(+ UCrop.Options.EXTRA_TOOL_BAR_COLOR,+ getColor(R.color.ucrop_color_toolbar),+ )+ val toolbarWidgetColor =+ intent.getIntExtra(+ UCrop.Options.EXTRA_UCROP_WIDGET_COLOR_TOOLBAR,+ getColor(R.color.ucrop_color_toolbar_widget),+ )++ findViewById<ViewGroup>(R.id.wrapper_controls)?.let { wrapper ->+ wrapper.setBackgroundColor(toolbarColor)+ for (i in 0 until wrapper.childCount) {+ val child = wrapper.getChildAt(i)+ if (child is ImageView && child.id == View.NO_ID) {+ child.background = null+ }+ }+ }++ installBottomActionBar(toolbarColor, toolbarWidgetColor)++ ucropView = findViewById(R.id.ucrop)+ ucropView?.let { ucrop ->+ val cropImageView = ucrop.cropImageView+ cropImageView.setScaleEnabled(true)+ cropImageView.setRotateEnabled(false)+ val overlay = ucrop.overlayView+ overlay.setFreestyleCropMode(OverlayView.FREESTYLE_CROP_MODE_ENABLE_WITH_PASS_THROUGH)+ overlay.setOverlayViewChangeListener(+ object : OverlayViewChangeListener {+ override fun onCropRectUpdated(cropRect: RectF) {+ if (inAutoZoom) {+ cropImageView.setCropRect(cropRect)+ return+ }+ val prev = lastCropRect+ if (prev == null) {+ lastCropRect = RectF(cropRect)+ cropImageView.setCropRect(cropRect)+ return+ }+ zoomCropToViewport(overlay, cropRect, prev)+ }+ },+ )+ }++ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {+ findViewById<View>(R.id.ucrop)?.addOnLayoutChangeListener(+ View.OnLayoutChangeListener { v, _, _, _, _, _, _, _, _ ->+ v.systemGestureExclusionRects = listOf(Rect(0, 0, v.width, v.height))+ },+ )+ }++ installModeSwitchButton()+ }++ private fun installModeSwitchButton() {+ val photobox = findViewById<ViewGroup>(R.id.ucrop_photobox) as? RelativeLayout ?: return+ val catalog = (application as? dev.davidv.translator.TranslatorApplication)?.languageCatalog+ val docDetectInstalled = catalog?.supportInstalledByKind("doc_detect") == true+ if (!docDetectInstalled) return+ val sizePx =+ TypedValue.applyDimension(+ TypedValue.COMPLEX_UNIT_DIP,+ 40f,+ resources.displayMetrics,+ ).toInt()+ val marginPx =+ TypedValue.applyDimension(+ TypedValue.COMPLEX_UNIT_DIP,+ 8f,+ resources.displayMetrics,+ ).toInt()++ val button =+ ImageButton(this).apply {+ setImageResource(dev.davidv.translator.R.drawable.auto_awesome)+ setColorFilter(android.graphics.Color.WHITE)+ val outValue = TypedValue()+ context.theme.resolveAttribute(+ android.R.attr.selectableItemBackgroundBorderless,+ outValue,+ true,+ )+ setBackgroundResource(outValue.resourceId)+ contentDescription = getString(dev.davidv.translator.R.string.a11y_detect_document_corners)+ setOnClickListener {+ setResult(RESULT_SWITCH_TO_DOC_ALIGN, Intent())+ finish()+ }+ layoutParams =+ RelativeLayout.LayoutParams(sizePx, sizePx).apply {+ addRule(RelativeLayout.ALIGN_PARENT_TOP)+ addRule(RelativeLayout.ALIGN_PARENT_END)+ setMargins(marginPx, marginPx, marginPx, marginPx)+ }+ }+ photobox.addView(button)+ }++ private fun zoomCropToViewport(+ overlay: OverlayView,+ newRect: RectF,+ prevRect: RectF,+ ) {+ val ucrop = ucropView ?: return+ val cropImageView = ucrop.cropImageView++ val vL = overlay.paddingLeft.toFloat()+ val vT = overlay.paddingTop.toFloat()+ val vR = (overlay.width - overlay.paddingRight).toFloat()+ val vB = (overlay.height - overlay.paddingBottom).toFloat()++ if (newRect.width() <= 0f || newRect.height() <= 0f) return++ val eps = MOVE_EPS_PX+ val leftMoved = abs(newRect.left - prevRect.left) > eps+ val rightMoved = abs(newRect.right - prevRect.right) > eps+ val topMoved = abs(newRect.top - prevRect.top) > eps+ val bottomMoved = abs(newRect.bottom - prevRect.bottom) > eps++ val xMoves = (if (leftMoved) 1 else 0) + (if (rightMoved) 1 else 0)+ val yMoves = (if (topMoved) 1 else 0) + (if (bottomMoved) 1 else 0)++ if (xMoves > 1 || yMoves > 1 || (xMoves == 0 && yMoves == 0)) {+ finishWithoutZoom(overlay, cropImageView, newRect)+ return+ }++ val anchorX: Float+ val maxScaleX: Float+ when {+ xMoves == 0 -> {+ anchorX = newRect.centerX()+ maxScaleX = 1f+ }+ leftMoved -> {+ anchorX = prevRect.right+ maxScaleX = (anchorX - vL) / (anchorX - newRect.left)+ }+ else -> {+ anchorX = prevRect.left+ maxScaleX = (vR - anchorX) / (newRect.right - anchorX)+ }+ }++ val anchorY: Float+ val maxScaleY: Float+ when {+ yMoves == 0 -> {+ anchorY = newRect.centerY()+ maxScaleY = 1f+ }+ topMoved -> {+ anchorY = prevRect.bottom+ maxScaleY = (anchorY - vT) / (anchorY - newRect.top)+ }+ else -> {+ anchorY = prevRect.top+ maxScaleY = (vB - anchorY) / (newRect.bottom - anchorY)+ }+ }++ var scale = min(maxScaleX, maxScaleY)+ val maxImage = cropImageView.maxScale / cropImageView.currentScale+ if (scale > maxImage) scale = maxImage+ if (scale <= 1.001f) {+ finishWithoutZoom(overlay, cropImageView, newRect)+ return+ }++ val totalScale = scale+ val initialRect = RectF(newRect)++ inAutoZoom = true+ overlay.setShowCropGrid(false)+ var lastF = 0f+ ValueAnimator.ofFloat(0f, 1f).apply {+ duration = 180L+ interpolator = DecelerateInterpolator()+ addUpdateListener {+ val f = it.animatedFraction+ val df = f - lastF+ if (df > 0f) {+ val r = totalScale.toDouble().pow(df.toDouble()).toFloat()+ cropImageView.postScale(r, anchorX, anchorY)++ val sf = totalScale.toDouble().pow(f.toDouble()).toFloat()+ overlay.cropViewRect.set(+ anchorX + (initialRect.left - anchorX) * sf,+ anchorY + (initialRect.top - anchorY) * sf,+ anchorX + (initialRect.right - anchorX) * sf,+ anchorY + (initialRect.bottom - anchorY) * sf,+ )+ overlay.invalidate()+ }+ lastF = f+ }+ addListener(+ object : AnimatorListenerAdapter() {+ override fun onAnimationEnd(animation: Animator) {+ cropImageView.setCropRect(overlay.cropViewRect)+ overlay.setShowCropGrid(true)+ overlay.setCropGridRowCount(GRID_COUNT)+ overlay.setCropGridColumnCount(GRID_COUNT)+ refreshOverlayGridCorners(overlay)+ overlay.invalidate()+ lastCropRect = RectF(overlay.cropViewRect)+ inAutoZoom = false+ }+ },+ )+ start()+ }+ }++ private fun finishWithoutZoom(+ overlay: OverlayView,+ cropImageView: com.yalantis.ucrop.view.GestureCropImageView,+ newRect: RectF,+ ) {+ cropImageView.setCropRect(newRect)+ lastCropRect = RectF(newRect)+ }++ private fun refreshOverlayGridCorners(overlay: OverlayView) {+ runCatching { updateGridPointsMethod.invoke(overlay) }+ }++ companion object {+ private const val GRID_COUNT = 2+ private const val MOVE_EPS_PX = 12f++ const val RESULT_SWITCH_TO_DOC_ALIGN = Activity.RESULT_FIRST_USER + 2++ private val updateGridPointsMethod by lazy {+ OverlayView::class.java.getDeclaredMethod("updateGridPoints").apply { isAccessible = true }+ }+ }++ private fun installBottomActionBar(+ barColor: Int,+ textColor: Int,+ ) {+ val photobox = findViewById<ViewGroup>(R.id.ucrop_photobox) as? RelativeLayout ?: return+ val controlsWrapper = findViewById<View>(R.id.controls_wrapper) ?: return++ val barHeightPx =+ TypedValue.applyDimension(+ TypedValue.COMPLEX_UNIT_DIP,+ 56f,+ resources.displayMetrics,+ ).toInt()++ val bottomBarId = View.generateViewId()+ val bottomBar =+ LinearLayout(this).apply {+ id = bottomBarId+ orientation = LinearLayout.HORIZONTAL+ setBackgroundColor(barColor)+ gravity = Gravity.CENTER_VERTICAL+ layoutParams =+ RelativeLayout.LayoutParams(+ RelativeLayout.LayoutParams.MATCH_PARENT,+ barHeightPx,+ ).apply { addRule(RelativeLayout.ALIGN_PARENT_BOTTOM) }+ }++ fun makeButton(+ label: String,+ onClick: () -> Unit,+ ) = TextView(this).apply {+ text = label+ setTextColor(textColor)+ setTextSize(TypedValue.COMPLEX_UNIT_SP, 14f)+ gravity = Gravity.CENTER+ isAllCaps = true+ val outValue = TypedValue()+ context.theme.resolveAttribute(+ android.R.attr.selectableItemBackgroundBorderless,+ outValue,+ true,+ )+ setBackgroundResource(outValue.resourceId)+ setOnClickListener { onClick() }+ layoutParams =+ LinearLayout.LayoutParams(+ 0,+ LinearLayout.LayoutParams.MATCH_PARENT,+ 1f,+ )+ }++ bottomBar.addView(makeButton(getString(dev.davidv.translator.R.string.common_cancel)) { finish() })+ bottomBar.addView(makeButton(getString(dev.davidv.translator.R.string.image_crop_action)) { cropAndSaveImage() })++ photobox.addView(bottomBar)++ val wrapperParams = controlsWrapper.layoutParams as RelativeLayout.LayoutParams+ wrapperParams.removeRule(RelativeLayout.ALIGN_PARENT_BOTTOM)+ wrapperParams.addRule(RelativeLayout.ABOVE, bottomBarId)+ controlsWrapper.layoutParams = wrapperParams+ }+}diff --git a/OCR-translation/src/main/java/dev/davidv/translator/ui/components/AppCropImageView.kt b/OCR-translation/src/main/java/dev/davidv/translator/ui/components/AppCropImageView.ktnew file mode 100644index 0000000..1d4462c--- /dev/null+++ b/OCR-translation/src/main/java/dev/davidv/translator/ui/components/AppCropImageView.kt@@ -0,0 +1,70 @@+/*+ * Copyright (C) 2024 David V+ *+ * This program 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.+ *+ * This program 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 <https://www.gnu.org/licenses/>.+ */++package dev.davidv.translator.ui.components++import android.content.Context+import android.graphics.Bitmap+import android.graphics.RectF+import android.util.AttributeSet+import com.yalantis.ucrop.callback.BitmapCropCallback+import com.yalantis.ucrop.util.RectUtils+import com.yalantis.ucrop.view.CropImageView+import com.yalantis.ucrop.view.GestureCropImageView++class AppCropImageView+ @JvmOverloads+ constructor(+ context: Context,+ attrs: AttributeSet? = null,+ defStyle: Int = 0,+ ) : GestureCropImageView(context, attrs, defStyle) {+ override fun setImageToWrapCropBounds() {}++ override fun setImageToWrapCropBounds(animate: Boolean) {}++ override fun postScale(+ deltaScale: Float,+ px: Float,+ py: Float,+ ) {+ if (deltaScale == 0f) return+ mCurrentImageMatrix.postScale(deltaScale, deltaScale, px, py)+ imageMatrix = mCurrentImageMatrix+ }++ override fun cropAndSaveImage(+ compressFormat: Bitmap.CompressFormat,+ compressQuality: Int,+ cropCallback: BitmapCropCallback?,+ ) {+ val imageBounds = RectUtils.trapToRect(mCurrentImageCorners)+ val cropRect = cropRectField.get(this) as RectF+ cropRect.intersect(+ imageBounds.left,+ imageBounds.top,+ imageBounds.right,+ imageBounds.bottom,+ )+ super.cropAndSaveImage(compressFormat, compressQuality, cropCallback)+ }++ companion object {+ private val cropRectField =+ CropImageView::class.java.getDeclaredField("mCropRect").apply { isAccessible = true }+ }+ }diff --git a/OCR-translation/src/main/java/dev/davidv/translator/ui/components/DetectedLanguageSection.kt b/OCR-translation/src/main/java/dev/davidv/translator/ui/components/DetectedLanguageSection.ktnew file mode 100644index 0000000..b36059c--- /dev/null+++ b/OCR-translation/src/main/java/dev/davidv/translator/ui/components/DetectedLanguageSection.kt@@ -0,0 +1,152 @@+/*+ * Copyright (C) 2024 David V+ *+ * This program 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.+ *+ * This program 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 <https://www.gnu.org/licenses/>.+ */++package dev.davidv.translator.ui.components++import android.content.res.Configuration+import androidx.compose.foundation.layout.padding+import androidx.compose.runtime.Composable+import androidx.compose.runtime.getValue+import androidx.compose.runtime.setValue+import androidx.compose.ui.Modifier+import androidx.compose.ui.tooling.preview.Preview+import androidx.compose.ui.unit.dp+import dev.davidv.translator.DownloadState+import dev.davidv.translator.FromLangChange+import dev.davidv.translator.LangAvailability+import dev.davidv.translator.Language+import dev.davidv.translator.LanguageAvailabilityEntry+import dev.davidv.translator.LanguageAvailabilityState+import dev.davidv.translator.Script+import dev.davidv.translator.TranslatorMessage+import dev.davidv.translator.singleScript+import dev.davidv.translator.ui.theme.TranslatorTheme++@Composable+fun DetectedLanguageSection(+ detectedLanguage: Language?,+ from: Language,+ languageState: LanguageAvailabilityState,+ onMessage: (TranslatorMessage) -> Unit,+ downloadStates: Map<Language, DownloadState>,+ onEvent: (LanguageEvent) -> Unit,+ isAutoSource: Boolean = false,+) {+ if (detectedLanguage == null) return+ val isInstalled = languageState.availabilityFor(detectedLanguage)?.translatorFiles == true+ if (isAutoSource && isInstalled) return+ if (!isAutoSource && detectedLanguage == from) return+ DetectedLanguageToast(+ detectedLanguage = detectedLanguage,+ languageState = languageState,+ onSwitchClick = {+ onMessage(TranslatorMessage.FromLang(detectedLanguage, FromLangChange.MovePreviousToTarget))+ },+ modifier = Modifier.padding(horizontal = 8.dp, vertical = 8.dp),+ downloadStates = downloadStates,+ onEvent = onEvent,+ )+}++private fun previewLanguageState(entries: List<Pair<Language, LangAvailability>>) =+ LanguageAvailabilityState(+ hasLanguages = true,+ availableLanguages = entries.map { (language, availability) -> LanguageAvailabilityEntry(language, availability) },+ isChecking = false,+ )++private fun previewLanguage(+ code: String,+ name: String,+) = Language(+ code = code,+ displayName = name,+ shortDisplayName = name,+ script = Script.LATIN,+ writingSystem = singleScript(Script.LATIN),+ dictionaryCode = code,+)++@Preview(showBackground = true)+@Composable+fun DetectedLanguageSectionPreview() {+ TranslatorTheme {+ DetectedLanguageSection(+ detectedLanguage = previewLanguage("fr", "French"),+ from = previewLanguage("en", "English"),+ languageState =+ previewLanguageState(+ listOf(+ previewLanguage("en", "English") to LangAvailability(true, true, true, true),+ previewLanguage("es", "Spanish") to LangAvailability(true, true, true, true),+ previewLanguage("fr", "French") to LangAvailability(true, true, true, true),+ previewLanguage("de", "German") to LangAvailability(false, false, true, true),+ ),+ ),+ onMessage = {},+ downloadStates = emptyMap(),+ onEvent = {},+ )+ }+}++@Preview(showBackground = true)+@Composable+fun DetectedLanguageSectionNoDetectionPreview() {+ TranslatorTheme {+ DetectedLanguageSection(+ detectedLanguage = null,+ from = previewLanguage("en", "English"),+ languageState =+ previewLanguageState(+ listOf(+ previewLanguage("en", "English") to LangAvailability(true, true, true, true),+ previewLanguage("es", "Spanish") to LangAvailability(true, true, true, true),+ previewLanguage("fr", "French") to LangAvailability(true, true, true, true),+ ),+ ),+ onMessage = {},+ downloadStates = emptyMap(),+ onEvent = {},+ )+ }+}++@Preview(+ showBackground = true,+ uiMode = Configuration.UI_MODE_NIGHT_YES,+)+@Composable+fun DetectedLanguageSectionDarkPreview() {+ TranslatorTheme {+ DetectedLanguageSection(+ detectedLanguage = previewLanguage("de", "German"),+ from = previewLanguage("es", "Spanish"),+ languageState =+ previewLanguageState(+ listOf(+ previewLanguage("en", "English") to LangAvailability(true, true, true, true),+ previewLanguage("es", "Spanish") to LangAvailability(true, true, true, true),+ previewLanguage("de", "German") to LangAvailability(true, true, true, true),+ ),+ ),+ onMessage = {},+ downloadStates = emptyMap(),+ onEvent = {},+ )+ }+}diff --git a/OCR-translation/src/main/java/dev/davidv/translator/ui/components/DetectedLanguageToast.kt b/OCR-translation/src/main/java/dev/davidv/translator/ui/components/DetectedLanguageToast.ktnew file mode 100644index 0000000..659150a--- /dev/null+++ b/OCR-translation/src/main/java/dev/davidv/translator/ui/components/DetectedLanguageToast.kt@@ -0,0 +1,195 @@+/*+ * Copyright (C) 2024 David V+ *+ * This program 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.+ *+ * This program 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 <https://www.gnu.org/licenses/>.+ */++package dev.davidv.translator.ui.components++import androidx.compose.foundation.background+import androidx.compose.foundation.clickable+import androidx.compose.foundation.layout.Arrangement+import androidx.compose.foundation.layout.Column+import androidx.compose.foundation.layout.Row+import androidx.compose.foundation.layout.fillMaxWidth+import androidx.compose.foundation.layout.padding+import androidx.compose.foundation.shape.RoundedCornerShape+import androidx.compose.material.icons.Icons+import androidx.compose.material.icons.automirrored.filled.ArrowForward+import androidx.compose.material3.Icon+import androidx.compose.material3.MaterialTheme+import androidx.compose.material3.Text+import androidx.compose.runtime.Composable+import androidx.compose.ui.Alignment+import androidx.compose.ui.Modifier+import androidx.compose.ui.draw.clip+import androidx.compose.ui.res.stringResource+import androidx.compose.ui.semantics.contentDescription+import androidx.compose.ui.semantics.semantics+import androidx.compose.ui.text.font.FontWeight+import androidx.compose.ui.tooling.preview.Preview+import androidx.compose.ui.unit.dp+import androidx.compose.ui.unit.sp+import dev.davidv.translator.DownloadState+import dev.davidv.translator.LangAvailability+import dev.davidv.translator.Language+import dev.davidv.translator.LanguageAvailabilityEntry+import dev.davidv.translator.LanguageAvailabilityState+import dev.davidv.translator.R+import dev.davidv.translator.Script+import dev.davidv.translator.localizedName+import dev.davidv.translator.singleScript+import dev.davidv.translator.ui.theme.TranslatorTheme++@Composable+fun DetectedLanguageToast(+ detectedLanguage: Language,+ languageState: LanguageAvailabilityState,+ onSwitchClick: () -> Unit,+ onEvent: (LanguageEvent) -> Unit,+ modifier: Modifier = Modifier,+ downloadStates: Map<Language, DownloadState> = emptyMap(),+) {+ val isLanguageAvailable = languageState.availabilityFor(detectedLanguage)?.translatorFiles == true+ val isDownloading = downloadStates[detectedLanguage]?.isDownloading == true+ val toastDescription = stringResource(R.string.a11y_detected_language_toast)++ val onToastClick: () -> Unit =+ when {+ isLanguageAvailable -> onSwitchClick+ isDownloading -> ({ onEvent(LanguageEvent.Cancel(detectedLanguage)) })+ else -> ({ onEvent(LanguageEvent.Download(detectedLanguage)) })+ }++ Row(+ modifier =+ modifier+ .fillMaxWidth()+ .clip(RoundedCornerShape(12.dp))+ .background(MaterialTheme.colorScheme.surfaceVariant.copy(alpha = 0.5f))+ .clickable(onClick = onToastClick)+ .padding(horizontal = 16.dp, vertical = 12.dp)+ .semantics { contentDescription = toastDescription },+ horizontalArrangement = Arrangement.SpaceBetween,+ verticalAlignment = Alignment.CenterVertically,+ ) {+ Column(+ modifier = Modifier.weight(1f),+ ) {+ Text(+ text =+ if (isLanguageAvailable) {+ stringResource(R.string.detected_translate_from)+ } else {+ stringResource(R.string.detected_missing_language)+ },+ fontSize = 12.sp,+ color = MaterialTheme.colorScheme.onSurface.copy(alpha = 0.7f),+ style = MaterialTheme.typography.bodySmall,+ )+ Text(+ text = detectedLanguage.localizedName(),+ fontSize = 16.sp,+ fontWeight = FontWeight.Medium,+ color = MaterialTheme.colorScheme.onSurface,+ style = MaterialTheme.typography.bodyMedium,+ )+ }++ if (isLanguageAvailable) {+ Icon(+ imageVector = Icons.AutoMirrored.Filled.ArrowForward,+ contentDescription = stringResource(R.string.a11y_switch_detected_language),+ tint = MaterialTheme.colorScheme.onSurface,+ modifier = Modifier.padding(horizontal = 8.dp, vertical = 4.dp),+ )+ } else {+ LanguageDownloadButton(+ language = detectedLanguage,+ downloadState = downloadStates[detectedLanguage],+ isLanguageAvailable = false,+ onEvent = onEvent,+ modifier = Modifier.padding(horizontal = 8.dp, vertical = 4.dp),+ enabled = true,+ )+ }+ }+}++private fun previewLanguageState(entries: List<Pair<Language, LangAvailability>>) =+ LanguageAvailabilityState(+ hasLanguages = true,+ availableLanguages = entries.map { (language, availability) -> LanguageAvailabilityEntry(language, availability) },+ isChecking = false,+ )++private fun previewLanguage(+ code: String,+ name: String,+) = Language(+ code = code,+ displayName = name,+ shortDisplayName = name,+ script = Script.LATIN,+ writingSystem = singleScript(Script.LATIN),+ dictionaryCode = code,+)++@Preview(showBackground = true)+@Composable+fun DetectedLanguageToastPreview() {+ TranslatorTheme {+ DetectedLanguageToast(+ detectedLanguage = previewLanguage("es", "Spanish"),+ languageState = previewLanguageState(listOf(previewLanguage("es", "Spanish") to LangAvailability(true, true, true, true))),+ onSwitchClick = {},+ onEvent = {},+ downloadStates = emptyMap(),+ )+ }+}++@Preview(+ showBackground = true,+ uiMode = android.content.res.Configuration.UI_MODE_NIGHT_YES,+)+@Composable+fun DetectedLanguageToastDarkPreview() {+ TranslatorTheme {+ DetectedLanguageToast(+ detectedLanguage = previewLanguage("fr", "French"),+ languageState = previewLanguageState(listOf(previewLanguage("fr", "French") to LangAvailability(true, true, true, true))),+ onSwitchClick = {},+ onEvent = {},+ downloadStates = emptyMap(),+ )+ }+}++@Preview(+ showBackground = true,+ uiMode = android.content.res.Configuration.UI_MODE_NIGHT_YES,+)+@Composable+fun MissingLanguage() {+ TranslatorTheme {+ DetectedLanguageToast(+ detectedLanguage = previewLanguage("es", "Spanish"),+ languageState = previewLanguageState(listOf(previewLanguage("fr", "French") to LangAvailability(false, false, true, true))),+ onSwitchClick = {},+ onEvent = {},+ downloadStates = emptyMap(),+ )+ }+}diff --git a/OCR-translation/src/main/java/dev/davidv/translator/ui/components/DictionaryActionModeCallback.kt b/OCR-translation/src/main/java/dev/davidv/translator/ui/components/DictionaryActionModeCallback.ktnew file mode 100644index 0000000..656ce50--- /dev/null+++ b/OCR-translation/src/main/java/dev/davidv/translator/ui/components/DictionaryActionModeCallback.kt@@ -0,0 +1,169 @@+/*+ * Copyright (C) 2024 David V+ *+ * This program 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.+ *+ * This program 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 <https://www.gnu.org/licenses/>.+ */++package dev.davidv.translator.ui.components++import android.content.Context+import android.content.Intent+import android.util.Log+import android.view.ActionMode+import android.view.Menu+import android.view.MenuItem+import android.widget.TextView+import dev.davidv.translator.browser.BrowserActivity+import dev.davidv.translator.isWebUrl++class DictionaryActionModeCallback(+ private val context: Context,+ private val onDictionaryLookup: (String) -> Unit,+ // When set, an "Alternatives" item is offered — but only for selections that+ // actually have alternatives (per [hasAlternatives]). Clicking reports the+ // selection's char range so the caller can open the matching word's options.+ private val onAlternatives: ((Int, Int) -> Unit)? = null,+ private val hasAlternatives: ((Int, Int) -> Boolean)? = null,+) : ActionMode.Callback2() {+ private var currentTextView: TextView? = null++ fun setTextView(textView: TextView) {+ currentTextView = textView+ }++ override fun onCreateActionMode(+ mode: ActionMode?,+ menu: Menu?,+ ): Boolean {+ syncCustomItems(menu)+ return true+ }++ override fun onPrepareActionMode(+ mode: ActionMode?,+ menu: Menu?,+ ): Boolean {+ menu?.let { m ->+ val itemsToRemove = mutableListOf<Int>()+ for (i in 0 until m.size()) {+ val item = m.getItem(i)+ if (item.intent?.action == Intent.ACTION_TRANSLATE ||+ item.intent?.`package` == context.packageName ||+ item.title == "Translate"+ ) {+ itemsToRemove.add(item.itemId)+ }+ }+ itemsToRemove.forEach { m.removeItem(it) }++ syncCustomItems(m)+ }+ Log.d("DictionaryActionMode", "Show menu now")+ return true+ }++ private fun syncCustomItems(menu: Menu?) {+ menu ?: return+ val selectionIsUrl = isSelectionUrl()+ val hasDictionary = menu.findItem(DICTIONARY_ID) != null+ val hasTranslateUrl = menu.findItem(TRANSLATE_URL_ID) != null++ val hasAlternativesItem = menu.findItem(ALTERNATIVES_ID) != null+ val offerAlternatives = onAlternatives != null && selectionHasAlternatives()+ if (selectionIsUrl) {+ if (hasDictionary) menu.removeItem(DICTIONARY_ID)+ if (hasAlternativesItem) menu.removeItem(ALTERNATIVES_ID)+ if (!hasTranslateUrl) menu.add(0, TRANSLATE_URL_ID, 0, "Translate URL")+ } else {+ if (hasTranslateUrl) menu.removeItem(TRANSLATE_URL_ID)+ if (!hasDictionary) menu.add(0, DICTIONARY_ID, 0, "Dictionary")+ if (offerAlternatives && !hasAlternativesItem) {+ menu.add(0, ALTERNATIVES_ID, 1, "Alternatives")+ } else if (!offerAlternatives && hasAlternativesItem) {+ menu.removeItem(ALTERNATIVES_ID)+ }+ }+ }++ private fun selectionHasAlternatives(): Boolean {+ val tv = currentTextView ?: return false+ val check = hasAlternatives ?: return false+ val start = tv.selectionStart+ val end = tv.selectionEnd+ return start in 0 until end && check(start, end)+ }++ private fun isSelectionUrl(): Boolean = selectedText()?.let { isWebUrl(it) } ?: false++ private fun selectedText(): String? {+ val tv = currentTextView ?: return null+ val start = tv.selectionStart+ val end = tv.selectionEnd+ if (start < 0 || end <= start) return null+ return tv.text?.subSequence(start, end)?.toString()+ }++ override fun onActionItemClicked(+ mode: ActionMode?,+ item: MenuItem?,+ ): Boolean {+ Log.d("DictionaryActionMode", "Clicked '${item?.itemId}' == '${item?.title}'")+ return when (item?.itemId) {+ DICTIONARY_ID -> {+ val selected = selectedText().orEmpty()+ if (selected.isNotBlank()) {+ onDictionaryLookup(selected)+ }+ mode?.finish()+ true+ }++ ALTERNATIVES_ID -> {+ val tv = currentTextView+ val cb = onAlternatives+ if (tv != null && cb != null) {+ val start = tv.selectionStart+ val end = tv.selectionEnd+ if (start in 0 until end) cb(start, end)+ }+ mode?.finish()+ true+ }++ TRANSLATE_URL_ID -> {+ val url = selectedText()?.trim()+ if (!url.isNullOrBlank() && isWebUrl(url)) {+ val intent =+ Intent(context, BrowserActivity::class.java).apply {+ putExtra(BrowserActivity.EXTRA_URL, url)+ addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)+ }+ context.startActivity(intent)+ }+ mode?.finish()+ true+ }++ else -> false+ }+ }++ override fun onDestroyActionMode(mode: ActionMode?) {}++ companion object {+ private const val DICTIONARY_ID = 12345+ private const val TRANSLATE_URL_ID = 12346+ private const val ALTERNATIVES_ID = 12347+ }+}diff --git a/OCR-translation/src/main/java/dev/davidv/translator/ui/components/DictionaryBottomSheet.kt b/OCR-translation/src/main/java/dev/davidv/translator/ui/components/DictionaryBottomSheet.ktnew file mode 100644index 0000000..4facda5--- /dev/null+++ b/OCR-translation/src/main/java/dev/davidv/translator/ui/components/DictionaryBottomSheet.kt@@ -0,0 +1,469 @@+/*+ * Copyright (C) 2024 David V+ *+ * This program 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.+ *+ * This program 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 <https://www.gnu.org/licenses/>.+ */++package dev.davidv.translator.ui.components++import androidx.compose.animation.AnimatedContent+import androidx.compose.animation.AnimatedVisibility+import androidx.compose.animation.core.tween+import androidx.compose.animation.fadeIn+import androidx.compose.animation.fadeOut+import androidx.compose.animation.slideInVertically+import androidx.compose.animation.slideOutVertically+import androidx.compose.animation.togetherWith+import androidx.compose.foundation.background+import androidx.compose.foundation.clickable+import androidx.compose.foundation.interaction.MutableInteractionSource+import androidx.compose.foundation.layout.Arrangement+import androidx.compose.foundation.layout.Box+import androidx.compose.foundation.layout.Column+import androidx.compose.foundation.layout.Row+import androidx.compose.foundation.layout.Spacer+import androidx.compose.foundation.layout.fillMaxSize+import androidx.compose.foundation.layout.fillMaxWidth+import androidx.compose.foundation.layout.heightIn+import androidx.compose.foundation.layout.imePadding+import androidx.compose.foundation.layout.navigationBarsPadding+import androidx.compose.foundation.layout.padding+import androidx.compose.foundation.layout.size+import androidx.compose.foundation.rememberScrollState+import androidx.compose.foundation.shape.RoundedCornerShape+import androidx.compose.foundation.verticalScroll+import androidx.compose.material3.Icon+import androidx.compose.material3.IconButton+import androidx.compose.material3.MaterialTheme+import androidx.compose.material3.Surface+import androidx.compose.material3.Text+import androidx.compose.runtime.Composable+import androidx.compose.runtime.LaunchedEffect+import androidx.compose.runtime.getValue+import androidx.compose.runtime.mutableIntStateOf+import androidx.compose.runtime.mutableStateOf+import androidx.compose.runtime.remember+import androidx.compose.runtime.setValue+import androidx.compose.ui.Alignment+import androidx.compose.ui.Modifier+import androidx.compose.ui.draw.clip+import androidx.compose.ui.graphics.Color+import androidx.compose.ui.platform.LocalConfiguration+import androidx.compose.ui.platform.testTag+import androidx.compose.ui.res.painterResource+import androidx.compose.ui.res.stringResource+import androidx.compose.ui.semantics.clearAndSetSemantics+import androidx.compose.ui.semantics.contentDescription+import androidx.compose.ui.semantics.semantics+import androidx.compose.ui.text.font.FontWeight+import androidx.compose.ui.tooling.preview.Preview+import androidx.compose.ui.unit.dp+import dev.davidv.translator.Gloss+import dev.davidv.translator.Language+import dev.davidv.translator.R+import dev.davidv.translator.Script+import dev.davidv.translator.Sense+import dev.davidv.translator.WordEntryComplete+import dev.davidv.translator.WordTag+import dev.davidv.translator.WordWithTaggedEntries+import dev.davidv.translator.singleScript+import dev.davidv.translator.ui.theme.TranslatorTheme+import dev.davidv.translator.wordTag++@Composable+fun DictionaryBottomSheet(+ dictionaryWord: WordWithTaggedEntries,+ dictionaryStack: List<WordWithTaggedEntries>,+ dictionaryLookupLanguage: Language,+ onDismiss: () -> Unit,+ onDictionaryLookup: (String) -> Unit = {},+ onBackPressed: () -> Unit = {},+) {+ var isVisible by remember { mutableStateOf(false) }+ var isDismissing by remember { mutableStateOf(false) }+ var selectedEntryIndex by remember(dictionaryWord) { mutableIntStateOf(0) }++ LaunchedEffect(Unit) {+ isVisible = true+ }++ val handleDismiss = {+ isDismissing = true+ isVisible = false+ }++ val handleBackPressed = {+ onBackPressed()+ }++ Box(+ modifier = Modifier.fillMaxSize(),+ ) {+ // Dimmed background+ Box(+ modifier =+ Modifier+ .fillMaxSize()+ .background(Color.Black.copy(alpha = 0.5f))+ .clickable(+ interactionSource = remember { MutableInteractionSource() },+ indication = null,+ ) { handleDismiss() },+ )++ // Bottom sheet content+ AnimatedVisibility(+ visible = isVisible,+ enter =+ slideInVertically(+ animationSpec = tween(300),+ initialOffsetY = { it },+ ),+ exit =+ slideOutVertically(+ animationSpec = tween(300),+ targetOffsetY = { it },+ ),+ modifier =+ Modifier+ .align(Alignment.BottomCenter)+ .navigationBarsPadding()+ .imePadding(),+ ) {+ Surface(+ modifier =+ Modifier+ .fillMaxWidth()+ .heightIn(max = (LocalConfiguration.current.screenHeightDp * 0.6f).dp)+ .clip(RoundedCornerShape(topStart = 16.dp, topEnd = 16.dp)),+ color = MaterialTheme.colorScheme.surface,+ tonalElevation = 8.dp,+ ) {+ Box(+ modifier = Modifier.fillMaxWidth(),+ ) {+ AnimatedContent(+ targetState = Pair(dictionaryWord, selectedEntryIndex),+ transitionSpec = {+ fadeIn(+ animationSpec = tween(150),+ ) togetherWith+ fadeOut(+ animationSpec = tween(150),+ )+ },+ label = "dictionary_content",+ modifier = Modifier.fillMaxWidth(),+ ) { (currentWord, entryIndex) ->+ DictionaryEntry(+ dictionaryWord = currentWord,+ dictionaryLookupLanguage = dictionaryLookupLanguage,+ selectedEntryIndex = entryIndex,+ onEntryIndexChanged = { selectedEntryIndex = it },+ showBackButton = dictionaryStack.size > 1,+ onDictionaryLookup = onDictionaryLookup,+ onBackPressed = handleBackPressed,+ )+ }+ }+ }+ }+ }++ LaunchedEffect(isDismissing) {+ if (isDismissing) {+ kotlinx.coroutines.delay(300) // Wait for exit animation+ onDismiss()+ }+ }+}++// The dictionary target is always English; this is a language code, not translatable text.+private const val ENGLISH_LANGUAGE_CODE = "en"++@Composable+fun DictionaryEntry(+ dictionaryWord: WordWithTaggedEntries,+ dictionaryLookupLanguage: Language,+ selectedEntryIndex: Int,+ onEntryIndexChanged: (Int) -> Unit,+ showBackButton: Boolean = false,+ onDictionaryLookup: (String) -> Unit = {},+ onBackPressed: () -> Unit = {},+) {+ val dictionaryEntryDescription = stringResource(R.string.a11y_dictionary_entry)+ Column(+ modifier =+ Modifier+ .fillMaxWidth()+ .padding(vertical = 16.dp, horizontal = 8.dp)+ .verticalScroll(rememberScrollState())+ .semantics { contentDescription = dictionaryEntryDescription }+ .testTag("DictionaryEntry"),+ ) {+ Box(+ modifier =+ Modifier+ .fillMaxWidth(),+ ) {+ if (showBackButton) {+ IconButton(+ onClick = onBackPressed,+ modifier =+ Modifier+ .align(Alignment.CenterStart)+ .size(24.dp),+ ) {+ Icon(+ painterResource(id = R.drawable.arrow_back),+ contentDescription = stringResource(R.string.a11y_back),+ tint = MaterialTheme.colorScheme.onSurface,+ )+ }+ }++ Row(+ modifier =+ Modifier+ .padding(start = if (showBackButton) 32.dp else 0.dp),+ ) {+ Text(+ dictionaryWord.word,+ style = MaterialTheme.typography.headlineSmall.copy(fontWeight = FontWeight.Bold),+ )++ Spacer(Modifier.weight(1f))+ if (dictionaryWord.wordTag == WordTag.BOTH) {+ Row(+ modifier = Modifier.alignByBaseline(),+ ) {+ Text(+ dictionaryLookupLanguage.code,+ style =+ MaterialTheme.typography.titleMedium.copy(+ fontWeight = if (selectedEntryIndex == 0) FontWeight.Bold else FontWeight.Normal,+ ),+ modifier =+ Modifier+ .padding(4.dp)+ .clickable { onEntryIndexChanged(0) },+ )+ Text(+ "|",+ style = MaterialTheme.typography.titleMedium.copy(fontWeight = FontWeight.Normal),+ modifier = Modifier.padding(4.dp),+ )+ Text(+ ENGLISH_LANGUAGE_CODE,+ style =+ MaterialTheme.typography.titleMedium.copy(+ fontWeight = if (selectedEntryIndex == 1) FontWeight.Bold else FontWeight.Normal,+ ),+ modifier =+ Modifier+ .padding(4.dp)+ .clickable { onEntryIndexChanged(1) },+ )+ }+ }+ }+ }++ val ipa = dictionaryWord.sounds?.replace('[', '/')?.replace(']', '/')+ val hyphenation = dictionaryWord.hyphenations.takeIf { it.isNotEmpty() }?.joinToString("‧")++ Row {+ if (!ipa.isNullOrEmpty()) {+ Text(+ text = ipa,+ style = MaterialTheme.typography.bodyMedium,+ modifier = Modifier.padding(bottom = 4.dp, end = if (hyphenation.isNullOrEmpty()) 0.dp else 16.dp),+ )+ }++ if (!hyphenation.isNullOrEmpty()) {+ Text(+ text = hyphenation,+ style = MaterialTheme.typography.bodyMedium,+ )+ }+ }++ val selectedEntry =+ if (dictionaryWord.tag == 3 && dictionaryWord.entries.size > selectedEntryIndex) {+ dictionaryWord.entries[selectedEntryIndex]+ } else {+ dictionaryWord.entries.firstOrNull()+ }++ if (dictionaryWord.redirects.isNotEmpty()) {+ Row(horizontalArrangement = Arrangement.spacedBy(0.dp)) {+ Text(+ text = stringResource(R.string.dict_also_as),+ style = MaterialTheme.typography.bodyMedium,+ modifier = Modifier.padding(end = 4.dp),+ )+ dictionaryWord.redirects.forEachIndexed { i, r ->+ InteractiveText(+ text = r,+ style = MaterialTheme.typography.bodyMedium.copy(fontWeight = FontWeight.SemiBold),+ onDictionaryLookup = onDictionaryLookup,+ )+ if (i < dictionaryWord.redirects.size - 1) {+ Text(+ text = ",",+ style = MaterialTheme.typography.bodyMedium,+ modifier = Modifier.padding(end = 2.dp),+ )+ }+ }+ }+ }++ if (selectedEntry != null) {+ WordEntryDisplay(+ entry = selectedEntry,+ onDictionaryLookup = onDictionaryLookup,+ )+ }+ }+}++@Composable+fun WordEntryDisplay(+ entry: WordEntryComplete,+ onDictionaryLookup: (String) -> Unit = {},+) {+ var lastPos: String? = null+ entry.senses.forEach { sense ->+ if (lastPos != sense.pos) {+ Text(+ text = sense.pos,+ style = MaterialTheme.typography.titleMedium.copy(fontWeight = FontWeight.SemiBold),+ modifier = Modifier.padding(bottom = 4.dp, top = 4.dp),+ )+ lastPos = sense.pos+ }++ sense.glosses.forEach { gloss ->+ gloss.glossLines.forEach { line ->+ Row(horizontalArrangement = Arrangement.spacedBy(2.dp), modifier = Modifier.padding(start = 10.dp)) {+ Text(+ "•",+ style = MaterialTheme.typography.bodyMedium,+ modifier = Modifier.clearAndSetSemantics { },+ )++ InteractiveText(+ text = line,+ style = MaterialTheme.typography.bodyMedium,+ onDictionaryLookup = onDictionaryLookup,+ modifier = Modifier.padding(bottom = 2.dp),+ )+ }+ }+ }+ }+}++@Preview(showBackground = true)+@Composable+fun DictionaryBottomSheetPreview() {+ // Spanish (monolingual) senses+ val spanishSenses =+ listOf(+ Sense(+ pos = "sustantivo masculino",+ glosses =+ listOf(+ Gloss(listOf("libro de consulta que contiene palabras ordenadas alfabéticamente con sus definiciones")),+ Gloss(listOf("obra que recopila y explica de forma ordenada voces de una o más lenguas")),+ Gloss(+ listOf(+ "repertorio en forma de libro donde se recogen, según un orden determinado, las palabras o expresiones de una o más lenguas",+ ),+ ),+ Gloss(listOf("catálogo de datos o noticias importantes de una materia determinada")),+ ),+ ),+ Sense(+ pos = "verbo transitivo",+ glosses = listOf(Gloss(listOf("compilar o registrar información de manera sistemática y ordenada"))),+ ),+ )++ // English senses+ val englishSenses =+ listOf(+ Sense(+ pos = "noun",+ glosses =+ listOf(+ Gloss(listOf("a reference book containing an alphabetical list of words with information about them")),+ Gloss(listOf("a book that explains the words of a language and is arranged in alphabetical order")),+ Gloss(listOf("a reference work that lists the words of a language typically in alphabetical order")),+ Gloss(listOf("a book giving information on particular subjects or on a particular class of words")),+ ),+ ),+ Sense(+ pos = "verb",+ glosses =+ listOf(+ Gloss(listOf("to compile a dictionary of")),+ Gloss(listOf("to supply with a dictionary")),+ ),+ ),+ )++ val sampleWord =+ WordWithTaggedEntries(+ word = "dictionary",+ // Both monolingual and English+ tag = 3,+ entries =+ listOf(+ // Spanish monolingual entry (first)+ WordEntryComplete(+ senses = spanishSenses,+ ),+ // English entry (second)+ WordEntryComplete(+ senses = englishSenses,+ ),+ ),+ sounds = "[dik.θjo.ˈna.ɾjo]",+ hyphenations = listOf("dic", "cio", "na", "rio"),+ redirects = listOf("book", "libro"),+ )++ TranslatorTheme {+ Surface {+ DictionaryEntry(+ dictionaryWord = sampleWord,+ dictionaryLookupLanguage =+ Language(+ code = "es",+ displayName = "Spanish",+ shortDisplayName = "Spanish",+ script = Script.LATIN,+ writingSystem = singleScript(Script.LATIN),+ dictionaryCode = "es",+ ),+ selectedEntryIndex = 0,+ onEntryIndexChanged = {},+ showBackButton = true,+ )+ }+ }+}diff --git a/OCR-translation/src/main/java/dev/davidv/translator/ui/components/DocAlignActivity.kt b/OCR-translation/src/main/java/dev/davidv/translator/ui/components/DocAlignActivity.ktnew file mode 100644index 0000000..c7fa2b6--- /dev/null+++ b/OCR-translation/src/main/java/dev/davidv/translator/ui/components/DocAlignActivity.kt@@ -0,0 +1,710 @@+/*+ * Copyright (C) 2024 David V+ *+ * This program 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.+ *+ * This program 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 <https://www.gnu.org/licenses/>.+ */++package dev.davidv.translator.ui.components++import android.app.Activity+import android.content.Intent+import android.graphics.Bitmap+import android.graphics.BitmapFactory+import android.graphics.Matrix+import android.net.Uri+import android.os.Bundle+import android.util.Log+import androidx.activity.ComponentActivity+import androidx.activity.compose.setContent+import androidx.compose.foundation.background+import androidx.compose.foundation.clickable+import androidx.compose.foundation.gestures.awaitEachGesture+import androidx.compose.foundation.gestures.awaitFirstDown+import androidx.compose.foundation.layout.Box+import androidx.compose.foundation.layout.Column+import androidx.compose.foundation.layout.Row+import androidx.compose.foundation.layout.fillMaxSize+import androidx.compose.foundation.layout.fillMaxWidth+import androidx.compose.foundation.layout.height+import androidx.compose.foundation.layout.padding+import androidx.compose.foundation.layout.size+import androidx.compose.foundation.layout.statusBarsPadding+import androidx.compose.foundation.layout.widthIn+import androidx.compose.material3.CircularProgressIndicator+import androidx.compose.material3.Icon+import androidx.compose.material3.IconButton+import androidx.compose.material3.MaterialTheme+import androidx.compose.material3.Text+import androidx.compose.runtime.Composable+import androidx.compose.runtime.LaunchedEffect+import androidx.compose.runtime.getValue+import androidx.compose.runtime.mutableStateOf+import androidx.compose.runtime.remember+import androidx.compose.runtime.rememberCoroutineScope+import androidx.compose.runtime.rememberUpdatedState+import androidx.compose.runtime.setValue+import androidx.compose.ui.Alignment+import androidx.compose.ui.Modifier+import androidx.compose.ui.geometry.Offset+import androidx.compose.ui.graphics.Color+import androidx.compose.ui.graphics.ImageBitmap+import androidx.compose.ui.graphics.Path+import androidx.compose.ui.graphics.asImageBitmap+import androidx.compose.ui.graphics.drawscope.DrawScope+import androidx.compose.ui.graphics.drawscope.Stroke+import androidx.compose.ui.input.pointer.pointerInput+import androidx.compose.ui.input.pointer.positionChange+import androidx.compose.ui.layout.onSizeChanged+import androidx.compose.ui.platform.LocalDensity+import androidx.compose.ui.res.painterResource+import androidx.compose.ui.res.stringResource+import androidx.compose.ui.unit.IntOffset+import androidx.compose.ui.unit.IntSize+import androidx.compose.ui.unit.dp+import androidx.compose.ui.window.Popup+import androidx.compose.ui.window.PopupProperties+import androidx.exifinterface.media.ExifInterface+import androidx.lifecycle.lifecycleScope+import dev.davidv.translator.R+import dev.davidv.translator.TranslatorApplication+import kotlinx.coroutines.Dispatchers+import kotlinx.coroutines.launch+import kotlinx.coroutines.withContext+import uniffi.translator_align.DocumentDetection+import uniffi.translator_align.DocumentPoint+import uniffi.translator_align.DocumentQuad+import androidx.compose.ui.geometry.Size as GeometrySize++private const val TAG = "DocAlignActivity"+private const val HANDLE_HIT_RADIUS_PX = 80f+private const val HANDLE_DRAW_RADIUS_PX = 18f++class DocAlignActivity : ComponentActivity() {+ override fun onCreate(savedInstanceState: Bundle?) {+ super.onCreate(savedInstanceState)++ val inputUri: Uri =+ intent.getParcelableExtra(EXTRA_INPUT_URI)+ ?: run {+ Log.e(TAG, "missing input URI")+ finishWithCancel()+ return+ }+ val outputUri: Uri =+ intent.getParcelableExtra(EXTRA_OUTPUT_URI)+ ?: run {+ Log.e(TAG, "missing output URI")+ finishWithCancel()+ return+ }++ setContent {+ DocAlignScreen(+ inputUri = inputUri,+ onCancel = { finishWithCancel() },+ onSwitchToRect = { finishWithSwitch() },+ onConfirm = { bitmap, quad ->+ lifecycleScope.launch {+ val ok = withContext(Dispatchers.IO) { warpAndWrite(bitmap, quad, outputUri) }+ if (ok) {+ setResult(Activity.RESULT_OK, Intent().setData(outputUri))+ } else {+ setResult(Activity.RESULT_CANCELED)+ }+ finish()+ }+ },+ )+ }+ }++ private fun warpAndWrite(+ bitmap: Bitmap,+ quad: DocumentQuad,+ outputUri: Uri,+ ): Boolean {+ val catalog = (application as TranslatorApplication).languageCatalog+ if (catalog == null) {+ Log.e(TAG, "no catalog available for warp")+ return false+ }+ return try {+ val warped = catalog.warpDocumentRgba(bitmap, quad, postprocess = false)+ val out = Bitmap.createBitmap(warped.width.toInt(), warped.height.toInt(), Bitmap.Config.ARGB_8888)+ out.copyPixelsFromBuffer(java.nio.ByteBuffer.wrap(warped.rgba))+ contentResolver.openOutputStream(outputUri)?.use { stream ->+ out.compress(Bitmap.CompressFormat.JPEG, 92, stream)+ } ?: run {+ Log.e(TAG, "openOutputStream returned null for $outputUri")+ return false+ }+ out.recycle()+ true+ } catch (e: Exception) {+ Log.e(TAG, "warp/write failed", e)+ false+ }+ }++ private fun finishWithCancel() {+ setResult(Activity.RESULT_CANCELED)+ finish()+ }++ private fun finishWithSwitch() {+ setResult(RESULT_SWITCH_TO_RECT, Intent())+ finish()+ }++ companion object {+ const val EXTRA_INPUT_URI = "dev.davidv.translator.DocAlign.InputUri"+ const val EXTRA_OUTPUT_URI = "dev.davidv.translator.DocAlign.OutputUri"+ const val RESULT_SWITCH_TO_RECT = Activity.RESULT_FIRST_USER + 1+ }+}++@Composable+private fun DocAlignScreen(+ inputUri: Uri,+ onCancel: () -> Unit,+ onSwitchToRect: () -> Unit,+ onConfirm: (Bitmap, DocumentQuad) -> Unit,+) {+ val context = androidx.compose.ui.platform.LocalContext.current+ val catalog = (context.applicationContext as TranslatorApplication).languageCatalog++ var bitmap by remember(inputUri) { mutableStateOf<Bitmap?>(null) }+ var imageBmp by remember(inputUri) { mutableStateOf<ImageBitmap?>(null) }+ var imageSize by remember(inputUri) { mutableStateOf(IntSize.Zero) }+ var corners by remember(inputUri) { mutableStateOf<List<Offset>>(emptyList()) }+ var detecting by remember(inputUri) { mutableStateOf(true) }+ var redetecting by remember(inputUri) { mutableStateOf(false) }+ var errorMessage by remember(inputUri) { mutableStateOf<String?>(null) }+ var helpVisible by remember { mutableStateOf(false) }++ fun rotate90Clockwise() {+ val src = bitmap ?: return+ val matrix = Matrix().apply { postRotate(90f) }+ val rotated = Bitmap.createBitmap(src, 0, 0, src.width, src.height, matrix, true)+ val oldH = src.height.toFloat()+ val transformed = corners.map { Offset(oldH - it.y, it.x) }+ val reordered =+ if (transformed.size == 4) {+ listOf(transformed[3], transformed[0], transformed[1], transformed[2])+ } else {+ transformed+ }+ bitmap = rotated+ imageBmp = rotated.asImageBitmap()+ imageSize = IntSize(rotated.width, rotated.height)+ corners = reordered+ }++ val detectFn: suspend (Bitmap) -> DocumentDetection? =+ remember(catalog) {+ { bmp ->+ if (catalog == null) {+ null+ } else {+ withContext(Dispatchers.Default) {+ runCatching { catalog.detectDocumentQuad(bmp) }+ .onFailure { Log.e(TAG, "detect failed", it) }+ .getOrNull()+ }+ }+ }+ }++ LaunchedEffect(inputUri) {+ val loaded =+ withContext(Dispatchers.IO) {+ runCatching { decodeOrientedBitmap(context, inputUri) }.getOrNull()+ }+ if (loaded == null) {+ errorMessage = context.getString(R.string.docalign_decode_failed)+ detecting = false+ return@LaunchedEffect+ }+ bitmap = loaded+ imageBmp = loaded.asImageBitmap()+ imageSize = IntSize(loaded.width, loaded.height)++ val detected = detectFn(loaded)+ corners =+ if (detected != null) {+ quadToOffsets(detected.quad)+ } else {+ listOf(+ Offset(0f, 0f),+ Offset(loaded.width.toFloat(), 0f),+ Offset(loaded.width.toFloat(), loaded.height.toFloat()),+ Offset(0f, loaded.height.toFloat()),+ )+ }+ detecting = false+ }++ Box(modifier = Modifier.fillMaxSize().background(Color.Black)) {+ Column(modifier = Modifier.fillMaxSize().statusBarsPadding()) {+ Box(+ modifier = Modifier.fillMaxWidth().weight(1f).padding(horizontal = 24.dp, vertical = 24.dp),+ contentAlignment = Alignment.Center,+ ) {+ val bmp = imageBmp+ val raw = bitmap+ val img = imageSize+ if (errorMessage != null) {+ Text(errorMessage!!, color = Color.White)+ } else if (bmp == null || raw == null || img == IntSize.Zero || corners.isEmpty()) {+ CircularProgressIndicator(color = Color.White)+ } else {+ QuadEditorCanvas(+ image = bmp,+ originalBitmap = raw,+ imageSize = img,+ corners = corners,+ onCornersChange = { corners = it },+ detectQuad = detectFn,+ onDetectingChange = { redetecting = it },+ )+ }+ }++ Row(+ modifier =+ Modifier+ .fillMaxWidth()+ .background(Color.Black)+ .height(56.dp),+ verticalAlignment = Alignment.CenterVertically,+ ) {+ BarTextButton(+ label = stringResource(R.string.common_cancel),+ enabled = true,+ onClick = onCancel,+ modifier = Modifier.weight(1f),+ )+ BarTextButton(+ label = stringResource(R.string.common_ok),+ enabled = !detecting && corners.size == 4 && bitmap != null,+ onClick = {+ val bmp = bitmap+ val quad = offsetsToQuad(corners)+ if (bmp != null && quad != null) onConfirm(bmp, quad)+ },+ modifier = Modifier.weight(1f),+ )+ }+ }++ Box(modifier = Modifier.align(Alignment.TopStart).statusBarsPadding().padding(8.dp)) {+ IconButton(onClick = { helpVisible = true }) {+ Icon(+ painter = painterResource(id = R.drawable.help_outline),+ contentDescription = stringResource(R.string.a11y_help),+ tint = Color.White,+ )+ }+ if (helpVisible) {+ Popup(+ alignment = Alignment.TopStart,+ offset = IntOffset(0, with(LocalDensity.current) { 48.dp.toPx().toInt() }),+ onDismissRequest = { helpVisible = false },+ properties = PopupProperties(focusable = true),+ ) {+ Box(+ modifier =+ Modifier+ .background(Color(0xCC222222))+ .padding(16.dp),+ ) {+ Text(+ text = stringResource(R.string.docalign_help),+ color = Color.White,+ style = MaterialTheme.typography.bodyMedium,+ modifier = Modifier.widthIn(max = 300.dp),+ )+ }+ }+ }+ }++ Row(+ modifier = Modifier.align(Alignment.TopEnd).statusBarsPadding().padding(8.dp),+ verticalAlignment = Alignment.CenterVertically,+ ) {+ IconButton(onClick = { rotate90Clockwise() }) {+ Icon(+ painter = painterResource(id = R.drawable.rotate_right),+ contentDescription = stringResource(R.string.a11y_rotate_90),+ tint = Color.White,+ )+ }+ IconButton(onClick = onSwitchToRect) {+ Icon(+ painter = painterResource(id = R.drawable.activity_zone),+ contentDescription = stringResource(R.string.a11y_switch_rectangular_crop),+ tint = Color.White,+ )+ }+ }++ if (detecting || redetecting) {+ Box(+ modifier =+ Modifier+ .align(Alignment.TopCenter)+ .statusBarsPadding()+ .padding(top = 24.dp)+ .background(MaterialTheme.colorScheme.surface.copy(alpha = 0.85f))+ .padding(horizontal = 12.dp, vertical = 6.dp),+ ) {+ Text(+ text = if (detecting) stringResource(R.string.docalign_detecting) else stringResource(R.string.docalign_redetecting),+ style = MaterialTheme.typography.labelMedium,+ )+ }+ }+ }+}++@Composable+private fun QuadEditorCanvas(+ image: ImageBitmap,+ originalBitmap: Bitmap,+ imageSize: IntSize,+ corners: List<Offset>,+ onCornersChange: (List<Offset>) -> Unit,+ detectQuad: suspend (Bitmap) -> DocumentDetection?,+ onDetectingChange: (Boolean) -> Unit,+) {+ var canvasSize by remember { mutableStateOf(IntSize.Zero) }+ var viewScale by remember(imageSize) { mutableStateOf(1f) }+ var viewOffset by remember(imageSize) { mutableStateOf(Offset.Zero) }++ val currentCorners by rememberUpdatedState(corners)+ val currentOnChange by rememberUpdatedState(onCornersChange)+ val currentDetect by rememberUpdatedState(detectQuad)+ val currentOriginal by rememberUpdatedState(originalBitmap)+ val currentOnDetecting by rememberUpdatedState(onDetectingChange)+ val scope = rememberCoroutineScope()+ val touchSlopPx = with(LocalDensity.current) { 6.dp.toPx() }++ fun displayedRect(canvas: IntSize): DisplayRect {+ val base = computeFitCenter(canvas, imageSize)+ val w = base.size.width * viewScale+ val h = base.size.height * viewScale+ val center = Offset(canvas.width / 2f, canvas.height / 2f)+ val offset =+ Offset(+ center.x - w * 0.5f + viewOffset.x,+ center.y - h * 0.5f + viewOffset.y,+ )+ return DisplayRect(offset, GeometrySize(w, h))+ }++ // Re-run detection on the original-image region currently visible in the canvas. Maps the+ // returned corners back into original-image coordinates. The same trick as the PoC: the+ // model is more confident when the document fills most of its 256x256 input.+ suspend fun redetectVisible() {+ val cs = canvasSize+ if (cs == IntSize.Zero) return+ val display = displayedRect(cs)+ if (display.size.width <= 0f || display.size.height <= 0f) return+ val sX = imageSize.width / display.size.width+ val sY = imageSize.height / display.size.height+ val imgLeft = ((-display.offset.x) * sX).toInt().coerceIn(0, imageSize.width - 1)+ val imgTop = ((-display.offset.y) * sY).toInt().coerceIn(0, imageSize.height - 1)+ val imgRight = ((cs.width - display.offset.x) * sX).toInt().coerceIn(imgLeft + 1, imageSize.width)+ val imgBottom = ((cs.height - display.offset.y) * sY).toInt().coerceIn(imgTop + 1, imageSize.height)+ val w = imgRight - imgLeft+ val h = imgBottom - imgTop+ if (w < 64 || h < 64) return+ currentOnDetecting(true)+ val source = currentOriginal+ val cropped =+ withContext(Dispatchers.IO) {+ runCatching { Bitmap.createBitmap(source, imgLeft, imgTop, w, h) }.getOrNull()+ }+ if (cropped == null) {+ currentOnDetecting(false)+ return+ }+ val detection = runCatching { currentDetect(cropped) }.getOrNull()+ // createBitmap returns `source` unchanged when the crop covers the whole image (zoomed+ // out); recycling it would destroy the bitmap still being drawn on the canvas.+ if (cropped !== source) cropped.recycle()+ currentOnDetecting(false)+ if (detection != null) {+ val inOriginal =+ quadToOffsets(detection.quad).map {+ Offset(it.x + imgLeft, it.y + imgTop)+ }+ currentOnChange(inOriginal)+ }+ }++ Box(+ modifier =+ Modifier+ .fillMaxSize()+ .onSizeChanged { canvasSize = it }+ .pointerInput(canvasSize, imageSize) {+ if (canvasSize == IntSize.Zero) return@pointerInput+ awaitEachGesture {+ val down = awaitFirstDown(requireUnconsumed = false)+ val downPos = down.position++ val display = displayedRect(canvasSize)+ val screenHandles = currentCorners.map { it.imageToScreen(display, imageSize) }+ val closestEntry =+ screenHandles.withIndex()+ .map { (i, h) -> i to (h - downPos).getDistance() }+ .minByOrNull { it.second }+ val cornerIdx = closestEntry?.takeIf { it.second <= HANDLE_HIT_RADIUS_PX }?.first ?: -1++ var mode = GestureMode.Pending+ var totalMovement = Offset.Zero+ var lastCentroid = downPos+ var lastSpread = 0f+ var didView = false++ while (true) {+ val event = awaitPointerEvent()+ val pressed = event.changes.filter { it.pressed }+ if (pressed.isEmpty()) break++ if (pressed.size >= 2) {+ val centroid =+ pressed.fold(Offset.Zero) { acc, c -> acc + c.position } /+ pressed.size.toFloat()+ val spread =+ pressed+ .map { (it.position - centroid).getDistance() }+ .average().toFloat()+ if (mode == GestureMode.MultiTouch && lastSpread > 0f && spread > 0f) {+ val scaleFactor = spread / lastSpread+ val displayBefore = displayedRect(canvasSize)+ val imgFocus = centroid.screenToImage(displayBefore, imageSize)+ viewScale = (viewScale * scaleFactor).coerceIn(0.5f, 12f)+ val displayAfter = displayedRect(canvasSize)+ val newScreenFocus = imgFocus.imageToScreen(displayAfter, imageSize)+ viewOffset = viewOffset + (centroid - newScreenFocus) ++ (centroid - lastCentroid)+ didView = true+ } else {+ mode = GestureMode.MultiTouch+ }+ lastCentroid = centroid+ lastSpread = spread+ pressed.forEach { it.consume() }+ continue+ }++ if (mode == GestureMode.MultiTouch) {+ pressed.forEach { it.consume() }+ continue+ }++ val change = pressed[0]+ val drag = change.positionChange()+ totalMovement += drag++ if (cornerIdx >= 0 && mode != GestureMode.Pan) {+ if (drag != Offset.Zero) {+ val d = displayedRect(canvasSize)+ val scale = d.size.width / imageSize.width+ val imgDelta = Offset(drag.x / scale, drag.y / scale)+ val updated =+ currentCorners.toMutableList().apply {+ val cur = this[cornerIdx]+ this[cornerIdx] =+ Offset(+ (cur.x + imgDelta.x).coerceIn(0f, imageSize.width.toFloat()),+ (cur.y + imgDelta.y).coerceIn(0f, imageSize.height.toFloat()),+ )+ }+ currentOnChange(updated)+ mode = GestureMode.CornerDrag+ change.consume()+ }+ } else if (cornerIdx < 0 && (totalMovement.getDistance() > touchSlopPx || mode == GestureMode.Pan)) {+ viewOffset += drag+ didView = true+ mode = GestureMode.Pan+ change.consume()+ }+ }++ if (didView) {+ scope.launch { redetectVisible() }+ }+ }+ },+ ) {+ androidx.compose.foundation.Canvas(modifier = Modifier.fillMaxSize()) {+ val display = displayedRect(IntSize(size.width.toInt(), size.height.toInt()))+ drawImage(+ image = image,+ dstOffset = IntOffset(display.offset.x.toInt(), display.offset.y.toInt()),+ dstSize =+ IntSize(+ display.size.width.toInt().coerceAtLeast(1),+ display.size.height.toInt().coerceAtLeast(1),+ ),+ )+ val screenHandles = corners.map { it.imageToScreen(display, imageSize) }+ drawQuadOverlay(screenHandles)+ }+ }+}++private enum class GestureMode { Pending, CornerDrag, Pan, MultiTouch }++@Composable+private fun BarTextButton(+ label: String,+ enabled: Boolean,+ onClick: () -> Unit,+ modifier: Modifier = Modifier,+) {+ val color = if (enabled) Color.White else Color.White.copy(alpha = 0.4f)+ Box(+ modifier =+ modifier+ .fillMaxSize()+ .let { if (enabled) it.clickable(onClick = onClick) else it },+ contentAlignment = Alignment.Center,+ ) {+ Text(+ text = label.uppercase(),+ style = MaterialTheme.typography.labelLarge,+ color = color,+ )+ }+}++private data class DisplayRect(val offset: Offset, val size: GeometrySize)++private fun computeFitCenter(+ canvas: IntSize,+ image: IntSize,+): DisplayRect {+ if (canvas.width <= 0 || canvas.height <= 0) {+ return DisplayRect(Offset.Zero, GeometrySize.Zero)+ }+ val scale =+ minOf(+ canvas.width.toFloat() / image.width,+ canvas.height.toFloat() / image.height,+ )+ val w = image.width * scale+ val h = image.height * scale+ val ox = (canvas.width - w) * 0.5f+ val oy = (canvas.height - h) * 0.5f+ return DisplayRect(Offset(ox, oy), GeometrySize(w, h))+}++private fun Offset.imageToScreen(+ display: DisplayRect,+ image: IntSize,+): Offset {+ if (image.width == 0 || image.height == 0) return display.offset+ val scaleX = display.size.width / image.width+ val scaleY = display.size.height / image.height+ return Offset(display.offset.x + x * scaleX, display.offset.y + y * scaleY)+}++private fun Offset.screenToImage(+ display: DisplayRect,+ image: IntSize,+): Offset {+ if (display.size.width == 0f || display.size.height == 0f) return Offset.Zero+ val scaleX = image.width.toFloat() / display.size.width+ val scaleY = image.height.toFloat() / display.size.height+ return Offset((x - display.offset.x) * scaleX, (y - display.offset.y) * scaleY)+}++private fun DrawScope.drawQuadOverlay(screenCorners: List<Offset>) {+ if (screenCorners.size != 4) return+ val path =+ Path().apply {+ moveTo(screenCorners[0].x, screenCorners[0].y)+ lineTo(screenCorners[1].x, screenCorners[1].y)+ lineTo(screenCorners[2].x, screenCorners[2].y)+ lineTo(screenCorners[3].x, screenCorners[3].y)+ close()+ }+ drawPath(path, color = Color(0x6633CCFF), style = Stroke(width = 4f))+ screenCorners.forEach { c ->+ drawCircle(color = Color.White, radius = HANDLE_DRAW_RADIUS_PX, center = c)+ drawCircle(color = Color(0xFF1976D2), radius = HANDLE_DRAW_RADIUS_PX * 0.65f, center = c)+ }+}++private fun quadToOffsets(quad: DocumentQuad): List<Offset> =+ listOf(+ Offset(quad.topLeft.x, quad.topLeft.y),+ Offset(quad.topRight.x, quad.topRight.y),+ Offset(quad.bottomRight.x, quad.bottomRight.y),+ Offset(quad.bottomLeft.x, quad.bottomLeft.y),+ )++private fun offsetsToQuad(corners: List<Offset>): DocumentQuad? {+ if (corners.size != 4) return null+ return DocumentQuad(+ topLeft = DocumentPoint(corners[0].x, corners[0].y),+ topRight = DocumentPoint(corners[1].x, corners[1].y),+ bottomRight = DocumentPoint(corners[2].x, corners[2].y),+ bottomLeft = DocumentPoint(corners[3].x, corners[3].y),+ )+}++private fun decodeOrientedBitmap(+ context: android.content.Context,+ uri: Uri,+): Bitmap? {+ val raw = context.contentResolver.openInputStream(uri)?.use { it.readBytes() } ?: return null+ val decoded = BitmapFactory.decodeByteArray(raw, 0, raw.size) ?: return null+ val orientation =+ try {+ java.io.ByteArrayInputStream(raw).use {+ ExifInterface(it).getAttributeInt(+ ExifInterface.TAG_ORIENTATION,+ ExifInterface.ORIENTATION_NORMAL,+ )+ }+ } catch (_: Exception) {+ ExifInterface.ORIENTATION_NORMAL+ }+ val matrix = Matrix()+ when (orientation) {+ ExifInterface.ORIENTATION_ROTATE_90 -> matrix.postRotate(90f)+ ExifInterface.ORIENTATION_ROTATE_180 -> matrix.postRotate(180f)+ ExifInterface.ORIENTATION_ROTATE_270 -> matrix.postRotate(270f)+ ExifInterface.ORIENTATION_FLIP_HORIZONTAL -> matrix.preScale(-1f, 1f)+ ExifInterface.ORIENTATION_FLIP_VERTICAL -> matrix.preScale(1f, -1f)+ else -> return convertToArgb8888(decoded)+ }+ val rotated = Bitmap.createBitmap(decoded, 0, 0, decoded.width, decoded.height, matrix, true)+ if (rotated !== decoded) decoded.recycle()+ return convertToArgb8888(rotated)+}++private fun convertToArgb8888(src: Bitmap): Bitmap {+ if (src.config == Bitmap.Config.ARGB_8888) return src+ val converted = src.copy(Bitmap.Config.ARGB_8888, false)+ src.recycle()+ return converted+}diff --git a/OCR-translation/src/main/java/dev/davidv/translator/ui/components/DocumentConfigureSheet.kt b/OCR-translation/src/main/java/dev/davidv/translator/ui/components/DocumentConfigureSheet.ktnew file mode 100644index 0000000..a4123d9--- /dev/null+++ b/OCR-translation/src/main/java/dev/davidv/translator/ui/components/DocumentConfigureSheet.kt@@ -0,0 +1,234 @@+/*+ * Copyright (C) 2024 David V+ *+ * This program 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.+ *+ * This program 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 <https://www.gnu.org/licenses/>.+ */++package dev.davidv.translator.ui.components++import android.text.format.Formatter+import androidx.annotation.StringRes+import androidx.compose.foundation.layout.Arrangement+import androidx.compose.foundation.layout.Column+import androidx.compose.foundation.layout.Row+import androidx.compose.foundation.layout.Spacer+import androidx.compose.foundation.layout.fillMaxWidth+import androidx.compose.foundation.layout.navigationBarsPadding+import androidx.compose.foundation.layout.padding+import androidx.compose.material3.Button+import androidx.compose.material3.DropdownMenu+import androidx.compose.material3.DropdownMenuItem+import androidx.compose.material3.ExperimentalMaterial3Api+import androidx.compose.material3.MaterialTheme+import androidx.compose.material3.ModalBottomSheet+import androidx.compose.material3.OutlinedButton+import androidx.compose.material3.Slider+import androidx.compose.material3.Switch+import androidx.compose.material3.Text+import androidx.compose.material3.rememberModalBottomSheetState+import androidx.compose.runtime.Composable+import androidx.compose.runtime.getValue+import androidx.compose.runtime.mutableStateOf+import androidx.compose.runtime.remember+import androidx.compose.runtime.setValue+import androidx.compose.ui.Alignment+import androidx.compose.ui.Modifier+import androidx.compose.ui.platform.LocalContext+import androidx.compose.ui.res.stringResource+import androidx.compose.ui.text.font.FontWeight+import androidx.compose.ui.unit.dp+import dev.davidv.translator.Language+import dev.davidv.translator.LanguageMetadata+import dev.davidv.translator.R+import dev.davidv.translator.TxtLayoutChoice+import kotlin.math.roundToInt++private enum class LayoutMode {+ PRESERVE,+ REFLOW,+ REFLOW_WRAP,+}++@StringRes+private fun LayoutMode.labelRes(): Int =+ when (this) {+ LayoutMode.PRESERVE -> R.string.layout_preserve+ LayoutMode.REFLOW -> R.string.layout_reflow+ LayoutMode.REFLOW_WRAP -> R.string.layout_reflow_wrap+ }++private const val WRAP_MIN = 70+private const val WRAP_MAX = 120+private const val WRAP_DEFAULT = 80++@OptIn(ExperimentalMaterial3Api::class)+@Composable+fun DocumentConfigureSheet(+ fileName: String,+ fileSizeBytes: Long,+ extension: String,+ initialFrom: Language,+ initialTo: Language,+ availableLanguages: List<Language>,+ languageMetadata: Map<Language, LanguageMetadata>,+ defaultTranslatePdfImages: Boolean,+ onDismiss: () -> Unit,+ onTranslate: (from: Language, to: Language, txtLayout: TxtLayoutChoice, translatePdfImages: Boolean) -> Unit,+) {+ val context = LocalContext.current+ val sheetState = rememberModalBottomSheetState()++ var selectedFrom by remember { mutableStateOf(initialFrom) }+ var selectedTo by remember { mutableStateOf(initialTo) }+ var layoutMode by remember { mutableStateOf(LayoutMode.PRESERVE) }+ var wrapColumns by remember { mutableStateOf(WRAP_DEFAULT) }+ var translatePdfImages by remember { mutableStateOf(defaultTranslatePdfImages) }++ val isTxt = extension == "txt"+ val isPdf = extension == "pdf"++ ModalBottomSheet(onDismissRequest = onDismiss, sheetState = sheetState) {+ Column(+ modifier =+ Modifier+ .fillMaxWidth()+ .padding(horizontal = 24.dp)+ .padding(bottom = 8.dp),+ verticalArrangement = Arrangement.spacedBy(16.dp),+ ) {+ Row(+ modifier = Modifier.fillMaxWidth(),+ verticalAlignment = Alignment.CenterVertically,+ ) {+ LanguageSelector(+ selectedLanguage = selectedFrom,+ availableLanguages = availableLanguages,+ languageMetadata = languageMetadata,+ onLanguageSelected = { selectedFrom = it },+ modifier = Modifier.weight(1f),+ )+ LanguageSwapButton(+ onClick = {+ val previousFrom = selectedFrom+ selectedFrom = selectedTo+ selectedTo = previousFrom+ },+ )+ LanguageSelector(+ selectedLanguage = selectedTo,+ availableLanguages = availableLanguages,+ languageMetadata = languageMetadata,+ onLanguageSelected = { selectedTo = it },+ modifier = Modifier.weight(1f),+ )+ }++ Column {+ Text(+ text = fileName,+ style = MaterialTheme.typography.bodyLarge,+ fontWeight = FontWeight.Medium,+ )+ Text(+ text = Formatter.formatShortFileSize(context, fileSizeBytes),+ style = MaterialTheme.typography.bodySmall,+ color = MaterialTheme.colorScheme.onSurfaceVariant,+ )+ }++ if (isTxt) {+ LayoutModeDropdown(+ selected = layoutMode,+ onSelected = { layoutMode = it },+ )+ if (layoutMode == LayoutMode.REFLOW_WRAP) {+ Column {+ Text(+ text = stringResource(R.string.document_wrap_columns, wrapColumns),+ style = MaterialTheme.typography.bodySmall,+ )+ Slider(+ value = wrapColumns.toFloat(),+ onValueChange = { wrapColumns = (it.roundToInt() / 10) * 10 },+ valueRange = WRAP_MIN.toFloat()..WRAP_MAX.toFloat(),+ steps = (WRAP_MAX - WRAP_MIN) / 10 - 1,+ )+ }+ }+ }++ if (isPdf) {+ Row(+ modifier = Modifier.fillMaxWidth(),+ verticalAlignment = Alignment.CenterVertically,+ horizontalArrangement = Arrangement.SpaceBetween,+ ) {+ Text(stringResource(R.string.document_translate_pdf_images))+ Switch(+ checked = translatePdfImages,+ onCheckedChange = { translatePdfImages = it },+ )+ }+ }++ Button(+ onClick = {+ val txtLayout =+ when (layoutMode) {+ LayoutMode.PRESERVE -> TxtLayoutChoice.Preserve+ LayoutMode.REFLOW -> TxtLayoutChoice.Reflow(wrapColumns = null)+ LayoutMode.REFLOW_WRAP -> TxtLayoutChoice.Reflow(wrapColumns = wrapColumns)+ }+ onTranslate(selectedFrom, selectedTo, txtLayout, translatePdfImages)+ },+ modifier = Modifier.fillMaxWidth(),+ ) {+ Text(stringResource(R.string.translate_text))+ }++ Spacer(modifier = Modifier.navigationBarsPadding())+ }+ }+}++@Composable+private fun LayoutModeDropdown(+ selected: LayoutMode,+ onSelected: (LayoutMode) -> Unit,+) {+ var expanded by remember { mutableStateOf(false) }+ Column {+ OutlinedButton(+ onClick = { expanded = true },+ modifier = Modifier.fillMaxWidth(),+ ) {+ Text(stringResource(selected.labelRes()), modifier = Modifier.weight(1f))+ Text("▾")+ }+ DropdownMenu(+ expanded = expanded,+ onDismissRequest = { expanded = false },+ ) {+ LayoutMode.entries.forEach { mode ->+ DropdownMenuItem(+ text = { Text(stringResource(mode.labelRes())) },+ onClick = {+ onSelected(mode)+ expanded = false+ },+ )+ }+ }+ }+}diff --git a/OCR-translation/src/main/java/dev/davidv/translator/ui/components/DottedUnderlineTextView.kt b/OCR-translation/src/main/java/dev/davidv/translator/ui/components/DottedUnderlineTextView.ktnew file mode 100644index 0000000..0b98b24--- /dev/null+++ b/OCR-translation/src/main/java/dev/davidv/translator/ui/components/DottedUnderlineTextView.kt@@ -0,0 +1,180 @@+/*+ * Copyright (C) 2024 David V+ *+ * This program 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.+ *+ * This program 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 <https://www.gnu.org/licenses/>.+ */++package dev.davidv.translator.ui.components++import android.content.Context+import android.graphics.Canvas+import android.graphics.DashPathEffect+import android.graphics.Paint+import android.text.Layout+import android.util.AttributeSet+import android.view.GestureDetector+import android.view.MotionEvent+import android.widget.TextView++/**+ * A selectable [TextView] that draws a subtle dotted underline under given+ * char ranges (`[start, endExclusive)` per `IntRange` built with `start until+ * end`). Used to mark translated words that have alternatives.+ *+ * In [wordTapMode] text selection is turned off and a single tap on a word+ * reports its char offset via [wordTapListener] — the fast path for swapping or+ * looking up one word after another without long-pressing each time.+ */+class DottedUnderlineTextView+ @JvmOverloads+ constructor(+ context: Context,+ attrs: AttributeSet? = null,+ ) : TextView(context, attrs) {+ var underlineRanges: List<IntRange> = emptyList()+ set(value) {+ field = value+ invalidate()+ }++ // The word whose alternatives are open, tinted behind the glyphs so the user+ // sees which word the drawer refers to (the drawer no longer repeats it).+ var highlightRange: IntRange? = null+ set(value) {+ field = value+ invalidate()+ }++ var wordHighlightColor: Int = 0+ set(value) {+ field = value+ invalidate()+ }++ var wordTapListener: ((Int) -> Unit)? = null++ var wordTapMode: Boolean = false+ set(value) {+ if (field == value) return+ field = value+ // Consume taps ourselves and drop the selection UI while the mode is on.+ isClickable = value+ setTextIsSelectable(!value)+ invalidate()+ }++ private val tapDetector =+ GestureDetector(+ context,+ object : GestureDetector.SimpleOnGestureListener() {+ override fun onSingleTapUp(e: MotionEvent): Boolean {+ val l = layout ?: return false+ val x = e.x - totalPaddingLeft + scrollX+ val y = e.y - totalPaddingTop + scrollY+ val line = l.getLineForVertical(y.toInt())+ wordTapListener?.invoke(l.getOffsetForHorizontal(line, x))+ performClick()+ return true+ }+ },+ )++ override fun onTouchEvent(event: MotionEvent): Boolean {+ if (wordTapMode) {+ tapDetector.onTouchEvent(event)+ return true+ }+ return super.onTouchEvent(event)+ }++ private val density = resources.displayMetrics.density+ private val underlinePaint =+ Paint().apply {+ style = Paint.Style.STROKE+ isAntiAlias = true+ strokeWidth = 1.5f * density+ pathEffect = DashPathEffect(floatArrayOf(2f * density, 2.5f * density), 0f)+ }+ private val highlightPaint =+ Paint().apply {+ style = Paint.Style.FILL+ isAntiAlias = true+ }++ private fun drawHighlight(+ canvas: Canvas,+ l: Layout,+ range: IntRange,+ ) {+ val len = text?.length ?: 0+ val start = range.first.coerceIn(0, len)+ val end = (range.last + 1).coerceIn(start, len)+ if (start >= end) return+ highlightPaint.color = wordHighlightColor+ val padLeft = totalPaddingLeft.toFloat()+ val padTop = totalPaddingTop.toFloat()+ val inset = 1.5f * density+ val radius = 4f * density+ val firstLine = l.getLineForOffset(start)+ val lastLine = l.getLineForOffset(end)+ for (line in firstLine..lastLine) {+ val segStart = if (line == firstLine) start else l.getLineStart(line)+ val segEnd = if (line == lastLine) end else l.getLineEnd(line)+ var x1 = l.getPrimaryHorizontal(segStart)+ var x2 = l.getPrimaryHorizontal(segEnd)+ if (x1 > x2) {+ val t = x1+ x1 = x2+ x2 = t+ }+ val top = padTop + l.getLineTop(line) + inset+ val bottom = padTop + l.getLineBottom(line) - inset+ canvas.drawRoundRect(padLeft + x1 - inset, top, padLeft + x2 + inset, bottom, radius, radius, highlightPaint)+ }+ }++ override fun onDraw(canvas: Canvas) {+ layout?.let { l -> highlightRange?.let { drawHighlight(canvas, l, it) } }+ super.onDraw(canvas)+ if (underlineRanges.isEmpty()) return+ val l = layout ?: return+ val len = text?.length ?: 0+ // ~45% of the text colour so it reads as a hint, not an edit.+ underlinePaint.color = (currentTextColor and 0x00FFFFFF) or (0x73 shl 24)+ val padLeft = totalPaddingLeft.toFloat()+ val padTop = totalPaddingTop.toFloat()+ val gap = 2.5f * density++ for (range in underlineRanges) {+ val start = range.first.coerceIn(0, len)+ val end = (range.last + 1).coerceIn(start, len)+ if (start >= end) continue+ val firstLine = l.getLineForOffset(start)+ val lastLine = l.getLineForOffset(end)+ for (line in firstLine..lastLine) {+ val segStart = if (line == firstLine) start else l.getLineStart(line)+ val segEnd = if (line == lastLine) end else l.getLineEnd(line)+ var x1 = l.getPrimaryHorizontal(segStart)+ var x2 = l.getPrimaryHorizontal(segEnd)+ if (x1 > x2) {+ val t = x1+ x1 = x2+ x2 = t+ }+ val y = padTop + l.getLineBaseline(line) + gap+ canvas.drawLine(padLeft + x1, y, padLeft + x2, y, underlinePaint)+ }+ }+ }+ }diff --git a/OCR-translation/src/main/java/dev/davidv/translator/ui/components/ImageCaptureComponent.kt b/OCR-translation/src/main/java/dev/davidv/translator/ui/components/ImageCaptureComponent.ktnew file mode 100644index 0000000..46a0a11--- /dev/null+++ b/OCR-translation/src/main/java/dev/davidv/translator/ui/components/ImageCaptureComponent.kt@@ -0,0 +1,335 @@+/*+ * Copyright (C) 2024 David V+ *+ * This program 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.+ *+ * This program 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 <https://www.gnu.org/licenses/>.+ */++package dev.davidv.translator.ui.components++import android.content.Context+import android.content.Intent+import android.graphics.Bitmap+import android.net.Uri+import android.os.Build+import android.provider.MediaStore+import android.util.Log+import android.widget.Toast+import androidx.activity.compose.rememberLauncherForActivityResult+import androidx.activity.result.PickVisualMediaRequest+import androidx.activity.result.contract.ActivityResultContracts+import androidx.compose.material3.MaterialTheme+import androidx.compose.runtime.Composable+import androidx.compose.runtime.LaunchedEffect+import androidx.compose.runtime.mutableStateOf+import androidx.compose.runtime.remember+import androidx.compose.runtime.rememberCoroutineScope+import androidx.compose.ui.graphics.toArgb+import androidx.compose.ui.platform.LocalContext+import androidx.core.content.FileProvider+import com.yalantis.ucrop.UCrop+import dev.davidv.translator.R+import dev.davidv.translator.TranslatorMessage+import dev.davidv.translator.copyDocumentUriToCache+import dev.davidv.translator.displayNameForUri+import dev.davidv.translator.isImageUri+import dev.davidv.translator.sizeBytesForUri+import kotlinx.coroutines.Dispatchers+import kotlinx.coroutines.flow.SharedFlow+import kotlinx.coroutines.launch+import kotlinx.coroutines.withContext+import java.io.File++private val filePickerMimeTypes =+ arrayOf(+ "image/*",+ "application/pdf",+ "text/plain",+ "application/vnd.oasis.opendocument.text",+ "application/epub+zip",+ )++private data class PendingImageImport(+ val sourceUri: Uri?,+ val cropOutputUri: Uri,+)++private fun createTemporaryImageUri(+ context: Context,+ prefix: String,+ compressFormat: Bitmap.CompressFormat = Bitmap.CompressFormat.JPEG,+): Uri {+ val suffix =+ when (compressFormat) {+ Bitmap.CompressFormat.JPEG -> ".jpg"+ Bitmap.CompressFormat.PNG -> ".png"+ Bitmap.CompressFormat.WEBP,+ Bitmap.CompressFormat.WEBP_LOSSY,+ Bitmap.CompressFormat.WEBP_LOSSLESS,+ -> ".webp"+ }+ val file = java.io.File.createTempFile(prefix, suffix, context.cacheDir)+ return FileProvider.getUriForFile(context, "${context.packageName}.fileprovider", file)+}++private fun deleteTemporaryImageUri(+ context: Context,+ uri: Uri,+): Boolean =+ try {+ when (uri.scheme) {+ "content" -> context.contentResolver.delete(uri, null, null) > 0+ "file" -> uri.path?.let(::File)?.delete() == true+ else -> false+ }+ } catch (e: Exception) {+ Log.w("ImageCapture", "Failed to delete temporary image URI: $uri", e)+ false+ }++private fun isRemoteUri(uri: Uri): Boolean = uri.scheme.equals("http", ignoreCase = true) || uri.scheme.equals("https", ignoreCase = true)++private fun shouldStartInDocAlign(+ context: Context,+ uri: Uri,+): Boolean {+ val mime = context.contentResolver.getType(uri)?.lowercase() ?: return false+ val isPhotoMime = mime == "image/jpeg" || mime == "image/jpg" || mime == "image/heic" || mime == "image/heif"+ if (!isPhotoMime) return false+ val catalog =+ (context.applicationContext as? dev.davidv.translator.TranslatorApplication)?.languageCatalog+ return catalog?.supportInstalledByKind("doc_detect") == true+}++// The image/document entry points a caller can trigger (from the input source+// row). Camera is navigation and stays with the caller; these are the ones that+// need the crop + import plumbing that lives here.+class ImageSourceActions(+ val pickPhotos: () -> Unit,+ val pickDocs: () -> Unit,+ val startScreen: () -> Unit,+)++@Composable+fun rememberImageSourceActions(+ onMessage: (TranslatorMessage) -> Unit,+ from: dev.davidv.translator.Language,+ to: dev.davidv.translator.Language,+ isAutoSource: Boolean,+ pendingSharedImage: SharedFlow<Uri>? = null,+): ImageSourceActions {+ val context = LocalContext.current+ val scope = rememberCoroutineScope()+ val pendingImport = remember { mutableStateOf<PendingImageImport?>(null) }++ val colorScheme = MaterialTheme.colorScheme+ val toolbarColor = colorScheme.surface.toArgb()+ val toolbarWidgetColor = colorScheme.onSurface.toArgb()+ val activeWidgetColor = colorScheme.primary.toArgb()+ val rootBackgroundColor = colorScheme.background.toArgb()++ val activeSourceUri = remember { mutableStateOf<Uri?>(null) }+ val cropLauncherState = remember { mutableStateOf<((Intent) -> Unit)?>(null) }++ fun buildRectIntent(+ sourceUri: Uri,+ destUri: Uri,+ ): Intent {+ val options =+ UCrop.Options().apply {+ setCompressionFormat(Bitmap.CompressFormat.JPEG)+ setCompressionQuality(95)+ setFreeStyleCropEnabled(true)+ setHideBottomControls(false)+ setToolbarColor(toolbarColor)+ setToolbarWidgetColor(toolbarWidgetColor)+ setActiveControlsWidgetColor(activeWidgetColor)+ setRootViewBackgroundColor(rootBackgroundColor)+ }+ return UCrop+ .of(sourceUri, destUri)+ .withOptions(options)+ .getIntent(context)+ .setClass(context, AppCropActivity::class.java)+ }++ fun buildDocAlignIntent(+ sourceUri: Uri,+ destUri: Uri,+ ): Intent =+ Intent(context, DocAlignActivity::class.java).apply {+ putExtra(DocAlignActivity.EXTRA_INPUT_URI, sourceUri)+ putExtra(DocAlignActivity.EXTRA_OUTPUT_URI, destUri)+ }++ val cropImage =+ rememberLauncherForActivityResult(ActivityResultContracts.StartActivityForResult()) { result ->+ val activeImport = pendingImport.value+ val resultIntent = result.data+ val sourceUri = activeSourceUri.value+ val ucropOutput = resultIntent?.let { UCrop.getOutput(it) }+ val ucropError = resultIntent?.let { UCrop.getError(it) }+ val docAlignOutput = resultIntent?.data+ val launch = cropLauncherState.value+ when {+ result.resultCode == android.app.Activity.RESULT_OK && ucropOutput != null -> {+ activeSourceUri.value = null+ activeImport?.sourceUri?.let { deleteTemporaryImageUri(context, it) }+ pendingImport.value = null+ Log.d("ImageCrop", "Image cropped (rect): $ucropOutput")+ onMessage(TranslatorMessage.SetImageUri(ucropOutput, deleteAfterLoad = true))+ }+ result.resultCode == android.app.Activity.RESULT_OK && docAlignOutput != null -> {+ activeSourceUri.value = null+ activeImport?.sourceUri?.let { deleteTemporaryImageUri(context, it) }+ pendingImport.value = null+ Log.d("ImageCrop", "Image cropped (doc-align): $docAlignOutput")+ onMessage(TranslatorMessage.SetImageUri(docAlignOutput, deleteAfterLoad = true))+ }+ result.resultCode == AppCropActivity.RESULT_SWITCH_TO_DOC_ALIGN &&+ activeImport != null && sourceUri != null && launch != null -> {+ Log.d("ImageCrop", "Switching to doc-align mode")+ launch(buildDocAlignIntent(sourceUri, activeImport.cropOutputUri))+ }+ result.resultCode == DocAlignActivity.RESULT_SWITCH_TO_RECT &&+ activeImport != null && sourceUri != null && launch != null -> {+ Log.d("ImageCrop", "Switching to rectangular crop")+ launch(buildRectIntent(sourceUri, activeImport.cropOutputUri))+ }+ else -> {+ activeSourceUri.value = null+ activeImport?.sourceUri?.let { deleteTemporaryImageUri(context, it) }+ activeImport?.cropOutputUri?.let { deleteTemporaryImageUri(context, it) }+ pendingImport.value = null+ Log.d("ImageCrop", "Crop cancelled or failed: ${ucropError?.message}")+ }+ }+ }+ cropLauncherState.value = { intent -> cropImage.launch(intent) }++ fun launchCrop(+ sourceUri: Uri,+ destUri: Uri,+ ) {+ if (isRemoteUri(sourceUri)) {+ deleteTemporaryImageUri(context, destUri)+ pendingImport.value = null+ Log.w("ImageCrop", "Remote image crop is unsupported: $sourceUri")+ Toast.makeText(context, context.getString(R.string.image_no_crop_remote), Toast.LENGTH_SHORT).show()+ return+ }++ activeSourceUri.value = sourceUri+ val intent =+ if (shouldStartInDocAlign(context, sourceUri)) {+ buildDocAlignIntent(sourceUri, destUri)+ } else {+ buildRectIntent(sourceUri, destUri)+ }+ cropImage.launch(intent)+ }++ if (pendingSharedImage != null) {+ LaunchedEffect(pendingSharedImage) {+ pendingSharedImage.collect { uri ->+ val cropOutputUri = createTemporaryImageUri(context, "cropped_image")+ pendingImport.value = PendingImageImport(sourceUri = null, cropOutputUri = cropOutputUri)+ Log.d("SharedImage", "Launching crop for shared URI: $uri")+ launchCrop(uri, cropOutputUri)+ }+ }+ }++ val pickMedia =+ rememberLauncherForActivityResult(ActivityResultContracts.PickVisualMedia()) { uri: Uri? ->+ if (uri != null) {+ val cropOutputUri = createTemporaryImageUri(context, "cropped_image")+ pendingImport.value = PendingImageImport(sourceUri = null, cropOutputUri = cropOutputUri)+ Log.d("PhotoPicker", "Selected URI: $uri")+ launchCrop(uri, cropOutputUri)+ } else {+ Log.d("PhotoPicker", "No media selected")+ }+ }++ val pickFromGallery =+ rememberLauncherForActivityResult(ActivityResultContracts.StartActivityForResult()) { result ->+ if (result.resultCode == android.app.Activity.RESULT_OK) {+ val imageUri = result.data?.data+ if (imageUri != null) {+ val cropOutputUri = createTemporaryImageUri(context, "cropped_image")+ pendingImport.value = PendingImageImport(sourceUri = null, cropOutputUri = cropOutputUri)+ Log.d("Gallery", "Selected URI: $imageUri")+ launchCrop(imageUri, cropOutputUri)+ } else {+ Log.d("Gallery", "No image selected")+ }+ }+ }++ val pickFromFiles =+ rememberLauncherForActivityResult(ActivityResultContracts.OpenDocument()) { uri: Uri? ->+ if (uri != null) {+ Log.d("FilePicker", "Selected URI: $uri")+ if (isImageUri(context, uri)) {+ val cropOutputUri = createTemporaryImageUri(context, "cropped_image")+ pendingImport.value = PendingImageImport(sourceUri = null, cropOutputUri = cropOutputUri)+ launchCrop(uri, cropOutputUri)+ } else {+ scope.launch {+ try {+ val documentFile = withContext(Dispatchers.IO) { copyDocumentUriToCache(context, uri) }+ Log.d("FilePicker", "Copied document to: ${documentFile.absolutePath}")+ onMessage(+ TranslatorMessage.SetDocumentPath(+ path = documentFile.absolutePath,+ displayName = displayNameForUri(context, uri) ?: documentFile.name,+ sizeBytes = sizeBytesForUri(context, uri) ?: documentFile.length(),+ deleteAfterLoad = true,+ ),+ )+ } catch (e: Exception) {+ Log.e("FilePicker", "Failed to import document: $uri", e)+ Toast.makeText(context, context.getString(R.string.image_open_failed), Toast.LENGTH_SHORT).show()+ }+ }+ }+ } else {+ Log.d("FilePicker", "No file selected")+ }+ }++ return ImageSourceActions(+ pickPhotos = {+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {+ pickMedia.launch(PickVisualMediaRequest(ActivityResultContracts.PickVisualMedia.ImageOnly))+ } else {+ val galleryIntent = Intent(Intent.ACTION_PICK, MediaStore.Images.Media.EXTERNAL_CONTENT_URI)+ pickFromGallery.launch(galleryIntent)+ }+ },+ pickDocs = {+ pickFromFiles.launch(filePickerMimeTypes)+ },+ startScreen = {+ context.startActivity(+ dev.davidv.translator.screenTranslate.ScreenCaptureRequestActivity.intent(+ context,+ sourceCode = from.code,+ targetCode = to.code,+ isAutoSource = false,+ ),+ )+ },+ )+}diff --git a/OCR-translation/src/main/java/dev/davidv/translator/ui/components/ImageDisplaySection.kt b/OCR-translation/src/main/java/dev/davidv/translator/ui/components/ImageDisplaySection.ktnew file mode 100644index 0000000..f4a6773--- /dev/null+++ b/OCR-translation/src/main/java/dev/davidv/translator/ui/components/ImageDisplaySection.kt@@ -0,0 +1,136 @@+/*+ * Copyright (C) 2024 David V+ *+ * This program 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.+ *+ * This program 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 <https://www.gnu.org/licenses/>.+ */++package dev.davidv.translator.ui.components++import android.graphics.Bitmap+import androidx.compose.foundation.Image+import androidx.compose.foundation.gestures.rememberTransformableState+import androidx.compose.foundation.gestures.transformable+import androidx.compose.foundation.layout.Box+import androidx.compose.foundation.layout.BoxWithConstraints+import androidx.compose.foundation.layout.absoluteOffset+import androidx.compose.foundation.layout.fillMaxSize+import androidx.compose.foundation.layout.fillMaxWidth+import androidx.compose.foundation.layout.size+import androidx.compose.runtime.Composable+import androidx.compose.runtime.getValue+import androidx.compose.runtime.mutableStateOf+import androidx.compose.runtime.remember+import androidx.compose.runtime.setValue+import androidx.compose.ui.Alignment+import androidx.compose.ui.Modifier+import androidx.compose.ui.draw.clip+import androidx.compose.ui.geometry.Offset+import androidx.compose.ui.graphics.RectangleShape+import androidx.compose.ui.graphics.asImageBitmap+import androidx.compose.ui.graphics.graphicsLayer+import androidx.compose.ui.layout.ContentScale+import androidx.compose.ui.platform.LocalDensity+import androidx.compose.ui.res.stringResource+import androidx.compose.ui.unit.Dp+import androidx.compose.ui.unit.IntOffset+import dev.davidv.translator.R+import kotlin.math.roundToInt++/**+ * The main-screen image surface: the image scaled to fill the available width (scaling small+ * images up), capped at `maxHeight`, and sized to the image so the content below sits right under+ * it. Pinch zooms (clamped) and, when zoomed, a one-finger drag pans; the word-selection overlay+ * is drawn directly on it and a tap selects. While OCR runs it shows the scan animation.+ * `showOriginal` (driven by the top-bar flip) swaps to the original image and its source words.+ */+@Composable+fun ImageDisplaySection(+ displayImage: Bitmap,+ originalImage: Bitmap?,+ showOriginal: Boolean,+ isProcessing: Boolean,+ detectedRegions: DetectedRegions?,+ wordSelection: ImageWordSelection?,+ maxHeight: Dp,+ modifier: Modifier = Modifier,+) {+ val shown = if (showOriginal && originalImage != null) originalImage else displayImage+ val aspect = displayImage.width.toFloat() / displayImage.height.toFloat()+ val density = LocalDensity.current++ BoxWithConstraints(modifier.fillMaxWidth()) {+ val heightForWidth = maxWidth / aspect+ val dispW = if (heightForWidth <= maxHeight) maxWidth else maxHeight * aspect+ val dispH = if (heightForWidth <= maxHeight) heightForWidth else maxHeight+ val dispWpx = with(density) { dispW.toPx() }+ val dispHpx = with(density) { dispH.toPx() }++ var scale by remember(displayImage) { mutableStateOf(1f) }+ var offset by remember(displayImage) { mutableStateOf(Offset.Zero) }+ val transformState =+ rememberTransformableState { zoomChange, panChange, _ ->+ val newScale = (scale * zoomChange).coerceIn(1f, 4f)+ offset =+ if (newScale <= 1f) {+ Offset.Zero+ } else {+ val maxX = dispWpx * (newScale - 1f) / 2f+ val maxY = dispHpx * (newScale - 1f) / 2f+ val proposed = offset + panChange * newScale+ Offset(proposed.x.coerceIn(-maxX, maxX), proposed.y.coerceIn(-maxY, maxY))+ }+ scale = newScale+ }++ Box(+ modifier =+ Modifier+ .align(Alignment.TopCenter)+ .size(dispW, dispH)+ .clip(RectangleShape)+ .absoluteOffset { IntOffset(offset.x.roundToInt(), offset.y.roundToInt()) }+ .graphicsLayer(scaleX = scale, scaleY = scale)+ .transformable(transformState),+ ) {+ Image(+ bitmap = shown.asImageBitmap(),+ contentDescription =+ if (showOriginal) {+ stringResource(+ R.string.a11y_original_image,+ )+ } else {+ stringResource(R.string.a11y_translated_image)+ },+ contentScale = ContentScale.Fit,+ modifier = Modifier.fillMaxSize(),+ )++ if (isProcessing && detectedRegions != null) {+ ScanAnimationOverlay(+ regions = detectedRegions,+ modifier = Modifier.matchParentSize(),+ )+ } else if (wordSelection != null) {+ WordSelectionOverlay(+ words = if (showOriginal) wordSelection.sourceWords else wordSelection.translatedWords,+ imageWidth = wordSelection.imageWidth,+ imageHeight = wordSelection.imageHeight,+ scale = scale,+ modifier = Modifier.matchParentSize(),+ )+ }+ }+ }+}diff --git a/OCR-translation/src/main/java/dev/davidv/translator/ui/components/InputSection.kt b/OCR-translation/src/main/java/dev/davidv/translator/ui/components/InputSection.ktnew file mode 100644index 0000000..9abf3d7--- /dev/null+++ b/OCR-translation/src/main/java/dev/davidv/translator/ui/components/InputSection.kt@@ -0,0 +1,214 @@+/*+ * Copyright (C) 2024 David V+ *+ * This program 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.+ *+ * This program 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 <https://www.gnu.org/licenses/>.+ */++package dev.davidv.translator.ui.components++import android.widget.TextView+import androidx.compose.foundation.clickable+import androidx.compose.foundation.interaction.MutableInteractionSource+import androidx.compose.foundation.layout.Column+import androidx.compose.foundation.layout.fillMaxSize+import androidx.compose.foundation.layout.fillMaxWidth+import androidx.compose.foundation.layout.padding+import androidx.compose.foundation.rememberScrollState+import androidx.compose.foundation.verticalScroll+import androidx.compose.material3.MaterialTheme+import androidx.compose.runtime.Composable+import androidx.compose.runtime.remember+import androidx.compose.ui.Modifier+import androidx.compose.ui.graphics.toArgb+import androidx.compose.ui.platform.LocalContext+import androidx.compose.ui.res.stringResource+import androidx.compose.ui.unit.dp+import androidx.compose.ui.viewinterop.AndroidView+import dev.davidv.translator.Language+import dev.davidv.translator.R+import dev.davidv.translator.TranslatorMessage+import dev.davidv.translator.localizedName++@Composable+fun InputSection(+ input: String,+ inputTransliteration: String?,+ from: Language,+ onMessage: (TranslatorMessage) -> Unit,+ focusController: StyledTextFieldFocusController,+ fontFactor: Float,+ showTransliteration: Boolean,+ canInputDict: Boolean,+ inputDictMode: Boolean,+ onToggleInputDict: () -> Unit,+ canSpeakInput: Boolean,+ isInputAudioPlaying: Boolean,+ isInputAudioLoading: Boolean,+ sourceTtsPlaybackSpeed: Float,+ selectedSourceTtsVoiceName: String?,+ availableSourceTtsVoices: List<uniffi.translator_core.InstalledTtsPack>,+ onSourceTtsPlaybackSpeedChange: (Float) -> Unit,+ onSourceTtsVoiceSelected: (String, String) -> Unit,+ onSpeakInput: (String, Language) -> Unit,+ onStopAudio: () -> Unit,+ showSourceRow: Boolean,+ sourceActions: ImageSourceActions,+ onCameraClick: () -> Unit,+ screenTranslateEnabled: Boolean,+ isAutoSource: Boolean,+ detectedSection: (@Composable () -> Unit)? = null,+ modifier: Modifier = Modifier,+) {+ val context = LocalContext.current++ TranslationCard(+ label = from.localizedName(),+ modifier = modifier,+ tools = {+ if (canSpeakInput) {+ SpeechPlaybackButton(+ isAudioPlaying = isInputAudioPlaying,+ isAudioLoading = isInputAudioLoading,+ speechPlaybackSpeed = sourceTtsPlaybackSpeed,+ selectedVoiceName = selectedSourceTtsVoiceName,+ availableVoices = availableSourceTtsVoices,+ onSpeak = {+ if (isInputAudioPlaying || isInputAudioLoading) {+ onStopAudio()+ } else {+ onSpeakInput(input, from)+ }+ },+ onSpeechPlaybackSpeedChange = onSourceTtsPlaybackSpeedChange,+ onVoiceSelected = onSourceTtsVoiceSelected,+ contentDescription =+ if (isInputAudioPlaying) {+ stringResource(R.string.a11y_stop_audio)+ } else {+ stringResource(R.string.a11y_speak_input)+ },+ )+ }+ if (canInputDict) {+ ToolIconButton(+ iconRes = R.drawable.dictionary_book,+ contentDescription =+ stringResource(+ if (inputDictMode) {+ R.string.a11y_dictionary_mode_on+ } else {+ R.string.a11y_dictionary_mode_off+ },+ ),+ active = inputDictMode,+ onClick = onToggleInputDict,+ )+ }+ if (input.isNotEmpty()) {+ ToolIconButton(+ iconRes = R.drawable.cancel,+ contentDescription = stringResource(R.string.a11y_clear_input),+ onClick = { onMessage(TranslatorMessage.ClearInput) },+ )+ } else if (rememberClipboardHasText()) {+ ToolIconButton(+ iconRes = R.drawable.paste,+ contentDescription = stringResource(R.string.a11y_paste),+ onClick = { pasteFromClipboard(context, onMessage) },+ )+ }+ },+ footer =+ if (showSourceRow) {+ {+ InputSourceRow(+ input = input,+ from = from,+ onMessage = onMessage,+ actions = sourceActions,+ onCameraClick = onCameraClick,+ screenTranslateEnabled = screenTranslateEnabled,+ isAutoSource = isAutoSource,+ )+ }+ } else {+ null+ },+ body = {+ Column(modifier = Modifier.fillMaxSize()) {+ Column(+ modifier =+ Modifier+ .fillMaxWidth()+ .weight(1f, fill = true)+ .verticalScroll(rememberScrollState())+ .clickable(+ interactionSource = remember { MutableInteractionSource() },+ indication = null,+ enabled = !inputDictMode,+ ) { focusController.focus() },+ ) {+ StyledTextField(+ text = input,+ onValueChange = { newInput ->+ onMessage(TranslatorMessage.TextInput(newInput))+ },+ onDictionaryLookup = { word ->+ onMessage(TranslatorMessage.DictionaryLookup(word, from))+ },+ wordTapMode = inputDictMode,+ onWordTap = { offset ->+ val word = wordAt(input, offset)+ if (!word.isNullOrBlank()) {+ onMessage(TranslatorMessage.DictionaryLookup(word, from))+ }+ },+ placeholder = stringResource(R.string.main_input_placeholder),+ modifier = Modifier.fillMaxWidth(),+ textStyle =+ MaterialTheme.typography.bodyLarge.copy(+ fontSize = (MaterialTheme.typography.bodyLarge.fontSize * fontFactor),+ lineHeight = (MaterialTheme.typography.bodyLarge.lineHeight * fontFactor),+ ),+ focusController = focusController,+ )++ if (showTransliteration && inputTransliteration != null) {+ val smallerFontSize = MaterialTheme.typography.bodyLarge.fontSize.value * 0.7f+ val textColor = MaterialTheme.colorScheme.onSurface.toArgb()+ AndroidView(+ factory = { ctx ->+ TextView(ctx).apply {+ this.text = inputTransliteration+ this.textSize = smallerFontSize+ this.setTextColor(textColor)+ this.isClickable = false+ this.isLongClickable = false+ this.isFocusable = false+ }+ },+ update = { textView ->+ textView.text = inputTransliteration+ textView.textSize = smallerFontSize+ },+ modifier = Modifier.fillMaxWidth().padding(top = 8.dp),+ )+ }+ }++ detectedSection?.invoke()+ }+ },+ )+}diff --git a/OCR-translation/src/main/java/dev/davidv/translator/ui/components/InputSourceRow.kt b/OCR-translation/src/main/java/dev/davidv/translator/ui/components/InputSourceRow.ktnew file mode 100644index 0000000..a6b3da1--- /dev/null+++ b/OCR-translation/src/main/java/dev/davidv/translator/ui/components/InputSourceRow.kt@@ -0,0 +1,85 @@+/*+ * Copyright (C) 2024 David V+ *+ * This program 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.+ *+ * This program 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 <https://www.gnu.org/licenses/>.+ */++package dev.davidv.translator.ui.components++import android.widget.Toast+import androidx.compose.foundation.layout.Arrangement+import androidx.compose.foundation.layout.Row+import androidx.compose.foundation.layout.fillMaxWidth+import androidx.compose.runtime.Composable+import androidx.compose.ui.Alignment+import androidx.compose.ui.Modifier+import androidx.compose.ui.platform.LocalContext+import androidx.compose.ui.res.stringResource+import androidx.compose.ui.unit.dp+import dev.davidv.translator.Language+import dev.davidv.translator.R+import dev.davidv.translator.TranslatorMessage++// The compact source row under the input field: screen (experimental, gated),+// voice, camera, photos and documents. It absorbs what used to be the FAB's+// image-source bottom sheet plus the standalone voice button.+@Composable+fun InputSourceRow(+ input: String,+ from: Language,+ onMessage: (TranslatorMessage) -> Unit,+ actions: ImageSourceActions,+ onCameraClick: () -> Unit,+ screenTranslateEnabled: Boolean,+ isAutoSource: Boolean,+ modifier: Modifier = Modifier,+) {+ val context = LocalContext.current++ Row(+ modifier = modifier.fillMaxWidth(),+ horizontalArrangement = Arrangement.spacedBy(4.dp),+ verticalAlignment = Alignment.CenterVertically,+ ) {+ if (screenTranslateEnabled) {+ ActionPillButton(+ iconRes = R.drawable.videocam,+ contentDescription = stringResource(R.string.a11y_translate_screen_live),+ onClick = {+ if (isAutoSource) {+ Toast.makeText(context, context.getString(R.string.screen_translate_needs_source), Toast.LENGTH_LONG).show()+ } else {+ actions.startScreen()+ }+ },+ )+ }+ SpeechInputButton(input = input, from = from, onMessage = onMessage)+ ActionPillButton(+ iconRes = R.drawable.camera,+ contentDescription = stringResource(R.string.a11y_source_camera),+ onClick = onCameraClick,+ )+ ActionPillButton(+ iconRes = R.drawable.gallery,+ contentDescription = stringResource(R.string.a11y_source_photos),+ onClick = actions.pickPhotos,+ )+ ActionPillButton(+ iconRes = R.drawable.draft,+ contentDescription = stringResource(R.string.a11y_source_document),+ onClick = actions.pickDocs,+ )+ }+}diff --git a/OCR-translation/src/main/java/dev/davidv/translator/ui/components/InteractiveText.kt b/OCR-translation/src/main/java/dev/davidv/translator/ui/components/InteractiveText.ktnew file mode 100644index 0000000..5b15f9d--- /dev/null+++ b/OCR-translation/src/main/java/dev/davidv/translator/ui/components/InteractiveText.kt@@ -0,0 +1,75 @@+/*+ * Copyright (C) 2024 David V+ *+ * This program 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.+ *+ * This program 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 <https://www.gnu.org/licenses/>.+ */++package dev.davidv.translator.ui.components++import android.widget.TextView+import androidx.compose.material3.MaterialTheme+import androidx.compose.runtime.Composable+import androidx.compose.runtime.remember+import androidx.compose.ui.Modifier+import androidx.compose.ui.graphics.toArgb+import androidx.compose.ui.platform.LocalContext+import androidx.compose.ui.semantics.semantics+import androidx.compose.ui.semantics.text+import androidx.compose.ui.text.AnnotatedString+import androidx.compose.ui.text.TextStyle+import androidx.compose.ui.viewinterop.AndroidView++@Composable+fun InteractiveText(+ text: String,+ modifier: Modifier = Modifier,+ style: TextStyle = MaterialTheme.typography.bodyMedium,+ onDictionaryLookup: (String) -> Unit,+) {+ val context = LocalContext.current+ val actionModeCallback =+ remember(onDictionaryLookup) {+ DictionaryActionModeCallback(context, onDictionaryLookup)+ }++ val textColor = MaterialTheme.colorScheme.onSurface.toArgb()+ val fontSize = style.fontSize.value++ AndroidView(+ factory = { context ->+ TextView(context).apply {+ this.text = text+ this.textSize = fontSize+ this.setTextColor(textColor)+ this.setTextIsSelectable(true)+ this.customSelectionActionModeCallback = actionModeCallback+ this.customInsertionActionModeCallback = actionModeCallback+ actionModeCallback.setTextView(this)+ }+ },+ update = { textView ->+ textView.text = text+ textView.textSize = fontSize+ textView.setTextColor(textColor)+ textView.setTextIsSelectable(true)+ textView.customSelectionActionModeCallback = actionModeCallback+ textView.customInsertionActionModeCallback = actionModeCallback+ actionModeCallback.setTextView(textView)+ },+ modifier =+ modifier.semantics {+ this.text = AnnotatedString(text)+ },+ )+}diff --git a/OCR-translation/src/main/java/dev/davidv/translator/ui/components/LanguageDownloadButton.kt b/OCR-translation/src/main/java/dev/davidv/translator/ui/components/LanguageDownloadButton.ktnew file mode 100644index 0000000..153f585--- /dev/null+++ b/OCR-translation/src/main/java/dev/davidv/translator/ui/components/LanguageDownloadButton.kt@@ -0,0 +1,219 @@+/*+ * Copyright (C) 2024 David V+ *+ * This program 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.+ *+ * This program 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 <https://www.gnu.org/licenses/>.+ */++package dev.davidv.translator.ui.components+import androidx.compose.animation.core.animateFloatAsState+import androidx.compose.animation.core.tween+import androidx.compose.foundation.layout.Arrangement+import androidx.compose.foundation.layout.Box+import androidx.compose.foundation.layout.Column+import androidx.compose.foundation.layout.fillMaxWidth+import androidx.compose.foundation.layout.padding+import androidx.compose.foundation.layout.size+import androidx.compose.material3.CircularProgressIndicator+import androidx.compose.material3.Icon+import androidx.compose.material3.IconButton+import androidx.compose.material3.MaterialTheme+import androidx.compose.material3.Surface+import androidx.compose.runtime.Composable+import androidx.compose.runtime.getValue+import androidx.compose.ui.Alignment+import androidx.compose.ui.Modifier+import androidx.compose.ui.res.painterResource+import androidx.compose.ui.res.stringResource+import androidx.compose.ui.tooling.preview.Preview+import androidx.compose.ui.unit.dp+import dev.davidv.translator.DownloadState+import dev.davidv.translator.Language+import dev.davidv.translator.R+import dev.davidv.translator.Script+import dev.davidv.translator.singleScript+import dev.davidv.translator.ui.theme.TranslatorTheme++@Composable+fun LanguageDownloadButton(+ language: Language,+ downloadState: DownloadState?,+ isLanguageAvailable: Boolean,+ onEvent: (LanguageEvent) -> Unit,+ modifier: Modifier = Modifier,+ enabled: Boolean,+) {+ val isDownloading = downloadState?.isDownloading == true++ if (isDownloading) {+ // Progress indicator with cancel button+ Box(+ contentAlignment = Alignment.Center,+ modifier = modifier.size(48.dp),+ ) {+ val targetProgress =+ downloadState!!.downloaded.toFloat() / downloadState.totalSize.toFloat()++ val animatedProgress by animateFloatAsState(+ targetValue = targetProgress,+ animationSpec = tween(durationMillis = 300),+ label = "progress",+ )+ CircularProgressIndicator(+ progress = { animatedProgress },+ modifier = Modifier.size(40.dp),+ )+ IconButton(+ enabled = enabled,+ onClick = {+ onEvent(LanguageEvent.Cancel(language))+ },+ modifier = Modifier.size(40.dp),+ ) {+ Icon(+ painterResource(id = R.drawable.cancel),+ contentDescription = stringResource(R.string.a11y_cancel_download),+ )+ }+ }+ } else if (isLanguageAvailable) {+ // Delete button for available/completed languages+ IconButton(+ enabled = enabled,+ onClick = {+ onEvent(LanguageEvent.Delete(language))+ },+ modifier = modifier,+ ) {+ Icon(+ painterResource(id = R.drawable.delete),+ contentDescription = stringResource(R.string.a11y_delete_language),+ tint = MaterialTheme.colorScheme.onSurface.copy(alpha = if (enabled) 1f else 0.5f),+ )+ }+ } else {+ // Download/retry button+ IconButton(+ enabled = enabled,+ onClick = {+ onEvent(LanguageEvent.Download(language))+ },+ modifier = modifier,+ ) {+ when {+ downloadState?.isCancelled == true || downloadState?.error != null -> {+ Icon(+ painterResource(id = R.drawable.refresh),+ contentDescription = stringResource(R.string.a11y_retry_download),+ )+ }+ else -> {+ Icon(+ painterResource(id = R.drawable.add),+ contentDescription = stringResource(R.string.a11y_download),+ )+ }+ }+ }+ }+}++sealed class LanguageEvent {+ data class Download(+ val language: Language,+ ) : LanguageEvent()++ data class Delete(+ val language: Language,+ ) : LanguageEvent()++ data class DeleteDictionary(+ val language: Language,+ ) : LanguageEvent()++ data class Cancel(+ val language: Language,+ ) : LanguageEvent()++ object FetchDictionaryIndex : LanguageEvent()+}++private fun previewLanguage(+ code: String,+ name: String,+) = Language(+ code = code,+ displayName = name,+ shortDisplayName = name,+ script = Script.LATIN,+ writingSystem = singleScript(Script.LATIN),+ dictionaryCode = code,+)++@Preview(showBackground = true)+@Composable+fun LanguageDownloadButtonPreview() {+ val french = previewLanguage("fr", "French")+ TranslatorTheme {+ Surface(+ modifier = Modifier.padding(16.dp),+ color = MaterialTheme.colorScheme.background,+ ) {+ Column(+ modifier = Modifier.fillMaxWidth(),+ verticalArrangement = Arrangement.spacedBy(16.dp),+ horizontalAlignment = Alignment.CenterHorizontally,+ ) {+ LanguageDownloadButton(+ language = french,+ downloadState = null,+ isLanguageAvailable = false,+ onEvent = {},+ enabled = true,+ )++ LanguageDownloadButton(+ language = french,+ downloadState = DownloadState(isDownloading = true, totalSize = 100, downloaded = 50),+ isLanguageAvailable = false,+ onEvent = {},+ enabled = true,+ )++ LanguageDownloadButton(+ language = french,+ downloadState = null,+ isLanguageAvailable = true,+ onEvent = {},+ enabled = false,+ )++ LanguageDownloadButton(+ language = french,+ downloadState = DownloadState(error = "Failed"),+ isLanguageAvailable = false,+ onEvent = {},+ enabled = true,+ )++ LanguageDownloadButton(+ language = french,+ downloadState = null,+ isLanguageAvailable = true,+ onEvent = {},+ enabled = true,+ )+ }+ }+ }+}diff --git a/OCR-translation/src/main/java/dev/davidv/translator/ui/components/LanguageSelectionRow.kt b/OCR-translation/src/main/java/dev/davidv/translator/ui/components/LanguageSelectionRow.ktnew file mode 100644index 0000000..4066798--- /dev/null+++ b/OCR-translation/src/main/java/dev/davidv/translator/ui/components/LanguageSelectionRow.kt@@ -0,0 +1,222 @@+/*+ * Copyright (C) 2024 David V+ *+ * This program 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.+ *+ * This program 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 <https://www.gnu.org/licenses/>.+ */++package dev.davidv.translator.ui.components++import android.content.res.Configuration+import androidx.compose.foundation.layout.Arrangement+import androidx.compose.foundation.layout.Row+import androidx.compose.foundation.layout.Spacer+import androidx.compose.foundation.layout.fillMaxWidth+import androidx.compose.foundation.layout.size+import androidx.compose.foundation.layout.widthIn+import androidx.compose.material3.Icon+import androidx.compose.material3.IconButton+import androidx.compose.material3.MaterialTheme+import androidx.compose.runtime.Composable+import androidx.compose.ui.Alignment+import androidx.compose.ui.Modifier+import androidx.compose.ui.res.painterResource+import androidx.compose.ui.res.stringResource+import androidx.compose.ui.text.font.FontWeight+import androidx.compose.ui.tooling.preview.Preview+import androidx.compose.ui.unit.dp+import androidx.compose.ui.unit.sp+import dev.davidv.translator.LangAvailability+import dev.davidv.translator.Language+import dev.davidv.translator.LanguageAvailabilityEntry+import dev.davidv.translator.LanguageAvailabilityState+import dev.davidv.translator.LanguageMetadata+import dev.davidv.translator.R+import dev.davidv.translator.Script+import dev.davidv.translator.TranslatorMessage+import dev.davidv.translator.singleScript+import dev.davidv.translator.ui.theme.TranslatorTheme++@Composable+fun LanguageSelectionRow(+ from: Language,+ to: Language,+ canSwap: Boolean,+ languageState: LanguageAvailabilityState,+ languageMetadata: Map<Language, LanguageMetadata>,+ onMessage: (TranslatorMessage) -> Unit,+ onSettings: (() -> Unit)?,+ drawable: Pair<String, Int>,+ isAutoSource: Boolean = false,+ detectedInstalled: Language? = null,+ showAutoOption: Boolean = false,+) {+ val titleStyle =+ MaterialTheme.typography.titleMedium.copy(+ fontWeight = FontWeight.SemiBold,+ fontSize = 18.sp,+ )++ Row(+ modifier = Modifier.fillMaxWidth(),+ horizontalArrangement = Arrangement.spacedBy(2.dp),+ verticalAlignment = Alignment.CenterVertically,+ ) {+ val fromLanguages =+ languageState.allLanguages().filter { x ->+ (isAutoSource || x != from) && (languageState.availabilityFor(x)?.hasToEnglish == true || x.isEnglish)+ }+ val toLanguages =+ languageState.allLanguages().filter { x ->+ (isAutoSource || x != from) && x != to && (languageState.availabilityFor(x)?.hasFromEnglish == true || x.isEnglish)+ }++ LanguageSelector(+ selectedLanguage = from,+ availableLanguages = fromLanguages,+ languageMetadata = languageMetadata,+ onLanguageSelected = { language ->+ onMessage(TranslatorMessage.FromLang(language))+ },+ modifier = Modifier.widthIn(max = 150.dp),+ isAutoSource = isAutoSource,+ detectedInstalled = detectedInstalled,+ showAutoOption = showAutoOption,+ onAutoSelected = { onMessage(TranslatorMessage.EnableAutoSource) },+ centered = false,+ textStyle = titleStyle,+ )+ LanguageSwapButton(+ onClick = { onMessage(TranslatorMessage.SwapLanguages) },+ enabled = canSwap && !(isAutoSource && detectedInstalled == null),+ )++ LanguageSelector(+ selectedLanguage = to,+ availableLanguages = toLanguages,+ languageMetadata = languageMetadata,+ onLanguageSelected = { language ->+ onMessage(TranslatorMessage.ToLang(language))+ },+ modifier = Modifier.widthIn(max = 150.dp),+ centered = false,+ textStyle = titleStyle,+ )++ Spacer(modifier = Modifier.weight(1f))++ if (onSettings != null) {+ IconButton(onClick = onSettings, modifier = Modifier.size(36.dp)) {+ Icon(+ painterResource(id = drawable.second),+ contentDescription = drawable.first,+ )+ }+ } else {+ Spacer(modifier = Modifier.size(48.dp))+ }+ }+}++@Composable+fun LanguageSwapButton(+ onClick: () -> Unit,+ enabled: Boolean = true,+) {+ IconButton(+ onClick = onClick,+ enabled = enabled,+ modifier = Modifier.size(36.dp),+ ) {+ Icon(+ painterResource(id = R.drawable.compare),+ contentDescription = stringResource(R.string.a11y_reverse_translation_direction),+ tint = MaterialTheme.colorScheme.primary,+ modifier = Modifier.size(20.dp),+ )+ }+}++private fun previewLanguage(+ code: String,+ name: String,+) = Language(+ code = code,+ displayName = name,+ shortDisplayName = name,+ script = Script.LATIN,+ writingSystem = singleScript(Script.LATIN),+ dictionaryCode = code,+)++@Preview(showBackground = true)+@Composable+fun LanguageSelectionRowPreview() {+ TranslatorTheme {+ LanguageSelectionRow(+ from = previewLanguage("en", "English"),+ to = previewLanguage("es", "Spanish"),+ canSwap = true,+ languageState = previewAvailability(),+ languageMetadata = mapOf(previewLanguage("es", "Spanish") to LanguageMetadata(favorite = true)),+ onMessage = {},+ onSettings = {},+ drawable = Pair("Settings", R.drawable.settings),+ )+ }+}++private fun previewAvailability() =+ LanguageAvailabilityState(+ hasLanguages = true,+ availableLanguages =+ listOf(+ LanguageAvailabilityEntry(+ previewLanguage("en", "English"),+ LangAvailability(hasFromEnglish = true, hasToEnglish = true, ocrFiles = true, dictionaryFiles = false),+ ),+ LanguageAvailabilityEntry(+ previewLanguage("es", "Spanish"),+ LangAvailability(hasFromEnglish = true, hasToEnglish = true, ocrFiles = true, dictionaryFiles = false),+ ),+ LanguageAvailabilityEntry(+ previewLanguage("fr", "French"),+ LangAvailability(hasFromEnglish = true, hasToEnglish = true, ocrFiles = true, dictionaryFiles = false),+ ),+ LanguageAvailabilityEntry(+ previewLanguage("de", "German"),+ LangAvailability(hasFromEnglish = true, hasToEnglish = true, ocrFiles = true, dictionaryFiles = false),+ ),+ ),+ isChecking = false,+ )++@Preview(+ showBackground = true,+ uiMode = Configuration.UI_MODE_NIGHT_YES,+)+@Composable+fun LanguageSelectionRowDarkPreview() {+ TranslatorTheme {+ LanguageSelectionRow(+ from = previewLanguage("fr", "French"),+ to = previewLanguage("de", "German"),+ canSwap = true,+ languageState = previewAvailability(),+ languageMetadata = mapOf(previewLanguage("fr", "French") to LanguageMetadata(favorite = true)),+ onMessage = {},+ onSettings = {},+ drawable = Pair("Settings", R.drawable.settings),+ )+ }+}diff --git a/OCR-translation/src/main/java/dev/davidv/translator/ui/components/LanguageSelector.kt b/OCR-translation/src/main/java/dev/davidv/translator/ui/components/LanguageSelector.ktnew file mode 100644index 0000000..e747e36--- /dev/null+++ b/OCR-translation/src/main/java/dev/davidv/translator/ui/components/LanguageSelector.kt@@ -0,0 +1,278 @@+/*+ * Copyright (C) 2024 David V+ *+ * This program 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.+ *+ * This program 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 <https://www.gnu.org/licenses/>.+ */++package dev.davidv.translator.ui.components++import androidx.compose.foundation.basicMarquee+import androidx.compose.foundation.clickable+import androidx.compose.foundation.interaction.MutableInteractionSource+import androidx.compose.foundation.layout.Arrangement+import androidx.compose.foundation.layout.Box+import androidx.compose.foundation.layout.Row+import androidx.compose.foundation.layout.fillMaxWidth+import androidx.compose.foundation.layout.padding+import androidx.compose.foundation.layout.width+import androidx.compose.foundation.shape.RoundedCornerShape+import androidx.compose.material3.DropdownMenu+import androidx.compose.material3.DropdownMenuItem+import androidx.compose.material3.HorizontalDivider+import androidx.compose.material3.Icon+import androidx.compose.material3.MaterialTheme+import androidx.compose.material3.Surface+import androidx.compose.material3.Text+import androidx.compose.runtime.Composable+import androidx.compose.runtime.getValue+import androidx.compose.runtime.mutableStateOf+import androidx.compose.runtime.remember+import androidx.compose.runtime.setValue+import androidx.compose.ui.Alignment+import androidx.compose.ui.Modifier+import androidx.compose.ui.draw.clip+import androidx.compose.ui.graphics.Color+import androidx.compose.ui.res.painterResource+import androidx.compose.ui.res.stringResource+import androidx.compose.ui.text.TextStyle+import androidx.compose.ui.text.style.TextAlign+import androidx.compose.ui.tooling.preview.Preview+import androidx.compose.ui.unit.dp+import dev.davidv.translator.Language+import dev.davidv.translator.LanguageMetadata+import dev.davidv.translator.R+import dev.davidv.translator.Script+import dev.davidv.translator.languageNameComparator+import dev.davidv.translator.localizedName+import dev.davidv.translator.singleScript+import dev.davidv.translator.ui.theme.TranslatorTheme++@Composable+fun LanguageSelector(+ selectedLanguage: Language,+ availableLanguages: List<Language>,+ languageMetadata: Map<Language, LanguageMetadata>,+ onLanguageSelected: (Language) -> Unit,+ modifier: Modifier = Modifier,+ isAutoSource: Boolean = false,+ detectedInstalled: Language? = null,+ showAutoOption: Boolean = false,+ onAutoSelected: (() -> Unit)? = null,+ textColor: androidx.compose.ui.graphics.Color? = null,+ marquee: Boolean = true,+ centered: Boolean = true,+ textStyle: TextStyle = MaterialTheme.typography.bodyMedium,+) {+ var expanded by remember { mutableStateOf(false) }+ val interactionSource = remember { MutableInteractionSource() }++ val displayText =+ when {+ isAutoSource && detectedInstalled != null -> "✨ ${detectedInstalled.localizedName()}"+ isAutoSource -> stringResource(R.string.langsel_auto)+ else -> selectedLanguage.localizedName()+ }++ Box(+ modifier = modifier,+ contentAlignment = if (centered) Alignment.Center else Alignment.CenterStart,+ ) {+ Text(+ modifier =+ Modifier+ .then(if (marquee) Modifier.basicMarquee() else Modifier)+ .clip(RoundedCornerShape(10.dp))+ .clickable(+ interactionSource = interactionSource,+ indication = null,+ ) {+ expanded = true+ }+ .then(if (centered) Modifier.fillMaxWidth() else Modifier)+ .padding(vertical = 8.dp, horizontal = 4.dp),+ text = displayText,+ textAlign = if (centered) TextAlign.Center else TextAlign.Start,+ maxLines = 1,+ overflow = if (marquee) androidx.compose.ui.text.style.TextOverflow.Clip else androidx.compose.ui.text.style.TextOverflow.Ellipsis,+ style = textStyle,+ color = textColor ?: MaterialTheme.colorScheme.onSurface,+ )++ DropdownMenu(+ expanded = expanded,+ onDismissRequest = { expanded = false },+ ) {+ if (showAutoOption && onAutoSelected != null) {+ DropdownMenuItem(+ text = {+ Text(+ text = stringResource(R.string.langsel_auto),+ color =+ if (isAutoSource) {+ MaterialTheme.colorScheme.primary+ } else {+ MaterialTheme.colorScheme.onSurface+ },+ )+ },+ onClick = {+ onAutoSelected()+ expanded = false+ },+ )+ HorizontalDivider()+ }+ availableLanguages+ .sortedWith(+ compareByDescending<Language> { languageMetadata[it]?.favorite ?: false }+ .thenBy(languageNameComparator()) { it.localizedName() },+ ).forEach { language ->+ val isFavorite = languageMetadata[language]?.favorite ?: false+ DropdownMenuItem(+ text = {+ Row(+ verticalAlignment = Alignment.CenterVertically,+ horizontalArrangement = Arrangement.SpaceBetween,+ modifier = Modifier.fillMaxWidth(),+ ) {+ Text(language.localizedName())+ if (isFavorite) {+ Icon(+ painter = painterResource(id = R.drawable.star_filled),+ contentDescription = null,+ tint = Color.Unspecified,+ modifier = Modifier.width(10.dp),+ )+ }+ }+ },+ onClick = {+ onLanguageSelected(language)+ expanded = false+ },+ )+ }+ }+ }+}++private fun previewLanguage(+ code: String,+ name: String,+) = Language(+ code = code,+ displayName = name,+ shortDisplayName = name,+ script = Script.LATIN,+ writingSystem = singleScript(Script.LATIN),+ dictionaryCode = code,+)++@Preview(showBackground = true)+@Composable+fun LanguageSelectorAzerbaijaniPreview() {+ TranslatorTheme {+ Surface(+ color = MaterialTheme.colorScheme.surface,+ ) {+ LanguageSelector(+ selectedLanguage = previewLanguage("az", "Azerbaijani"),+ availableLanguages =+ listOf(+ previewLanguage("en", "English"),+ previewLanguage("es", "Spanish"),+ previewLanguage("fr", "French"),+ previewLanguage("az", "Azerbaijani"),+ previewLanguage("de", "German"),+ ),+ languageMetadata = mapOf(previewLanguage("es", "Spanish") to LanguageMetadata(favorite = true)),+ onLanguageSelected = { },+ )+ }+ }+}++@Preview(showBackground = true)+@Composable+fun LanguageSelectorSpanishPreview() {+ TranslatorTheme {+ Surface(+ color = MaterialTheme.colorScheme.surface,+ ) {+ LanguageSelector(+ selectedLanguage = previewLanguage("es", "Spanish"),+ availableLanguages =+ listOf(+ previewLanguage("en", "English"),+ previewLanguage("es", "Spanish"),+ previewLanguage("fr", "French"),+ previewLanguage("az", "Azerbaijani"),+ previewLanguage("de", "German"),+ ),+ languageMetadata = mapOf(previewLanguage("es", "Spanish") to LanguageMetadata(favorite = true)),+ onLanguageSelected = { },+ )+ }+ }+}++@Preview(showBackground = true)+@Composable+fun LanguageSelectorAutoNoDetectionPreview() {+ TranslatorTheme {+ Surface(+ color = MaterialTheme.colorScheme.surface,+ ) {+ LanguageSelector(+ selectedLanguage = previewLanguage("en", "English"),+ availableLanguages =+ listOf(+ previewLanguage("en", "English"),+ previewLanguage("es", "Spanish"),+ ),+ languageMetadata = emptyMap(),+ onLanguageSelected = { },+ isAutoSource = true,+ detectedInstalled = null,+ showAutoOption = true,+ onAutoSelected = {},+ )+ }+ }+}++@Preview(showBackground = true)+@Composable+fun LanguageSelectorAutoSpanishPreview() {+ TranslatorTheme {+ Surface(+ color = MaterialTheme.colorScheme.surface,+ ) {+ LanguageSelector(+ selectedLanguage = previewLanguage("es", "Spanish"),+ availableLanguages =+ listOf(+ previewLanguage("en", "English"),+ previewLanguage("es", "Spanish"),+ ),+ languageMetadata = emptyMap(),+ onLanguageSelected = { },+ isAutoSource = true,+ detectedInstalled = previewLanguage("es", "Spanish"),+ showAutoOption = true,+ onAutoSelected = {},+ )+ }+ }+}diff --git a/OCR-translation/src/main/java/dev/davidv/translator/ui/components/LiveGlSurfaceView.kt b/OCR-translation/src/main/java/dev/davidv/translator/ui/components/LiveGlSurfaceView.ktnew file mode 100644index 0000000..945775c--- /dev/null+++ b/OCR-translation/src/main/java/dev/davidv/translator/ui/components/LiveGlSurfaceView.kt@@ -0,0 +1,575 @@+/*+ * Copyright (C) 2024 David V+ *+ * This program 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.+ *+ * This program 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 <https://www.gnu.org/licenses/>.+ */++package dev.davidv.translator.ui.components++import android.content.Context+import android.graphics.SurfaceTexture+import android.opengl.EGL14+import android.opengl.EGLContext+import android.opengl.EGLDisplay+import android.opengl.EGLSurface+import android.opengl.GLES20+import android.util.Log+import android.view.Surface+import android.view.SurfaceHolder+import android.view.SurfaceView+import androidx.camera.core.SurfaceRequest+import dev.davidv.translator.GlEgl+import dev.davidv.translator.LivePipelineJni+import java.util.concurrent.Executor+import kotlin.math.max++/**+ * GPU camera surface. Owns an EGL GLES3 context on the SurfaceView's+ * surface plus a `GL_TEXTURE_EXTERNAL_OES` texture wrapped in a+ * `SurfaceTexture` that CameraX's `Preview` writes into. Per camera+ * frame, the render thread (woken by `onFrameAvailable`) hands the+ * external texture to the native `GlesRenderer`, which:+ *+ * 1. GPU-renders the canonical (downscaled, upright) luma into a small+ * `Vec<u8>` (~650 KB) for the tracker.+ * 2. Composites the same external camera + overlay into the EGL+ * surface (no second camera upload).+ *+ * No CPU camera-pixel walk per frame; the analyzer pipeline that used+ * to deliver RGBA bytes through `ImageAnalysis` is gone.+ */+class LiveGlSurfaceView(context: Context) :+ SurfaceView(context), SurfaceHolder.Callback {+ @Volatile+ var onSizeChanged: ((Int, Int) -> Unit)? = null++ /** Invoked on the GL thread after each frame is presented, carrying+ * the packed [LivePipelineJni.processFrameGl] result. Hosted in+ * [LivePlanarOcrEngine] which forwards it to the debug pill. */+ @Volatile+ var onFrameResult: ((Long) -> Unit)? = null++ /** Pointer to the `LiveTrackerPipeline` to drive each frame, written+ * by the engine once it has created its tracker. The GL loop skips+ * frames while this is 0. */+ @Volatile+ var pipelinePtr: Long = 0L++ /** Sensor → display rotation in CW 90° quadrants (0/1/2/3 =+ * 0°/90°/180°/270°), derived from `CameraInfo.sensorRotationDegrees`+ * once the camera is bound. Defaults to 1 (90°), matching the+ * common back-camera-on-portrait-phone case so the very first few+ * frames before the camera binds still render upright. */+ @Volatile+ var rotQuadrant: Int = 1++ /** Set the sensor mount rotation from a degrees value (0/90/180/270).+ * Bound to CameraInfo.sensorRotationDegrees in LiveCameraScreen. */+ fun setCameraOrientationDegrees(degrees: Int) {+ val norm = ((degrees % 360) + 360) % 360+ rotQuadrant = norm / 90+ }++ private var glThread: GlThread? = null++ init {+ holder.addCallback(this)+ }++ // Reconciliation between "CameraX wants a surface" (an open SurfaceRequest)+ // and "the GL thread has a live Surface to give it". Both sides change+ // independently: CameraX (re)issues requests as the camera opens/closes,+ // the GL surface comes and goes with surfaceCreated/surfaceDestroyed. All+ // three fields are guarded by surfaceLock and reconciled whenever either+ // side moves, so a request that arrives before the surface exists is+ // fulfilled the moment it's minted, and vice versa.+ private val surfaceLock = Object()++ /** Live Surface the GL thread minted for CameraX to write into; null+ * while the EGL context / OES texture aren't up. */+ private var cameraSurface: Surface? = null++ /** A request from CameraX we haven't handed a surface to yet (surface+ * wasn't live when it arrived). Fulfilled on the next mint. */+ private var pendingRequest: SurfaceRequest? = null++ /** The request we've already provided [cameraSurface] to. Kept so that+ * when the surface dies (surfaceDestroyed) we can `invalidate()` it —+ * otherwise CameraX reuses the now-dead surface across a stop/resume+ * and the preview goes black (issue #248). */+ private var providedRequest: SurfaceRequest? = null++ /** Executor CameraX gave us for surface callbacks; needed to fulfill a+ * pending request from the GL thread once the surface is minted. */+ @Volatile+ private var requestExecutor: Executor? = null++ /** Last camera buffer size seen from a SurfaceRequest, kept at the view+ * level so it survives GL-thread recreation. A fresh GlThread starts+ * with buffer size 0 and gates its whole render loop on it; without+ * this it would stay black until (if ever) CameraX re-issued a request+ * after the thread existed. */+ @Volatile+ private var lastCamBufW = 0++ @Volatile+ private var lastCamBufH = 0++ /** Entry point for CameraX's `Preview.SurfaceProvider`. Owns the whole+ * request lifecycle: records the buffer size, provides the live surface+ * if we have one, else parks the request until the GL thread mints one. */+ fun provideSurfaceRequest(+ request: SurfaceRequest,+ executor: Executor,+ ) {+ val resolution = request.resolution+ Log.i(TAG, "Preview SurfaceRequest resolution=${resolution.width}x${resolution.height}")+ synchronized(surfaceLock) {+ requestExecutor = executor+ lastCamBufW = resolution.width+ lastCamBufH = resolution.height+ glThread?.setCameraBufferSize(resolution.width, resolution.height)+ request.addRequestCancellationListener(executor) {+ synchronized(surfaceLock) {+ if (pendingRequest === request) pendingRequest = null+ if (providedRequest === request) providedRequest = null+ }+ }+ val surface = cameraSurface+ if (surface != null) {+ fulfill(request, surface, executor)+ } else {+ pendingRequest = request+ }+ }+ }++ /** Provide [surface] to [request]. Caller holds [surfaceLock]. */+ private fun fulfill(+ request: SurfaceRequest,+ surface: Surface,+ executor: Executor,+ ) {+ runCatching {+ request.provideSurface(surface, executor) {+ // The Surface is released by the GL thread on teardown+ // (surfaceDestroyed); CameraX's release callback is a no-op.+ }+ }.onFailure { Log.w(TAG, "provideSurface failed", it) }+ providedRequest = request+ pendingRequest = null+ }++ override fun surfaceCreated(holder: SurfaceHolder) {+ glThread =+ GlThread(holder.surface).also { thread ->+ synchronized(surfaceLock) {+ if (lastCamBufW > 0 && lastCamBufH > 0) {+ thread.setCameraBufferSize(lastCamBufW, lastCamBufH)+ }+ }+ thread.start()+ }+ }++ override fun surfaceChanged(+ holder: SurfaceHolder,+ format: Int,+ width: Int,+ height: Int,+ ) {+ glThread?.resize(width, height)+ onSizeChanged?.invoke(width, height)+ }++ override fun surfaceDestroyed(holder: SurfaceHolder) {+ synchronized(surfaceLock) {+ cameraSurface?.release()+ cameraSurface = null+ // Tell CameraX the surface it holds is dead so it re-requests one+ // when the camera reopens, instead of rebuilding the capture session+ // around the released surface (issue #248).+ runCatching { providedRequest?.invalidate() }+ .onFailure { Log.w(TAG, "surfaceRequest invalidate failed", it) }+ providedRequest = null+ pendingRequest = null+ }+ glThread?.shutdown()+ glThread = null+ }++ private fun publishCameraSurface(s: Surface) {+ synchronized(surfaceLock) {+ cameraSurface = s+ val req = pendingRequest+ val exec = requestExecutor+ if (req != null && exec != null) {+ fulfill(req, s, exec)+ }+ }+ }++ /** Owns the EGL context + OES texture + SurfaceTexture + native+ * renderer; all GL touches happen here. Woken per camera frame by+ * `onFrameAvailable`. */+ private inner class GlThread(private val surface: Surface) : Thread("live-gl") {+ private var eglDisplay: EGLDisplay = EGL14.EGL_NO_DISPLAY+ private var eglContext: EGLContext = EGL14.EGL_NO_CONTEXT+ private var eglSurface: EGLSurface = EGL14.EGL_NO_SURFACE+ private var rendererPtr: Long = 0L+ private var cameraTexId: Int = 0++ // Guards the (surfaceTexture, camBufW, camBufH) trio so the camera's+ // default buffer size is applied exactly once whichever thread wins:+ // CameraX's SurfaceProvider thread (`setCameraBufferSize`) or the GL+ // thread that mints the SurfaceTexture. If `setDefaultBufferSize` is+ // missed, the camera HAL falls back to its minimum stream size (176x144)+ // and the whole preview + OCR readback come through as garbage.+ private val stLock = Object()+ private var surfaceTexture: SurfaceTexture? = null++ @Volatile+ private var running = true++ @Volatile+ private var surfW = 0++ @Volatile+ private var surfH = 0++ @Volatile+ private var camBufW = 0++ @Volatile+ private var camBufH = 0++ private val lock = Object()+ private var frameAvailable = false++ fun resize(+ w: Int,+ h: Int,+ ) {+ surfW = w+ surfH = h+ }++ fun setCameraBufferSize(+ w: Int,+ h: Int,+ ) {+ // SurfaceTexture must be touched after creation, on any thread (it's+ // documented thread-safe for setDefaultBufferSize). If the GL thread+ // hasn't minted it yet, `run()` applies these dims when it does.+ synchronized(stLock) {+ camBufW = w+ camBufH = h+ surfaceTexture?.setDefaultBufferSize(w, h)+ }+ }++ fun shutdown() {+ synchronized(lock) {+ running = false+ lock.notifyAll()+ }+ try {+ join(500)+ } catch (_: InterruptedException) {+ }+ }++ override fun run() {+ // Render thread must win scheduling against the OCR worker (MNN+ // saturates cores during detect/recognize); without this the+ // camera producer eventually stalls waiting for our consumer.+ android.os.Process.setThreadPriority(android.os.Process.THREAD_PRIORITY_URGENT_DISPLAY)+ if (!setupEgl()) {+ Log.e(TAG, "EGL setup failed; GL present disabled")+ return+ }+ rendererPtr = LivePipelineJni.createGlRenderer()+ if (rendererPtr == 0L) {+ Log.e(TAG, "createGlRenderer failed")+ teardownEgl()+ return+ }+ cameraTexId = GlEgl.createExternalOesTexture()+ if (cameraTexId == 0) {+ Log.e(TAG, "createExternalOesTexture failed")+ LivePipelineJni.destroyGlRenderer(rendererPtr)+ rendererPtr = 0L+ teardownEgl()+ return+ }+ val st = SurfaceTexture(cameraTexId)+ synchronized(stLock) {+ surfaceTexture = st+ if (camBufW > 0 && camBufH > 0) st.setDefaultBufferSize(camBufW, camBufH)+ }+ // Frame-available wakes the GL loop. We pass `null` for the handler+ // so it fires on a binder thread; the callback just flips a flag.+ st.setOnFrameAvailableListener {+ synchronized(lock) {+ frameAvailable = true+ lock.notifyAll()+ }+ }+ publishCameraSurface(Surface(st))++ while (true) {+ synchronized(lock) {+ while (running && !frameAvailable) {+ try {+ lock.wait()+ } catch (_: InterruptedException) {+ }+ }+ if (!running) return@synchronized+ frameAvailable = false+ }+ if (!running) break++ st.updateTexImage()+ val sw = surfW+ val sh = surfH+ val pipeline = pipelinePtr+ val cbw = camBufW+ val cbh = camBufH+ if (sw <= 0 || sh <= 0 || pipeline == 0L || cbw <= 0 || cbh <= 0) continue+ val (cw, ch) = canonicalDims(sw, sh)+ val uv = computeUvMat(cbw, cbh, cw, ch, rotQuadrant)+ val dx = displayXform(cw, ch)+ val packed =+ LivePipelineJni.processFrameGl(+ pipeline,+ rendererPtr,+ cameraTexId,+ cw,+ ch,+ sw,+ sh,+ uv,+ dx,+ st.timestamp,+ )+ EGL14.eglSwapBuffers(eglDisplay, eglSurface)+ onFrameResult?.invoke(packed)+ }++ surfaceTexture?.release()+ surfaceTexture = null+ if (cameraTexId != 0) {+ GLES20.glDeleteTextures(1, intArrayOf(cameraTexId), 0)+ cameraTexId = 0+ }+ if (rendererPtr != 0L) {+ LivePipelineJni.destroyGlRenderer(rendererPtr)+ rendererPtr = 0L+ }+ teardownEgl()+ }++ private fun setupEgl(): Boolean {+ // Window surface, no alpha — the camera composite is opaque.+ val core =+ GlEgl.initContext(+ intArrayOf(+ EGL14.EGL_RENDERABLE_TYPE, GlEgl.EGL_OPENGL_ES3_BIT,+ EGL14.EGL_SURFACE_TYPE, EGL14.EGL_WINDOW_BIT,+ EGL14.EGL_RED_SIZE, 8,+ EGL14.EGL_GREEN_SIZE, 8,+ EGL14.EGL_BLUE_SIZE, 8,+ EGL14.EGL_ALPHA_SIZE, 0,+ EGL14.EGL_NONE,+ ),+ ) ?: return false+ eglDisplay = core.display+ eglContext = core.context+ eglSurface =+ EGL14.eglCreateWindowSurface(+ eglDisplay,+ core.config,+ surface,+ intArrayOf(EGL14.EGL_NONE),+ 0,+ )+ if (eglSurface == EGL14.EGL_NO_SURFACE) return false+ return EGL14.eglMakeCurrent(eglDisplay, eglSurface, eglSurface, eglContext)+ }++ private fun teardownEgl() {+ if (eglDisplay != EGL14.EGL_NO_DISPLAY) {+ if (eglSurface != EGL14.EGL_NO_SURFACE) {+ EGL14.eglMakeCurrent(+ eglDisplay,+ EGL14.EGL_NO_SURFACE,+ EGL14.EGL_NO_SURFACE,+ EGL14.EGL_NO_CONTEXT,+ )+ EGL14.eglDestroySurface(eglDisplay, eglSurface)+ }+ GlEgl.destroyContext(eglDisplay, eglContext)+ }+ eglDisplay = EGL14.EGL_NO_DISPLAY+ eglContext = EGL14.EGL_NO_CONTEXT+ eglSurface = EGL14.EGL_NO_SURFACE+ }+ }++ companion object {+ private const val TAG = "LiveGlSurfaceView"++ /** Cap canonical (tracker/composite) frame at 1000 px on the long+ * side, preserving display aspect — same rule the Linux GPU path+ * uses. The R8 readback is `cw * ch` bytes per frame, so capping+ * keeps the per-frame readback ~600–700 KB regardless of the+ * surface (or camera) resolution. */+ private const val CANONICAL_MAX_SIDE: Int = 1000++ fun canonicalDims(+ surfaceW: Int,+ surfaceH: Int,+ ): Pair<Int, Int> {+ if (surfaceW <= 0 || surfaceH <= 0) return Pair(0, 0)+ val long = max(surfaceW, surfaceH).toFloat()+ val s = (CANONICAL_MAX_SIDE.toFloat() / long).coerceAtMost(1f)+ return Pair(+ (surfaceW * s).toInt().coerceAtLeast(1),+ (surfaceH * s).toInt().coerceAtLeast(1),+ )+ }++ /** Row-major 3×3 dst-pixel (canonical, bottom-left origin) → clip-space+ * transform. Matches the Linux GPU path's `display_xform`+ * (`DISPLAY_FLIP_Y=false` branch): unit-quad vertex (0,0) lands at+ * clip (-1,-1) and (1,1) at clip (1,1). [computeUvMat] is built+ * against this same convention. The canonical frame's aspect is+ * preserved across the composite because the UV xform crops the+ * camera to the canonical aspect (aspect-fill); `bind_present_framebuffer`+ * then stretches the canonical frame uniformly to the EGL surface. */+ fun displayXform(+ canonicalW: Int,+ canonicalH: Int,+ ): FloatArray {+ val cw = canonicalW.toFloat().coerceAtLeast(1f)+ val ch = canonicalH.toFloat().coerceAtLeast(1f)+ return floatArrayOf(+ 2f / cw, 0f, -1f,+ 0f, 2f / ch, -1f,+ 0f, 0f, 1f,+ )+ }++ /** Port of `offline-translator-linux/src/live_gpu.rs::compute_uv_mat`.+ * Builds the row-major 3×3 sampler transform mapping the unit-quad+ * vertex space (0..1, 0..1) to the external-OES texture's sensor uv,+ * encoding:+ *+ * - sensor → display rotation (`rotQuadrant`: 0/90/180/270 CW),+ * from `CameraInfo.sensorRotationDegrees` once the camera binds+ * - aspect-fill cropping (canonical aspect vs camera aspect): the+ * narrower axis is shown 100%, the wider axis is cropped to+ * match canonical aspect+ * - per-axis mirror correction ([FLIP_U] / [FLIP_V]; tunable on+ * device — Android's SurfaceTexture for a back camera in+ * portrait typically wants `FLIP_U=true, FLIP_V=false`, matching+ * the Linux defaults)+ *+ * `camW/H` are the SurfaceTexture buffer dims (sensor orientation,+ * typically landscape e.g. 1920×1080). `canonicalW/H` is the output+ * aspect (matches the display aspect, downscaled). */+ fun computeUvMat(+ camW: Int,+ camH: Int,+ canonicalW: Int,+ canonicalH: Int,+ rotQuadrant: Int,+ ): FloatArray {+ val q = ((rotQuadrant % 4) + 4) % 4+ val odd = q == 1 || q == 3+ val cw = camW.toFloat().coerceAtLeast(1f)+ val ch = camH.toFloat().coerceAtLeast(1f)+ val fw = canonicalW.toFloat().coerceAtLeast(1f)+ val fh = canonicalH.toFloat().coerceAtLeast(1f)+ val displayedAspect = if (odd) ch / cw else cw / ch+ val outAspect = fw / fh+ val visW: Float+ val visH: Float+ if (outAspect <= displayedAspect) {+ visW = outAspect / displayedAspect+ visH = 1f+ } else {+ visW = 1f+ visH = displayedAspect / outAspect+ }+ val fracU = if (odd) visH else visW+ val fracV = if (odd) visW else visH+ val r00: Float+ val r01: Float+ val r10: Float+ val r11: Float+ when (q) {+ 0 -> {+ r00 = 1f+ r01 = 0f+ r10 = 0f+ r11 = 1f+ }+ 1 -> {+ r00 = 0f+ r01 = 1f+ r10 = -1f+ r11 = 0f+ }+ 2 -> {+ r00 = -1f+ r01 = 0f+ r10 = 0f+ r11 = -1f+ }+ else -> {+ r00 = 0f+ r01 = -1f+ r10 = 1f+ r11 = 0f+ }+ }+ var l00 = fracU * r00+ var l01 = fracU * r01+ var l10 = fracV * r10+ var l11 = fracV * r11+ var t0 = 0.5f - 0.5f * (l00 + l01)+ var t1 = 0.5f - 0.5f * (l10 + l11)+ if (FLIP_U) {+ l00 = -l00+ l01 = -l01+ t0 = 1f - t0+ }+ if (FLIP_V) {+ l10 = -l10+ l11 = -l11+ t1 = 1f - t1+ }+ return floatArrayOf(+ l00, l01, t0,+ l10, l11, t1,+ 0f, 0f, 1f,+ )+ }++ private const val FLIP_U: Boolean = true+ private const val FLIP_V: Boolean = false+ }+}diff --git a/OCR-translation/src/main/java/dev/davidv/translator/ui/components/OutputTapMode.kt b/OCR-translation/src/main/java/dev/davidv/translator/ui/components/OutputTapMode.ktnew file mode 100644index 0000000..0db58dd--- /dev/null+++ b/OCR-translation/src/main/java/dev/davidv/translator/ui/components/OutputTapMode.kt@@ -0,0 +1,23 @@+/*+ * Copyright (C) 2024 David V+ *+ * This program 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.+ *+ * This program 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 <https://www.gnu.org/licenses/>.+ */++package dev.davidv.translator.ui.components++// Which single-tap action the output field is in. Mutually exclusive: a tap+// either opens a word's alternatives, looks it up, or (None) does nothing and+// text selection works normally.+enum class OutputTapMode { None, Alternatives, Dictionary }diff --git a/OCR-translation/src/main/java/dev/davidv/translator/ui/components/OverlayGeometry.kt b/OCR-translation/src/main/java/dev/davidv/translator/ui/components/OverlayGeometry.ktnew file mode 100644index 0000000..e595dd7--- /dev/null+++ b/OCR-translation/src/main/java/dev/davidv/translator/ui/components/OverlayGeometry.kt@@ -0,0 +1,68 @@+/*+ * Copyright (C) 2024 David V+ *+ * This program 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.+ *+ * This program 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 <https://www.gnu.org/licenses/>.+ */++package dev.davidv.translator.ui.components++import androidx.compose.ui.geometry.CornerRadius+import androidx.compose.ui.geometry.Offset+import androidx.compose.ui.geometry.Size+import androidx.compose.ui.graphics.Color+import androidx.compose.ui.graphics.drawscope.DrawScope+import androidx.compose.ui.graphics.drawscope.rotate+import uniffi.translator_core.OrientedRect+import kotlin.math.min++/** Image->view transform for a bitmap drawn with ContentScale.Fit inside `viewSize`. */+internal data class FitTransform(val scale: Float, val offsetX: Float, val offsetY: Float) {+ fun mapX(x: Float) = offsetX + x * scale++ fun mapY(y: Float) = offsetY + y * scale++ fun unmapX(x: Float) = (x - offsetX) / scale++ fun unmapY(y: Float) = (y - offsetY) / scale+}++internal fun fitTransform(+ viewW: Float,+ viewH: Float,+ imageW: Int,+ imageH: Int,+): FitTransform {+ val scale = min(viewW / imageW, viewH / imageH)+ return FitTransform(scale, (viewW - imageW * scale) / 2f, (viewH - imageH * scale) / 2f)+}++/** Draw an oriented rect as a rounded pill, mapped through `t` and rotated to its angle. */+internal fun DrawScope.drawOrientedPill(+ rect: OrientedRect,+ t: FitTransform,+ color: Color,+) {+ val cx = t.mapX(rect.cx)+ val cy = t.mapY(rect.cy)+ val w = rect.width * t.scale+ val h = rect.height * t.scale+ rotate(degrees = Math.toDegrees(rect.angleRadians.toDouble()).toFloat(), pivot = Offset(cx, cy)) {+ drawRoundRect(+ color = color,+ topLeft = Offset(cx - w / 2f, cy - h / 2f),+ size = Size(w, h),+ cornerRadius = CornerRadius(h / 2f, h / 2f),+ )+ }+}diff --git a/OCR-translation/src/main/java/dev/davidv/translator/ui/components/SamplePlayer.kt b/OCR-translation/src/main/java/dev/davidv/translator/ui/components/SamplePlayer.ktnew file mode 100644index 0000000..0406325--- /dev/null+++ b/OCR-translation/src/main/java/dev/davidv/translator/ui/components/SamplePlayer.kt@@ -0,0 +1,160 @@+/*+ * Copyright (C) 2024 David V+ *+ * This program 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.+ *+ * This program 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 <https://www.gnu.org/licenses/>.+ */++package dev.davidv.translator.ui.components++import android.media.MediaPlayer+import androidx.compose.runtime.getValue+import androidx.compose.runtime.mutableStateOf+import androidx.compose.runtime.setValue+import kotlinx.coroutines.CoroutineScope+import kotlinx.coroutines.Dispatchers+import kotlinx.coroutines.Job+import kotlinx.coroutines.launch+import kotlinx.coroutines.withContext+import java.io.File+import java.net.HttpURLConnection+import java.net.URL++sealed interface SamplePlaybackState {+ data object Idle : SamplePlaybackState++ data class Loading(+ val packId: String,+ ) : SamplePlaybackState++ data class Playing(+ val packId: String,+ ) : SamplePlaybackState+}++class SamplePlayer(+ private val cacheRoot: File,+ private val scope: CoroutineScope,+) {+ var state by mutableStateOf<SamplePlaybackState>(SamplePlaybackState.Idle)+ private set++ private var player: MediaPlayer? = null+ private var fetchJob: Job? = null++ fun isCached(packId: String): Boolean = cacheFile(packId).exists()++ fun toggle(+ packId: String,+ sampleUrl: String,+ ) {+ val current = state+ when {+ current is SamplePlaybackState.Playing && current.packId == packId -> stopAndReset()+ current is SamplePlaybackState.Loading && current.packId == packId -> stopAndReset()+ else -> play(packId, sampleUrl)+ }+ }++ fun release() = stopAndReset()++ private fun play(+ packId: String,+ sampleUrl: String,+ ) {+ stopAndReset()+ state = SamplePlaybackState.Loading(packId)+ fetchJob =+ scope.launch {+ val file = ensureCached(packId, sampleUrl)+ if (file == null) {+ state = SamplePlaybackState.Idle+ return@launch+ }+ if (state !is SamplePlaybackState.Loading || (state as SamplePlaybackState.Loading).packId != packId) {+ return@launch+ }+ startPlayback(packId, file)+ }+ }++ private fun stopAndReset() {+ fetchJob?.cancel()+ fetchJob = null+ player?.let { mp ->+ runCatching { if (mp.isPlaying) mp.stop() }+ mp.release()+ }+ player = null+ state = SamplePlaybackState.Idle+ }++ private suspend fun ensureCached(+ packId: String,+ sampleUrl: String,+ ): File? =+ withContext(Dispatchers.IO) {+ val target = cacheFile(packId)+ if (target.exists() && target.length() > 0) return@withContext target+ target.parentFile?.mkdirs()+ val tmp = File(target.parentFile, "${target.name}.tmp")+ runCatching {+ val connection =+ (URL(sampleUrl).openConnection() as HttpURLConnection).apply {+ connectTimeout = 10_000+ readTimeout = 15_000+ }+ connection.inputStream.use { input ->+ tmp.outputStream().use { output -> input.copyTo(output) }+ }+ connection.disconnect()+ if (!tmp.renameTo(target)) {+ tmp.delete()+ null+ } else {+ target+ }+ }.onFailure { tmp.delete() }.getOrNull()+ }++ private fun startPlayback(+ packId: String,+ file: File,+ ) {+ val mp =+ MediaPlayer().apply {+ setDataSource(file.absolutePath)+ setOnPreparedListener { start() }+ setOnCompletionListener {+ if (([email protected] as? SamplePlaybackState.Playing)?.packId == packId) {+ [email protected] = SamplePlaybackState.Idle+ }+ it.release()+ if (player === it) player = null+ }+ setOnErrorListener { mp, _, _ ->+ if (([email protected] as? SamplePlaybackState.Playing)?.packId == packId) {+ [email protected] = SamplePlaybackState.Idle+ }+ mp.release()+ if (player === mp) player = null+ true+ }+ prepareAsync()+ }+ player = mp+ state = SamplePlaybackState.Playing(packId)+ }++ private fun cacheFile(packId: String): File = File(cacheRoot, "$packId.opus")+}diff --git a/OCR-translation/src/main/java/dev/davidv/translator/ui/components/ScanAnimationOverlay.kt b/OCR-translation/src/main/java/dev/davidv/translator/ui/components/ScanAnimationOverlay.ktnew file mode 100644index 0000000..e323b9e--- /dev/null+++ b/OCR-translation/src/main/java/dev/davidv/translator/ui/components/ScanAnimationOverlay.kt@@ -0,0 +1,95 @@+/*+ * Copyright (C) 2024 David V+ *+ * This program 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.+ *+ * This program 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 <https://www.gnu.org/licenses/>.+ */++package dev.davidv.translator.ui.components++import androidx.compose.animation.core.Animatable+import androidx.compose.animation.core.FastOutSlowInEasing+import androidx.compose.animation.core.LinearEasing+import androidx.compose.animation.core.RepeatMode+import androidx.compose.animation.core.infiniteRepeatable+import androidx.compose.animation.core.tween+import androidx.compose.foundation.Canvas+import androidx.compose.runtime.Composable+import androidx.compose.runtime.LaunchedEffect+import androidx.compose.runtime.getValue+import androidx.compose.runtime.mutableStateOf+import androidx.compose.runtime.remember+import androidx.compose.runtime.setValue+import androidx.compose.ui.Modifier+import androidx.compose.ui.graphics.Color+import uniffi.translator_core.OrientedRect+import kotlin.math.abs++/**+ * Detected text regions of one image (oriented rects in image-pixel space, `imageWidth` x+ * `imageHeight`), surfaced by the detect pass before recognition runs so the UI can show progress.+ */+data class DetectedRegions(+ val imageWidth: Int,+ val imageHeight: Int,+ val boxes: List<OrientedRect>,+)++private const val BASE_ALPHA = 0.14f++/**+ * Progress indicator for the detect→recognize→translate pass: transparent-white pills over each+ * detected region. A wave sweeps top-to-bottom *once* (brightening the pills it passes), then the+ * pills settle into a gentle synchronized pulse — a determinate-looking pass into an+ * indeterminate "work still happening, unknown how long" state, instead of a confusing re-loop.+ */+@Composable+fun ScanAnimationOverlay(+ regions: DetectedRegions,+ modifier: Modifier = Modifier,+) {+ val sweep = remember { Animatable(0f) }+ // `breathe` is driven from 0 only after the sweep finishes, so the pulse begins at exactly the+ // sweep's resting opacity (`BASE_ALPHA`) and rises from there — no jump into a random phase.+ val breathe = remember { Animatable(0f) }+ var sweepDone by remember { mutableStateOf(false) }+ LaunchedEffect(Unit) {+ sweep.animateTo(1f, tween(durationMillis = 1300, easing = LinearEasing))+ sweepDone = true+ breathe.animateTo(+ 1f,+ infiniteRepeatable(+ animation = tween(durationMillis = 1100, easing = FastOutSlowInEasing),+ repeatMode = RepeatMode.Reverse,+ ),+ )+ }++ Canvas(modifier = modifier) {+ if (regions.boxes.isEmpty()) return@Canvas+ val t = fitTransform(size.width, size.height, regions.imageWidth, regions.imageHeight)+ if (!sweepDone) {+ val waveY = sweep.value * size.height+ val halfWidth = size.height * 0.06f+ for (box in regions.boxes) {+ val falloff = (1f - abs(t.mapY(box.cy) - waveY) / halfWidth).coerceAtLeast(0f)+ drawOrientedPill(box, t, Color(1f, 1f, 1f, BASE_ALPHA + 0.30f * falloff))+ }+ } else {+ val alpha = BASE_ALPHA + 0.12f * breathe.value+ for (box in regions.boxes) {+ drawOrientedPill(box, t, Color(1f, 1f, 1f, alpha))+ }+ }+ }+}diff --git a/OCR-translation/src/main/java/dev/davidv/translator/ui/components/SelectionSurface.kt b/OCR-translation/src/main/java/dev/davidv/translator/ui/components/SelectionSurface.ktnew file mode 100644index 0000000..f890f39--- /dev/null+++ b/OCR-translation/src/main/java/dev/davidv/translator/ui/components/SelectionSurface.kt@@ -0,0 +1,93 @@+/*+ * Copyright (C) 2024 David V+ *+ * This program 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.+ *+ * This program 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 <https://www.gnu.org/licenses/>.+ */++package dev.davidv.translator.ui.components++import android.graphics.Bitmap+import androidx.compose.foundation.layout.fillMaxWidth+import androidx.compose.runtime.Composable+import androidx.compose.runtime.mutableStateOf+import androidx.compose.ui.Modifier+import androidx.compose.ui.platform.LocalConfiguration+import androidx.compose.ui.unit.dp++/**+ * State for a frozen-screenshot selection surface, shared by the assistant session and the+ * accessibility overlay's select-text mode: the screenshot with the scan animation while OCR runs,+ * then the translated image with the interactive word-selection overlay, and the flip to the+ * original. Bitmap lifetimes stay with the owner; [clear] drops references without recycling.+ */+class SelectionSurfaceState {+ val display = mutableStateOf<Bitmap?>(null)+ val original = mutableStateOf<Bitmap?>(null)+ val selection = mutableStateOf<ImageWordSelection?>(null)+ val processing = mutableStateOf(false)+ val regions = mutableStateOf<DetectedRegions?>(null)+ val showOriginal = mutableStateOf(false)++ fun showProcessing(source: Bitmap) {+ original.value = source+ display.value = source+ selection.value = null+ regions.value = null+ showOriginal.value = false+ processing.value = true+ }++ fun showResult(+ translated: Bitmap,+ source: Bitmap,+ words: ImageWordSelection,+ ) {+ processing.value = false+ regions.value = null+ original.value = source+ selection.value = words+ display.value = translated+ }++ fun toggleShowOriginal(): Boolean {+ val show = !showOriginal.value+ showOriginal.value = show+ return show+ }++ fun clear() {+ display.value = null+ original.value = null+ selection.value = null+ regions.value = null+ processing.value = false+ showOriginal.value = false+ }+}++@Composable+fun SelectionSurface(state: SelectionSurfaceState) {+ val display = state.display.value ?: return+ val configuration = LocalConfiguration.current+ ImageDisplaySection(+ displayImage = display,+ originalImage = state.original.value,+ showOriginal = state.showOriginal.value,+ isProcessing = state.processing.value,+ detectedRegions = state.regions.value,+ wordSelection = state.selection.value,+ maxHeight = configuration.screenHeightDp.dp,+ modifier = Modifier.fillMaxWidth(),+ )+}diff --git a/OCR-translation/src/main/java/dev/davidv/translator/ui/components/SpeechSpeedControl.kt b/OCR-translation/src/main/java/dev/davidv/translator/ui/components/SpeechSpeedControl.ktnew file mode 100644index 0000000..9dc3660--- /dev/null+++ b/OCR-translation/src/main/java/dev/davidv/translator/ui/components/SpeechSpeedControl.kt@@ -0,0 +1,75 @@+package dev.davidv.translator.ui.components++import androidx.compose.foundation.background+import androidx.compose.foundation.clickable+import androidx.compose.foundation.layout.Box+import androidx.compose.foundation.layout.Row+import androidx.compose.foundation.layout.fillMaxWidth+import androidx.compose.foundation.layout.padding+import androidx.compose.foundation.shape.RoundedCornerShape+import androidx.compose.material3.MaterialTheme+import androidx.compose.material3.Text+import androidx.compose.runtime.Composable+import androidx.compose.ui.Alignment+import androidx.compose.ui.Modifier+import androidx.compose.ui.draw.clip+import androidx.compose.ui.text.style.TextAlign+import androidx.compose.ui.unit.dp+import java.util.Locale++private const val MIN_SPEECH_SPEED = 0.5f+private const val MAX_SPEECH_SPEED = 2.0f+private const val SPEECH_SPEED_STEP = 0.1f++@Composable+fun SpeechSpeedControl(+ speed: Float,+ onSpeedChange: (Float) -> Unit,+ modifier: Modifier = Modifier,+) {+ Row(+ modifier = modifier.fillMaxWidth(),+ verticalAlignment = Alignment.CenterVertically,+ ) {+ SpeechSpeedChip(+ label = "-",+ onClick = {+ onSpeedChange((speed - SPEECH_SPEED_STEP).coerceAtLeast(MIN_SPEECH_SPEED))+ },+ )+ Text(+ text = String.format(Locale.US, "%.2fx", speed),+ modifier = Modifier.weight(1f),+ style = MaterialTheme.typography.bodyMedium,+ textAlign = TextAlign.Center,+ )+ SpeechSpeedChip(+ label = "+",+ onClick = {+ onSpeedChange((speed + SPEECH_SPEED_STEP).coerceAtMost(MAX_SPEECH_SPEED))+ },+ )+ }+}++@Composable+private fun SpeechSpeedChip(+ label: String,+ onClick: () -> Unit,+) {+ Box(+ modifier =+ Modifier+ .clip(RoundedCornerShape(8.dp))+ .background(MaterialTheme.colorScheme.surfaceVariant)+ .clickable(onClick = onClick)+ .padding(horizontal = 12.dp, vertical = 6.dp),+ contentAlignment = Alignment.Center,+ ) {+ Text(+ text = label,+ style = MaterialTheme.typography.labelLarge,+ color = MaterialTheme.colorScheme.onSurfaceVariant,+ )+ }+}diff --git a/OCR-translation/src/main/java/dev/davidv/translator/ui/components/SplitHandle.kt b/OCR-translation/src/main/java/dev/davidv/translator/ui/components/SplitHandle.ktnew file mode 100644index 0000000..80c343f--- /dev/null+++ b/OCR-translation/src/main/java/dev/davidv/translator/ui/components/SplitHandle.kt@@ -0,0 +1,72 @@+/*+ * Copyright (C) 2024 David V+ *+ * This program 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.+ *+ * This program 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 <https://www.gnu.org/licenses/>.+ */++package dev.davidv.translator.ui.components++import androidx.compose.foundation.background+import androidx.compose.foundation.gestures.Orientation+import androidx.compose.foundation.gestures.draggable+import androidx.compose.foundation.gestures.rememberDraggableState+import androidx.compose.foundation.layout.Box+import androidx.compose.foundation.layout.fillMaxWidth+import androidx.compose.foundation.layout.height+import androidx.compose.foundation.layout.width+import androidx.compose.foundation.shape.RoundedCornerShape+import androidx.compose.material3.MaterialTheme+import androidx.compose.runtime.Composable+import androidx.compose.ui.Alignment+import androidx.compose.ui.Modifier+import androidx.compose.ui.draw.clip+import androidx.compose.ui.res.stringResource+import androidx.compose.ui.semantics.contentDescription+import androidx.compose.ui.semantics.semantics+import androidx.compose.ui.unit.dp+import dev.davidv.translator.R++/**+ * Drag band between the input and output cards. Compose clips hit-testing to a+ * node's reported bounds, so the band cannot overhang the cards the way a View+ * TouchDelegate would — the touch target is exactly this height.+ */+@Composable+fun SplitHandle(+ onDrag: (Float) -> Unit,+ modifier: Modifier = Modifier,+) {+ val description = stringResource(R.string.a11y_resize_split)+ Box(+ modifier =+ modifier+ .fillMaxWidth()+ .height(24.dp)+ .semantics { contentDescription = description }+ .draggable(+ orientation = Orientation.Vertical,+ state = rememberDraggableState { onDrag(it) },+ ),+ contentAlignment = Alignment.Center,+ ) {+ Box(+ modifier =+ Modifier+ .width(64.dp)+ .height(4.dp)+ .clip(RoundedCornerShape(2.dp))+ .background(MaterialTheme.colorScheme.outlineVariant),+ )+ }+}diff --git a/OCR-translation/src/main/java/dev/davidv/translator/ui/components/StyledTextField.kt b/OCR-translation/src/main/java/dev/davidv/translator/ui/components/StyledTextField.ktnew file mode 100644index 0000000..93f6154--- /dev/null+++ b/OCR-translation/src/main/java/dev/davidv/translator/ui/components/StyledTextField.kt@@ -0,0 +1,233 @@+/*+ * Copyright (C) 2024 David V+ *+ * This program 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.+ *+ * This program 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 <https://www.gnu.org/licenses/>.+ */++package dev.davidv.translator.ui.components++import android.content.Context+import android.text.Editable+import android.text.InputType+import android.text.TextWatcher+import android.view.Gravity+import android.view.MotionEvent+import android.view.ViewGroup+import android.view.inputmethod.InputMethodManager+import android.widget.EditText+import androidx.compose.foundation.ExperimentalFoundationApi+import androidx.compose.foundation.layout.Box+import androidx.compose.foundation.layout.fillMaxSize+import androidx.compose.foundation.relocation.BringIntoViewRequester+import androidx.compose.foundation.relocation.bringIntoViewRequester+import androidx.compose.material3.MaterialTheme+import androidx.compose.runtime.Composable+import androidx.compose.runtime.DisposableEffect+import androidx.compose.runtime.getValue+import androidx.compose.runtime.remember+import androidx.compose.runtime.rememberCoroutineScope+import androidx.compose.runtime.rememberUpdatedState+import androidx.compose.ui.Modifier+import androidx.compose.ui.graphics.toArgb+import androidx.compose.ui.graphics.toComposeRect+import androidx.compose.ui.platform.LocalContext+import androidx.compose.ui.platform.LocalLifecycleOwner+import androidx.compose.ui.text.TextStyle+import androidx.compose.ui.tooling.preview.Preview+import androidx.compose.ui.viewinterop.AndroidView+import androidx.lifecycle.Lifecycle+import androidx.lifecycle.LifecycleEventObserver+import dev.davidv.translator.R+import dev.davidv.translator.ui.theme.TranslatorTheme+import kotlinx.coroutines.launch++class StyledTextFieldFocusController {+ internal var editText: EditText? = null++ fun focus() {+ val target = editText ?: return+ target.requestFocus()+ val end = target.text?.length ?: 0+ target.setSelection(end)+ val imm = target.context.getSystemService(Context.INPUT_METHOD_SERVICE) as? InputMethodManager+ imm?.showSoftInput(target, 0)+ }+}++@OptIn(ExperimentalFoundationApi::class)+@Composable+fun StyledTextField(+ text: String,+ onValueChange: (String) -> Unit,+ onDictionaryLookup: (String) -> Unit,+ modifier: Modifier = Modifier,+ placeholder: String? = null,+ textStyle: TextStyle = MaterialTheme.typography.bodyLarge,+ focusController: StyledTextFieldFocusController? = null,+ wordTapMode: Boolean = false,+ onWordTap: ((Int) -> Unit)? = null,+) {+ val context = LocalContext.current+ val lifecycleOwner = LocalLifecycleOwner.current+ val currentText by rememberUpdatedState(text)+ val currentOnValueChange by rememberUpdatedState(onValueChange)+ val actionModeCallback =+ remember(onDictionaryLookup) {+ DictionaryActionModeCallback(context, onDictionaryLookup)+ }+ val textColor = MaterialTheme.colorScheme.onSurface.toArgb()+ val hintColor = MaterialTheme.colorScheme.onSurfaceVariant.toArgb()+ val fontSize = textStyle.fontSize.value+ val bringIntoViewRequester = remember { BringIntoViewRequester() }+ val scope = rememberCoroutineScope()++ Box(modifier = modifier.bringIntoViewRequester(bringIntoViewRequester)) {+ AndroidView(+ factory = { context ->+ TapWordEditText(context).apply {+ this.contentDescription = context.getString(R.string.a11y_primary_input)+ this.layoutParams =+ ViewGroup.LayoutParams(+ ViewGroup.LayoutParams.MATCH_PARENT,+ ViewGroup.LayoutParams.WRAP_CONTENT,+ )+ this.gravity = Gravity.START+ this.setText(text)+ this.textSize = fontSize+ this.setTextColor(textColor)+ this.setHintTextColor(hintColor)+ this.hint = placeholder+ this.isEnabled = true+ this.isFocusable = true+ this.isFocusableInTouchMode = true+ this.setTextIsSelectable(true)+ this.customSelectionActionModeCallback = actionModeCallback+ this.customInsertionActionModeCallback = actionModeCallback+ this.wordTapListener = onWordTap+ this.wordTapMode = wordTapMode+ this.cursorRectListener = { rect ->+ scope.launch { bringIntoViewRequester.bringIntoView(rect.toComposeRect()) }+ }+ this.inputType = InputType.TYPE_CLASS_TEXT or InputType.TYPE_TEXT_FLAG_MULTI_LINE+ this.background = null+ this.setPadding(0, 0, 0, 0)+ this.setOnTouchListener { v, event ->+ if (v.canScrollVertically(1) || v.canScrollVertically(-1)) {+ v.parent?.requestDisallowInterceptTouchEvent(true)+ if (event.actionMasked == MotionEvent.ACTION_UP ||+ event.actionMasked == MotionEvent.ACTION_CANCEL+ ) {+ v.parent?.requestDisallowInterceptTouchEvent(false)+ }+ }+ false+ }+ focusController?.editText = this+ actionModeCallback.setTextView(this)+ this.addTextChangedListener(+ object : TextWatcher {+ override fun beforeTextChanged(+ s: CharSequence?,+ start: Int,+ count: Int,+ after: Int,+ ) {}++ override fun onTextChanged(+ s: CharSequence?,+ start: Int,+ before: Int,+ count: Int,+ ) {}++ override fun afterTextChanged(s: Editable?) {+ val newText = s?.toString() ?: ""+ if (newText != currentText) {+ currentOnValueChange(newText)+ }+ }+ },+ )+ }+ },+ update = { editText ->+ if (editText.text.toString() != text) {+ editText.setText(text)+ }+ editText.textSize = fontSize+ editText.setTextColor(textColor)+ editText.setHintTextColor(hintColor)+ editText.hint = placeholder+ editText.isEnabled = true+ editText.isFocusable = true+ editText.customSelectionActionModeCallback = actionModeCallback+ editText.wordTapListener = onWordTap+ // The setter owns isFocusableInTouchMode / cursor visibility, so leave+ // those to it rather than forcing them back on every recomposition.+ editText.wordTapMode = wordTapMode+ focusController?.editText = editText+ actionModeCallback.setTextView(editText)+ },+ )++ DisposableEffect(lifecycleOwner) {+ val observer =+ LifecycleEventObserver { _, event ->+ when (event) {+ Lifecycle.Event.ON_PAUSE -> {+ val currentFocus = (context as? android.app.Activity)?.currentFocus+ currentFocus?.clearFocus()+ }+ else -> {}+ }+ }+ lifecycleOwner.lifecycle.addObserver(observer)+ onDispose {+ lifecycleOwner.lifecycle.removeObserver(observer)+ }+ }+ }+}++@Preview(showBackground = true)+@Composable+fun StyledTextFieldWeightedPreview() {+ TranslatorTheme {+ Box(modifier = Modifier.fillMaxSize()) {+ StyledTextField(+ text = "very long text. very long text. very long text. very long text. very long text. very long text. very long text. very long text. very long text. very long text. very long text. very long text. very long text. very long text. very long text. very long text. very long text. very long text. very long text. very long text. very long text. very long text. very long text. very long text. very long text. very long text. very long text. very long text. very long text. very long text. very long text. very long text. very long text. very long text. very long text. very long text. very long text. very long text. very long text. very long text. very long text. very long text. very long text. very long text. very long text. very long text. very long text. very long text. very long text. very long text. very long text. very long text. very long text. very long text. very long text. very long text. very long text. very long text. very long text. very long text. very long text. very long text. very long text. very long text. very long text. very long text.",+ onValueChange = {},+ onDictionaryLookup = {},+ placeholder = "Enter text",+ modifier = Modifier.fillMaxSize(),+ )+ }+ }+}++@Preview(showBackground = true)+@Composable+fun ShortText() {+ TranslatorTheme {+ Box {+ StyledTextField(+ text = "very short text.",+ onValueChange = {},+ onDictionaryLookup = {},+ placeholder = "Enter text",+ modifier = Modifier.fillMaxSize(),+ )+ }+ }+}diff --git a/OCR-translation/src/main/java/dev/davidv/translator/ui/components/TapWordEditText.kt b/OCR-translation/src/main/java/dev/davidv/translator/ui/components/TapWordEditText.ktnew file mode 100644index 0000000..f1b69ea--- /dev/null+++ b/OCR-translation/src/main/java/dev/davidv/translator/ui/components/TapWordEditText.kt@@ -0,0 +1,127 @@+/*+ * Copyright (C) 2024 David V+ *+ * This program 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.+ *+ * This program 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 <https://www.gnu.org/licenses/>.+ */++package dev.davidv.translator.ui.components++import android.content.Context+import android.graphics.Rect+import android.util.AttributeSet+import android.view.GestureDetector+import android.view.MotionEvent+import android.view.inputmethod.InputMethodManager+import android.widget.EditText++/**+ * An [EditText] that, in [wordTapMode], stops being editable — keyboard hidden,+ * cursor gone, taps no longer move the caret — and instead reports the char+ * offset of a tapped word via [wordTapListener], for tap-to-look-up. Toggling the+ * mode off restores normal editing.+ */+class TapWordEditText+ @JvmOverloads+ constructor(+ context: Context,+ attrs: AttributeSet? = null,+ ) : EditText(context, attrs) {+ var wordTapListener: ((Int) -> Unit)? = null++ /**+ * Reports the caret line's bounds, in this view's own coordinates, whenever the+ * caret moves. The view is measured [ViewGroup.LayoutParams.WRAP_CONTENT] inside a+ * Compose scroll container, so it never scrolls itself and its native+ * bringPointIntoView never fires — the container has to do the scrolling instead.+ */+ var cursorRectListener: ((Rect) -> Unit)? = null++ private var cursorRectPending = false++ var wordTapMode: Boolean = false+ set(value) {+ if (field == value) return+ field = value+ isFocusableInTouchMode = !value+ isCursorVisible = !value+ if (value) {+ clearFocus()+ val imm = context.getSystemService(Context.INPUT_METHOD_SERVICE) as? InputMethodManager+ imm?.hideSoftInputFromWindow(windowToken, 0)+ }+ }++ private val tapDetector =+ GestureDetector(+ context,+ object : GestureDetector.SimpleOnGestureListener() {+ override fun onSingleTapUp(e: MotionEvent): Boolean {+ val l = layout ?: return false+ val x = e.x - totalPaddingLeft + scrollX+ val y = e.y - totalPaddingTop + scrollY+ val line = l.getLineForVertical(y.toInt())+ wordTapListener?.invoke(l.getOffsetForHorizontal(line, x))+ performClick()+ return true+ }+ },+ )++ override fun onSelectionChanged(+ selStart: Int,+ selEnd: Int,+ ) {+ super.onSelectionChanged(selStart, selEnd)+ cursorRectPending = true+ if (!isLayoutRequested) {+ emitCursorRect()+ }+ }++ override fun onLayout(+ changed: Boolean,+ left: Int,+ top: Int,+ right: Int,+ bottom: Int,+ ) {+ super.onLayout(changed, left, top, right, bottom)+ if (cursorRectPending) {+ emitCursorRect()+ }+ }++ private fun emitCursorRect() {+ val listener = cursorRectListener ?: return+ val l = layout ?: return+ cursorRectPending = false+ val line = l.getLineForOffset(selectionEnd)+ listener(+ Rect(+ 0,+ totalPaddingTop + l.getLineTop(line),+ width,+ totalPaddingTop + l.getLineBottom(line),+ ),+ )+ }++ override fun onTouchEvent(event: MotionEvent): Boolean {+ if (wordTapMode) {+ tapDetector.onTouchEvent(event)+ return true+ }+ return super.onTouchEvent(event)+ }+ }diff --git a/OCR-translation/src/main/java/dev/davidv/translator/ui/components/TargetTabsHeader.kt b/OCR-translation/src/main/java/dev/davidv/translator/ui/components/TargetTabsHeader.ktnew file mode 100644index 0000000..aa56a82--- /dev/null+++ b/OCR-translation/src/main/java/dev/davidv/translator/ui/components/TargetTabsHeader.kt@@ -0,0 +1,127 @@+/*+ * Copyright (C) 2024 David V+ *+ * This program 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.+ *+ * This program 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 <https://www.gnu.org/licenses/>.+ */++package dev.davidv.translator.ui.components++import androidx.compose.foundation.clickable+import androidx.compose.foundation.horizontalScroll+import androidx.compose.foundation.layout.Arrangement+import androidx.compose.foundation.layout.Row+import androidx.compose.foundation.layout.size+import androidx.compose.foundation.rememberScrollState+import androidx.compose.material3.DropdownMenu+import androidx.compose.material3.DropdownMenuItem+import androidx.compose.material3.Icon+import androidx.compose.material3.MaterialTheme+import androidx.compose.material3.Text+import androidx.compose.runtime.Composable+import androidx.compose.runtime.getValue+import androidx.compose.runtime.mutableStateOf+import androidx.compose.runtime.remember+import androidx.compose.runtime.setValue+import androidx.compose.ui.Alignment+import androidx.compose.ui.Modifier+import androidx.compose.ui.res.painterResource+import androidx.compose.ui.res.stringResource+import androidx.compose.ui.text.font.FontWeight+import androidx.compose.ui.unit.dp+import androidx.compose.ui.unit.sp+import dev.davidv.translator.Language+import dev.davidv.translator.R+import dev.davidv.translator.localizedName++// Output-card header for multi-target mode: a scrollable strip of target tabs.+// The active tab renders like the plain single-target label; the others are+// lighter and tappable to switch. Tapping a tab only switches; "+" adds a new+// target, and the active tab gets an "×" to remove it (never the last one).+@Composable+fun TargetTabsHeader(+ tabs: List<Language>,+ active: Language,+ candidates: List<Language>,+ showAdd: Boolean,+ onSwitch: (Language) -> Unit,+ onAdd: (Language) -> Unit,+ onRemove: (Language) -> Unit,+) {+ var addExpanded by remember { mutableStateOf(false) }++ Row(+ modifier = Modifier.horizontalScroll(rememberScrollState()),+ horizontalArrangement = Arrangement.spacedBy(10.dp),+ verticalAlignment = Alignment.CenterVertically,+ ) {+ tabs.forEach { lang ->+ val selected = lang == active+ Text(+ text = lang.localizedName().uppercase(),+ style = MaterialTheme.typography.labelMedium,+ fontWeight = if (selected) FontWeight.SemiBold else FontWeight.Normal,+ letterSpacing = 0.8.sp,+ color =+ if (selected) {+ MaterialTheme.colorScheme.onSurfaceVariant+ } else {+ MaterialTheme.colorScheme.onSurfaceVariant.copy(alpha = 0.55f)+ },+ modifier = Modifier.alignByBaseline().clickable(enabled = !selected) { onSwitch(lang) },+ )++ if (selected && tabs.size > 1) {+ Icon(+ painter = painterResource(id = R.drawable.cancel),+ contentDescription = stringResource(R.string.a11y_remove_target_language),+ tint = MaterialTheme.colorScheme.onSurfaceVariant.copy(alpha = 0.7f),+ modifier =+ Modifier+ // Align the glyph's visible bottom (cancel spans to 704/960) to the text baseline.+ .alignBy { (it.measuredHeight * 704 / 960f).toInt() }+ .size(16.dp)+ .clickable { onRemove(lang) },+ )+ }+ }++ if (showAdd) {+ Icon(+ painter = painterResource(id = R.drawable.add_material),+ contentDescription = stringResource(R.string.a11y_add_target_language),+ tint = MaterialTheme.colorScheme.onSurfaceVariant,+ modifier =+ Modifier+ // Align the glyph's visible bottom (the plus spans to 760/960) to the text baseline.+ .alignBy { (it.measuredHeight * 760 / 960f).toInt() }+ .size(16.dp)+ .clickable(enabled = candidates.isNotEmpty()) { addExpanded = true },+ )+ DropdownMenu(+ expanded = addExpanded,+ onDismissRequest = { addExpanded = false },+ ) {+ candidates.forEach { lang ->+ DropdownMenuItem(+ text = { Text(lang.localizedName()) },+ onClick = {+ onAdd(lang)+ addExpanded = false+ },+ )+ }+ }+ }+ }+}diff --git a/OCR-translation/src/main/java/dev/davidv/translator/ui/components/TranslationCard.kt b/OCR-translation/src/main/java/dev/davidv/translator/ui/components/TranslationCard.ktnew file mode 100644index 0000000..20627b5--- /dev/null+++ b/OCR-translation/src/main/java/dev/davidv/translator/ui/components/TranslationCard.kt@@ -0,0 +1,106 @@+/*+ * Copyright (C) 2024 David V+ *+ * This program 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.+ *+ * This program 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 <https://www.gnu.org/licenses/>.+ */++package dev.davidv.translator.ui.components++import androidx.compose.foundation.layout.Arrangement+import androidx.compose.foundation.layout.Box+import androidx.compose.foundation.layout.Column+import androidx.compose.foundation.layout.Row+import androidx.compose.foundation.layout.RowScope+import androidx.compose.foundation.layout.fillMaxSize+import androidx.compose.foundation.layout.fillMaxWidth+import androidx.compose.foundation.layout.heightIn+import androidx.compose.foundation.layout.padding+import androidx.compose.material3.HorizontalDivider+import androidx.compose.material3.MaterialTheme+import androidx.compose.material3.Text+import androidx.compose.runtime.Composable+import androidx.compose.ui.Alignment+import androidx.compose.ui.Modifier+import androidx.compose.ui.text.font.FontWeight+import androidx.compose.ui.text.style.TextOverflow+import androidx.compose.ui.unit.dp+import androidx.compose.ui.unit.sp++// The shared skeleton for the input and output cards: a header row with the+// source/target language label on the left and a tools cluster on the right, a+// body that fills the remaining height, and an optional footer separated from+// the body by a subtle gutter line (used by the input card for its source row).+@Composable+fun TranslationCard(+ label: String,+ modifier: Modifier = Modifier,+ tools: @Composable RowScope.() -> Unit,+ footer: (@Composable () -> Unit)? = null,+ labelContent: (@Composable () -> Unit)? = null,+ body: @Composable () -> Unit,+) {+ AppCard(modifier = modifier) {+ Column(+ modifier =+ Modifier+ .fillMaxSize()+ .padding(start = 20.dp, end = 8.dp, top = 8.dp, bottom = 12.dp),+ ) {+ Row(+ modifier = Modifier.fillMaxWidth().heightIn(min = 40.dp),+ verticalAlignment = Alignment.CenterVertically,+ ) {+ if (labelContent != null) {+ Box(modifier = Modifier.weight(1f).padding(end = 8.dp)) {+ labelContent()+ }+ } else {+ Text(+ text = label.uppercase(),+ style = MaterialTheme.typography.labelMedium,+ fontWeight = FontWeight.SemiBold,+ letterSpacing = 0.8.sp,+ color = MaterialTheme.colorScheme.onSurfaceVariant,+ maxLines = 1,+ overflow = TextOverflow.Ellipsis,+ modifier = Modifier.weight(1f).padding(end = 8.dp),+ )+ }+ Row(+ horizontalArrangement = Arrangement.spacedBy(2.dp),+ verticalAlignment = Alignment.CenterVertically,+ content = tools,+ )+ }++ Box(+ modifier =+ Modifier+ .fillMaxWidth()+ .weight(1f)+ .padding(end = 12.dp, top = 4.dp),+ ) {+ body()+ }++ if (footer != null) {+ HorizontalDivider(+ modifier = Modifier.padding(end = 12.dp, top = 4.dp, bottom = 4.dp),+ color = MaterialTheme.colorScheme.outlineVariant.copy(alpha = 0.6f),+ )+ footer()+ }+ }+ }+}diff --git a/OCR-translation/src/main/java/dev/davidv/translator/ui/components/TranslationField.kt b/OCR-translation/src/main/java/dev/davidv/translator/ui/components/TranslationField.ktnew file mode 100644index 0000000..812b087--- /dev/null+++ b/OCR-translation/src/main/java/dev/davidv/translator/ui/components/TranslationField.kt@@ -0,0 +1,479 @@+/*+ * Copyright (C) 2024 David V+ *+ * This program 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.+ *+ * This program 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 <https://www.gnu.org/licenses/>.+ */++package dev.davidv.translator.ui.components++import android.content.ClipData+import android.content.ClipboardManager+import android.content.Context+import android.content.res.Configuration+import android.widget.TextView+import androidx.compose.foundation.ExperimentalFoundationApi+import androidx.compose.foundation.background+import androidx.compose.foundation.combinedClickable+import androidx.compose.foundation.layout.Box+import androidx.compose.foundation.layout.Column+import androidx.compose.foundation.layout.Spacer+import androidx.compose.foundation.layout.fillMaxSize+import androidx.compose.foundation.layout.fillMaxWidth+import androidx.compose.foundation.layout.heightIn+import androidx.compose.foundation.layout.padding+import androidx.compose.foundation.layout.size+import androidx.compose.foundation.layout.widthIn+import androidx.compose.foundation.rememberScrollState+import androidx.compose.foundation.shape.RoundedCornerShape+import androidx.compose.foundation.verticalScroll+import androidx.compose.material3.CircularProgressIndicator+import androidx.compose.material3.DropdownMenu+import androidx.compose.material3.HorizontalDivider+import androidx.compose.material3.Icon+import androidx.compose.material3.MaterialTheme+import androidx.compose.material3.Text+import androidx.compose.runtime.Composable+import androidx.compose.runtime.getValue+import androidx.compose.runtime.mutableStateOf+import androidx.compose.runtime.remember+import androidx.compose.runtime.setValue+import androidx.compose.ui.Alignment+import androidx.compose.ui.Modifier+import androidx.compose.ui.draw.clip+import androidx.compose.ui.graphics.Color+import androidx.compose.ui.graphics.toArgb+import androidx.compose.ui.platform.LocalContext+import androidx.compose.ui.res.painterResource+import androidx.compose.ui.res.stringResource+import androidx.compose.ui.semantics.contentDescription+import androidx.compose.ui.semantics.semantics+import androidx.compose.ui.semantics.text+import androidx.compose.ui.text.AnnotatedString+import androidx.compose.ui.text.TextStyle+import androidx.compose.ui.tooling.preview.Preview+import androidx.compose.ui.unit.dp+import androidx.compose.ui.viewinterop.AndroidView+import dev.davidv.translator.R+import dev.davidv.translator.TranslatedText+import dev.davidv.translator.ui.theme.TranslatorTheme++@OptIn(ExperimentalFoundationApi::class)+@Composable+fun TranslationField(+ text: TranslatedText?,+ modifier: Modifier = Modifier,+ label: String = "",+ header: (@Composable () -> Unit)? = null,+ textStyle: TextStyle = MaterialTheme.typography.bodyLarge,+ onDictionaryLookup: (String) -> Unit = {},+ onAlternatives: ((Int, Int) -> Unit)? = null,+ hasAlternatives: ((Int, Int) -> Boolean)? = null,+ underlineRanges: List<IntRange> = emptyList(),+ highlightRange: IntRange? = null,+ tapMode: OutputTapMode = OutputTapMode.None,+ onToggleAlternativesMode: (() -> Unit)? = null,+ onToggleDictionaryMode: (() -> Unit)? = null,+ dictionaryAvailable: Boolean = false,+ onDictionaryUnavailable: () -> Unit = {},+ speakerAvailable: Boolean = false,+ onSpeakerUnavailable: () -> Unit = {},+ onWordTap: ((Int) -> Unit)? = null,+ isAudioPlaying: Boolean = false,+ isAudioLoading: Boolean = false,+ speechPlaybackSpeed: Float = 1.0f,+ selectedVoiceName: String? = null,+ availableVoices: List<uniffi.translator_core.InstalledTtsPack> = emptyList(),+ onSpeak: () -> Unit = {},+ onSpeechPlaybackSpeedChange: (Float) -> Unit = {},+ onVoiceSelected: (String, String) -> Unit = { _, _ -> },+) {+ val context = LocalContext.current++ val actionModeCallback =+ remember(onDictionaryLookup, onAlternatives, hasAlternatives) {+ DictionaryActionModeCallback(context, onDictionaryLookup, onAlternatives, hasAlternatives)+ }++ val textColor = MaterialTheme.colorScheme.onSurface.toArgb()+ val highlightColor = MaterialTheme.colorScheme.primary.copy(alpha = 0.35f).toArgb()+ val fontSize = textStyle.fontSize.value+ val smallerFontSize = fontSize * 0.7f+ val translationOutputDescription = stringResource(R.string.a11y_translation_output)++ TranslationCard(+ label = label,+ labelContent = header,+ modifier =+ modifier+ .semantics {+ contentDescription = translationOutputDescription+ this.text = AnnotatedString(text?.translated ?: "")+ },+ tools = {+ if (text?.translated?.isNotEmpty() == true) {+ if (speakerAvailable) {+ SpeechPlaybackButton(+ isAudioPlaying = isAudioPlaying,+ isAudioLoading = isAudioLoading,+ speechPlaybackSpeed = speechPlaybackSpeed,+ selectedVoiceName = selectedVoiceName,+ availableVoices = availableVoices,+ onSpeak = onSpeak,+ onSpeechPlaybackSpeedChange = onSpeechPlaybackSpeedChange,+ onVoiceSelected = onVoiceSelected,+ contentDescription =+ if (isAudioPlaying) {+ stringResource(R.string.a11y_stop_audio)+ } else {+ stringResource(R.string.a11y_speak_translation)+ },+ )+ } else {+ ToolIconButton(+ iconRes = R.drawable.volume_up,+ contentDescription = stringResource(R.string.a11y_speak_translation),+ available = false,+ onClick = onSpeakerUnavailable,+ )+ }++ ToolIconButton(+ iconRes = R.drawable.alt_route,+ contentDescription =+ stringResource(+ if (tapMode == OutputTapMode.Alternatives) {+ R.string.a11y_alternatives_mode_on+ } else {+ R.string.a11y_alternatives_mode_off+ },+ ),+ active = tapMode == OutputTapMode.Alternatives,+ onClick = onToggleAlternativesMode ?: {},+ )++ if (dictionaryAvailable) {+ ToolIconButton(+ iconRes = R.drawable.dictionary_book,+ contentDescription =+ stringResource(+ if (tapMode == OutputTapMode.Dictionary) {+ R.string.a11y_dictionary_mode_on+ } else {+ R.string.a11y_dictionary_mode_off+ },+ ),+ active = tapMode == OutputTapMode.Dictionary,+ onClick = onToggleDictionaryMode ?: {},+ )+ } else {+ ToolIconButton(+ iconRes = R.drawable.dictionary_book,+ contentDescription = stringResource(R.string.a11y_dictionary_mode_off),+ available = false,+ onClick = onDictionaryUnavailable,+ )+ }++ ToolIconButton(+ iconRes = R.drawable.copy,+ contentDescription = stringResource(R.string.a11y_copy_translation),+ onClick = {+ val clipboard =+ context.getSystemService(Context.CLIPBOARD_SERVICE) as ClipboardManager+ val clip = ClipData.newPlainText("Translation", text.translated)+ clipboard.setPrimaryClip(clip)+ },+ )+ }+ },+ body = {+ Column(+ modifier =+ Modifier+ .fillMaxSize()+ .verticalScroll(rememberScrollState()),+ ) {+ AndroidView(+ modifier = Modifier.fillMaxWidth(),+ factory = { context ->+ DottedUnderlineTextView(context).apply {+ this.tag = "output_textview_tag"+ this.contentDescription = context.getString(R.string.a11y_output_textview)+ this.text = text?.translated ?: ""+ this.textSize = fontSize+ this.setTextColor(textColor)+ this.setTextIsSelectable(true)+ this.customSelectionActionModeCallback = actionModeCallback+ this.customInsertionActionModeCallback = actionModeCallback+ this.underlineRanges = underlineRanges+ this.wordHighlightColor = highlightColor+ this.highlightRange = highlightRange+ this.wordTapListener = onWordTap+ this.wordTapMode = tapMode != OutputTapMode.None+ actionModeCallback.setTextView(this)+ }+ },+ update = { textView ->+ textView.text = text?.translated ?: ""+ textView.textSize = fontSize+ textView.wordTapListener = onWordTap+ // Toggle selection off/on before re-applying the selection callback,+ // since leaving the mode re-enables selection.+ textView.wordTapMode = tapMode != OutputTapMode.None+ textView.customSelectionActionModeCallback = actionModeCallback+ textView.underlineRanges = underlineRanges+ textView.wordHighlightColor = highlightColor+ textView.highlightRange = highlightRange+ actionModeCallback.setTextView(textView)+ },+ )++ if (text?.transliterated != null) {+ AndroidView(+ factory = { context ->+ TextView(context).apply {+ this.text = text.transliterated+ this.textSize = smallerFontSize+ this.setTextColor(textColor)+ this.setTextIsSelectable(true)+ }+ },+ update = { textView ->+ textView.text = text.transliterated+ textView.textSize = smallerFontSize+ },+ modifier = Modifier.padding(top = 8.dp, bottom = 20.dp),+ )+ }+ }+ },+ )+}++@OptIn(ExperimentalFoundationApi::class)+@Composable+fun SpeechPlaybackButton(+ isAudioPlaying: Boolean,+ isAudioLoading: Boolean,+ speechPlaybackSpeed: Float,+ selectedVoiceName: String?,+ availableVoices: List<uniffi.translator_core.InstalledTtsPack>,+ onSpeak: () -> Unit,+ onSpeechPlaybackSpeedChange: (Float) -> Unit,+ onVoiceSelected: (String, String) -> Unit,+ contentDescription: String,+ modifier: Modifier = Modifier,+) {+ var showSpeechOptions by remember { mutableStateOf(false) }+ val active = isAudioPlaying || isAudioLoading+ val tint =+ if (active) {+ MaterialTheme.colorScheme.primary+ } else {+ MaterialTheme.colorScheme.onSurfaceVariant+ }++ Box(+ modifier =+ modifier+ .size(40.dp),+ ) {+ Box(+ modifier =+ Modifier+ .matchParentSize()+ .clip(RoundedCornerShape(12.dp))+ .background(+ if (active) MaterialTheme.colorScheme.primary.copy(alpha = 0.14f) else Color.Transparent,+ ).combinedClickable(+ onClick = onSpeak,+ onLongClick = {+ showSpeechOptions = true+ },+ ).semantics {+ this.contentDescription = contentDescription+ },+ contentAlignment = Alignment.Center,+ ) {+ if (isAudioLoading && !isAudioPlaying) {+ CircularProgressIndicator(+ modifier = Modifier.size(20.dp),+ strokeWidth = 2.dp,+ color = tint,+ )+ } else {+ Icon(+ painter = painterResource(id = if (isAudioPlaying) R.drawable.stop else R.drawable.volume_up),+ contentDescription = null,+ tint = tint,+ modifier = Modifier.size(24.dp),+ )+ }+ }++ DropdownMenu(+ expanded = showSpeechOptions,+ onDismissRequest = { showSpeechOptions = false },+ ) {+ Column(+ modifier =+ Modifier+ .widthIn(min = 220.dp, max = 280.dp)+ .padding(horizontal = 12.dp, vertical = 8.dp),+ ) {+ Text(+ text = stringResource(R.string.voice_playback_speed),+ style = MaterialTheme.typography.labelLarge,+ )+ SpeechSpeedControl(+ speed = speechPlaybackSpeed,+ onSpeedChange = onSpeechPlaybackSpeedChange,+ modifier =+ Modifier+ .padding(top = 8.dp),+ )++ HorizontalDivider(modifier = Modifier.padding(vertical = 12.dp))++ Text(+ text = stringResource(R.string.voice_label),+ style = MaterialTheme.typography.labelLarge,+ )+ Column(+ modifier =+ Modifier+ .padding(top = 8.dp)+ .heightIn(max = 220.dp)+ .verticalScroll(rememberScrollState()),+ ) {+ if (availableVoices.isEmpty()) {+ Text(+ text = stringResource(R.string.voice_default),+ style = MaterialTheme.typography.bodyMedium,+ color = MaterialTheme.colorScheme.onSurfaceVariant,+ )+ } else {+ availableVoices.forEach { pack ->+ val isMulti = pack.voices.size > 1+ if (isMulti) {+ Text(+ text = pack.displayName.uppercase(),+ style = MaterialTheme.typography.labelSmall,+ color = MaterialTheme.colorScheme.onSurfaceVariant,+ modifier = Modifier.padding(horizontal = 4.dp, vertical = 6.dp),+ )+ pack.voices.forEach { speaker ->+ VoiceRowEntry(+ label = speaker.name,+ isSelected = speaker.name == selectedVoiceName,+ indented = true,+ onClick = {+ onVoiceSelected(pack.packId, speaker.name)+ showSpeechOptions = false+ },+ )+ }+ } else {+ val speaker = pack.voices.first()+ VoiceRowEntry(+ label = pack.displayName,+ isSelected = speaker.name == selectedVoiceName,+ indented = false,+ onClick = {+ onVoiceSelected(pack.packId, speaker.name)+ showSpeechOptions = false+ },+ )+ }+ }+ }+ }+ }+ }+ }+}++@OptIn(ExperimentalFoundationApi::class)+@Composable+private fun VoiceRowEntry(+ label: String,+ isSelected: Boolean,+ indented: Boolean,+ onClick: () -> Unit,+) {+ Text(+ text = label,+ modifier =+ Modifier+ .fillMaxWidth()+ .clip(RoundedCornerShape(8.dp))+ .background(+ if (isSelected) {+ MaterialTheme.colorScheme.secondaryContainer+ } else {+ MaterialTheme.colorScheme.surface+ },+ ).combinedClickable(+ onClick = onClick,+ onLongClick = {},+ ).padding(+ start = if (indented) 20.dp else 10.dp,+ end = 10.dp,+ top = 8.dp,+ bottom = 8.dp,+ ),+ color =+ if (isSelected) {+ MaterialTheme.colorScheme.onSecondaryContainer+ } else {+ MaterialTheme.colorScheme.onSurface+ },+ style = MaterialTheme.typography.bodyMedium,+ )+ Spacer(modifier = Modifier.size(4.dp))+}++@Preview(+ showBackground = true,+ uiMode = Configuration.UI_MODE_NIGHT_YES,+)+@Composable+fun TranslationFieldBothWeightedPreview() {+ TranslatorTheme {+ Column(modifier = Modifier.fillMaxSize()) {+ TranslationField(+ text =+ TranslatedText(+ "very long text. very long text. very long text. very long text. very long text. very long text. very long text. very long text. very long text. very long text. very long text. very long text. very long text. very long text. very long text. very long text. very long text. very long text. very long text. very long text. very long text. very long text. very long text. very long text. very long text. very long text. very long text. very long text. very long text. very long text. very long text. very long text. very long text. very long text. very long text. very long text. very long text. very long text. very long text. very long text. very long text. very long text. very long text. very long text. very long text. very long text. very long text. very long text. very long text. very long text. very long text. very long text. very long text. very long text. very long text. very long text. very long text. very long text. very long text. very long text. very long text. very long text. very long text. very long text. very long text. very long text.",+ null,+ ),+ )+ }+ }+}++@Preview(+ showBackground = true,+ uiMode = Configuration.UI_MODE_NIGHT_YES,+)+@Composable+fun WithTransliteration() {+ TranslatorTheme {+ Column(modifier = Modifier.fillMaxSize()) {+ TranslationField(+ text = TranslatedText("some words", "transliterated"),+ )+ }+ }+}diff --git a/OCR-translation/src/main/java/dev/davidv/translator/ui/components/WindowComposeHost.kt b/OCR-translation/src/main/java/dev/davidv/translator/ui/components/WindowComposeHost.ktnew file mode 100644index 0000000..84071b5--- /dev/null+++ b/OCR-translation/src/main/java/dev/davidv/translator/ui/components/WindowComposeHost.kt@@ -0,0 +1,75 @@+/*+ * Copyright (C) 2024 David V+ *+ * This program 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.+ *+ * This program 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 <https://www.gnu.org/licenses/>.+ */++package dev.davidv.translator.ui.components++import android.content.Context+import android.view.View+import androidx.compose.runtime.Composable+import androidx.compose.ui.platform.ComposeView+import androidx.lifecycle.Lifecycle+import androidx.lifecycle.LifecycleOwner+import androidx.lifecycle.LifecycleRegistry+import androidx.lifecycle.ViewModelStore+import androidx.lifecycle.ViewModelStoreOwner+import androidx.lifecycle.setViewTreeLifecycleOwner+import androidx.lifecycle.setViewTreeViewModelStoreOwner+import androidx.savedstate.SavedStateRegistry+import androidx.savedstate.SavedStateRegistryController+import androidx.savedstate.SavedStateRegistryOwner+import androidx.savedstate.setViewTreeSavedStateRegistryOwner++/**+ * Minimal lifecycle/owner scaffolding so a [ComposeView] can run inside a non-Activity window+ * (the accessibility and assistant overlays, which add Views to a WindowManager/Dialog window with+ * no ViewTree owners). The host is created RESUMED; call [dispose] when the window goes away.+ */+class WindowComposeHost(context: Context) : LifecycleOwner, ViewModelStoreOwner, SavedStateRegistryOwner {+ private val lifecycleRegistry = LifecycleRegistry(this)+ private val store = ViewModelStore()+ private val savedStateController = SavedStateRegistryController.create(this)++ override val lifecycle: Lifecycle get() = lifecycleRegistry+ override val viewModelStore: ViewModelStore get() = store+ override val savedStateRegistry: SavedStateRegistry get() = savedStateController.savedStateRegistry++ val view: ComposeView =+ ComposeView(context).also { composeView ->+ savedStateController.performRestore(null)+ lifecycleRegistry.currentState = Lifecycle.State.RESUMED+ installOn(composeView)+ }++ /**+ * Compose resolves its window recomposer from the *top-level* view of the window (the first child+ * of `android.R.id.content`, or the topmost view when there is none, as in a WindowManager/Dialog+ * window) and reads the ViewTree owners off it. Setting them only on the [ComposeView] is not+ * enough: the owners must live on whatever view roots this window, so install them there too.+ */+ fun installOn(target: View) {+ target.setViewTreeLifecycleOwner(this)+ target.setViewTreeViewModelStoreOwner(this)+ target.setViewTreeSavedStateRegistryOwner(this)+ }++ fun setContent(content: @Composable () -> Unit) = view.setContent(content)++ fun dispose() {+ lifecycleRegistry.currentState = Lifecycle.State.DESTROYED+ store.clear()+ }+}diff --git a/OCR-translation/src/main/java/dev/davidv/translator/ui/components/WordRange.kt b/OCR-translation/src/main/java/dev/davidv/translator/ui/components/WordRange.ktnew file mode 100644index 0000000..0682e92--- /dev/null+++ b/OCR-translation/src/main/java/dev/davidv/translator/ui/components/WordRange.kt@@ -0,0 +1,43 @@+/*+ * Copyright (C) 2024 David V+ *+ * This program 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.+ *+ * This program 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 <https://www.gnu.org/licenses/>.+ */++package dev.davidv.translator.ui.components++// The char range of the whole word around a tap offset (an insertion index, so+// it may land just past a word or on a space — step back onto the preceding+// letter in that case). Null when the tap isn't on a word.+fun wordRangeAt(+ text: String,+ offset: Int,+): IntRange? {+ val n = text.length+ if (n == 0) return null+ var i = offset.coerceIn(0, n)+ if (i >= n || !text[i].isLetterOrDigit()) {+ if (i > 0 && text[i - 1].isLetterOrDigit()) i-- else return null+ }+ var start = i+ while (start > 0 && text[start - 1].isLetterOrDigit()) start--+ var end = i + 1+ while (end < n && text[end].isLetterOrDigit()) end+++ return start until end+}++fun wordAt(+ text: String,+ offset: Int,+): String? = wordRangeAt(text, offset)?.let { text.substring(it.first, it.last + 1) }diff --git a/OCR-translation/src/main/java/dev/davidv/translator/ui/components/WordSelectionOverlay.kt b/OCR-translation/src/main/java/dev/davidv/translator/ui/components/WordSelectionOverlay.ktnew file mode 100644index 0000000..04285fd--- /dev/null+++ b/OCR-translation/src/main/java/dev/davidv/translator/ui/components/WordSelectionOverlay.kt@@ -0,0 +1,381 @@+/*+ * Copyright (C) 2024 David V+ *+ * This program 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.+ *+ * This program 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 <https://www.gnu.org/licenses/>.+ */++package dev.davidv.translator.ui.components++import android.app.SearchManager+import android.content.ClipData+import android.content.ClipboardManager+import android.content.Context+import android.content.Intent+import android.os.Build+import android.view.ActionMode+import android.view.Menu+import android.view.MenuItem+import android.view.View+import android.widget.Magnifier+import androidx.compose.foundation.Canvas+import androidx.compose.foundation.gestures.awaitEachGesture+import androidx.compose.foundation.gestures.awaitFirstDown+import androidx.compose.runtime.Composable+import androidx.compose.runtime.DisposableEffect+import androidx.compose.runtime.LaunchedEffect+import androidx.compose.runtime.getValue+import androidx.compose.runtime.mutableStateOf+import androidx.compose.runtime.remember+import androidx.compose.runtime.rememberUpdatedState+import androidx.compose.runtime.setValue+import androidx.compose.ui.Modifier+import androidx.compose.ui.geometry.Offset+import androidx.compose.ui.geometry.Size+import androidx.compose.ui.graphics.Color+import androidx.compose.ui.graphics.drawscope.withTransform+import androidx.compose.ui.input.pointer.pointerInput+import androidx.compose.ui.layout.LayoutCoordinates+import androidx.compose.ui.layout.onGloballyPositioned+import androidx.compose.ui.platform.LocalContext+import androidx.compose.ui.platform.LocalView+import androidx.compose.ui.res.painterResource+import androidx.compose.ui.unit.dp+import dev.davidv.translator.Point+import dev.davidv.translator.R+import uniffi.bindings.selectionNearestWord+import uniffi.bindings.selectionResolve+import uniffi.bindings.selectionWordAt+import uniffi.bindings.selectionWordAxis+import uniffi.translator_core.PositionedWord+import kotlin.math.max+import kotlin.math.min++/**+ * Per-word selection data for one translated image, in the image-pixel space of the displayed+ * bitmap. Source words come from the recognized text (CTC firings); translated words from the+ * overlay layout. Both produced in translator-rs; each word carries its `lineIndex`.+ */+data class ImageWordSelection(+ val imageWidth: Int,+ val imageHeight: Int,+ val sourceWords: List<PositionedWord>,+ val translatedWords: List<PositionedWord>,+)++/** Local-space distance from a point to an image-space position, for handle grabbing. */+private fun distanceTo(+ point: Offset,+ target: Point,+ t: FitTransform,+): Float = (point - Offset(t.mapX(target.x), t.mapY(target.y))).getDistance()++private fun copyToClipboard(+ context: Context,+ text: String,+) {+ val clipboard = context.getSystemService(Context.CLIPBOARD_SERVICE) as ClipboardManager+ clipboard.setPrimaryClip(ClipData.newPlainText("Selection", text))+}++private const val MENU_COPY = 1+private const val MENU_SHARE = 2+private const val MENU_SEARCH = 3++/**+ * A floating text-selection action bar (Copy / Share / Web search) over the image, mirroring the+ * system text toolbar. `textProvider`/`rectProvider` are read live so the bar follows the+ * selection. Returns a callback; the caller drives `startActionMode`.+ */+private class SelectionActionModeCallback(+ private val context: Context,+ private val textProvider: () -> String,+ private val rectProvider: () -> android.graphics.Rect,+ private val onFinished: () -> Unit,+) : ActionMode.Callback2() {+ override fun onCreateActionMode(+ mode: ActionMode,+ menu: Menu,+ ): Boolean {+ menu.add(0, MENU_COPY, 0, android.R.string.copy)+ menu.add(0, MENU_SHARE, 1, "Share")+ menu.add(0, MENU_SEARCH, 2, "Web search")+ return true+ }++ override fun onPrepareActionMode(+ mode: ActionMode,+ menu: Menu,+ ): Boolean = false++ override fun onActionItemClicked(+ mode: ActionMode,+ item: MenuItem,+ ): Boolean {+ val text = textProvider()+ when (item.itemId) {+ MENU_COPY -> copyToClipboard(context, text)+ MENU_SHARE -> {+ val intent =+ Intent(Intent.ACTION_SEND).apply {+ type = "text/plain"+ putExtra(Intent.EXTRA_TEXT, text)+ }+ context.startActivity(Intent.createChooser(intent, null).addFlags(Intent.FLAG_ACTIVITY_NEW_TASK))+ }+ MENU_SEARCH -> {+ val intent =+ Intent(Intent.ACTION_WEB_SEARCH).apply {+ putExtra(SearchManager.QUERY, text)+ addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)+ }+ runCatching { context.startActivity(intent) }+ }+ else -> return false+ }+ mode.finish()+ return true+ }++ override fun onDestroyActionMode(mode: ActionMode) {+ onFinished()+ }++ override fun onGetContentRect(+ mode: ActionMode,+ view: View,+ outRect: android.graphics.Rect,+ ) {+ outRect.set(rectProvider())+ }+}++private enum class DragMode { START, END }++/**+ * Persistent Lens-style word selection over the displayed image. Tapping a word selects it (and+ * starts the selection); tapping another word moves the selection; tapping empty space clears it.+ * The selection stays with draggable end handles, and a floating action bar (Copy / Share / Web+ * search) tracks it. A plain drag is left for the container to pan/zoom; only a drag that grabs a+ * handle edits the selection. Nothing is auto-copied.+ *+ * `words` are in image-pixel space; mapped with the image's ContentScale.Fit transform, so this+ * stays aligned inside the image's transformed (zoom/pan) container. `scale` is the container's+ * current zoom — the magnifier is suppressed when zoomed (its source mapping assumes identity).+ */+@Composable+fun WordSelectionOverlay(+ words: List<PositionedWord>,+ imageWidth: Int,+ imageHeight: Int,+ scale: Float = 1f,+ modifier: Modifier = Modifier,+) {+ val context = LocalContext.current+ val view = LocalView.current+ val handlePainter = painterResource(R.drawable.selection_handle)+ // Loupe under the dragging finger so the text/handle isn't obscured. Native Magnifier is API+ // 28+; older devices simply get no loupe.+ val magnifier = remember(view) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) Magnifier(view) else null }+ DisposableEffect(magnifier) {+ onDispose { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) magnifier?.dismiss() }+ }++ var selStart by remember(words) { mutableStateOf<Int?>(null) }+ var selEnd by remember(words) { mutableStateOf<Int?>(null) }+ var dragging by remember { mutableStateOf(false) }+ var contentRect by remember { mutableStateOf(android.graphics.Rect()) }+ // The Canvas's layout coords; `localToRoot` maps Canvas-local points to root-view coords through+ // the container's zoom/pan transform, which the action bar and magnifier need.+ var layoutCoords by remember { mutableStateOf<LayoutCoordinates?>(null) }+ val scaleState = rememberUpdatedState(scale)++ val hasSelection = selStart != null && selEnd != null+ // Pills, handles, bounds and copy text all come from translator-rs in one call, so this overlay+ // and the Qt one cannot disagree about what a drag selected.+ val selection =+ remember(words, selStart, selEnd) {+ val s = selStart+ val e = selEnd+ if (s != null && e != null) selectionResolve(words, s.toUInt(), e.toUInt()) else null+ }+ val selectedText = rememberUpdatedState(selection?.text ?: "")+ val rectState = rememberUpdatedState(contentRect)++ // Drive the floating action bar: present while there's a selection and no active drag.+ var actionMode by remember { mutableStateOf<ActionMode?>(null) }+ LaunchedEffect(hasSelection, dragging, selStart, selEnd) {+ if (hasSelection && !dragging) {+ if (actionMode == null) {+ actionMode =+ view.startActionMode(+ SelectionActionModeCallback(+ context = context,+ textProvider = { selectedText.value },+ rectProvider = { rectState.value },+ onFinished = { actionMode = null },+ ),+ ActionMode.TYPE_FLOATING,+ )+ } else {+ actionMode?.invalidateContentRect()+ }+ } else {+ actionMode?.finish()+ actionMode = null+ }+ }+ DisposableEffect(Unit) {+ onDispose { actionMode?.finish() }+ }++ Canvas(+ modifier =+ modifier+ .onGloballyPositioned { layoutCoords = it }+ .pointerInput(words, imageWidth, imageHeight) {+ val slop = viewConfiguration.touchSlop++ fun transform() = fitTransform(size.width.toFloat(), size.height.toFloat(), imageWidth, imageHeight)++ fun recomputeRect() {+ val s = selStart ?: return+ val e = selEnd ?: return+ val coords = layoutCoords ?: return+ val t = transform()+ val box = selectionResolve(words, s.toUInt(), e.toUInt())?.bounds ?: return+ val l = t.mapX(box.left.toFloat())+ val top = t.mapY(box.top.toFloat())+ val r = t.mapX(box.right.toFloat())+ val b = t.mapY(box.bottom.toFloat())+ // Map the local bounds through the container's zoom/pan to root-view coords.+ val topLeft = coords.localToRoot(Offset(l, top))+ val bottomRight = coords.localToRoot(Offset(r, b))+ contentRect =+ android.graphics.Rect(+ topLeft.x.toInt(),+ topLeft.y.toInt(),+ bottomRight.x.toInt(),+ bottomRight.y.toInt(),+ )+ }++ // Loupe raised a full bubble-height above the finger so it isn't occluded. The finger's+ // root-view position comes through the container transform, so it tracks under zoom.+ fun showMagnifier(pos: Offset) {+ if (Build.VERSION.SDK_INT < Build.VERSION_CODES.P) return+ val m = magnifier ?: return+ val root = (layoutCoords ?: return).localToRoot(pos)+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {+ m.show(root.x, root.y, root.x, root.y - m.height.toFloat())+ } else {+ m.show(root.x, root.y)+ }+ }++ // Word whose oriented box (slightly padded) contains the touched point, or null.+ fun wordAt(pos: Offset): Int? {+ val t = transform()+ return selectionWordAt(words, t.unmapX(pos.x), t.unmapY(pos.y))?.toInt()+ }++ awaitEachGesture {+ val down = awaitFirstDown(requireUnconsumed = false)+ val t = transform()+ // Grab radius in local coords; divide by zoom so it stays a constant on-screen size.+ val handleRadius = 28.dp.toPx() / scaleState.value+ val s0 = selStart+ val e0 = selEnd+ val view = if (s0 != null && e0 != null) selectionResolve(words, s0.toUInt(), e0.toUInt()) else null+ val handleMode =+ if (view != null) {+ when {+ distanceTo(down.position, view.startHandle, t) < handleRadius -> DragMode.START+ distanceTo(down.position, view.endHandle, t) < handleRadius -> DragMode.END+ else -> null+ }+ } else {+ null+ }++ if (handleMode != null) {+ // Grab a handle: consume so the container doesn't pan, and resize the selection.+ down.consume()+ while (true) {+ val event = awaitPointerEvent()+ val change = event.changes.firstOrNull { it.id == down.id } ?: break+ if (!change.pressed) break+ change.consume()+ dragging = true+ val fixed = if (handleMode == DragMode.START) e0!! else s0!!+ val tt = transform()+ val axis = selectionWordAxis(words, fixed.toUInt())+ selectionNearestWord(+ words,+ tt.unmapX(change.position.x),+ tt.unmapY(change.position.y),+ axis,+ )?.let { nw ->+ selStart = min(fixed, nw.toInt())+ selEnd = max(fixed, nw.toInt())+ }+ recomputeRect()+ showMagnifier(change.position)+ }+ dragging = false+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) magnifier?.dismiss()+ } else {+ // Not a handle: observe without consuming so the container can pan/zoom; a tap (no+ // drag) selects the word under the finger, or clears when it's on empty space.+ var moved = false+ while (true) {+ val event = awaitPointerEvent()+ val change = event.changes.firstOrNull { it.id == down.id } ?: break+ if (!change.pressed) break+ if (!moved && (change.position - down.position).getDistance() > slop) moved = true+ }+ if (!moved) {+ val w = wordAt(down.position)+ selStart = w+ selEnd = w+ if (w != null) recomputeRect()+ }+ }+ }+ },+ ) {+ val view = selection ?: return@Canvas+ val t = fitTransform(size.width, size.height, imageWidth, imageHeight)+ // Pills arrive merged per line and already clamped against neighbouring lines.+ view.pills.forEach { pill -> drawOrientedPill(pill, t, Color(0x553B82F6)) }+ // End handles: pin markers whose tip sits at the line bottom, hanging below it. The opening+ // pin points up-right (toward the selection), the closing pin up-left. The drawable's tip is+ // at its bottom-centre, so anchor and rotate about that. Divide by zoom so the pin stays a+ // constant on-screen size instead of growing with the image.+ val handleSize = 26.dp.toPx() / scale++ fun drawHandle(+ p: Point,+ degrees: Float,+ ) {+ withTransform({+ translate(t.mapX(p.x) - handleSize / 2f, t.mapY(p.y) - handleSize)+ rotate(degrees, pivot = Offset(handleSize / 2f, handleSize))+ }) {+ with(handlePainter) { draw(Size(handleSize, handleSize)) }+ }+ }+ drawHandle(view.startHandle, -135f)+ drawHandle(view.endHandle, 135f)+ }+}diff --git a/OCR-translation/src/main/java/dev/davidv/translator/ui/components/ZoomableImageViewer.kt b/OCR-translation/src/main/java/dev/davidv/translator/ui/components/ZoomableImageViewer.ktnew file mode 100644index 0000000..3f9915c--- /dev/null+++ b/OCR-translation/src/main/java/dev/davidv/translator/ui/components/ZoomableImageViewer.kt@@ -0,0 +1,223 @@+/*+ * Copyright (C) 2024 David V+ *+ * This program 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.+ *+ * This program 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 <https://www.gnu.org/licenses/>.+ */++package dev.davidv.translator.ui.components++import android.graphics.Bitmap+import androidx.compose.foundation.Image+import androidx.compose.foundation.background+import androidx.compose.foundation.gestures.rememberTransformableState+import androidx.compose.foundation.gestures.transformable+import androidx.compose.foundation.layout.Box+import androidx.compose.foundation.layout.Row+import androidx.compose.foundation.layout.absoluteOffset+import androidx.compose.foundation.layout.fillMaxSize+import androidx.compose.foundation.layout.size+import androidx.compose.material3.Icon+import androidx.compose.material3.IconButton+import androidx.compose.material3.MaterialTheme+import androidx.compose.runtime.Composable+import androidx.compose.runtime.getValue+import androidx.compose.runtime.mutableStateOf+import androidx.compose.runtime.remember+import androidx.compose.runtime.setValue+import androidx.compose.ui.Alignment+import androidx.compose.ui.Modifier+import androidx.compose.ui.draw.clip+import androidx.compose.ui.geometry.Offset+import androidx.compose.ui.graphics.Color+import androidx.compose.ui.graphics.RectangleShape+import androidx.compose.ui.graphics.asImageBitmap+import androidx.compose.ui.graphics.graphicsLayer+import androidx.compose.ui.platform.LocalConfiguration+import androidx.compose.ui.platform.LocalDensity+import androidx.compose.ui.res.painterResource+import androidx.compose.ui.res.stringResource+import androidx.compose.ui.unit.IntOffset+import androidx.compose.ui.unit.dp+import androidx.compose.ui.window.Dialog+import androidx.compose.ui.window.DialogProperties+import dev.davidv.translator.R+import kotlin.math.max+import kotlin.math.roundToInt++@Composable+fun ZoomableImageViewer(+ bitmap: Bitmap,+ originalBitmap: Bitmap,+ wordSelection: ImageWordSelection?,+ onDismiss: () -> Unit,+ onShare: () -> Unit,+) {+ var showOriginal by remember { mutableStateOf(false) }+ val displayed = if (showOriginal) originalBitmap else bitmap+ Dialog(+ onDismissRequest = onDismiss,+ properties =+ DialogProperties(+ dismissOnBackPress = true,+ dismissOnClickOutside = false,+ usePlatformDefaultWidth = false,+ ),+ ) {+ var scale by remember { mutableStateOf(1f) }+ var offset by remember { mutableStateOf(Offset.Zero) }++ val configuration = LocalConfiguration.current+ val density = LocalDensity.current++ val screenWidth = with(density) { configuration.screenWidthDp.dp.toPx() }+ val screenHeight = with(density) { configuration.screenHeightDp.dp.toPx() }++ val state =+ rememberTransformableState { zoomChange, offsetChange, _ ->+ val newScale = (scale * zoomChange).coerceIn(1f, 3f)++ // offset is also scaled, otherwise dragging is weird+ val proposedOffset = offset + offsetChange * newScale++ val newOffset =+ if (newScale <= 1f) {+ Offset.Zero+ } else {+ // Calculate the image display size (how it's actually shown on screen)+ val imageAspectRatio = displayed.width.toFloat() / displayed.height.toFloat()+ val screenAspectRatio = screenWidth / screenHeight++ val (displayWidth, displayHeight) =+ if (imageAspectRatio > screenAspectRatio) {+ screenWidth to screenWidth / imageAspectRatio+ } else {+ screenHeight * imageAspectRatio to screenHeight+ }++ val scaledImageWidth = displayWidth * newScale+ val scaledImageHeight = displayHeight * newScale++ // Calculate how much of the image extends beyond the screen on each side+ val overflowX = max(0f, scaledImageWidth - screenWidth)+ val overflowY = max(0f, scaledImageHeight - screenHeight)++ // Maximum offset is half the overflow (can pan that much in each direction)+ val maxOffsetX = overflowX / 2f+ val maxOffsetY = overflowY / 2f++ Offset(+ x = proposedOffset.x.coerceIn(-maxOffsetX, maxOffsetX),+ y = proposedOffset.y.coerceIn(-maxOffsetY, maxOffsetY),+ )+ }++ scale = newScale+ offset = newOffset+ }++ Box(+ modifier =+ Modifier+ .fillMaxSize()+ .background(Color.Black),+ ) {+ Box(+ modifier =+ Modifier+ .fillMaxSize()+ .clip(RectangleShape)+ .absoluteOffset { IntOffset(offset.x.roundToInt(), offset.y.roundToInt()) }+ .graphicsLayer(+ scaleX = scale,+ scaleY = scale,+ ).transformable(state = state),+ ) {+ Image(+ bitmap = displayed.asImageBitmap(),+ contentDescription =+ if (showOriginal) {+ stringResource(+ R.string.a11y_zoomable_original_image,+ )+ } else {+ stringResource(R.string.a11y_zoomable_translated_image)+ },+ modifier = Modifier.fillMaxSize(),+ )++ if (wordSelection != null) {+ WordSelectionOverlay(+ words = if (showOriginal) wordSelection.sourceWords else wordSelection.translatedWords,+ imageWidth = wordSelection.imageWidth,+ imageHeight = wordSelection.imageHeight,+ modifier = Modifier.matchParentSize(),+ )+ }+ }++ Row(+ modifier = Modifier.align(Alignment.TopEnd),+ ) {+ IconButton(+ onClick = { showOriginal = !showOriginal },+ modifier = Modifier.size(48.dp),+ ) {+ Icon(+ painterResource(id = R.drawable.flip),+ contentDescription =+ if (showOriginal) {+ stringResource(+ R.string.a11y_show_translated_image,+ )+ } else {+ stringResource(R.string.a11y_show_original_image)+ },+ tint =+ if (showOriginal) {+ MaterialTheme.colorScheme.primary+ } else {+ MaterialTheme.colorScheme.onSurface.copy(alpha = 0.8f)+ },+ )+ }++ IconButton(+ onClick = onShare,+ modifier = Modifier.size(48.dp),+ ) {+ Icon(+ painterResource(id = R.drawable.share),+ contentDescription = stringResource(R.string.a11y_share_image),+ tint = MaterialTheme.colorScheme.onSurface.copy(alpha = 0.8f),+ )+ }+ }++ // Back button+ IconButton(+ onClick = onDismiss,+ modifier =+ Modifier+ .align(Alignment.TopStart)+ .size(48.dp),+ ) {+ Icon(+ painterResource(id = R.drawable.arrow_back),+ contentDescription = stringResource(R.string.a11y_close_fullscreen),+ tint = MaterialTheme.colorScheme.onSurface.copy(alpha = 0.8f),+ )+ }+ }+ }+}diff --git a/OCR-translation/src/main/java/dev/davidv/translator/ui/screens/HowToUseScreen.kt b/OCR-translation/src/main/java/dev/davidv/translator/ui/screens/HowToUseScreen.ktnew file mode 100644index 0000000..2f0cb0c--- /dev/null+++ b/OCR-translation/src/main/java/dev/davidv/translator/ui/screens/HowToUseScreen.kt@@ -0,0 +1,214 @@+/*+ * Copyright (C) 2024 David V+ *+ * This program 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.+ *+ * This program 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 <https://www.gnu.org/licenses/>.+ */++package dev.davidv.translator.ui.screens++import androidx.annotation.StringRes+import androidx.compose.foundation.layout.Arrangement+import androidx.compose.foundation.layout.Column+import androidx.compose.foundation.layout.Row+import androidx.compose.foundation.layout.Spacer+import androidx.compose.foundation.layout.fillMaxSize+import androidx.compose.foundation.layout.fillMaxWidth+import androidx.compose.foundation.layout.height+import androidx.compose.foundation.layout.padding+import androidx.compose.foundation.layout.size+import androidx.compose.foundation.rememberScrollState+import androidx.compose.foundation.verticalScroll+import androidx.compose.material3.ExperimentalMaterial3Api+import androidx.compose.material3.Icon+import androidx.compose.material3.IconButton+import androidx.compose.material3.MaterialTheme+import androidx.compose.material3.Scaffold+import androidx.compose.material3.Text+import androidx.compose.material3.TopAppBar+import androidx.compose.runtime.Composable+import androidx.compose.ui.Alignment+import androidx.compose.ui.Modifier+import androidx.compose.ui.platform.testTag+import androidx.compose.ui.res.painterResource+import androidx.compose.ui.res.stringResource+import androidx.compose.ui.text.font.FontWeight+import androidx.compose.ui.tooling.preview.Preview+import androidx.compose.ui.unit.dp+import dev.davidv.translator.R+import dev.davidv.translator.ui.components.AppCard+import dev.davidv.translator.ui.theme.TranslatorTheme++private data class Tip(+ val iconRes: Int,+ @StringRes val titleRes: Int,+ @StringRes val bodyRes: Int,+)++private data class TipSection(+ @StringRes val titleRes: Int,+ val tips: List<Tip>,+)++private val sections =+ listOf(+ TipSection(+ titleRes = R.string.howto_section_other_apps,+ tips =+ listOf(+ Tip(+ iconRes = R.drawable.share,+ titleRes = R.string.howto_share_title,+ bodyRes = R.string.howto_share_body,+ ),+ Tip(+ iconRes = R.drawable.copy,+ titleRes = R.string.howto_copy_title,+ bodyRes = R.string.howto_copy_body,+ ),+ ),+ ),+ TipSection(+ titleRes = R.string.howto_section_in_app,+ tips =+ listOf(+ Tip(+ iconRes = R.drawable.draft,+ titleRes = R.string.howto_docs_title,+ bodyRes = R.string.howto_docs_body,+ ),+ Tip(+ iconRes = R.drawable.dictionary,+ titleRes = R.string.howto_dict_title,+ bodyRes = R.string.howto_dict_body,+ ),+ Tip(+ iconRes = R.drawable.alt_route,+ titleRes = R.string.howto_alt_title,+ bodyRes = R.string.howto_alt_body,+ ),+ Tip(+ iconRes = R.drawable.volume_up,+ titleRes = R.string.howto_voice_title,+ bodyRes = R.string.howto_voice_body,+ ),+ ),+ ),+ )++@OptIn(ExperimentalMaterial3Api::class)+@Composable+fun HowToUseScreen(onBack: () -> Unit) {+ Scaffold(+ containerColor = MaterialTheme.colorScheme.surfaceContainer,+ topBar = {+ TopAppBar(+ title = { Text(stringResource(R.string.howto_title)) },+ navigationIcon = {+ IconButton(onClick = onBack) {+ Icon(+ painter = painterResource(id = R.drawable.arrow_back),+ contentDescription = stringResource(R.string.a11y_back),+ )+ }+ },+ )+ },+ ) { paddingValues ->+ Column(+ modifier =+ Modifier+ .fillMaxSize()+ .padding(paddingValues)+ .padding(horizontal = 16.dp)+ .verticalScroll(rememberScrollState()),+ ) {+ Spacer(modifier = Modifier.height(8.dp))++ sections.forEach { section ->+ Text(+ text = stringResource(section.titleRes),+ style = MaterialTheme.typography.titleSmall,+ color = MaterialTheme.colorScheme.primary,+ modifier = Modifier.padding(top = 8.dp, bottom = 8.dp),+ )+ AppCard(+ modifier = Modifier.fillMaxWidth().testTag("export-section:" + stringResource(section.titleRes)),+ ) {+ Column(+ modifier = Modifier.padding(vertical = 8.dp),+ verticalArrangement = Arrangement.spacedBy(4.dp),+ ) {+ section.tips.forEach { tip -> TipRow(tip) }+ }+ }+ Spacer(modifier = Modifier.height(8.dp))+ }++ Spacer(modifier = Modifier.height(16.dp))+ }+ }+}++@Composable+private fun TipRow(tip: Tip) {+ Row(+ modifier =+ Modifier+ .fillMaxWidth()+ .padding(horizontal = 16.dp, vertical = 12.dp),+ verticalAlignment = Alignment.Top,+ ) {+ Icon(+ painter = painterResource(id = tip.iconRes),+ contentDescription = null,+ tint = MaterialTheme.colorScheme.primary,+ modifier = Modifier.size(24.dp).padding(top = 2.dp),+ )+ Column(+ modifier = Modifier.padding(start = 16.dp),+ ) {+ Text(+ text = stringResource(tip.titleRes),+ style = MaterialTheme.typography.bodyMedium,+ fontWeight = FontWeight.SemiBold,+ color = MaterialTheme.colorScheme.onSurface,+ )+ Text(+ text = stringResource(tip.bodyRes),+ style = MaterialTheme.typography.bodySmall,+ color = MaterialTheme.colorScheme.onSurfaceVariant,+ modifier = Modifier.padding(top = 4.dp),+ )+ }+ }+}++@Preview(showBackground = true)+@Composable+fun HowToUseScreenPreview() {+ TranslatorTheme {+ HowToUseScreen(onBack = {})+ }+}++@Preview(+ showBackground = true,+ uiMode = android.content.res.Configuration.UI_MODE_NIGHT_YES,+)+@Composable+fun HowToUseScreenDarkPreview() {+ TranslatorTheme {+ HowToUseScreen(onBack = {})+ }+}diff --git a/OCR-translation/src/main/java/dev/davidv/translator/ui/screens/LanguageAssetManagerScreen.kt b/OCR-translation/src/main/java/dev/davidv/translator/ui/screens/LanguageAssetManagerScreen.ktnew file mode 100644index 0000000..dde64e4--- /dev/null+++ b/OCR-translation/src/main/java/dev/davidv/translator/ui/screens/LanguageAssetManagerScreen.kt@@ -0,0 +1,1535 @@+/*+ * Copyright (C) 2024 David V+ *+ * This program 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.+ *+ * This program 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 <https://www.gnu.org/licenses/>.+ */++package dev.davidv.translator.ui.screens++import android.content.Context+import androidx.compose.animation.AnimatedVisibility+import androidx.compose.animation.core.animateFloatAsState+import androidx.compose.animation.core.tween+import androidx.compose.animation.expandVertically+import androidx.compose.animation.fadeIn+import androidx.compose.animation.fadeOut+import androidx.compose.animation.shrinkVertically+import androidx.compose.foundation.background+import androidx.compose.foundation.clickable+import androidx.compose.foundation.layout.Arrangement+import androidx.compose.foundation.layout.Box+import androidx.compose.foundation.layout.Column+import androidx.compose.foundation.layout.Row+import androidx.compose.foundation.layout.Spacer+import androidx.compose.foundation.layout.fillMaxSize+import androidx.compose.foundation.layout.fillMaxWidth+import androidx.compose.foundation.layout.heightIn+import androidx.compose.foundation.layout.imePadding+import androidx.compose.foundation.layout.offset+import androidx.compose.foundation.layout.padding+import androidx.compose.foundation.layout.size+import androidx.compose.foundation.layout.width+import androidx.compose.foundation.lazy.LazyColumn+import androidx.compose.foundation.lazy.itemsIndexed+import androidx.compose.foundation.rememberScrollState+import androidx.compose.foundation.shape.RoundedCornerShape+import androidx.compose.foundation.verticalScroll+import androidx.compose.material3.AlertDialog+import androidx.compose.material3.BasicAlertDialog+import androidx.compose.material3.CircularProgressIndicator+import androidx.compose.material3.ExperimentalMaterial3Api+import androidx.compose.material3.FilledTonalIconButton+import androidx.compose.material3.HorizontalDivider+import androidx.compose.material3.Icon+import androidx.compose.material3.IconButton+import androidx.compose.material3.IconButtonDefaults+import androidx.compose.material3.LocalContentColor+import androidx.compose.material3.MaterialTheme+import androidx.compose.material3.OutlinedTextField+import androidx.compose.material3.Surface+import androidx.compose.material3.Text+import androidx.compose.material3.TextButton+import androidx.compose.material3.pulltorefresh.PullToRefreshBox+import androidx.compose.runtime.Composable+import androidx.compose.runtime.DisposableEffect+import androidx.compose.runtime.Immutable+import androidx.compose.runtime.LaunchedEffect+import androidx.compose.runtime.collectAsState+import androidx.compose.runtime.getValue+import androidx.compose.runtime.mutableStateMapOf+import androidx.compose.runtime.mutableStateOf+import androidx.compose.runtime.remember+import androidx.compose.runtime.rememberCoroutineScope+import androidx.compose.runtime.setValue+import androidx.compose.ui.Alignment+import androidx.compose.ui.Modifier+import androidx.compose.ui.graphics.Color+import androidx.compose.ui.platform.testTag+import androidx.compose.ui.res.painterResource+import androidx.compose.ui.res.stringResource+import androidx.compose.ui.text.font.FontWeight+import androidx.compose.ui.unit.IntOffset+import androidx.compose.ui.unit.dp+import androidx.compose.ui.unit.sp+import dev.davidv.translator.DictionaryInfo+import dev.davidv.translator.DownloadService+import dev.davidv.translator.DownloadState+import dev.davidv.translator.Feature+import dev.davidv.translator.LangAvailability+import dev.davidv.translator.Language+import dev.davidv.translator.LanguageAvailabilityState+import dev.davidv.translator.LanguageCatalog+import dev.davidv.translator.LanguageMetadata+import dev.davidv.translator.LanguageMetadataManager+import dev.davidv.translator.LanguageStateManager+import dev.davidv.translator.R+import dev.davidv.translator.SettingsManager+import dev.davidv.translator.encodeVoiceOverride+import dev.davidv.translator.languageNameComparator+import dev.davidv.translator.localizedName+import dev.davidv.translator.parseVoiceOverride+import dev.davidv.translator.ui.components.SamplePlaybackState+import dev.davidv.translator.ui.components.SamplePlayer+import java.io.File+import kotlin.math.roundToInt++private const val ROW_EXPAND_ANIMATION_MS = 140++private sealed class FavoriteEvent {+ data class Star(+ val language: Language,+ ) : FavoriteEvent()++ data class Unstar(+ val language: Language,+ ) : FavoriteEvent()+}++private data class PendingSharedDictionaryDelete(+ val language: Language,+ val sharedWith: List<Language>,+ val deleteLanguage: Boolean,+ val deleteTts: Boolean,+)++private data class PendingTtsVoicePicker(+ val language: Language,+)++private data class PaddleUpgrade(+ val languages: List<Language>,+ val totalBytes: Long,+) {+ companion object {+ val EMPTY = PaddleUpgrade(emptyList(), 0L)+ }+}++private data class TranslationUpgrade(+ val languages: List<Language>,+ val totalBytes: Long,+) {+ companion object {+ val EMPTY = TranslationUpgrade(emptyList(), 0L)+ }+}++@OptIn(ExperimentalMaterial3Api::class)+@Composable+private fun VoicePickerDialog(+ context: Context,+ language: Language,+ catalog: LanguageCatalog,+ languageStateManager: LanguageStateManager,+ settingsManager: SettingsManager,+ ttsDownloadStates: Map<Language, DownloadState>,+ activeTtsPackId: String?,+ queuedTtsPackIds: List<String>,+ onDismiss: () -> Unit,+) {+ val regions = catalog.ttsVoicePickerRegions(language.code)+ val installedRegions = catalog.installedTtsVoicePickerRegions(language.code)+ val installedPackIds =+ remember(installedRegions) {+ installedRegions.flatMap { region -> region.voices.map { it.packId } }.toSet()+ }+ val showRegions = regions.size > 1+ val voicesWithRegion =+ remember(regions, showRegions) {+ regions.flatMap { region ->+ region.voices.map { pack -> VoiceWithRegion(pack, region.displayName.takeIf { showRegions }) }+ }+ }+ val downloaded = voicesWithRegion.filter { it.pack.packId in installedPackIds }+ val available = voicesWithRegion.filterNot { it.pack.packId in installedPackIds }++ val settings by settingsManager.settings.collectAsState()+ val override = parseVoiceOverride(settings.ttsVoiceOverrides[language.code])+ val installedDisplayNames = downloaded.map { it.pack.displayName }+ val effectiveDefaultVoiceName =+ override?.voiceName?.takeIf { it in installedDisplayNames }+ ?: installedDisplayNames.minOrNull()++ val initialDefaultVoiceName =+ remember(language.code) {+ val initialOverride =+ parseVoiceOverride(settingsManager.settings.value.ttsVoiceOverrides[language.code])+ val initialNames =+ catalog+ .installedTtsVoicePickerRegions(language.code)+ .flatMap { region -> region.voices.map { it.displayName } }+ initialOverride?.voiceName?.takeIf { it in initialNames } ?: initialNames.minOrNull()+ }++ val orderedDownloaded =+ downloaded.sortedWith(+ compareByDescending<VoiceWithRegion> { it.pack.displayName == initialDefaultVoiceName }+ .thenBy { it.regionName ?: "" }+ .thenBy { it.pack.displayName },+ )+ val orderedAvailable =+ available.sortedWith(+ compareBy<VoiceWithRegion> { it.regionName ?: "" }+ .thenBy { it.pack.displayName },+ )++ val playerScope = rememberCoroutineScope()+ val samplePlayer =+ remember(language.code) {+ SamplePlayer(+ cacheRoot = File(context.cacheDir, "tts_samples"),+ scope = playerScope,+ )+ }+ DisposableEffect(samplePlayer) {+ onDispose { samplePlayer.release() }+ }++ val ttsDownloadState = ttsDownloadStates[language]++ val setDefault: (String, String) -> Unit = { packId, voiceName ->+ settingsManager.updateSettings(+ settings.copy(+ ttsVoiceOverrides =+ settings.ttsVoiceOverrides + (language.code to encodeVoiceOverride(packId, voiceName)),+ ),+ )+ }++ BasicAlertDialog(onDismissRequest = onDismiss) {+ Surface(+ modifier = Modifier.testTag("export-section:Voice picker"),+ shape = RoundedCornerShape(28.dp),+ color = MaterialTheme.colorScheme.surfaceContainerHigh,+ tonalElevation = 6.dp,+ ) {+ Column(+ modifier = Modifier.padding(horizontal = 24.dp, vertical = 20.dp),+ ) {+ Row(verticalAlignment = Alignment.Top) {+ Column(modifier = Modifier.weight(1f)) {+ Text(+ text = language.localizedName().uppercase(),+ style = MaterialTheme.typography.labelSmall,+ color = MaterialTheme.colorScheme.primary,+ fontWeight = FontWeight.SemiBold,+ )+ Text(+ text = stringResource(R.string.langmgr_voices),+ style = MaterialTheme.typography.headlineSmall,+ fontWeight = FontWeight.SemiBold,+ )+ }+ FilledTonalIconButton(+ onClick = onDismiss,+ modifier = Modifier.size(36.dp),+ colors =+ IconButtonDefaults.filledTonalIconButtonColors(+ containerColor = MaterialTheme.colorScheme.surfaceContainerHighest,+ ),+ ) {+ Icon(+ painter = painterResource(id = R.drawable.cancel),+ contentDescription = stringResource(R.string.a11y_close),+ modifier = Modifier.size(18.dp),+ )+ }+ }+ Spacer(modifier = Modifier.size(16.dp))+ Column(+ modifier =+ Modifier+ .heightIn(max = 520.dp)+ .verticalScroll(rememberScrollState()),+ verticalArrangement = Arrangement.spacedBy(4.dp),+ ) {+ val dimAvailable = orderedDownloaded.isNotEmpty()+ if (orderedDownloaded.isNotEmpty()) {+ VoiceSectionHeader(stringResource(R.string.voice_section_downloaded))+ orderedDownloaded.forEach { entry ->+ VoiceRow(+ voice = entry,+ isInstalled = true,+ isDefault = entry.pack.displayName == effectiveDefaultVoiceName,+ dimmed = false,+ player = samplePlayer,+ onTap = { setDefault(entry.pack.packId, entry.pack.displayName) },+ downloadStatus = DownloadStatus.Idle,+ onAction = {+ if (entry.pack.displayName == effectiveDefaultVoiceName) {+ val nextPack =+ downloaded.firstOrNull { it.pack.packId != entry.pack.packId }?.pack+ val newOverrides =+ if (nextPack != null) {+ settings.ttsVoiceOverrides ++ (language.code to encodeVoiceOverride(nextPack.packId, nextPack.displayName))+ } else {+ settings.ttsVoiceOverrides - language.code+ }+ settingsManager.updateSettings(settings.copy(ttsVoiceOverrides = newOverrides))+ }+ languageStateManager.deleteTtsPack(language, entry.pack.packId)+ },+ )+ }+ }+ if (orderedAvailable.isNotEmpty()) {+ if (orderedDownloaded.isNotEmpty()) {+ HorizontalDivider(+ thickness = 1.dp,+ color = MaterialTheme.colorScheme.outlineVariant,+ modifier = Modifier.padding(vertical = 4.dp),+ )+ }+ VoiceSectionHeader(stringResource(R.string.voice_section_available))+ orderedAvailable.forEach { entry ->+ val isPackActive = activeTtsPackId == entry.pack.packId+ val isPackQueued = entry.pack.packId in queuedTtsPackIds+ val downloadStatus =+ when {+ isPackActive -> {+ val total = ttsDownloadState?.totalSize ?: 1+ val done = ttsDownloadState?.downloaded ?: 0+ val progress =+ if (total > 0) {+ (done.toFloat() / total.toFloat()).coerceIn(0f, 1f)+ } else {+ 0f+ }+ DownloadStatus.Active(progress)+ }+ isPackQueued -> DownloadStatus.Queued+ else -> DownloadStatus.Idle+ }+ VoiceRow(+ voice = entry,+ isInstalled = false,+ isDefault = false,+ dimmed = dimAvailable,+ player = samplePlayer,+ onTap = null,+ onAction = {+ if (downloadStatus == DownloadStatus.Idle) {+ DownloadService.startTtsDownload(context, language, entry.pack.packId)+ }+ },+ downloadStatus = downloadStatus,+ )+ }+ }+ }+ }+ }+ }+}++private data class VoiceWithRegion(+ val pack: dev.davidv.translator.TtsVoicePackInfo,+ val regionName: String?,+)++@Composable+private fun VoiceSectionHeader(label: String) {+ Text(+ text = label,+ style = MaterialTheme.typography.labelMedium,+ color = MaterialTheme.colorScheme.onSurfaceVariant,+ fontWeight = FontWeight.SemiBold,+ letterSpacing = 1.sp,+ modifier = Modifier.padding(top = 8.dp, bottom = 4.dp),+ )+}++private sealed interface DownloadStatus {+ data object Idle : DownloadStatus++ data class Active(val progress: Float) : DownloadStatus++ data object Queued : DownloadStatus+}++@Composable+private fun VoiceRow(+ voice: VoiceWithRegion,+ isInstalled: Boolean,+ isDefault: Boolean,+ dimmed: Boolean,+ player: SamplePlayer,+ onTap: (() -> Unit)?,+ onAction: () -> Unit,+ downloadStatus: DownloadStatus,+) {+ val pack = voice.pack+ val baseModifier = Modifier.fillMaxWidth()+ val rowModifier =+ if (onTap != null && !isDefault) {+ baseModifier.clickable(onClick = onTap)+ } else {+ baseModifier+ }+ val nameColor =+ if (dimmed) {+ MaterialTheme.colorScheme.onSurface.copy(alpha = 0.55f)+ } else {+ MaterialTheme.colorScheme.onSurface+ }+ val metaColor =+ if (dimmed) {+ MaterialTheme.colorScheme.onSurface.copy(alpha = 0.4f)+ } else {+ MaterialTheme.colorScheme.onSurface.copy(alpha = 0.6f)+ }+ val iconTint =+ if (dimmed) {+ MaterialTheme.colorScheme.onSurface.copy(alpha = 0.55f)+ } else {+ LocalContentColor.current+ }+ val nameWeight = if (isInstalled) FontWeight.Bold else FontWeight.Normal+ Row(+ modifier = rowModifier.padding(vertical = 4.dp),+ verticalAlignment = Alignment.CenterVertically,+ ) {+ Column(+ modifier = Modifier.weight(1f),+ verticalArrangement = Arrangement.spacedBy(0.dp),+ ) {+ if (isDefault) {+ Text(+ text = stringResource(R.string.langmgr_default),+ style = MaterialTheme.typography.labelSmall,+ color = MaterialTheme.colorScheme.onSurface.copy(alpha = 0.55f),+ fontWeight = FontWeight.SemiBold,+ letterSpacing = 1.sp,+ )+ }+ Text(+ text = formatVoiceName(pack.displayName),+ style = MaterialTheme.typography.bodyLarge,+ fontWeight = nameWeight,+ color = nameColor,+ maxLines = 1,+ overflow = androidx.compose.ui.text.style.TextOverflow.Ellipsis,+ )+ val parts =+ buildList {+ add(formatQualityLabel(pack.quality).replaceFirstChar { it.uppercase() })+ add(formatSize(pack.sizeBytes.toLong()))+ voice.regionName?.let { add(it) }+ }+ Text(+ text = parts.joinToString(" · "),+ style = MaterialTheme.typography.bodySmall,+ color = metaColor,+ )+ }+ Row(+ modifier = Modifier.width(88.dp),+ verticalAlignment = Alignment.CenterVertically,+ horizontalArrangement = Arrangement.End,+ ) {+ SampleButton(+ packId = pack.packId,+ sampleUrl = pack.sampleUrl,+ player = player,+ tint = iconTint,+ )+ val actionIcon = if (isInstalled) R.drawable.delete else R.drawable.download+ val actionDescription = if (isInstalled) "Delete voice" else "Download voice"+ when (downloadStatus) {+ is DownloadStatus.Active -> {+ Box(+ modifier = Modifier.size(40.dp),+ contentAlignment = Alignment.Center,+ ) {+ CircularProgressIndicator(+ progress = { downloadStatus.progress },+ modifier = Modifier.size(20.dp),+ strokeWidth = 2.dp,+ color = iconTint,+ )+ }+ }+ DownloadStatus.Queued -> {+ Box(+ modifier = Modifier.size(40.dp),+ contentAlignment = Alignment.Center,+ ) {+ CircularProgressIndicator(+ modifier = Modifier.size(18.dp),+ strokeWidth = 2.dp,+ color = iconTint.copy(alpha = 0.4f),+ )+ }+ }+ DownloadStatus.Idle -> {+ IconButton(+ onClick = onAction,+ modifier = Modifier.size(40.dp),+ ) {+ Icon(+ painter = painterResource(id = actionIcon),+ contentDescription = actionDescription,+ modifier = Modifier.size(20.dp),+ tint = iconTint,+ )+ }+ }+ }+ }+ }+}++@Composable+private fun SampleButton(+ packId: String,+ sampleUrl: String?,+ player: SamplePlayer,+ tint: Color = LocalContentColor.current,+) {+ val size = 40.dp+ if (sampleUrl == null) {+ Spacer(modifier = Modifier.size(size))+ return+ }+ val state = player.state+ val isLoading = state is SamplePlaybackState.Loading && state.packId == packId+ val isPlaying = state is SamplePlaybackState.Playing && state.packId == packId+ IconButton(+ onClick = { player.toggle(packId, sampleUrl) },+ modifier = Modifier.size(size),+ ) {+ if (isLoading) {+ CircularProgressIndicator(+ modifier = Modifier.size(18.dp),+ strokeWidth = 2.dp,+ color = tint,+ )+ } else {+ val iconRes = if (isPlaying) R.drawable.stop else R.drawable.volume_up+ val description = if (isPlaying) "Stop sample" else "Play sample"+ Icon(+ painter = painterResource(id = iconRes),+ contentDescription = description,+ modifier = Modifier.size(20.dp),+ tint = tint,+ )+ }+ }+}++@Composable+private fun FavoriteButton(+ isFavorite: Boolean,+ language: Language,+ onEvent: (FavoriteEvent) -> Unit,+) {+ IconButton(+ onClick = {+ if (isFavorite) {+ onEvent(FavoriteEvent.Unstar(language))+ } else {+ onEvent(FavoriteEvent.Star(language))+ }+ },+ modifier = Modifier.size(32.dp),+ ) {+ Icon(+ painter = painterResource(id = if (isFavorite) R.drawable.star_filled else R.drawable.star),+ contentDescription = if (isFavorite) stringResource(R.string.a11y_favorite_remove) else stringResource(R.string.a11y_favorite_add),+ tint = if (isFavorite) Color.Unspecified else MaterialTheme.colorScheme.onSurface.copy(alpha = 0.6f),+ modifier = Modifier.size(18.dp),+ )+ }+}++private data class LanguageFeatureRow(+ @androidx.annotation.StringRes val labelRes: Int,+ val secondaryLabel: String? = null,+ val installed: Boolean,+ val downloadState: DownloadState?,+ val onDownload: () -> Unit,+ val onInstalledAction: () -> Unit,+ val onCancel: () -> Unit,+ @androidx.annotation.DrawableRes val installedIconRes: Int = R.drawable.delete,+ val installedDescription: String = "Delete",+ val actionTag: String? = null,+)++@Immutable+private data class LanguageAssetRow(+ val language: Language,+ val availability: LangAvailability,+ val dictionaryInfo: DictionaryInfo?,+ val translationVisible: Boolean,+ val dictionaryVisible: Boolean,+ val ttsVisible: Boolean,+ val translationSizeBytes: Long,+ val ttsSizeBytes: Long,+) {+ val translationInstalled: Boolean get() = translationVisible && availability.translatorFiles+ val dictionaryInstalled: Boolean get() = dictionaryVisible && availability.dictionaryFiles+ val ttsInstalled: Boolean get() = ttsVisible && availability.ttsFiles+ val visibleFeatureCount: Int get() = listOf(translationVisible, dictionaryVisible, ttsVisible).count { it }+ val installedFeatureCount: Int get() = listOf(translationInstalled, dictionaryInstalled, ttsInstalled).count { it }+ val fullyInstalled: Boolean get() = visibleFeatureCount > 0 && installedFeatureCount == visibleFeatureCount+ val fullyMissing: Boolean get() = installedFeatureCount == 0+ val partiallyInstalled: Boolean get() = installedFeatureCount in 1 until visibleFeatureCount+}++@OptIn(ExperimentalMaterial3Api::class)+@Composable+fun LanguageAssetManagerScreen(+ context: Context,+ languageStateManager: LanguageStateManager,+ languageMetadataManager: LanguageMetadataManager,+ settingsManager: SettingsManager,+ catalog: LanguageCatalog?,+ languageAvailabilityState: LanguageAvailabilityState,+ downloadStates: Map<Language, DownloadState>,+ dictionaryDownloadStates: Map<Language, DownloadState>,+ ttsDownloadStates: Map<Language, DownloadState>,+ activeTtsPackIds: Map<Language, String> = emptyMap(),+ queuedTtsPackIds: Map<Language, List<String>> = emptyMap(),+ repairDownloadState: DownloadState = DownloadState(),+) {+ val languageMetadata by languageMetadataManager.metadata.collectAsState()+ val expandedLanguages = remember { mutableStateMapOf<String, Boolean>() }+ var isRefreshing by remember { mutableStateOf(false) }+ var filterQuery by remember { mutableStateOf("") }+ var pendingSharedDictionaryDelete by remember { mutableStateOf<PendingSharedDictionaryDelete?>(null) }+ var pendingTtsVoicePicker by remember { mutableStateOf<PendingTtsVoicePicker?>(null) }+ val catalogRefreshToken by languageStateManager.catalogRefreshToken.collectAsState()++ LaunchedEffect(catalogRefreshToken) {+ isRefreshing = false+ }++ // Re-check the filesystem on entry: install state can drift without a+ // download event (files lost to storage issues, a newly fetched catalog+ // orphaning an on-disk variant), and this screen is where that surfaces+ // as the repair banner.+ LaunchedEffect(Unit) {+ languageStateManager.refreshLanguageAvailability()+ }++ val normalizedFilter = filterQuery.trim().lowercase()+ val rows =+ remember(catalog, languageAvailabilityState.availableLanguages, normalizedFilter) {+ catalog+ ?.let { loadedCatalog ->+ languageAvailabilityState.availableLanguages+ .sortedWith(compareBy(languageNameComparator()) { it.language.localizedName() })+ .mapNotNull { entry ->+ val language = entry.language+ val availability = entry.availability+ val dictInfo = loadedCatalog.dictionaryInfoFor(language)+ val translationVisible = !language.isEnglish+ val dictionaryVisible = dictInfo != null+ val ttsVisible = loadedCatalog.hasTtsVoices(language.code)+ if (!translationVisible && !dictionaryVisible && !ttsVisible) {+ null+ } else {+ LanguageAssetRow(+ language = language,+ availability = availability,+ dictionaryInfo = dictInfo,+ translationVisible = translationVisible,+ dictionaryVisible = dictionaryVisible,+ ttsVisible = ttsVisible,+ translationSizeBytes = loadedCatalog.sizeBytesForFeature(language.code, Feature.CORE),+ ttsSizeBytes = loadedCatalog.sizeBytesForFeature(language.code, Feature.TTS),+ )+ }+ }.filter { row ->+ if (normalizedFilter.isBlank()) {+ true+ } else {+ val language = row.language+ val haystack =+ listOf(language.localizedName(), language.displayName, language.shortDisplayName, language.code)+ .joinToString(" ")+ .lowercase()+ normalizedFilter in haystack+ }+ }+ }+ ?: emptyList()+ }+ // Packs with files on disk but missing required ones (partial download, or a+ // catalog change that orphaned the installed variant): without a repair these+ // read as not-installed and their feature silently stops working (issue #246).+ val repairPlanSize =+ remember(catalog, catalogRefreshToken, repairDownloadState.isCompleted) {+ catalog?.planRepair()?.takeIf { it.tasks.isNotEmpty() }?.totalSize?.toLong() ?: 0L+ }++ val ppocrModelUpgrade =+ remember(catalog, rows, catalogRefreshToken) {+ if (catalog == null) {+ PaddleUpgrade.EMPTY+ } else {+ val languages =+ rows+ .filter { "ppocr" in catalog.installedOcrEngines(it.language.code) }+ .map { it.language }+ val plan = catalog.planOcrEngineUpgrades(languages.map { it.code }, "ppocr")+ if (plan.tasks.isEmpty()) {+ PaddleUpgrade.EMPTY+ } else {+ PaddleUpgrade(languages = languages, totalBytes = plan.totalSize.toLong())+ }+ }+ }++ val translationUpgrade =+ remember(catalog, rows, catalogRefreshToken) {+ if (catalog == null) {+ TranslationUpgrade.EMPTY+ } else {+ val codes = catalog.translationUpgradeLanguageCodes().toSet()+ val languages = rows.map { it.language }.filter { it.code in codes }+ val plan = catalog.planTranslationUpgrades(languages.map { it.code })+ if (plan.tasks.isEmpty()) {+ TranslationUpgrade.EMPTY+ } else {+ TranslationUpgrade(languages = languages, totalBytes = plan.totalSize.toLong())+ }+ }+ }++ val sharedDictionaryUsersByLanguageCode =+ remember(rows) {+ rows+ .asSequence()+ .filter { it.dictionaryInstalled }+ .groupBy { it.language.dictionaryCode }+ .mapValues { (_, installedRows) ->+ installedRows+ .map { it.language }+ .sortedBy { it.displayName }+ }.flatMap { (_, languages) ->+ languages.map { language ->+ language.code to languages.filter { it.code != language.code }+ }+ }.toMap()+ }++ PullToRefreshBox(+ isRefreshing = isRefreshing,+ onRefresh = {+ isRefreshing = true+ DownloadService.fetchCatalog(context)+ },+ modifier =+ Modifier+ .fillMaxSize()+ .imePadding(),+ ) {+ Column(+ modifier =+ Modifier+ .fillMaxSize()+ .padding(horizontal = 12.dp),+ ) {+ OutlinedTextField(+ value = filterQuery,+ onValueChange = { filterQuery = it },+ modifier =+ Modifier+ .fillMaxWidth()+ .padding(top = 2.dp, bottom = 6.dp),+ singleLine = true,+ label = { Text(stringResource(R.string.langmgr_filter)) },+ )++ if (repairPlanSize > 0L) {+ RepairCard(+ totalBytes = repairPlanSize,+ isDownloading = repairDownloadState.isDownloading,+ onRepair = { DownloadService.startRepairDownload(context) },+ )+ }++ if (ppocrModelUpgrade.languages.isNotEmpty()) {+ UpgradeCard(+ text = stringResource(R.string.langmgr_ocr_upgrade_available),+ totalBytes = ppocrModelUpgrade.totalBytes,+ onDownload = {+ DownloadService.startOcrEngineUpgrades(context, ppocrModelUpgrade.languages, "ppocr")+ },+ )+ }++ if (translationUpgrade.languages.isNotEmpty()) {+ UpgradeCard(+ text =+ stringResource(+ R.string.langmgr_translation_upgrade_available,+ translationUpgrade.languages.joinToString(", ") { it.displayName },+ ),+ totalBytes = translationUpgrade.totalBytes,+ onDownload = {+ DownloadService.startTranslationUpgrades(context, translationUpgrade.languages)+ },+ )+ }++ LazyColumn(+ modifier = Modifier.fillMaxSize(),+ ) {+ itemsIndexed(rows, key = { _, row -> row.language.code }) { index, row ->+ val expanded = expandedLanguages[row.language.code] == true+ val sharedDictionaryUsers = sharedDictionaryUsersByLanguageCode[row.language.code].orEmpty()+ LanguageAssetCard(+ row = row,+ zebra = index % 2 == 1,+ expanded = expanded,+ isFavorite = languageMetadata[row.language]?.favorite ?: false,+ translationDownloadState = downloadStates[row.language],+ dictionaryDownloadState = dictionaryDownloadStates[row.language],+ ttsDownloadState = ttsDownloadStates[row.language],+ onToggleExpanded = {+ expandedLanguages[row.language.code] = !expanded+ },+ onFavorite = { event ->+ when (event) {+ is FavoriteEvent.Star -> {+ val current = languageMetadata[event.language] ?: LanguageMetadata()+ languageMetadataManager.updateLanguage(event.language, current.copy(favorite = true))+ }++ is FavoriteEvent.Unstar -> {+ val current = languageMetadata[event.language] ?: LanguageMetadata()+ languageMetadataManager.updateLanguage(event.language, current.copy(favorite = false))+ }+ }+ },+ onDownloadTranslation = {+ DownloadService.startDownload(context, row.language)+ },+ onDeleteTranslation = {+ languageStateManager.deleteLanguage(row.language)+ },+ onCancelTranslation = {+ DownloadService.cancelDownload(context, row.language)+ },+ onDownloadDictionary = {+ DownloadService.startDictDownload(context, row.language, row.dictionaryInfo)+ },+ onDeleteDictionary = {+ if (sharedDictionaryUsers.isNotEmpty()) {+ pendingSharedDictionaryDelete =+ PendingSharedDictionaryDelete(+ language = row.language,+ sharedWith = sharedDictionaryUsers,+ deleteLanguage = false,+ deleteTts = false,+ )+ } else {+ languageStateManager.deleteDict(row.language)+ }+ },+ onCancelDictionary = {+ DownloadService.cancelDictDownload(context, row.language)+ },+ onDownloadTts = {+ pendingTtsVoicePicker = PendingTtsVoicePicker(row.language)+ },+ onDeleteTts = {+ languageStateManager.deleteTts(row.language)+ },+ onCancelTts = {+ DownloadService.cancelTtsDownload(context, row.language)+ },+ onDownloadAll = {+ if (row.translationVisible && !row.translationInstalled) {+ DownloadService.startDownload(context, row.language)+ }+ if (row.dictionaryVisible && !row.dictionaryInstalled) {+ DownloadService.startDictDownload(context, row.language, row.dictionaryInfo)+ }+ if (row.ttsVisible && !row.ttsInstalled) {+ DownloadService.startTtsDownload(context, row.language)+ }+ },+ onDeleteAll = {+ if (row.dictionaryInstalled && sharedDictionaryUsers.isNotEmpty()) {+ pendingSharedDictionaryDelete =+ PendingSharedDictionaryDelete(+ language = row.language,+ sharedWith = sharedDictionaryUsers,+ deleteLanguage = row.translationInstalled,+ deleteTts = row.ttsInstalled,+ )+ } else {+ if (row.translationInstalled) {+ languageStateManager.deleteLanguage(row.language)+ }+ if (row.ttsInstalled) {+ languageStateManager.deleteTts(row.language)+ }+ if (row.dictionaryInstalled) {+ languageStateManager.deleteDict(row.language)+ }+ }+ },+ onCancelAll = {+ if (downloadStates[row.language]?.isDownloading == true) {+ DownloadService.cancelDownload(context, row.language)+ }+ if (dictionaryDownloadStates[row.language]?.isDownloading == true) {+ DownloadService.cancelDictDownload(context, row.language)+ }+ if (ttsDownloadStates[row.language]?.isDownloading == true) {+ DownloadService.cancelTtsDownload(context, row.language)+ }+ },+ )+ }+ }+ }+ }+ pendingSharedDictionaryDelete?.let { pendingDelete ->+ val sharedNames = pendingDelete.sharedWith.joinToString(", ") { it.displayName }+ AlertDialog(+ onDismissRequest = { pendingSharedDictionaryDelete = null },+ title = { Text(stringResource(R.string.langmgr_delete_shared_title)) },+ text = {+ Text(+ stringResource(R.string.langmgr_delete_shared_body, sharedNames),+ )+ },+ confirmButton = {+ TextButton(+ onClick = {+ if (pendingDelete.deleteLanguage) {+ languageStateManager.deleteLanguage(pendingDelete.language)+ }+ if (pendingDelete.deleteTts) {+ languageStateManager.deleteTts(pendingDelete.language)+ }+ languageStateManager.deleteDict(pendingDelete.language)+ pendingSharedDictionaryDelete = null+ },+ ) {+ Text(stringResource(R.string.common_ok))+ }+ },+ dismissButton = {+ TextButton(+ onClick = { pendingSharedDictionaryDelete = null },+ ) {+ Text(stringResource(R.string.common_cancel))+ }+ },+ )+ }++ pendingTtsVoicePicker?.let { pendingPicker ->+ val pickerCatalog = catalog ?: return@let+ VoicePickerDialog(+ context = context,+ language = pendingPicker.language,+ catalog = pickerCatalog,+ languageStateManager = languageStateManager,+ settingsManager = settingsManager,+ ttsDownloadStates = ttsDownloadStates,+ activeTtsPackId = activeTtsPackIds[pendingPicker.language],+ queuedTtsPackIds = queuedTtsPackIds[pendingPicker.language].orEmpty(),+ onDismiss = { pendingTtsVoicePicker = null },+ )+ }+}++@Composable+private fun LanguageAssetCard(+ row: LanguageAssetRow,+ zebra: Boolean,+ expanded: Boolean,+ isFavorite: Boolean,+ translationDownloadState: DownloadState?,+ dictionaryDownloadState: DownloadState?,+ ttsDownloadState: DownloadState?,+ onToggleExpanded: () -> Unit,+ onFavorite: (FavoriteEvent) -> Unit,+ onDownloadTranslation: () -> Unit,+ onDeleteTranslation: () -> Unit,+ onCancelTranslation: () -> Unit,+ onDownloadDictionary: () -> Unit,+ onDeleteDictionary: () -> Unit,+ onCancelDictionary: () -> Unit,+ onDownloadTts: () -> Unit,+ onDeleteTts: () -> Unit,+ onCancelTts: () -> Unit,+ onDownloadAll: () -> Unit,+ onDeleteAll: () -> Unit,+ onCancelAll: () -> Unit,+) {+ val totalVisibleSize =+ (if (row.translationVisible) row.translationSizeBytes else 0L) ++ (if (row.dictionaryVisible) row.dictionaryInfo?.size ?: 0L else 0L) ++ (if (row.ttsVisible) row.ttsSizeBytes else 0L)+ val collapsedDownloadState =+ when {+ row.fullyMissing -> translationDownloadState ?: dictionaryDownloadState ?: ttsDownloadState+ row.fullyInstalled -> null+ else -> null+ }+ val clusterToStarSpacing =+ if (expanded || row.partiallyInstalled) {+ 8.dp+ } else {+ 2.dp+ }++ Column(+ modifier =+ Modifier+ .fillMaxWidth()+ .background(+ if (zebra) {+ MaterialTheme.colorScheme.onSurface.copy(alpha = 0.035f)+ } else {+ Color.Transparent+ },+ )+ .padding(vertical = 1.dp),+ ) {+ Row(+ modifier =+ Modifier+ .fillMaxWidth()+ .clickable { onToggleExpanded() }+ .padding(vertical = 1.dp),+ verticalAlignment = Alignment.CenterVertically,+ ) {+ IconButton(+ onClick = onToggleExpanded,+ modifier = Modifier.size(28.dp),+ ) {+ Icon(+ painter = painterResource(id = if (expanded) R.drawable.expandless else R.drawable.expandmore),+ contentDescription = if (expanded) stringResource(R.string.a11y_collapse) else stringResource(R.string.a11y_expand),+ modifier = Modifier.size(18.dp),+ )+ }++ Column(+ modifier = Modifier.weight(1f),+ verticalArrangement = Arrangement.spacedBy(0.dp),+ ) {+ Text(+ text = row.language.localizedName(),+ style = MaterialTheme.typography.bodyLarge,+ fontWeight = FontWeight.SemiBold,+ )+ Text(+ text = formatSize(totalVisibleSize),+ style = MaterialTheme.typography.bodySmall,+ color = MaterialTheme.colorScheme.onSurfaceVariant,+ )+ }++ Row(+ verticalAlignment = Alignment.CenterVertically,+ horizontalArrangement = Arrangement.End,+ ) {+ Box(+ modifier = Modifier.width(60.dp),+ contentAlignment = Alignment.CenterEnd,+ ) {+ when {+ expanded || row.partiallyInstalled -> {+ FeaturePresenceIndicators(row)+ }++ else -> {+ AggregateActionButton(+ downloadState = collapsedDownloadState,+ isInstalled = row.fullyInstalled,+ onDownload = onDownloadAll,+ onDelete = onDeleteAll,+ onCancel = onCancelAll,+ )+ }+ }+ }++ Spacer(modifier = Modifier.width(clusterToStarSpacing))++ FavoriteButton(+ isFavorite = isFavorite,+ language = row.language,+ onEvent = onFavorite,+ )+ }+ }++ AnimatedVisibility(+ visible = expanded,+ enter = expandVertically(animationSpec = tween(ROW_EXPAND_ANIMATION_MS)) + fadeIn(animationSpec = tween(ROW_EXPAND_ANIMATION_MS)),+ exit = shrinkVertically(animationSpec = tween(ROW_EXPAND_ANIMATION_MS)) + fadeOut(animationSpec = tween(ROW_EXPAND_ANIMATION_MS / 2)),+ ) {+ Column(+ modifier =+ Modifier+ .fillMaxWidth()+ .padding(start = 28.dp, end = 0.dp, bottom = 1.dp),+ ) {+ val featureRows =+ buildFeatureRows(+ row = row,+ translationDownloadState = translationDownloadState,+ dictionaryDownloadState = dictionaryDownloadState,+ ttsDownloadState = ttsDownloadState,+ onDownloadTranslation = onDownloadTranslation,+ onDeleteTranslation = onDeleteTranslation,+ onCancelTranslation = onCancelTranslation,+ onDownloadDictionary = onDownloadDictionary,+ onDeleteDictionary = onDeleteDictionary,+ onCancelDictionary = onCancelDictionary,+ onDownloadTts = onDownloadTts,+ onDeleteTts = onDeleteTts,+ onCancelTts = onCancelTts,+ )+ featureRows.forEach { featureRow ->+ FeatureRow(featureRow)+ }+ }+ }+ }+}++private fun buildFeatureRows(+ row: LanguageAssetRow,+ translationDownloadState: DownloadState?,+ dictionaryDownloadState: DownloadState?,+ ttsDownloadState: DownloadState?,+ onDownloadTranslation: () -> Unit,+ onDeleteTranslation: () -> Unit,+ onCancelTranslation: () -> Unit,+ onDownloadDictionary: () -> Unit,+ onDeleteDictionary: () -> Unit,+ onCancelDictionary: () -> Unit,+ onDownloadTts: () -> Unit,+ onDeleteTts: () -> Unit,+ onCancelTts: () -> Unit,+): List<LanguageFeatureRow> {+ val featureRows = mutableListOf<LanguageFeatureRow>()++ if (row.translationVisible) {+ featureRows +=+ LanguageFeatureRow(+ labelRes = R.string.feature_translation,+ secondaryLabel = formatSize(row.translationSizeBytes),+ installed = row.translationInstalled,+ downloadState = translationDownloadState,+ onDownload = onDownloadTranslation,+ onInstalledAction = onDeleteTranslation,+ onCancel = onCancelTranslation,+ )+ }++ if (row.dictionaryVisible) {+ featureRows +=+ LanguageFeatureRow(+ labelRes = R.string.feature_dictionary,+ secondaryLabel =+ buildDictionarySecondaryLabel(+ sizeBytes = row.dictionaryInfo?.size ?: 0L,+ type = row.dictionaryInfo?.type,+ ),+ installed = row.dictionaryInstalled,+ downloadState = dictionaryDownloadState,+ onDownload = onDownloadDictionary,+ onInstalledAction = onDeleteDictionary,+ onCancel = onCancelDictionary,+ )+ }++ if (row.ttsVisible) {+ featureRows +=+ LanguageFeatureRow(+ labelRes = R.string.feature_tts,+ secondaryLabel = formatSize(row.ttsSizeBytes),+ installed = row.ttsInstalled,+ downloadState = ttsDownloadState,+ onDownload = onDownloadTts,+ onInstalledAction = onDownloadTts,+ onCancel = onCancelTts,+ installedIconRes = R.drawable.settings,+ installedDescription = "Manage voices",+ actionTag = "export-trigger:voice",+ )+ }++ return featureRows+}++@Composable+private fun FeatureRow(featureRow: LanguageFeatureRow) {+ Row(+ modifier =+ Modifier+ .fillMaxWidth()+ .padding(vertical = 0.dp),+ verticalAlignment = Alignment.CenterVertically,+ ) {+ Row(+ modifier = Modifier.weight(1f),+ verticalAlignment = Alignment.CenterVertically,+ horizontalArrangement = Arrangement.spacedBy(6.dp),+ ) {+ Text(+ text = stringResource(featureRow.labelRes),+ style = MaterialTheme.typography.bodyMedium,+ )+ featureRow.secondaryLabel?.let { secondaryLabel ->+ Text(+ text = secondaryLabel,+ style = MaterialTheme.typography.bodySmall,+ color = MaterialTheme.colorScheme.onSurface.copy(alpha = 0.55f),+ )+ }+ }+ FeatureActionButton(+ downloadState = featureRow.downloadState,+ isInstalled = featureRow.installed,+ onDownload = featureRow.onDownload,+ onInstalledAction = featureRow.onInstalledAction,+ onCancel = featureRow.onCancel,+ installedIconRes = featureRow.installedIconRes,+ installedDescription = featureRow.installedDescription,+ actionTag = featureRow.actionTag,+ )+ }+}++// Non-translatable single-letter glyph marking the translation feature.+private const val TRANSLATION_FEATURE_BADGE = "T"++@Composable+private fun FeaturePresenceIndicators(row: LanguageAssetRow) {+ val installedTint = MaterialTheme.colorScheme.onSurface+ val missingTint = MaterialTheme.colorScheme.onSurface.copy(alpha = 0.30f)++ Row(+ verticalAlignment = Alignment.CenterVertically,+ horizontalArrangement = Arrangement.spacedBy(8.dp),+ ) {+ if (row.translationVisible) {+ Text(+ text = TRANSLATION_FEATURE_BADGE,+ style = MaterialTheme.typography.bodyMedium,+ fontWeight = FontWeight.Bold,+ color =+ if (row.translationInstalled) {+ installedTint+ } else {+ missingTint+ },+ )+ }++ if (row.dictionaryVisible) {+ Icon(+ painter = painterResource(id = R.drawable.dictionary),+ contentDescription = stringResource(R.string.a11y_dictionary_status),+ tint =+ if (row.dictionaryInstalled) {+ installedTint+ } else {+ missingTint+ },+ modifier = Modifier.size(20.dp),+ )+ }++ if (row.ttsVisible) {+ Icon(+ painter = painterResource(id = R.drawable.volume_up),+ contentDescription = stringResource(R.string.a11y_tts_status),+ tint =+ if (row.ttsInstalled) {+ installedTint+ } else {+ missingTint+ },+ modifier =+ Modifier+ .size(22.dp)+ .offset { IntOffset(1, 0) },+ )+ }+ }+}++@Composable+private fun AggregateActionButton(+ downloadState: DownloadState?,+ isInstalled: Boolean,+ onDownload: () -> Unit,+ onDelete: () -> Unit,+ onCancel: () -> Unit,+) {+ if (downloadState?.isDownloading == true) {+ ProgressIconButton(+ downloadState = downloadState,+ onClick = onCancel,+ contentDescription = stringResource(R.string.a11y_cancel_download),+ )+ return+ }++ IconButton(+ onClick = if (isInstalled) onDelete else onDownload,+ modifier = Modifier.size(32.dp),+ ) {+ Icon(+ painter =+ painterResource(+ id =+ when {+ isInstalled -> R.drawable.delete+ downloadState?.isCancelled == true || downloadState?.error != null -> R.drawable.refresh+ else -> R.drawable.add+ },+ ),+ contentDescription =+ when {+ isInstalled -> stringResource(R.string.a11y_delete)+ downloadState?.isCancelled == true || downloadState?.error != null -> stringResource(R.string.a11y_retry_download)+ else -> stringResource(R.string.a11y_download)+ },+ modifier = Modifier.size(18.dp),+ )+ }+}++@Composable+private fun FeatureActionButton(+ downloadState: DownloadState?,+ isInstalled: Boolean,+ onDownload: () -> Unit,+ onInstalledAction: () -> Unit,+ onCancel: () -> Unit,+ @androidx.annotation.DrawableRes installedIconRes: Int,+ installedDescription: String,+ actionTag: String? = null,+) {+ if (downloadState?.isDownloading == true) {+ ProgressIconButton(+ downloadState = downloadState,+ onClick = onCancel,+ contentDescription = stringResource(R.string.a11y_cancel_download),+ )+ return+ }++ IconButton(+ onClick = if (isInstalled) onInstalledAction else onDownload,+ modifier =+ Modifier+ .size(32.dp)+ .then(if (actionTag != null) Modifier.testTag(actionTag) else Modifier),+ ) {+ Icon(+ painter =+ painterResource(+ id =+ when {+ isInstalled -> installedIconRes+ downloadState?.isCancelled == true || downloadState?.error != null -> R.drawable.refresh+ else -> R.drawable.add+ },+ ),+ contentDescription =+ when {+ isInstalled -> installedDescription+ downloadState?.isCancelled == true || downloadState?.error != null -> stringResource(R.string.a11y_retry_download)+ else -> stringResource(R.string.a11y_download_feature)+ },+ modifier = Modifier.size(18.dp),+ )+ }+}++@Composable+private fun ProgressIconButton(+ downloadState: DownloadState,+ onClick: () -> Unit,+ contentDescription: String,+) {+ Box(+ contentAlignment = Alignment.Center,+ modifier = Modifier.size(32.dp),+ ) {+ val targetProgress =+ if (downloadState.totalSize > 0) {+ downloadState.downloaded.toFloat() / downloadState.totalSize.toFloat()+ } else {+ 0f+ }+ val animatedProgress by animateFloatAsState(+ targetValue = targetProgress,+ animationSpec = tween(durationMillis = 300),+ label = "progress",+ )++ CircularProgressIndicator(+ progress = { animatedProgress },+ modifier = Modifier.size(22.dp),+ strokeWidth = 2.dp,+ )+ IconButton(+ onClick = onClick,+ modifier = Modifier.size(28.dp),+ ) {+ Icon(+ painter = painterResource(id = R.drawable.cancel),+ contentDescription = contentDescription,+ modifier = Modifier.size(14.dp),+ )+ }+ }+}++@Composable+private fun RepairCard(+ totalBytes: Long,+ isDownloading: Boolean,+ onRepair: () -> Unit,+) {+ Surface(+ color = MaterialTheme.colorScheme.errorContainer,+ shape = RoundedCornerShape(12.dp),+ modifier =+ Modifier+ .fillMaxWidth()+ .padding(bottom = 6.dp),+ ) {+ Row(+ modifier = Modifier.padding(horizontal = 12.dp, vertical = 8.dp),+ verticalAlignment = Alignment.CenterVertically,+ ) {+ Text(+ text = stringResource(R.string.langmgr_repair_needed),+ style = MaterialTheme.typography.bodySmall,+ color = MaterialTheme.colorScheme.onErrorContainer,+ modifier = Modifier.weight(1f),+ )+ if (isDownloading) {+ CircularProgressIndicator(modifier = Modifier.size(20.dp))+ } else {+ TextButton(onClick = onRepair) {+ Text(stringResource(R.string.langmgr_repair_size, formatSize(totalBytes)))+ }+ }+ }+ }+}++@Composable+private fun UpgradeCard(+ text: String,+ totalBytes: Long,+ onDownload: () -> Unit,+) {+ Surface(+ color = MaterialTheme.colorScheme.surfaceContainerHigh,+ shape = RoundedCornerShape(12.dp),+ modifier =+ Modifier+ .fillMaxWidth()+ .padding(bottom = 6.dp),+ ) {+ Row(+ modifier = Modifier.padding(horizontal = 12.dp, vertical = 8.dp),+ verticalAlignment = Alignment.CenterVertically,+ ) {+ Text(+ text = text,+ style = MaterialTheme.typography.bodySmall,+ modifier = Modifier.weight(1f),+ )+ TextButton(onClick = onDownload) {+ Text(stringResource(R.string.langmgr_download_size, formatSize(totalBytes)))+ }+ }+ }+}++private fun formatSize(sizeBytes: Long): String {+ val sizeMiB = sizeBytes / (1024f * 1024f)+ return if (sizeMiB < 1f) {+ "<1 MB"+ } else {+ "${sizeMiB.roundToInt()} MB"+ }+}++private fun buildDictionarySecondaryLabel(+ sizeBytes: Long,+ type: String?,+): String? {+ val parts = mutableListOf(formatSize(sizeBytes))+ dictionaryTypeLabel(type)?.let(parts::add)+ return parts.takeIf { it.isNotEmpty() }?.joinToString(", ")+}++private fun dictionaryTypeLabel(type: String?): String? =+ when (type?.lowercase()) {+ null, "" -> null+ "english" -> "English"+ "bilingual" -> "Bilingual"+ else -> type.replaceFirstChar { if (it.isLowerCase()) it.titlecase() else it.toString() }+ }++private fun formatQualityLabel(quality: String?): String =+ when (quality?.lowercase()) {+ "x_low" -> "Extra-low"+ null, "" -> "Unknown"+ else -> quality.replace('_', '-').replaceFirstChar { if (it.isLowerCase()) it.titlecase() else it.toString() }+ }++private fun formatVoiceName(voice: String): String =+ voice+ .replace('_', ' ')+ .replace('-', ' ')+ .split(' ')+ .filter { it.isNotBlank() }+ .joinToString(" ") { token ->+ token.replaceFirstChar { if (it.isLowerCase()) it.titlecase() else it.toString() }+ }diff --git a/OCR-translation/src/main/java/dev/davidv/translator/ui/screens/LiveCameraScreen.kt b/OCR-translation/src/main/java/dev/davidv/translator/ui/screens/LiveCameraScreen.ktnew file mode 100644index 0000000..ba91cf5--- /dev/null+++ b/OCR-translation/src/main/java/dev/davidv/translator/ui/screens/LiveCameraScreen.kt@@ -0,0 +1,1028 @@+/*+ * Copyright (C) 2024 David V+ *+ * This program 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.+ *+ * This program 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 <https://www.gnu.org/licenses/>.+ */++package dev.davidv.translator.ui.screens++import android.Manifest+import android.annotation.SuppressLint+import android.app.Activity+import android.content.pm.ActivityInfo+import android.content.pm.PackageManager+import android.hardware.camera2.CameraCaptureSession+import android.hardware.camera2.CameraCharacteristics+import android.hardware.camera2.CameraMetadata+import android.hardware.camera2.CaptureRequest+import android.hardware.camera2.CaptureResult+import android.hardware.camera2.TotalCaptureResult+import android.net.Uri+import android.util.Log+import android.view.GestureDetector+import android.view.MotionEvent+import android.view.ScaleGestureDetector+import android.widget.Toast+import androidx.activity.compose.BackHandler+import androidx.activity.compose.rememberLauncherForActivityResult+import androidx.activity.result.contract.ActivityResultContracts+import androidx.camera.camera2.interop.Camera2CameraControl+import androidx.camera.camera2.interop.Camera2CameraInfo+import androidx.camera.camera2.interop.Camera2Interop+import androidx.camera.camera2.interop.CaptureRequestOptions+import androidx.camera.core.Camera+import androidx.camera.core.CameraSelector+import androidx.camera.core.FocusMeteringAction+import androidx.camera.core.ImageCapture+import androidx.camera.core.ImageCaptureException+import androidx.camera.core.Preview+import androidx.camera.core.SurfaceOrientedMeteringPointFactory+import androidx.camera.core.resolutionselector.ResolutionSelector+import androidx.camera.core.resolutionselector.ResolutionStrategy+import androidx.camera.lifecycle.ProcessCameraProvider+import androidx.compose.animation.core.Animatable+import androidx.compose.animation.core.tween+import androidx.compose.foundation.background+import androidx.compose.foundation.border+import androidx.compose.foundation.clickable+import androidx.compose.foundation.layout.Arrangement+import androidx.compose.foundation.layout.Box+import androidx.compose.foundation.layout.Column+import androidx.compose.foundation.layout.Row+import androidx.compose.foundation.layout.Spacer+import androidx.compose.foundation.layout.absoluteOffset+import androidx.compose.foundation.layout.fillMaxSize+import androidx.compose.foundation.layout.fillMaxWidth+import androidx.compose.foundation.layout.navigationBarsPadding+import androidx.compose.foundation.layout.padding+import androidx.compose.foundation.layout.size+import androidx.compose.foundation.layout.statusBarsPadding+import androidx.compose.foundation.layout.width+import androidx.compose.foundation.shape.CircleShape+import androidx.compose.foundation.shape.RoundedCornerShape+import androidx.compose.material3.Icon+import androidx.compose.material3.IconButton+import androidx.compose.material3.LocalContentColor+import androidx.compose.material3.Text+import androidx.compose.runtime.Composable+import androidx.compose.runtime.CompositionLocalProvider+import androidx.compose.runtime.DisposableEffect+import androidx.compose.runtime.LaunchedEffect+import androidx.compose.runtime.collectAsState+import androidx.compose.runtime.getValue+import androidx.compose.runtime.mutableStateOf+import androidx.compose.runtime.remember+import androidx.compose.runtime.setValue+import androidx.compose.ui.AbsoluteAlignment+import androidx.compose.ui.Alignment+import androidx.compose.ui.Modifier+import androidx.compose.ui.draw.alpha+import androidx.compose.ui.draw.clip+import androidx.compose.ui.draw.scale+import androidx.compose.ui.geometry.Offset+import androidx.compose.ui.graphics.Color+import androidx.compose.ui.layout.onSizeChanged+import androidx.compose.ui.platform.LocalContext+import androidx.compose.ui.platform.LocalDensity+import androidx.compose.ui.platform.LocalLifecycleOwner+import androidx.compose.ui.res.painterResource+import androidx.compose.ui.res.stringResource+import androidx.compose.ui.unit.IntOffset+import androidx.compose.ui.unit.dp+import androidx.compose.ui.viewinterop.AndroidView+import androidx.core.content.ContextCompat+import androidx.core.content.FileProvider+import dev.davidv.translator.Language+import dev.davidv.translator.LanguageAvailabilityState+import dev.davidv.translator.LanguageMetadata+import dev.davidv.translator.LivePlanarOcrEngine+import dev.davidv.translator.R+import dev.davidv.translator.TranslatorMessage+import dev.davidv.translator.ui.components.LanguageSelector+import dev.davidv.translator.ui.components.LiveGlSurfaceView+import java.io.File+import java.util.concurrent.Executor+import android.util.Size as AndroidSize++private const val TAG = "LiveCameraScreen"+private val TARGET_RESOLUTION = AndroidSize(1080, 1920)+private val PREVIEW_RESOLUTION = AndroidSize(1080, 1920)++/** Minimum change in target focus (diopters, 1/m) before we re-issue a+ * capture request. A deadband: holding the camera still leaves scale+ * essentially constant, so without it we'd churn `setCaptureRequestOptions`+ * every frame and chase sub-pixel scale jitter into focus jitter. */+private const val FOCUS_UPDATE_DEADBAND_DIOPTERS = 0.5f++/** EMA weight applied to the raw tracker `scale` before it drives focus.+ * Handheld jitter pushes per-frame scale around by a few % even on a+ * static scene; smoothing it absorbs that without adding meaningful lag+ * for real zoom-in/out motion. */+private const val FOCUS_SCALE_EMA_ALPHA = 0.25f++/** Minimum interval between focus-distance writes. Caps how often we+ * rebuild the repeating capture request from the steer path even when+ * the deadband is repeatedly crossed (slow drift across many frames). */+private const val FOCUS_UPDATE_MIN_INTERVAL_MS = 750L++/** Reference captured when the tracker-driven focus lock is established:+ * the focus distance ([refDiopters], 1/m) the lens was at and the+ * tracker scale ([refScale]) at that instant, tagged with the chain+ * [rootAnchorId] they belong to. Target focus for a later frame with+ * scale `s` is `refDiopters * s / refScale` — image scale is inversely+ * proportional to subject distance, and focus distance is in diopters+ * (1/m), so diopters track scale linearly. */+private data class FocusBaseline(+ val rootAnchorId: Long,+ val refDiopters: Float,+ val refScale: Float,+)++/** Show a small overlay pill in the corner reporting tracker state+ * (Idle/Acquiring/Locked/Lost + inliers + last acquire's det/rec+ * counts). Useful while tuning, off in production. Gated on+ * `BuildConfig.DEBUG` so release builds never show it. */+private val DEBUG_SHOW_TRACKER_STATUS: Boolean = dev.davidv.translator.BuildConfig.DEBUG++@Composable+fun LiveCameraScreen(+ from: Language,+ to: Language,+ isAutoSource: Boolean,+ canSwap: Boolean,+ languageState: LanguageAvailabilityState,+ languageMetadata: Map<Language, LanguageMetadata>,+ onMessage: (TranslatorMessage) -> Unit,+ showAutoOption: Boolean,+ liveOverlayDefaultEnabled: Boolean,+ catalog: dev.davidv.translator.LanguageCatalog?,+ onClose: () -> Unit,+ onImageCaptured: (Uri) -> Unit,+) {+ val context = LocalContext.current+ var permissionGranted by remember {+ mutableStateOf(+ ContextCompat.checkSelfPermission(context, Manifest.permission.CAMERA) ==+ PackageManager.PERMISSION_GRANTED,+ )+ }+ var hasAsked by remember { mutableStateOf(permissionGranted) }+ val requestPermission =+ rememberLauncherForActivityResult(ActivityResultContracts.RequestPermission()) { granted ->+ permissionGranted = granted+ hasAsked = true+ }++ LaunchedEffect(Unit) {+ if (!permissionGranted && !hasAsked) {+ requestPermission.launch(Manifest.permission.CAMERA)+ }+ }++ BackHandler { onClose() }++ DisposableEffect(Unit) {+ val activity = context as? Activity+ activity?.requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT+ onDispose {+ activity?.requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED+ }+ }++ Box(+ modifier =+ Modifier+ .fillMaxSize()+ .background(Color.Black),+ ) {+ when {+ permissionGranted ->+ CameraSurface(+ from = from,+ to = to,+ isAutoSource = isAutoSource,+ canSwap = canSwap,+ languageState = languageState,+ languageMetadata = languageMetadata,+ onMessage = onMessage,+ showAutoOption = showAutoOption,+ liveOverlayDefaultEnabled = liveOverlayDefaultEnabled,+ catalog = catalog,+ onClose = onClose,+ onImageCaptured = onImageCaptured,+ )+ hasAsked ->+ PermissionPrompt(+ onRequest = { requestPermission.launch(Manifest.permission.CAMERA) },+ onCancel = onClose,+ )+ }+ }+}++@Composable+private fun PermissionPrompt(+ onRequest: () -> Unit,+ onCancel: () -> Unit,+) {+ Column(+ modifier =+ Modifier+ .fillMaxSize()+ .padding(24.dp),+ verticalArrangement = Arrangement.Center,+ horizontalAlignment = Alignment.CenterHorizontally,+ ) {+ Text(+ text = stringResource(R.string.camera_permission_rationale),+ color = Color.White,+ )+ Spacer(modifier = Modifier.size(16.dp))+ Row(horizontalArrangement = Arrangement.spacedBy(12.dp)) {+ Text(+ text = stringResource(R.string.common_grant),+ color = Color.White,+ modifier =+ Modifier+ .clip(CircleShape)+ .background(Color.White.copy(alpha = 0.2f))+ .clickable { onRequest() }+ .padding(horizontal = 16.dp, vertical = 8.dp),+ )+ Text(+ text = stringResource(R.string.common_cancel),+ color = Color.White,+ modifier =+ Modifier+ .clip(CircleShape)+ .background(Color.White.copy(alpha = 0.1f))+ .clickable { onCancel() }+ .padding(horizontal = 16.dp, vertical = 8.dp),+ )+ }+ }+}++@SuppressLint("ClickableViewAccessibility")+@Composable+private fun CameraSurface(+ from: Language,+ to: Language,+ isAutoSource: Boolean,+ canSwap: Boolean,+ languageState: LanguageAvailabilityState,+ languageMetadata: Map<Language, LanguageMetadata>,+ onMessage: (TranslatorMessage) -> Unit,+ showAutoOption: Boolean,+ liveOverlayDefaultEnabled: Boolean,+ catalog: dev.davidv.translator.LanguageCatalog?,+ onClose: () -> Unit,+ onImageCaptured: (Uri) -> Unit,+) {+ val context = LocalContext.current+ val lifecycleOwner = LocalLifecycleOwner.current+ val mainExecutor: Executor = remember { ContextCompat.getMainExecutor(context) }++ var torchOn by remember { mutableStateOf(false) }+ val hasPaddleOcrModels =+ remember(catalog, languageState, from.code, isAutoSource) {+ if (isAutoSource) {+ catalog != null &&+ languageState.allLanguages().any { language ->+ catalog.installedOcrEngines(language.code).contains("ppocr")+ }+ } else {+ catalog?.installedOcrEngines(from.code)?.contains("ppocr") == true+ }+ }+ var liveOverlayOn by remember { mutableStateOf(liveOverlayDefaultEnabled && hasPaddleOcrModels) }+ var camera by remember { mutableStateOf<Camera?>(null) }+ val cameraControl = camera?.cameraControl+ var hasFlashUnit by remember { mutableStateOf(false) }+ var isCapturing by remember { mutableStateOf(false) }+ var focusPoint by remember { mutableStateOf<Offset?>(null) }+ val focusScale = remember { Animatable(1.5f) }+ val focusAlpha = remember { Animatable(0f) }+ // Persistent crop centre for the live OCR engine. Defaults to dead centre; a tap+ // moves it so we crop around the user's focus area instead of the middle of the frame.+ var cropFocusNormalized by remember { mutableStateOf(Offset(0.5f, 0.5f)) }++ LaunchedEffect(focusPoint) {+ val point = focusPoint ?: return@LaunchedEffect+ focusScale.snapTo(1.5f)+ focusAlpha.snapTo(1f)+ focusScale.animateTo(1f, tween(durationMillis = 280))+ focusAlpha.animateTo(0f, tween(durationMillis = 420))+ if (focusPoint == point) focusPoint = null+ }++ val imageCapture =+ remember {+ val resolutionSelector =+ ResolutionSelector.Builder()+ .setResolutionStrategy(+ ResolutionStrategy(+ TARGET_RESOLUTION,+ ResolutionStrategy.FALLBACK_RULE_CLOSEST_HIGHER_THEN_LOWER,+ ),+ )+ .build()+ ImageCapture.Builder()+ .setCaptureMode(ImageCapture.CAPTURE_MODE_MINIMIZE_LATENCY)+ .setResolutionSelector(resolutionSelector)+ .build()+ }++ // AF state from the Camera2 session capture callback. True while the+ // sensor reports CONTROL_AF_STATE_*_SCAN. The planar engine treats+ // this as a hard "don't try to lock" signal — features from blurred+ // frames during the scan would lock against geometry that's about to+ // shift when focus settles.+ val afScanning = remember { kotlinx.coroutines.flow.MutableStateFlow(false) }++ // LENS_FOCUS_DISTANCE (diopters, 1/m) latched from the most recent+ // capture result whose CONTROL_AF_STATE reports a converged focus+ // (FOCUSED_LOCKED or PASSIVE_FOCUSED). Used to pin focus when the+ // planar tracker reaches Locked — AF excursions blur frames, BRIEF+ // descriptors die, the tracker drops. Pin the focus we have, accept+ // progressive blur as the user approaches the subject.+ val latestFocusedDistance =+ remember { kotlinx.coroutines.flow.MutableStateFlow<Float?>(null) }++ // Tracks whether the tracker-driven focus lock (LENS_FOCUS_DISTANCE ++ // AF_MODE=OFF, installed via Camera2 interop) is currently active.+ // Hoisted out of the LaunchedEffect so tap-to-focus can clear it —+ // otherwise the sticky interop bundle keeps AF_MODE=OFF on every+ // capture request and startFocusAndMetering silently no-ops.+ val focusLockedRef = remember { java.util.concurrent.atomic.AtomicBoolean(false) }++ // Reference scale/distance the focus lock was seeded from, plus the+ // last focus distance we actually pushed to the lens. Both written+ // from the trackerStatus collector and reset by tap-to-focus (all on+ // the main thread, but held in atomics to keep the cross-effect reads+ // honest). `null` baseline = not yet seeded; once seeded we stay in+ // AF_MODE=OFF and steer focus from tracker scale until the next tap.+ val focusBaselineRef =+ remember { java.util.concurrent.atomic.AtomicReference<FocusBaseline?>(null) }+ val heldFocusDiopters =+ remember { java.util.concurrent.atomic.AtomicReference<Float?>(null) }++ // CameraX `Preview` use case. Its output Surface is provided by+ // `LiveGlSurfaceView`'s SurfaceTexture (the GL render thread owns the+ // external-OES texture the SurfaceTexture wraps). No `ImageAnalysis`:+ // per-frame pixels never cross JNI as CPU bytes — the engine renders+ // canonical luma on the GPU from the same external texture the present+ // composite samples.+ val preview =+ remember {+ val resolutionSelector =+ ResolutionSelector.Builder()+ .setResolutionStrategy(+ ResolutionStrategy(+ PREVIEW_RESOLUTION,+ ResolutionStrategy.FALLBACK_RULE_CLOSEST_HIGHER_THEN_LOWER,+ ),+ )+ .build()+ val builder =+ Preview.Builder()+ .setResolutionSelector(resolutionSelector)+ Camera2Interop.Extender(builder).setSessionCaptureCallback(+ object : CameraCaptureSession.CaptureCallback() {+ override fun onCaptureCompleted(+ session: CameraCaptureSession,+ request: CaptureRequest,+ result: TotalCaptureResult,+ ) {+ val afState = result.get(CaptureResult.CONTROL_AF_STATE) ?: return+ val scanning =+ afState == CaptureResult.CONTROL_AF_STATE_ACTIVE_SCAN ||+ afState == CaptureResult.CONTROL_AF_STATE_PASSIVE_SCAN+ if (afScanning.value != scanning) afScanning.value = scanning+ // Latch the focus distance once AF has converged; the+ // tracker-state observer below uses it to pin focus when+ // we reach Locked. Skip "inactive" results (no AF activity+ // yet) and "scanning" results (in-flight, value transient).+ if (afState == CaptureResult.CONTROL_AF_STATE_FOCUSED_LOCKED ||+ afState == CaptureResult.CONTROL_AF_STATE_PASSIVE_FOCUSED+ ) {+ val d = result.get(CaptureResult.LENS_FOCUS_DISTANCE)+ if (d != null) latestFocusedDistance.value = d+ }+ }+ },+ )+ builder.build()+ }+ // Background executor for the CameraX SurfaceProvider's surface-release+ // callback. CameraX cancels surface requests on this executor; the+ // single-thread is plenty since the callback fires at most a handful of+ // times over the Composable's lifetime.+ val cameraSurfaceExecutor =+ remember { java.util.concurrent.Executors.newSingleThreadExecutor() }++ val workerScope = androidx.compose.runtime.rememberCoroutineScope()+ val liveOcrEngine: LivePlanarOcrEngine? =+ remember(catalog) { catalog?.let { LivePlanarOcrEngine(it, workerScope) } }+ var previewSizePx by remember { mutableStateOf(androidx.compose.ui.unit.IntSize.Zero) }++ DisposableEffect(Unit) {+ onDispose { cameraSurfaceExecutor.shutdown() }+ }++ LaunchedEffect(from.code, isAutoSource, hasPaddleOcrModels, liveOverlayDefaultEnabled) {+ liveOverlayOn = liveOverlayDefaultEnabled && hasPaddleOcrModels+ if (!liveOverlayOn) liveOcrEngine?.clear()+ }++ LaunchedEffect(liveOcrEngine, liveOverlayOn) {+ liveOcrEngine?.setOverlayEnabled(liveOverlayOn)+ }++ LaunchedEffect(liveOcrEngine) {+ val engine = liveOcrEngine ?: return@LaunchedEffect+ afScanning.collect { scanning ->+ if (scanning) engine.onAfScanStart() else engine.onAfScanEnd()+ }+ }++ // Pin focus when the tracker first locks, then *steer* it from the+ // tracked plane's scale instead of ever handing control back to AF.+ // Autofocus excursions blur frames mid-track, which kills BRIEF+ // descriptors and drops the tracker — and the old policy re-enabled+ // continuous AF on every drop, so the camera hunted in a loop even on a+ // perfectly still scene. Here AF stays OFF after the first lock: as the+ // user nears/recedes the plane its scale changes, and we move+ // LENS_FOCUS_DISTANCE to match (image scale ∝ 1/distance ∝ diopters).+ // Focus is handed back to AF only on an explicit tap (see the tap+ // handler). A full re-acquire restarts the scale baseline (new chain+ // root) but the camera hasn't teleported, so we re-baseline at the+ // focus distance we're already holding — no hunt, no jump.+ LaunchedEffect(camera, liveOcrEngine) {+ val engine = liveOcrEngine ?: return@LaunchedEffect+ val cam = camera ?: return@LaunchedEffect+ // Closest the lens can focus, in diopters (1/m); 0 = infinity. Caps+ // the steered distance so we never command past the optics.+ val minFocusDiopters =+ runCatching {+ Camera2CameraInfo+ .from(cam.cameraInfo)+ .getCameraCharacteristic(CameraCharacteristics.LENS_INFO_MINIMUM_FOCUS_DISTANCE)+ }.getOrNull() ?: 10f++ fun applyFocus(diopters: Float) {+ // Explicitly hold AE = ON in the same bundle. Empirically some+ // Camera2 implementations couple AF and AE state; if+ // setCaptureRequestOptions replaces the bundle and AE wasn't named,+ // AE can transiently destabilise. Tiny exposure shifts kill BRIEF+ // descriptor matches (256 sign-bit comparisons; pixels near a+ // comparison's zero crossing flip on sub-1/3-EV shifts), which+ // manifested as sudden inlier collapses on frames where nothing+ // actually moved.+ Log.i(TAG, "applyFocus d=$diopters")+ val opts =+ CaptureRequestOptions.Builder()+ .setCaptureRequestOption(+ CaptureRequest.CONTROL_AF_MODE,+ CameraMetadata.CONTROL_AF_MODE_OFF,+ )+ .setCaptureRequestOption(CaptureRequest.LENS_FOCUS_DISTANCE, diopters)+ .setCaptureRequestOption(+ CaptureRequest.CONTROL_AE_MODE,+ CameraMetadata.CONTROL_AE_MODE_ON,+ )+ .build()+ Camera2CameraControl.from(cam.cameraControl).captureRequestOptions = opts+ }++ var smoothedScale = Float.NaN+ var lastSeenRoot = -1L+ var lastFocusUpdateMs = 0L+ engine.trackerStatus.collect { status ->+ if (status.state != uniffi.bindings.PlanarTrackerState.LOCKED) {+ smoothedScale = Float.NaN+ lastSeenRoot = -1L+ return@collect+ }+ val raw = if (status.scale > 0f) status.scale else 1f+ smoothedScale =+ if (smoothedScale.isNaN() || status.rootAnchorId != lastSeenRoot) {+ raw+ } else {+ smoothedScale + FOCUS_SCALE_EMA_ALPHA * (raw - smoothedScale)+ }+ lastSeenRoot = status.rootAnchorId+ val scale = smoothedScale++ val existing = focusBaselineRef.get()+ if (existing == null) {+ // First lock since startup or a tap: seed from whatever distance+ // AF converged to while it was still running. Wait for it.+ val d0 = latestFocusedDistance.value ?: return@collect+ runCatching {+ applyFocus(d0)+ focusBaselineRef.set(FocusBaseline(status.rootAnchorId, d0, scale))+ heldFocusDiopters.set(d0)+ focusLockedRef.set(true)+ Log.i(TAG, "focus pinned d0=$d0 s0=$scale root=${status.rootAnchorId}")+ }.onFailure { Log.w(TAG, "focus pin failed", it) }+ return@collect+ }++ val baseline =+ if (status.rootAnchorId != existing.rootAnchorId) {+ val held = heldFocusDiopters.get() ?: existing.refDiopters+ FocusBaseline(status.rootAnchorId, held, scale).also {+ focusBaselineRef.set(it)+ Log.i(TAG, "focus re-baseline root=${status.rootAnchorId} held=$held s0=$scale")+ }+ } else {+ existing+ }++ val target =+ (baseline.refDiopters * scale / baseline.refScale).coerceIn(0f, minFocusDiopters)+ val prev = heldFocusDiopters.get()+ if (prev == null || kotlin.math.abs(target - prev) > FOCUS_UPDATE_DEADBAND_DIOPTERS) {+ val nowMs = android.os.SystemClock.uptimeMillis()+ if (nowMs - lastFocusUpdateMs >= FOCUS_UPDATE_MIN_INTERVAL_MS) {+ lastFocusUpdateMs = nowMs+ runCatching {+ applyFocus(target)+ heldFocusDiopters.set(target)+ }.onFailure { Log.w(TAG, "focus steer failed", it) }+ }+ }+ }+ }++ // Push language config into the tracker whenever it changes. The+ // pipeline only diffs the call internally if the codes/auto flag+ // actually change, so calling once per real change is safe and cheap.+ LaunchedEffect(liveOcrEngine, from.code, to.code, isAutoSource) {+ liveOcrEngine?.setLanguages(from, to, isAutoSource)+ }++ // Tap-to-focus = fresh-start intent. The GL thread doesn't see the+ // tap; bump the tracker generation here so any in-flight async job+ // bails at its next gen-check.+ LaunchedEffect(liveOcrEngine, cropFocusNormalized) {+ liveOcrEngine?.resetTracker()+ }++ val liveSurfaceView =+ remember { LiveGlSurfaceView(context).apply { keepScreenOn = true } }++ // Hand the tracker pointer + per-frame result callback to the GL+ // thread. The GL render loop, driven by `SurfaceTexture.onFrameAvailable`+ // from CameraX's `Preview`, calls `LivePipelineJni.processFrameGl`+ // directly with this pointer and forwards the packed result here so+ // the debug pill stays in sync.+ DisposableEffect(liveSurfaceView, liveOcrEngine) {+ val engine = liveOcrEngine+ if (engine != null) {+ liveSurfaceView.pipelinePtr = engine.pipelinePtr+ liveSurfaceView.onFrameResult = { packed -> engine.onFrameResult(packed) }+ }+ onDispose {+ liveSurfaceView.pipelinePtr = 0L+ liveSurfaceView.onFrameResult = null+ }+ }++ DisposableEffect(liveSurfaceView) {+ val scaleDetector =+ ScaleGestureDetector(+ context,+ object : ScaleGestureDetector.SimpleOnScaleGestureListener() {+ override fun onScale(detector: ScaleGestureDetector): Boolean {+ val cam = camera ?: return true+ val zoomState = cam.cameraInfo.zoomState.value ?: return true+ val target =+ (zoomState.zoomRatio * detector.scaleFactor)+ .coerceIn(zoomState.minZoomRatio, zoomState.maxZoomRatio)+ cam.cameraControl.setZoomRatio(target)+ return true+ }+ },+ )+ val tapDetector =+ GestureDetector(+ context,+ object : GestureDetector.SimpleOnGestureListener() {+ override fun onSingleTapUp(e: MotionEvent): Boolean {+ focusPoint = Offset(e.x, e.y)+ val viewW = liveSurfaceView.width.toFloat().coerceAtLeast(1f)+ val viewH = liveSurfaceView.height.toFloat().coerceAtLeast(1f)+ cropFocusNormalized =+ Offset(+ (e.x / viewW).coerceIn(0f, 1f),+ (e.y / viewH).coerceIn(0f, 1f),+ )+ val cam = camera ?: return true+ // If the tracker-driven lock is currently pinning focus via+ // Camera2 interop (AF_MODE=OFF + steered LENS_FOCUS_DISTANCE),+ // startFocusAndMetering would be silently overridden on the+ // next capture request. Clear the interop bundle first, drop+ // the latched distance and the scale baseline so the focus+ // controller waits for AF to re-converge at the tapped point+ // before re-seeding, and reset the lock flag.+ if (focusLockedRef.getAndSet(false)) {+ runCatching {+ Camera2CameraControl.from(cam.cameraControl).captureRequestOptions =+ CaptureRequestOptions.Builder().build()+ }.onFailure { Log.w(TAG, "clear interop options failed", it) }+ latestFocusedDistance.value = null+ focusBaselineRef.set(null)+ heldFocusDiopters.set(null)+ }+ // Without a PreviewView there's no built-in+ // MeteringPointFactory, so we hand-build one against the+ // surface dimensions. Normalised coords are in [0, 1] over+ // (viewW × viewH); the factory maps that to the camera's+ // active sensor region under the hood.+ val factory = SurfaceOrientedMeteringPointFactory(viewW, viewH)+ val point = factory.createPoint(e.x, e.y)+ val action =+ FocusMeteringAction+ .Builder(point, FocusMeteringAction.FLAG_AF or FocusMeteringAction.FLAG_AE)+ .build()+ runCatching { cam.cameraControl.startFocusAndMetering(action) }+ .onFailure { Log.w(TAG, "focus action failed", it) }+ return true+ }+ },+ )+ liveSurfaceView.setOnTouchListener { _, event ->+ scaleDetector.onTouchEvent(event)+ tapDetector.onTouchEvent(event)+ true+ }+ onDispose { liveSurfaceView.setOnTouchListener(null) }+ }++ DisposableEffect(lifecycleOwner, liveSurfaceView) {+ val providerFuture = ProcessCameraProvider.getInstance(context)+ providerFuture.addListener({+ val provider = providerFuture.get()+ try {+ provider.unbindAll()+ // CameraX `Preview` writes camera frames into the GL surface+ // view's SurfaceTexture (GL_TEXTURE_EXTERNAL_OES). The render+ // thread, woken by SurfaceTexture.onFrameAvailable, GPU-renders+ // canonical luma for the tracker and composites the same+ // external texture + overlay into the EGL surface. One camera+ // consumer; no `ImageAnalysis` stream, no per-frame CPU bytes.+ preview.setSurfaceProvider(cameraSurfaceExecutor) { request ->+ liveSurfaceView.provideSurfaceRequest(request, cameraSurfaceExecutor)+ }+ val boundCamera =+ provider.bindToLifecycle(+ lifecycleOwner,+ CameraSelector.DEFAULT_BACK_CAMERA,+ imageCapture,+ preview,+ )+ camera = boundCamera+ hasFlashUnit = boundCamera.cameraInfo.hasFlashUnit()+ // Sensor mount angle (CW degrees the sensor is rotated vs the+ // natural display orientation). Plumbed into the UV xform so the+ // composite is upright on devices with a non-90° mount, instead+ // of hard-coding the back-camera-on-portrait-phone case.+ liveSurfaceView.setCameraOrientationDegrees(boundCamera.cameraInfo.sensorRotationDegrees)+ } catch (e: Exception) {+ Log.e(TAG, "Failed to bind camera", e)+ }+ }, mainExecutor)++ onDispose {+ runCatching { providerFuture.get().unbindAll() }+ }+ }++ LaunchedEffect(torchOn, cameraControl) {+ cameraControl?.enableTorch(torchOn && hasFlashUnit)+ }++ Box(+ modifier =+ Modifier+ .fillMaxSize()+ .onSizeChanged { previewSizePx = it },+ ) {+ // Single surface for both camera pixels and overlay. The engine+ // composites them in Rust per analyzer frame and we blit the+ // result; no two-surface drift possible. When the live overlay is+ // off (toggled by the user or unavailable because OCR models for+ // this language aren't installed), the engine still receives+ // frames and composites camera-only — the tracker is held in+ // SUPPRESSED so no acquire/refresh worker runs.+ AndroidView(+ factory = { liveSurfaceView },+ modifier = Modifier.fillMaxSize(),+ update = { },+ )++ if (DEBUG_SHOW_TRACKER_STATUS && liveOcrEngine != null) {+ val status by liveOcrEngine.trackerStatus.collectAsState()+ TrackerStatusPill(status)+ }++ val indicatorSizeDp = 72.dp+ val indicatorRadiusPx =+ with(androidx.compose.ui.platform.LocalDensity.current) {+ (indicatorSizeDp / 2).toPx()+ }+ focusPoint?.let { pt ->+ Box(+ modifier =+ Modifier+ // pt comes from a raw MotionEvent (origin at the physical+ // left edge), so its placement must ignore layout direction —+ // absoluteOffset + AbsoluteAlignment.TopLeft, or the ring+ // mirrors horizontally under RTL locales.+ .align(AbsoluteAlignment.TopLeft)+ .absoluteOffset {+ IntOffset(+ (pt.x - indicatorRadiusPx).toInt(),+ (pt.y - indicatorRadiusPx).toInt(),+ )+ }+ .size(indicatorSizeDp)+ .scale(focusScale.value)+ .alpha(focusAlpha.value)+ .border(2.dp, Color.White, CircleShape),+ )+ }++ TopLanguagePills(+ from = from,+ to = to,+ isAutoSource = isAutoSource,+ canSwap = canSwap,+ languageState = languageState,+ languageMetadata = languageMetadata,+ onMessage = onMessage,+ showAutoOption = showAutoOption,+ modifier =+ Modifier+ .fillMaxWidth()+ .statusBarsPadding()+ .padding(horizontal = 8.dp, vertical = 4.dp),+ )++ BottomControls(+ torchOn = torchOn,+ hasFlashUnit = hasFlashUnit,+ onTorchToggle = { torchOn = !torchOn },+ liveOverlayOn = liveOverlayOn,+ liveOverlayAvailable = hasPaddleOcrModels,+ onLiveOverlayToggle = {+ if (!hasPaddleOcrModels) {+ Toast+ .makeText(+ context,+ context.getString(R.string.camera_need_ocr_models),+ Toast.LENGTH_SHORT,+ )+ .show()+ return@BottomControls+ }+ liveOverlayOn = !liveOverlayOn+ if (!liveOverlayOn) liveOcrEngine?.clear()+ },+ isCapturing = isCapturing,+ onCapture = {+ if (isCapturing) return@BottomControls+ isCapturing = true+ val outputFile = File.createTempFile("camera_capture_", ".jpg", context.cacheDir)+ val outputOptions = ImageCapture.OutputFileOptions.Builder(outputFile).build()+ imageCapture.takePicture(+ outputOptions,+ mainExecutor,+ object : ImageCapture.OnImageSavedCallback {+ override fun onImageSaved(results: ImageCapture.OutputFileResults) {+ val uri =+ FileProvider.getUriForFile(+ context,+ "${context.packageName}.fileprovider",+ outputFile,+ )+ isCapturing = false+ onImageCaptured(uri)+ onClose()+ }++ override fun onError(exception: ImageCaptureException) {+ Log.e(TAG, "Image capture failed", exception)+ outputFile.delete()+ isCapturing = false+ }+ },+ )+ },+ modifier =+ Modifier+ .align(Alignment.BottomCenter)+ .fillMaxWidth(),+ )+ }+}++@Composable+private fun TopLanguagePills(+ from: Language,+ to: Language,+ isAutoSource: Boolean,+ canSwap: Boolean,+ languageState: LanguageAvailabilityState,+ languageMetadata: Map<Language, LanguageMetadata>,+ onMessage: (TranslatorMessage) -> Unit,+ showAutoOption: Boolean,+ modifier: Modifier = Modifier,+) {+ val fromLanguages =+ languageState.allLanguages().filter { x ->+ (isAutoSource || x != from) && (languageState.availabilityFor(x)?.hasToEnglish == true || x.isEnglish)+ }+ val toLanguages =+ languageState.allLanguages().filter { x ->+ (isAutoSource || x != from) && x != to && (languageState.availabilityFor(x)?.hasFromEnglish == true || x.isEnglish)+ }+ val pillShape = RoundedCornerShape(50)+ val pillBackground = Color.Black.copy(alpha = 0.5f)++ val pillWidth = 110.dp+ Row(+ modifier = modifier,+ horizontalArrangement = Arrangement.spacedBy(6.dp, Alignment.CenterHorizontally),+ verticalAlignment = Alignment.CenterVertically,+ ) {+ Box(+ modifier =+ Modifier+ .width(pillWidth)+ .clip(pillShape)+ .background(pillBackground),+ ) {+ LanguageSelector(+ selectedLanguage = from,+ availableLanguages = fromLanguages,+ languageMetadata = languageMetadata,+ onLanguageSelected = { onMessage(TranslatorMessage.FromLang(it)) },+ isAutoSource = isAutoSource,+ showAutoOption = showAutoOption,+ onAutoSelected = { onMessage(TranslatorMessage.EnableAutoSource) },+ textColor = Color.White,+ marquee = false,+ )+ }+ CompositionLocalProvider(LocalContentColor provides Color.White) {+ IconButton(+ onClick = { onMessage(TranslatorMessage.SwapLanguages) },+ enabled = canSwap,+ modifier = Modifier.size(32.dp),+ ) {+ Icon(+ painter = painterResource(id = R.drawable.compare),+ contentDescription = stringResource(R.string.a11y_reverse_translation_direction),+ )+ }+ }+ Box(+ modifier =+ Modifier+ .width(pillWidth)+ .clip(pillShape)+ .background(pillBackground),+ ) {+ LanguageSelector(+ selectedLanguage = to,+ availableLanguages = toLanguages,+ languageMetadata = languageMetadata,+ onLanguageSelected = { onMessage(TranslatorMessage.ToLang(it)) },+ textColor = Color.White,+ marquee = false,+ )+ }+ }+}++@Composable+private fun BottomControls(+ torchOn: Boolean,+ hasFlashUnit: Boolean,+ onTorchToggle: () -> Unit,+ liveOverlayOn: Boolean,+ liveOverlayAvailable: Boolean,+ onLiveOverlayToggle: () -> Unit,+ isCapturing: Boolean,+ onCapture: () -> Unit,+ modifier: Modifier = Modifier,+) {+ Row(+ modifier =+ modifier+ .navigationBarsPadding()+ .padding(horizontal = 24.dp, vertical = 24.dp),+ horizontalArrangement = Arrangement.SpaceBetween,+ verticalAlignment = Alignment.CenterVertically,+ ) {+ IconButton(+ onClick = onTorchToggle,+ enabled = hasFlashUnit,+ ) {+ Icon(+ painter = painterResource(if (torchOn) R.drawable.flash_on else R.drawable.flash_off),+ contentDescription = if (torchOn) stringResource(R.string.a11y_torch_on) else stringResource(R.string.a11y_torch_off),+ tint = if (hasFlashUnit) Color.White else Color.White.copy(alpha = 0.3f),+ )+ }++ Box(+ modifier =+ Modifier+ .size(72.dp)+ .clip(CircleShape)+ .border(4.dp, Color.White, CircleShape)+ .padding(6.dp)+ .clip(CircleShape)+ .background(if (isCapturing) Color.White.copy(alpha = 0.5f) else Color.White)+ .clickable(enabled = !isCapturing, onClick = onCapture),+ )++ IconButton(onClick = onLiveOverlayToggle) {+ Icon(+ painter = painterResource(R.drawable.auto_awesome),+ contentDescription =+ if (liveOverlayOn) {+ stringResource(+ R.string.a11y_live_overlay_on,+ )+ } else {+ stringResource(R.string.a11y_live_overlay_off)+ },+ tint =+ when {+ !liveOverlayAvailable -> Color.White.copy(alpha = 0.25f)+ liveOverlayOn -> Color.White+ else -> Color.White.copy(alpha = 0.4f)+ },+ )+ }+ }+}++@Composable+private fun androidx.compose.foundation.layout.BoxScope.TrackerStatusPill(status: dev.davidv.translator.TrackerStatus) {+ val (color, label) =+ when (status.state) {+ uniffi.bindings.PlanarTrackerState.IDLE ->+ androidx.compose.ui.graphics.Color(0xCC444444) to "IDLE"+ uniffi.bindings.PlanarTrackerState.ACQUIRING ->+ androidx.compose.ui.graphics.Color(0xCCB58900) to "ACQUIRING"+ uniffi.bindings.PlanarTrackerState.LOCKED ->+ androidx.compose.ui.graphics.Color(0xCC2AA198) to "LOCKED"+ uniffi.bindings.PlanarTrackerState.LOST ->+ androidx.compose.ui.graphics.Color(0xCCDC322F) to "LOST"+ }+ // Format: STATE | anchor#N inliers | det=D rec_ok=K rec_empty=M pending=P+ val detPart =+ if (status.lastAcquireDet < 0) {+ ""+ } else {+ " | det=${status.lastAcquireDet} rec_ok=${status.lastAcquireRecOk} rec_empty=${status.lastAcquireRecEmpty} pending=${status.lastAcquirePending}"+ }+ val anchorPart =+ if (status.anchorId == 0L) {+ ""+ } else {+ " | a#${status.anchorId} inl=${status.inliers}"+ }+ val text = "$label$anchorPart$detPart"+ androidx.compose.foundation.layout.Box(+ modifier =+ androidx.compose.ui.Modifier+ .align(androidx.compose.ui.Alignment.TopStart)+ .padding(top = 56.dp, start = 8.dp)+ .background(color, shape = androidx.compose.foundation.shape.RoundedCornerShape(6.dp))+ .padding(horizontal = 8.dp, vertical = 4.dp),+ ) {+ androidx.compose.material3.Text(+ text = text,+ color = androidx.compose.ui.graphics.Color.White,+ style = androidx.compose.material3.MaterialTheme.typography.labelSmall,+ )+ }+}diff --git a/OCR-translation/src/main/java/dev/davidv/translator/ui/screens/MainScreen.kt b/OCR-translation/src/main/java/dev/davidv/translator/ui/screens/MainScreen.ktnew file mode 100644index 0000000..0777ce7--- /dev/null+++ b/OCR-translation/src/main/java/dev/davidv/translator/ui/screens/MainScreen.kt@@ -0,0 +1,906 @@+/*+ * Copyright (C) 2024 David V+ *+ * This program 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.+ *+ * This program 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 <https://www.gnu.org/licenses/>.+ */++package dev.davidv.translator.ui.screens++import android.content.res.Configuration+import android.graphics.Bitmap+import android.util.Log+import android.widget.Toast+import androidx.activity.compose.BackHandler+import androidx.compose.foundation.background+import androidx.compose.foundation.layout.Arrangement+import androidx.compose.foundation.layout.Box+import androidx.compose.foundation.layout.BoxWithConstraints+import androidx.compose.foundation.layout.Column+import androidx.compose.foundation.layout.Row+import androidx.compose.foundation.layout.fillMaxSize+import androidx.compose.foundation.layout.fillMaxWidth+import androidx.compose.foundation.layout.height+import androidx.compose.foundation.layout.navigationBarsPadding+import androidx.compose.foundation.layout.padding+import androidx.compose.foundation.layout.size+import androidx.compose.foundation.shape.RoundedCornerShape+import androidx.compose.material3.FloatingActionButton+import androidx.compose.material3.FloatingActionButtonDefaults+import androidx.compose.material3.Icon+import androidx.compose.material3.MaterialTheme+import androidx.compose.material3.Scaffold+import androidx.compose.material3.Surface+import androidx.compose.runtime.Composable+import androidx.compose.runtime.LaunchedEffect+import androidx.compose.runtime.collectAsState+import androidx.compose.runtime.getValue+import androidx.compose.runtime.mutableFloatStateOf+import androidx.compose.runtime.mutableStateOf+import androidx.compose.runtime.remember+import androidx.compose.runtime.saveable.rememberSaveable+import androidx.compose.runtime.setValue+import androidx.compose.ui.Alignment+import androidx.compose.ui.Modifier+import androidx.compose.ui.draw.clip+import androidx.compose.ui.graphics.Color+import androidx.compose.ui.layout.layout+import androidx.compose.ui.platform.LocalConfiguration+import androidx.compose.ui.platform.LocalContext+import androidx.compose.ui.platform.LocalDensity+import androidx.compose.ui.platform.testTag+import androidx.compose.ui.res.painterResource+import androidx.compose.ui.res.stringResource+import androidx.compose.ui.semantics.contentDescription+import androidx.compose.ui.semantics.semantics+import androidx.compose.ui.tooling.preview.Preview+import androidx.compose.ui.unit.dp+import androidx.core.content.ContextCompat+import androidx.core.graphics.drawable.toBitmap+import dev.davidv.translator.AppSettings+import dev.davidv.translator.DownloadService+import dev.davidv.translator.DownloadState+import dev.davidv.translator.LangAvailability+import dev.davidv.translator.Language+import dev.davidv.translator.LanguageAvailabilityEntry+import dev.davidv.translator.LanguageAvailabilityState+import dev.davidv.translator.LanguageMetadata+import dev.davidv.translator.LaunchMode+import dev.davidv.translator.R+import dev.davidv.translator.ReadingOrder+import dev.davidv.translator.Script+import dev.davidv.translator.TranslatedText+import dev.davidv.translator.TranslatorMessage+import dev.davidv.translator.WordWithTaggedEntries+import dev.davidv.translator.localizedName+import dev.davidv.translator.singleScript+import dev.davidv.translator.ui.components.ActionPillButton+import dev.davidv.translator.ui.components.AlternativesDrawer+import dev.davidv.translator.ui.components.AlternativesTarget+import dev.davidv.translator.ui.components.ClearInput+import dev.davidv.translator.ui.components.DetectedLanguageSection+import dev.davidv.translator.ui.components.DetectedRegions+import dev.davidv.translator.ui.components.DictionaryBottomSheet+import dev.davidv.translator.ui.components.ImageDisplaySection+import dev.davidv.translator.ui.components.ImageWordSelection+import dev.davidv.translator.ui.components.InputSection+import dev.davidv.translator.ui.components.JapaneseOcrModeToggle+import dev.davidv.translator.ui.components.LanguageEvent+import dev.davidv.translator.ui.components.LanguageSelectionRow+import dev.davidv.translator.ui.components.OutputTapMode+import dev.davidv.translator.ui.components.ShareImage+import dev.davidv.translator.ui.components.SplitHandle+import dev.davidv.translator.ui.components.StyledTextFieldFocusController+import dev.davidv.translator.ui.components.TargetTabsHeader+import dev.davidv.translator.ui.components.TranslationField+import dev.davidv.translator.ui.components.ZoomableImageViewer+import dev.davidv.translator.ui.components.rememberImageSourceActions+import dev.davidv.translator.ui.components.wordAt+import dev.davidv.translator.ui.components.wordRangeAt+import dev.davidv.translator.ui.theme.TranslatorTheme+import kotlinx.coroutines.flow.MutableStateFlow+import kotlinx.coroutines.flow.SharedFlow+import kotlinx.coroutines.flow.StateFlow+import kotlinx.coroutines.flow.asStateFlow+import kotlin.math.roundToInt++@Composable+fun MainScreen(+ // Navigation+ onSettings: () -> Unit,+ onLiveCamera: () -> Unit,+ // Current state (read-only)+ input: String,+ inputTransliteration: String?,+ output: TranslatedText?,+ from: Language,+ to: Language,+ targetTabs: List<Language> = listOf(to),+ detectedLanguage: Language?,+ displayImage: Bitmap?,+ originalImage: Bitmap?,+ imageWordSelection: ImageWordSelection?,+ detectedRegions: DetectedRegions?,+ ocrReadingOrder: ReadingOrder?,+ isTranslating: StateFlow<Boolean>,+ isOcrInProgress: StateFlow<Boolean>,+ dictionaryWord: WordWithTaggedEntries?,+ dictionaryStack: List<WordWithTaggedEntries>,+ dictionaryLookupLanguage: Language?,+ isAudioPlaying: Boolean = false,+ isAudioLoading: Boolean = false,+ isInputAudioPlaying: Boolean = false,+ isInputAudioLoading: Boolean = false,+ isOutputAudioPlaying: Boolean = false,+ isOutputAudioLoading: Boolean = false,+ // Action requests+ onMessage: (TranslatorMessage) -> Unit,+ onSteerPreview: suspend (String) -> String? = { null },+ canSwapLanguages: Boolean = true,+ onStopAudio: () -> Unit = {},+ // System integration+ languageState: LanguageAvailabilityState,+ languageMetadata: Map<Language, LanguageMetadata>,+ downloadStates: Map<Language, DownloadState> = emptyMap(),+ settings: AppSettings,+ availableSourceTtsVoices: List<uniffi.translator_core.InstalledTtsPack> = emptyList(),+ selectedSourceTtsVoiceName: String? = null,+ sourceTtsPlaybackSpeed: Float = 1.0f,+ availableTtsVoices: List<uniffi.translator_core.InstalledTtsPack> = emptyList(),+ selectedTtsVoiceName: String? = null,+ targetTtsPlaybackSpeed: Float = 1.0f,+ onTtsPlaybackSpeedChange: (Float) -> Unit = {},+ onSourceTtsPlaybackSpeedChange: (Float) -> Unit = {},+ onSourceTtsVoiceSelected: (String, String) -> Unit = { _, _ -> },+ onTtsVoiceSelected: (String, String) -> Unit = { _, _ -> },+ onSpeakInput: (String, Language) -> Unit = { _, _ -> },+ onSpeakOutput: (String, Language) -> Unit = { _, _ -> },+ launchMode: LaunchMode,+ pendingSharedImage: SharedFlow<android.net.Uri>? = null,+ isAutoSource: Boolean = false,+) {+ var showFullScreenImage by remember { mutableStateOf(false) }+ var alternativesTarget by remember { mutableStateOf<AlternativesTarget?>(null) }+ var outputTapMode by remember { mutableStateOf(OutputTapMode.None) }+ var inputDictMode by remember { mutableStateOf(false) }+ val hasAnyAlternatives = output?.alternatives?.isNotEmpty() == true+ val hasSourceDictionary = languageState.availabilityFor(from)?.dictionaryFiles == true+ val hasTargetDictionary = languageState.availabilityFor(to)?.dictionaryFiles == true+ val canInputDict = hasSourceDictionary && input.isNotBlank()+ // A mode whose toggle is no longer offered would strand as an invisible tap+ // handler, so drop it when its backing data goes away.+ LaunchedEffect(hasAnyAlternatives) {+ if (!hasAnyAlternatives && outputTapMode == OutputTapMode.Alternatives) {+ outputTapMode = OutputTapMode.None+ alternativesTarget = null+ }+ }+ LaunchedEffect(hasTargetDictionary) {+ if (!hasTargetDictionary && outputTapMode == OutputTapMode.Dictionary) {+ outputTapMode = OutputTapMode.None+ }+ }+ LaunchedEffect(canInputDict) {+ if (!canInputDict) inputDictMode = false+ }+ // Flip the main image between the translation and the original (resets on a new image).+ var showOriginal by remember(displayImage) { mutableStateOf(false) }+ val isImageProcessing = isOcrInProgress.collectAsState().value || isTranslating.collectAsState().value+ val inputFocusController = remember { StyledTextFieldFocusController() }+ val sourceActions =+ rememberImageSourceActions(+ onMessage = onMessage,+ from = from,+ to = to,+ isAutoSource = isAutoSource,+ pendingSharedImage = pendingSharedImage,+ )+ val extraTopPadding = if (launchMode == LaunchMode.Normal) 0.dp else 8.dp+ val context = LocalContext.current+ val showOnlyOutputInReadonlyModal =+ launchMode == LaunchMode.ReadonlyModal && settings.onlyShowOutputOnReadonlyModal+ val detectedInstalled =+ detectedLanguage?.takeIf { languageState.availabilityFor(it)?.translatorFiles == true }+ val mainScreenDescription = stringResource(R.string.a11y_main_screen)++ // Handle back button when dictionary is open+ BackHandler(enabled = dictionaryWord != null) {+ onMessage(TranslatorMessage.ClearDictionaryStack)+ }++ Scaffold(+ modifier = Modifier.semantics { contentDescription = mainScreenDescription },+ containerColor = MaterialTheme.colorScheme.surfaceContainer,+ floatingActionButton = {+ when (launchMode) {+ LaunchMode.Normal -> {+ }++ LaunchMode.ReadonlyModal -> {+ }++ is LaunchMode.ReadWriteModal -> {+ if (output != null) {+ FloatingActionButton(+ onClick = {+ launchMode.reply(output.translated)+ },+ shape = FloatingActionButtonDefaults.smallShape,+ modifier = Modifier.size(30.dp),+ ) {+ Icon(+ painterResource(id = R.drawable.check),+ contentDescription = stringResource(R.string.a11y_replace_text),+ modifier = Modifier.size(20.dp),+ )+ }+ }+ }+ }+ },+ ) { paddingValues ->+ Box(+ modifier =+ Modifier+ .fillMaxSize()+ .navigationBarsPadding()+ .padding(top = paddingValues.calculateTopPadding() + extraTopPadding, bottom = 8.dp),+ ) {+ Column(+ modifier =+ Modifier+ .fillMaxSize()+ .padding(horizontal = 12.dp),+ verticalArrangement = Arrangement.spacedBy(12.dp),+ ) {+ Box(modifier = Modifier.testTag("export-section:Language selection")) {+ LanguageSelectionRow(+ from = from,+ to = to,+ canSwap = canSwapLanguages,+ languageState = languageState,+ languageMetadata = languageMetadata,+ onMessage = onMessage,+ isAutoSource = isAutoSource,+ detectedInstalled = detectedInstalled,+ showAutoOption = !settings.disableCLD,+ drawable =+ if (launchMode == LaunchMode.Normal) {+ Pair("Settings", R.drawable.settings)+ } else {+ Pair(+ "Expand",+ R.drawable.open_in_full,+ )+ },+ onSettings =+ if (launchMode == LaunchMode.Normal) {+ onSettings+ } else {+ { onMessage(TranslatorMessage.ChangeLaunchMode(LaunchMode.Normal)) }+ },+ )+ }++ BoxWithConstraints(+ modifier =+ Modifier+ .fillMaxWidth()+ .weight(1f),+ ) {+ val parentHeight = maxHeight+ val parentHeightPx = with(LocalDensity.current) { parentHeight.toPx() }+ // Only ever read from measure/drag lambdas: reading it during composition+ // would recompose both cards (and the interop EditText) on every drag frame.+ val splitFraction = rememberSaveable { mutableFloatStateOf(0.5f) }++ Column(+ modifier = Modifier.fillMaxWidth(),+ ) {+ // The detected-language prompt is an input modifier, so it lives at+ // the bottom of the input card; in image mode (no input card) it+ // sits directly under the image instead.+ val detectedLanguageSection: @Composable () -> Unit = {+ Box(modifier = Modifier.testTag("export-section:Detected language")) {+ DetectedLanguageSection(+ detectedLanguage = detectedLanguage,+ from = from,+ languageState = languageState,+ onMessage = onMessage,+ downloadStates = downloadStates,+ isAutoSource = isAutoSource,+ onEvent = { event ->+ when (event) {+ is LanguageEvent.Download -> DownloadService.startDownload(context, event.language)+ is LanguageEvent.Cancel -> DownloadService.cancelDownload(context, event.language)+ else -> Log.e("MainScreen", "Got unexpected event: $event")+ }+ },+ )+ }+ }++ if (displayImage != null) {+ Box(modifier = Modifier.fillMaxWidth()) {+ ImageDisplaySection(+ displayImage = displayImage,+ originalImage = originalImage,+ showOriginal = showOriginal,+ isProcessing = isImageProcessing,+ detectedRegions = detectedRegions,+ wordSelection = imageWordSelection,+ maxHeight = parentHeight * 0.85f,+ modifier = Modifier.fillMaxWidth().testTag("export-section:Image"),+ )+ Row(+ modifier =+ Modifier+ .align(Alignment.TopEnd)+ .padding(8.dp),+ horizontalArrangement = Arrangement.spacedBy(8.dp),+ ) {+ if (from.code == "ja") {+ JapaneseOcrModeToggle(+ readingOrder = ocrReadingOrder,+ onMessage = onMessage,+ )+ }+ if (originalImage != null) {+ ActionPillButton(+ iconRes = R.drawable.flip,+ contentDescription =+ if (showOriginal) {+ stringResource(+ R.string.a11y_show_translated_image,+ )+ } else {+ stringResource(R.string.a11y_show_original_image)+ },+ showBackdrop = true,+ onClick = { showOriginal = !showOriginal },+ )+ }+ ShareImage(onMessage)+ ClearInput(+ onMessage = onMessage,+ showBackdrop = true,+ )+ }+ }+ detectedLanguageSection()+ }++ if (!showOnlyOutputInReadonlyModal && displayImage == null) {+ val isOtherAudioActive = (isAudioPlaying || isAudioLoading) && !isInputAudioPlaying && !isInputAudioLoading+ val canSpeakInput =+ input.isNotBlank() && languageState.availabilityFor(from)?.ttsFiles == true && !isOtherAudioActive+ InputSection(+ input = input,+ inputTransliteration = inputTransliteration,+ from = from,+ onMessage = onMessage,+ focusController = inputFocusController,+ fontFactor = settings.fontFactor,+ showTransliteration = settings.showTransliterationOnInput,+ canInputDict = canInputDict,+ inputDictMode = inputDictMode,+ onToggleInputDict = { inputDictMode = !inputDictMode },+ canSpeakInput = canSpeakInput,+ isInputAudioPlaying = isInputAudioPlaying,+ isInputAudioLoading = isInputAudioLoading,+ sourceTtsPlaybackSpeed = sourceTtsPlaybackSpeed,+ selectedSourceTtsVoiceName = selectedSourceTtsVoiceName,+ availableSourceTtsVoices = availableSourceTtsVoices,+ onSourceTtsPlaybackSpeedChange = onSourceTtsPlaybackSpeedChange,+ onSourceTtsVoiceSelected = onSourceTtsVoiceSelected,+ onSpeakInput = onSpeakInput,+ onStopAudio = onStopAudio,+ showSourceRow = launchMode == LaunchMode.Normal,+ sourceActions = sourceActions,+ onCameraClick = onLiveCamera,+ screenTranslateEnabled = settings.experimentalScreenTranslate,+ isAutoSource = isAutoSource,+ detectedSection = detectedLanguageSection,+ modifier =+ Modifier+ .fillMaxWidth()+ .layout { measurable, constraints ->+ val height =+ (constraints.maxHeight * splitFraction.floatValue).roundToInt()+ val placeable =+ measurable.measure(+ constraints.copy(minHeight = height, maxHeight = height),+ )+ layout(placeable.width, placeable.height) { placeable.place(0, 0) }+ }+ .testTag("export-section:Input"),+ )+ SplitHandle(+ onDrag = { delta ->+ splitFraction.floatValue =+ (splitFraction.floatValue + delta / parentHeightPx).coerceIn(0.25f, 0.75f)+ },+ )+ }++ // With an image the translation is shown in the image itself, so hide the output text+ // field too (the input is already hidden above).+ if (showOnlyOutputInReadonlyModal || displayImage == null) {+ Box(+ modifier =+ Modifier+ .fillMaxWidth()+ .testTag("export-section:Output")+ .let { m ->+ if (displayImage == null) {+ m.weight(1f, fill = true)+ } else {+ m.height(parentHeight * 0.5f)+ }+ },+ ) {+ TranslationField(+ text = output,+ modifier = Modifier.fillMaxSize(),+ label = to.localizedName(),+ header =+ if (settings.multiTargetEnabled) {+ {+ TargetTabsHeader(+ tabs = targetTabs,+ active = to,+ candidates =+ languageState.allLanguages().filter { x ->+ x != from && x !in targetTabs &&+ (languageState.availabilityFor(x)?.hasFromEnglish == true || x.isEnglish)+ },+ showAdd = true,+ onSwitch = { onMessage(TranslatorMessage.ToLang(it)) },+ onAdd = { onMessage(TranslatorMessage.AddTab(it)) },+ onRemove = { onMessage(TranslatorMessage.RemoveTab(it)) },+ )+ }+ } else {+ null+ },+ textStyle =+ MaterialTheme.typography.bodyLarge.copy(+ fontSize = (MaterialTheme.typography.bodyLarge.fontSize * settings.fontFactor),+ lineHeight = (MaterialTheme.typography.bodyLarge.lineHeight * settings.fontFactor),+ ),+ onDictionaryLookup = {+ onMessage(TranslatorMessage.DictionaryLookup(it, to))+ },+ onAlternatives =+ if (output?.alternatives?.isNotEmpty() == true) {+ { start, end ->+ val wa =+ output?.alternatives?.firstOrNull {+ start < it.tgtEnd.toInt() && end > it.tgtBegin.toInt()+ }+ alternativesTarget =+ wa?.let { AlternativesTarget(it.tgtBegin.toInt(), it.tgtEnd.toInt(), it.options) }+ }+ } else {+ null+ },+ hasAlternatives =+ if (output?.alternatives?.isNotEmpty() == true) {+ { start, end ->+ output?.alternatives?.any {+ start < it.tgtEnd.toInt() && end > it.tgtBegin.toInt()+ } == true+ }+ } else {+ null+ },+ highlightRange =+ alternativesTarget?.let { it.wordBegin until it.wordEnd },+ tapMode = outputTapMode,+ onToggleAlternativesMode = {+ outputTapMode =+ if (outputTapMode == OutputTapMode.Alternatives) {+ OutputTapMode.None+ } else {+ OutputTapMode.Alternatives+ }+ alternativesTarget = null+ },+ onToggleDictionaryMode = {+ outputTapMode =+ if (outputTapMode == OutputTapMode.Dictionary) {+ OutputTapMode.None+ } else {+ OutputTapMode.Dictionary+ }+ alternativesTarget = null+ },+ dictionaryAvailable = hasTargetDictionary,+ onDictionaryUnavailable = {+ Toast+ .makeText(context, context.getString(R.string.feature_unavailable_dictionary), Toast.LENGTH_SHORT)+ .show()+ },+ speakerAvailable = languageState.availabilityFor(to)?.ttsFiles == true,+ onSpeakerUnavailable = {+ Toast+ .makeText(context, context.getString(R.string.feature_unavailable_tts), Toast.LENGTH_SHORT)+ .show()+ },+ onWordTap = { offset ->+ when (outputTapMode) {+ OutputTapMode.Alternatives -> {+ val text = output?.translated+ val wa =+ output?.alternatives?.firstOrNull {+ offset >= it.tgtBegin.toInt() && offset < it.tgtEnd.toInt()+ }+ alternativesTarget =+ when {+ wa != null ->+ AlternativesTarget(wa.tgtBegin.toInt(), wa.tgtEnd.toInt(), wa.options)++ text != null ->+ wordRangeAt(text, offset)?.let {+ AlternativesTarget(it.first, it.last + 1, emptyList())+ }++ else -> null+ }+ }++ OutputTapMode.Dictionary -> {+ val word = output?.translated?.let { wordAt(it, offset) }+ if (!word.isNullOrBlank()) {+ onMessage(TranslatorMessage.DictionaryLookup(word, to))+ }+ }++ OutputTapMode.None -> {}+ }+ },+ isAudioPlaying = isOutputAudioPlaying,+ isAudioLoading = isOutputAudioLoading,+ speechPlaybackSpeed = targetTtsPlaybackSpeed,+ selectedVoiceName = selectedTtsVoiceName,+ availableVoices = availableTtsVoices,+ onSpeak = {+ if (isOutputAudioPlaying || isOutputAudioLoading) {+ onStopAudio()+ } else {+ output?.translated?.takeIf { it.isNotBlank() }?.let { translatedText ->+ onSpeakOutput(translatedText, to)+ }+ }+ },+ onSpeechPlaybackSpeedChange = onTtsPlaybackSpeedChange,+ onVoiceSelected = onTtsVoiceSelected,+ )+ }+ }+ }+ }+ }+ }+ }++ // Full screen image viewer+ if (showFullScreenImage && displayImage != null && originalImage != null) {+ ZoomableImageViewer(+ bitmap = displayImage,+ originalBitmap = originalImage,+ wordSelection = imageWordSelection,+ onDismiss = { showFullScreenImage = false },+ onShare = {+ onMessage(TranslatorMessage.ShareTranslatedImage)+ },+ )+ }++ alternativesTarget?.let { target ->+ AlternativesDrawer(+ target = target,+ fullText = output?.translated.orEmpty(),+ steerPreview = onSteerPreview,+ onCommit = { prefix ->+ onMessage(TranslatorMessage.Steer(prefix))+ alternativesTarget = null+ },+ onDismiss = { alternativesTarget = null },+ )+ }++ if (dictionaryWord != null && dictionaryLookupLanguage != null) {+ DictionaryBottomSheet(+ dictionaryWord = dictionaryWord,+ dictionaryStack = dictionaryStack,+ dictionaryLookupLanguage = dictionaryLookupLanguage,+ onDismiss = {+ onMessage(TranslatorMessage.ClearDictionaryStack)+ },+ onDictionaryLookup = { word ->+ onMessage(TranslatorMessage.DictionaryLookup(word, dictionaryLookupLanguage))+ },+ onBackPressed = {+ onMessage(TranslatorMessage.PopDictionary)+ },+ )+ }+}++@Composable+fun WideDialogTheme(content: @Composable () -> Unit) {+ TranslatorTheme {+ Box(+ modifier =+ Modifier+ .fillMaxSize()+ .background(Color.Transparent),+ contentAlignment = Alignment.Center,+ ) {+ Surface(+ modifier =+ Modifier+ .fillMaxWidth(0.9f)+ .height((LocalConfiguration.current.screenHeightDp * 0.5f).dp)+ .clip(RoundedCornerShape(16.dp)),+ color = MaterialTheme.colorScheme.surface,+ tonalElevation = 6.dp,+ ) {+ content()+ }+ }+ }+}++private fun previewLanguage(+ code: String,+ name: String,+) = Language(+ code = code,+ displayName = name,+ shortDisplayName = name,+ script = Script.LATIN,+ writingSystem = singleScript(Script.LATIN),+ dictionaryCode = code,+)++private fun previewLanguageState(vararg languages: Pair<Language, LangAvailability>) =+ LanguageAvailabilityState(+ hasLanguages = true,+ availableLanguages = languages.map { (language, availability) -> LanguageAvailabilityEntry(language, availability) },+ isChecking = false,+ )++@Preview(+ showBackground = true,+ uiMode = Configuration.UI_MODE_NIGHT_YES,+)+@Composable+fun PopupMode() {+ WideDialogTheme {+ MainScreen(+ onSettings = { },+ onLiveCamera = { },+ input = "Example input",+ output = TranslatedText("Example output", null),+ from = previewLanguage("az", "Azerbaijani"),+ to = previewLanguage("es", "Spanish"),+ detectedLanguage = previewLanguage("fr", "French"),+ displayImage = null,+ originalImage = null,+ imageWordSelection = null,+ detectedRegions = null,+ ocrReadingOrder = ReadingOrder.LEFT_TO_RIGHT,+ isTranslating = MutableStateFlow(false).asStateFlow(),+ isOcrInProgress = MutableStateFlow(false).asStateFlow(),+ launchMode = LaunchMode.ReadWriteModal {},+ onMessage = {},+ languageState =+ previewLanguageState(+ previewLanguage("en", "English") to LangAvailability(true, true, true, true),+ previewLanguage("es", "Spanish") to LangAvailability(true, true, true, true),+ previewLanguage("fr", "French") to LangAvailability(true, true, true, true),+ ),+ languageMetadata = mapOf(previewLanguage("es", "Spanish") to LanguageMetadata(favorite = true)),+ downloadStates = emptyMap(),+ settings = AppSettings(),+ dictionaryWord = null,+ dictionaryStack = emptyList(),+ dictionaryLookupLanguage = null,+ inputTransliteration = null,+ )+ }+}++@Preview(+ showBackground = true,+ uiMode = Configuration.UI_MODE_NIGHT_YES,+)+@Composable+fun MainScreenPreview() {+ TranslatorTheme {+ MainScreen(+ onSettings = { },+ onLiveCamera = { },+ input = "Example input",+ output = TranslatedText("Example output", null),+ from = previewLanguage("en", "English"),+ to = previewLanguage("es", "Spanish"),+ detectedLanguage = previewLanguage("fr", "French"),+ displayImage = null,+ originalImage = null,+ imageWordSelection = null,+ detectedRegions = null,+ ocrReadingOrder = ReadingOrder.LEFT_TO_RIGHT,+ isTranslating = MutableStateFlow(false).asStateFlow(),+ isOcrInProgress = MutableStateFlow(false).asStateFlow(),+ launchMode = LaunchMode.Normal,+ onMessage = {},+ languageState =+ previewLanguageState(+ previewLanguage("en", "English") to LangAvailability(true, true, true, true),+ previewLanguage("es", "Spanish") to LangAvailability(true, true, true, true),+ previewLanguage("fr", "French") to LangAvailability(true, true, true, true),+ ),+ languageMetadata = mapOf(previewLanguage("es", "Spanish") to LanguageMetadata(favorite = true)),+ downloadStates = emptyMap(),+ settings = AppSettings(),+ dictionaryWord = null,+ dictionaryStack = emptyList(),+ dictionaryLookupLanguage = null,+ inputTransliteration = null,+ )+ }+}++@Preview(+ showBackground = true,+ uiMode = Configuration.UI_MODE_NIGHT_YES,+)+@Composable+fun PreviewTranslitText() {+ TranslatorTheme {+ MainScreen(+ onSettings = { },+ onLiveCamera = { },+ input = "東京",+ output =+ TranslatedText(+ "Tokyo",+ null,+ ),+ from = previewLanguage("ja", "Japanese"),+ to = previewLanguage("en", "English"),+ detectedLanguage = null,+ displayImage = null,+ originalImage = null,+ imageWordSelection = null,+ detectedRegions = null,+ ocrReadingOrder = ReadingOrder.LEFT_TO_RIGHT,+ isTranslating = MutableStateFlow(false).asStateFlow(),+ isOcrInProgress = MutableStateFlow(false).asStateFlow(),+ launchMode = LaunchMode.Normal,+ onMessage = {},+ languageState =+ previewLanguageState(+ previewLanguage("en", "English") to LangAvailability(true, true, true, true),+ previewLanguage("es", "Spanish") to LangAvailability(true, true, true, true),+ previewLanguage("fr", "French") to LangAvailability(true, true, true, true),+ ),+ downloadStates = emptyMap(),+ settings = AppSettings(showTransliterationOnInput = true),+ languageMetadata = mapOf(previewLanguage("es", "Spanish") to LanguageMetadata(favorite = true)),+ dictionaryWord = null,+ dictionaryStack = emptyList(),+ dictionaryLookupLanguage = null,+ inputTransliteration = "tōkyō",+ )+ }+}++@Preview(+ showBackground = true,+ uiMode = Configuration.UI_MODE_NIGHT_YES,+)+@Composable+fun PreviewVeryLongText() {+ val vlong = "very long text. ".repeat(100)+ TranslatorTheme {+ MainScreen(+ onSettings = { },+ onLiveCamera = { },+ input = vlong,+ output =+ TranslatedText(+ vlong,+ null,+ ),+ from = previewLanguage("en", "English"),+ to = previewLanguage("en", "English"),+ detectedLanguage = null,+ displayImage = null,+ originalImage = null,+ imageWordSelection = null,+ detectedRegions = null,+ ocrReadingOrder = ReadingOrder.LEFT_TO_RIGHT,+ isTranslating = MutableStateFlow(false).asStateFlow(),+ isOcrInProgress = MutableStateFlow(false).asStateFlow(),+ launchMode = LaunchMode.Normal,+ onMessage = {},+ languageState =+ previewLanguageState(+ previewLanguage("en", "English") to LangAvailability(true, true, true, true),+ previewLanguage("es", "Spanish") to LangAvailability(true, true, true, true),+ previewLanguage("fr", "French") to LangAvailability(true, true, true, true),+ ),+ downloadStates = emptyMap(),+ settings = AppSettings(showTransliterationOnInput = true),+ languageMetadata = mapOf(previewLanguage("es", "Spanish") to LanguageMetadata(favorite = true)),+ dictionaryWord = null,+ dictionaryStack = emptyList(),+ dictionaryLookupLanguage = null,+ inputTransliteration = "translit",+ )+ }+}++@Preview(+ showBackground = true,+ uiMode = Configuration.UI_MODE_NIGHT_YES,+)+@Composable+fun PreviewVeryLongTextImage() {+ val vlong = "very long text. ".repeat(100)+ val context = LocalContext.current+ val drawable = ContextCompat.getDrawable(context, R.drawable.example)+ val bitmap = drawable?.toBitmap()++ TranslatorTheme {+ MainScreen(+ onSettings = { },+ onLiveCamera = { },+ input = vlong,+ output =+ TranslatedText(+ vlong,+ null,+ ),+ from = previewLanguage("en", "English"),+ to = previewLanguage("en", "English"),+ detectedLanguage = null,+ displayImage = bitmap,+ originalImage = bitmap,+ imageWordSelection = null,+ detectedRegions = null,+ ocrReadingOrder = ReadingOrder.LEFT_TO_RIGHT,+ isTranslating = MutableStateFlow(false).asStateFlow(),+ isOcrInProgress = MutableStateFlow(false).asStateFlow(),+ launchMode = LaunchMode.Normal,+ onMessage = {},+ languageState =+ previewLanguageState(+ previewLanguage("en", "English") to LangAvailability(true, true, true, true),+ previewLanguage("es", "Spanish") to LangAvailability(true, true, true, true),+ previewLanguage("fr", "French") to LangAvailability(true, true, true, true),+ ),+ downloadStates = emptyMap(),+ settings = AppSettings(),+ languageMetadata = mapOf(previewLanguage("es", "Spanish") to LanguageMetadata(favorite = true)),+ dictionaryWord = null,+ dictionaryStack = emptyList(),+ dictionaryLookupLanguage = null,+ inputTransliteration = null,+ )+ }+}diff --git a/OCR-translation/src/main/java/dev/davidv/translator/ui/screens/NoLanguagesScreen.kt b/OCR-translation/src/main/java/dev/davidv/translator/ui/screens/NoLanguagesScreen.ktnew file mode 100644index 0000000..2aca47e--- /dev/null+++ b/OCR-translation/src/main/java/dev/davidv/translator/ui/screens/NoLanguagesScreen.kt@@ -0,0 +1,158 @@+/*+ * Copyright (C) 2024 David V+ *+ * This program 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.+ *+ * This program 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 <https://www.gnu.org/licenses/>.+ */++package dev.davidv.translator.ui.screens++import androidx.compose.foundation.layout.Column+import androidx.compose.foundation.layout.fillMaxSize+import androidx.compose.foundation.layout.fillMaxWidth+import androidx.compose.foundation.layout.navigationBarsPadding+import androidx.compose.foundation.layout.padding+import androidx.compose.material3.Button+import androidx.compose.material3.ExperimentalMaterial3Api+import androidx.compose.material3.Icon+import androidx.compose.material3.IconButton+import androidx.compose.material3.MaterialTheme+import androidx.compose.material3.Scaffold+import androidx.compose.material3.Text+import androidx.compose.material3.TopAppBar+import androidx.compose.runtime.Composable+import androidx.compose.runtime.collectAsState+import androidx.compose.runtime.getValue+import androidx.compose.runtime.rememberCoroutineScope+import androidx.compose.ui.Modifier+import androidx.compose.ui.platform.LocalContext+import androidx.compose.ui.res.painterResource+import androidx.compose.ui.res.stringResource+import androidx.compose.ui.text.style.TextAlign+import androidx.compose.ui.tooling.preview.Preview+import androidx.compose.ui.unit.dp+import dev.davidv.translator.AppSettings+import dev.davidv.translator.DownloadEvent+import dev.davidv.translator.DownloadService+import dev.davidv.translator.FilePathManager+import dev.davidv.translator.Language+import dev.davidv.translator.LanguageMetadataManager+import dev.davidv.translator.LanguageStateManager+import dev.davidv.translator.R+import dev.davidv.translator.ui.theme.TranslatorTheme+import kotlinx.coroutines.flow.MutableSharedFlow+import kotlinx.coroutines.flow.MutableStateFlow++@OptIn(ExperimentalMaterial3Api::class)+@Composable+fun NoLanguagesScreen(+ settingsManager: dev.davidv.translator.SettingsManager,+ onDone: () -> Unit,+ onSettings: () -> Unit,+ languageStateManager: LanguageStateManager,+ languageMetadataManager: dev.davidv.translator.LanguageMetadataManager,+ downloadService: DownloadService,+) {+ val state by languageStateManager.languageState.collectAsState()+ val context = LocalContext.current++ Scaffold(+ topBar = {+ TopAppBar(+ title = { Text(stringResource(R.string.nolang_title)) },+ actions = {+ IconButton(onClick = onSettings) {+ Icon(+ painterResource(id = R.drawable.settings),+ contentDescription = stringResource(R.string.a11y_settings),+ )+ }+ },+ )+ },+ bottomBar = {+ Button(+ onClick = onDone,+ enabled = state.hasLanguages,+ modifier =+ Modifier+ .fillMaxWidth()+ .padding(8.dp)+ .navigationBarsPadding(),+ ) {+ Text(stringResource(R.string.common_done))+ }+ },+ ) { paddingValues ->+ Column(+ modifier =+ Modifier+ .fillMaxSize()+ .padding(paddingValues)+ .padding(horizontal = 16.dp),+ ) {+ Text(+ text = stringResource(R.string.nolang_prompt),+ style = MaterialTheme.typography.bodyLarge,+ textAlign = TextAlign.Center,+ color = MaterialTheme.colorScheme.onSurfaceVariant,+ modifier = Modifier.padding(top = 16.dp, bottom = 8.dp),+ )++ val downloadStates by downloadService.downloadStates.collectAsState()+ val catalog by languageStateManager.catalog.collectAsState()+ val dictionaryDownloadStates by downloadService.dictionaryDownloadStates.collectAsState()+ val ttsDownloadStates by downloadService.ttsDownloadStates.collectAsState()+ val activeTtsPackIds by downloadService.activeTtsPackIds.collectAsState()+ val queuedTtsPackIds by downloadService.queuedTtsPackIds.collectAsState()+ val repairDownloadState by downloadService.repairDownloadState.collectAsState()++ LanguageAssetManagerScreen(+ context = context,+ languageStateManager = languageStateManager,+ languageMetadataManager = languageMetadataManager,+ settingsManager = settingsManager,+ catalog = catalog,+ languageAvailabilityState = state,+ downloadStates = downloadStates,+ dictionaryDownloadStates = dictionaryDownloadStates,+ ttsDownloadStates = ttsDownloadStates,+ activeTtsPackIds = activeTtsPackIds,+ queuedTtsPackIds = queuedTtsPackIds,+ repairDownloadState = repairDownloadState,+ )+ }+ }+}++@Preview(showBackground = true)+@Composable+fun NoLanguagesScreenPreview() {+ val context = LocalContext.current+ val scope = rememberCoroutineScope()+ val appSettingsFlow = MutableStateFlow(AppSettings())+ val fp = FilePathManager(context, appSettingsFlow)+ val mockDownloadEvents = MutableSharedFlow<DownloadEvent>()+ val downloadService = DownloadService()+ val languagesFlow = kotlinx.coroutines.flow.MutableStateFlow<List<Language>>(emptyList())+ TranslatorTheme {+ NoLanguagesScreen(+ settingsManager = dev.davidv.translator.SettingsManager(context),+ onDone = {},+ onSettings = {},+ downloadService = downloadService,+ languageStateManager = LanguageStateManager(scope, fp, mockDownloadEvents),+ languageMetadataManager = LanguageMetadataManager(context, languagesFlow),+ )+ }+}diff --git a/OCR-translation/src/main/java/dev/davidv/translator/ui/screens/SettingsScreen.kt b/OCR-translation/src/main/java/dev/davidv/translator/ui/screens/SettingsScreen.ktnew file mode 100644index 0000000..30c3437--- /dev/null+++ b/OCR-translation/src/main/java/dev/davidv/translator/ui/screens/SettingsScreen.kt@@ -0,0 +1,1522 @@+/*+ * Copyright (C) 2024 David V+ *+ * This program 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.+ *+ * This program 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 <https://www.gnu.org/licenses/>.+ */++package dev.davidv.translator.ui.screens++import android.app.role.RoleManager+import android.content.ClipData+import android.content.ClipboardManager+import android.content.Context+import android.content.Intent+import android.net.Uri+import android.os.Build+import android.provider.Settings+import android.widget.Toast+import androidx.activity.compose.rememberLauncherForActivityResult+import androidx.activity.result.contract.ActivityResultContracts+import androidx.compose.animation.core.animateFloatAsState+import androidx.compose.animation.core.tween+import androidx.compose.foundation.clickable+import androidx.compose.foundation.layout.Arrangement+import androidx.compose.foundation.layout.Box+import androidx.compose.foundation.layout.Column+import androidx.compose.foundation.layout.Row+import androidx.compose.foundation.layout.fillMaxSize+import androidx.compose.foundation.layout.fillMaxWidth+import androidx.compose.foundation.layout.padding+import androidx.compose.foundation.layout.size+import androidx.compose.foundation.rememberScrollState+import androidx.compose.foundation.text.KeyboardOptions+import androidx.compose.foundation.verticalScroll+import androidx.compose.material3.AlertDialog+import androidx.compose.material3.CircularProgressIndicator+import androidx.compose.material3.DropdownMenuItem+import androidx.compose.material3.ExperimentalMaterial3Api+import androidx.compose.material3.ExposedDropdownMenuBox+import androidx.compose.material3.ExposedDropdownMenuDefaults+import androidx.compose.material3.Icon+import androidx.compose.material3.IconButton+import androidx.compose.material3.MaterialTheme+import androidx.compose.material3.OutlinedTextField+import androidx.compose.material3.Scaffold+import androidx.compose.material3.Slider+import androidx.compose.material3.Switch+import androidx.compose.material3.Text+import androidx.compose.material3.TextButton+import androidx.compose.material3.TopAppBar+import androidx.compose.runtime.Composable+import androidx.compose.runtime.LaunchedEffect+import androidx.compose.runtime.getValue+import androidx.compose.runtime.mutableStateOf+import androidx.compose.runtime.remember+import androidx.compose.runtime.setValue+import androidx.compose.ui.Alignment+import androidx.compose.ui.Modifier+import androidx.compose.ui.platform.LocalContext+import androidx.compose.ui.platform.testTag+import androidx.compose.ui.res.painterResource+import androidx.compose.ui.res.stringResource+import androidx.compose.ui.text.input.KeyboardType+import androidx.compose.ui.tooling.preview.Preview+import androidx.compose.ui.unit.dp+import dev.davidv.translator.AppSettings+import dev.davidv.translator.BackgroundMode+import dev.davidv.translator.DownloadService+import dev.davidv.translator.DownloadState+import dev.davidv.translator.HttpServerBindMode+import dev.davidv.translator.Language+import dev.davidv.translator.LanguageCatalog+import dev.davidv.translator.LanguageMetadataManager+import dev.davidv.translator.PermissionHelper+import dev.davidv.translator.R+import dev.davidv.translator.ReadonlyModalOutputAlignment+import dev.davidv.translator.Script+import dev.davidv.translator.TapToTranslateNotification+import dev.davidv.translator.labelRes+import dev.davidv.translator.languageNameComparator+import dev.davidv.translator.localizedName+import dev.davidv.translator.singleScript+import dev.davidv.translator.ui.components.AppCard+import dev.davidv.translator.ui.theme.TranslatorTheme+import kotlinx.coroutines.delay+import kotlin.math.roundToInt++@OptIn(ExperimentalMaterial3Api::class)+@Composable+private fun LanguageDropdown(+ label: String,+ selectedLanguage: Language?,+ availableLanguages: List<Language>,+ fallbackLanguage: Language?,+ onLanguageSelected: (Language) -> Unit,+) {+ var expanded by remember { mutableStateOf(false) }+ val languagesByDisplayName =+ remember(availableLanguages) {+ availableLanguages.sortedWith(compareBy(languageNameComparator()) { it.localizedName() })+ }++ Text(+ text = label,+ style = MaterialTheme.typography.bodyMedium,+ color = MaterialTheme.colorScheme.onSurface,+ )++ ExposedDropdownMenuBox(+ expanded = expanded,+ onExpandedChange = { expanded = it },+ modifier = Modifier.fillMaxWidth(),+ ) {+ OutlinedTextField(+ value = selectedLanguage?.localizedName() ?: fallbackLanguage?.localizedName() ?: stringResource(R.string.settings_no_languages_available),+ onValueChange = {},+ readOnly = true,+ trailingIcon = { ExposedDropdownMenuDefaults.TrailingIcon(expanded = expanded) },+ modifier =+ Modifier+ .menuAnchor()+ .fillMaxWidth(),+ colors = ExposedDropdownMenuDefaults.outlinedTextFieldColors(),+ )+ ExposedDropdownMenu(+ expanded = expanded,+ onDismissRequest = { expanded = false },+ ) {+ languagesByDisplayName.forEach { language ->+ DropdownMenuItem(+ text = { Text(language.localizedName()) },+ onClick = {+ onLanguageSelected(language)+ expanded = false+ },+ )+ }+ }+ }+}++@OptIn(ExperimentalMaterial3Api::class)+@Composable+private fun HttpServerCard(+ settings: AppSettings,+ onSettingsChange: (AppSettings) -> Unit,+) {+ AppCard(+ modifier = Modifier.fillMaxWidth().testTag("export-section:HttpServer"),+ ) {+ Column(+ modifier = Modifier.padding(16.dp),+ verticalArrangement = Arrangement.spacedBy(8.dp),+ ) {+ Text(+ text = stringResource(R.string.settings_http_server_title),+ style = MaterialTheme.typography.headlineSmall,+ color = MaterialTheme.colorScheme.primary,+ modifier = Modifier.padding(bottom = 8.dp),+ )++ // Commit the port after a pause so per-keystroke edits don't rebind the+ // running server (and briefly try to bind partial numbers like "5").+ var portText by remember(settings.httpServerPort) { mutableStateOf(settings.httpServerPort.toString()) }+ LaunchedEffect(portText) {+ delay(500)+ portText.toIntOrNull()?.takeIf { it in 1..65535 }?.let { port ->+ if (port != settings.httpServerPort) onSettingsChange(settings.copy(httpServerPort = port))+ }+ }++ Text(+ text = stringResource(R.string.settings_http_server_port),+ style = MaterialTheme.typography.bodyMedium,+ color = MaterialTheme.colorScheme.onSurface,+ )+ OutlinedTextField(+ value = portText,+ onValueChange = { input -> portText = input.filter { it.isDigit() }.take(5) },+ modifier = Modifier.fillMaxWidth(),+ singleLine = true,+ keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Number),+ )++ Text(+ text = stringResource(R.string.settings_http_server_bind),+ style = MaterialTheme.typography.bodyMedium,+ color = MaterialTheme.colorScheme.onSurface,+ )+ var bindExpanded by remember { mutableStateOf(false) }+ ExposedDropdownMenuBox(+ expanded = bindExpanded,+ onExpandedChange = { bindExpanded = it },+ modifier = Modifier.fillMaxWidth(),+ ) {+ OutlinedTextField(+ value = stringResource(settings.httpServerBindMode.labelRes),+ onValueChange = {},+ readOnly = true,+ trailingIcon = { ExposedDropdownMenuDefaults.TrailingIcon(expanded = bindExpanded) },+ modifier =+ Modifier+ .menuAnchor()+ .fillMaxWidth(),+ colors = ExposedDropdownMenuDefaults.outlinedTextFieldColors(),+ )+ ExposedDropdownMenu(+ expanded = bindExpanded,+ onDismissRequest = { bindExpanded = false },+ ) {+ HttpServerBindMode.entries.forEach { mode ->+ DropdownMenuItem(+ text = { Text(stringResource(mode.labelRes)) },+ onClick = {+ onSettingsChange(settings.copy(httpServerBindMode = mode))+ bindExpanded = false+ },+ )+ }+ }+ }+ }+ }+}++@OptIn(ExperimentalMaterial3Api::class)+@Composable+fun SettingsScreen(+ settings: AppSettings,+ languageMetadataManager: dev.davidv.translator.LanguageMetadataManager,+ availableLanguages: List<Language>,+ catalog: LanguageCatalog?,+ adblockDownloadState: DownloadState,+ adblockInstalled: Boolean,+ onSettingsChange: (AppSettings) -> Unit,+ onManageLanguages: () -> Unit,+ onDeleteAdblockSupport: () -> Unit,+ onHowToUse: () -> Unit,+) {+ val context = LocalContext.current+ var showPermissionDialog by remember { mutableStateOf(false) }++ val permissionLauncher =+ rememberLauncherForActivityResult(+ contract = ActivityResultContracts.RequestMultiplePermissions(),+ ) { permissions ->+ val allGranted = permissions.values.all { it }+ if (allGranted) {+ onSettingsChange(settings.copy(useExternalStorage = true))+ } else {+ onSettingsChange(settings.copy(useExternalStorage = false))+ }+ }++ val manageStorageLauncher =+ rememberLauncherForActivityResult(+ contract = ActivityResultContracts.StartActivityForResult(),+ ) { _ ->+ val gotPerms = PermissionHelper.hasExternalStoragePermission(context)+ onSettingsChange(settings.copy(useExternalStorage = gotPerms))+ }++ val assistantRoleLauncher =+ rememberLauncherForActivityResult(+ contract = ActivityResultContracts.StartActivityForResult(),+ ) { _ -> }++ val notificationPermissionLauncher =+ rememberLauncherForActivityResult(+ contract = ActivityResultContracts.RequestPermission(),+ ) { granted ->+ if (granted) {+ onSettingsChange(settings.copy(tapToTranslateEnabled = true))+ TapToTranslateNotification.show(context)+ }+ }+ Scaffold(+ containerColor = MaterialTheme.colorScheme.surfaceContainer,+ topBar = {+ TopAppBar(+ title = { Text(stringResource(R.string.settings_title)) },+ )+ },+ ) { paddingValues ->+ Column(+ modifier =+ Modifier+ .fillMaxSize()+ .padding(paddingValues)+ .padding(16.dp)+ .verticalScroll(rememberScrollState()),+ verticalArrangement = Arrangement.spacedBy(16.dp),+ ) {+ // Languages Section+ AppCard(+ modifier = Modifier.fillMaxWidth().testTag("export-section:Languages"),+ ) {+ Column(+ modifier = Modifier.padding(16.dp),+ verticalArrangement = Arrangement.spacedBy(4.dp),+ ) {+ Text(+ text = stringResource(R.string.settings_languages),+ style = MaterialTheme.typography.headlineSmall,+ color = MaterialTheme.colorScheme.primary,+ )++ // Manage Languages Button+ Row(+ modifier = Modifier.fillMaxWidth(),+ horizontalArrangement = Arrangement.SpaceBetween,+ verticalAlignment = Alignment.CenterVertically,+ ) {+ Text(+ text = stringResource(R.string.settings_language_packs),+ style = MaterialTheme.typography.bodyMedium,+ color = MaterialTheme.colorScheme.onSurface,+ modifier = Modifier.weight(1f).padding(end = 8.dp),+ )++ TextButton(+ onClick = onManageLanguages,+ ) {+ Text(stringResource(R.string.common_manage))+ }+ }+ }+ }++ // General Settings Section+ AppCard(+ modifier = Modifier.fillMaxWidth().testTag("export-section:General"),+ ) {+ Column(+ modifier = Modifier.padding(16.dp),+ verticalArrangement = Arrangement.spacedBy(8.dp),+ ) {+ Text(+ text = stringResource(R.string.settings_general),+ style = MaterialTheme.typography.headlineSmall,+ color = MaterialTheme.colorScheme.primary,+ )++ LanguageDropdown(+ label = stringResource(R.string.settings_default_from),+ selectedLanguage = settings.defaultSourceLanguageCode?.let { catalog?.languageByCode(it) },+ availableLanguages = availableLanguages,+ fallbackLanguage = availableLanguages.firstOrNull { it.code != settings.defaultTargetLanguageCode },+ onLanguageSelected = { language ->+ onSettingsChange(settings.copy(defaultSourceLanguageCode = language.code))+ },+ )++ LanguageDropdown(+ label = stringResource(R.string.settings_default_to),+ selectedLanguage = catalog?.languageByCode(settings.defaultTargetLanguageCode),+ availableLanguages = availableLanguages,+ fallbackLanguage = null,+ onLanguageSelected = { language ->+ onSettingsChange(settings.copy(defaultTargetLanguageCode = language.code))+ },+ )++ Text(+ text = stringResource(R.string.settings_font_size),+ style = MaterialTheme.typography.bodyMedium,+ color = MaterialTheme.colorScheme.onSurface,+ )++ var showExampleText by remember { mutableStateOf(false) }++ Slider(+ value = settings.fontFactor,+ onValueChange = { value ->+ onSettingsChange(settings.copy(fontFactor = value))+ showExampleText = true+ },+ valueRange = 1.0f..3.0f,+ steps = 3,+ modifier = Modifier.fillMaxWidth(),+ )++ LaunchedEffect(settings.fontFactor) {+ if (showExampleText) {+ delay(1500)+ showExampleText = false+ }+ }++ if (showExampleText) {+ Text(+ text = stringResource(R.string.settings_font_sample),+ style =+ MaterialTheme.typography.bodyLarge.copy(+ fontSize = (MaterialTheme.typography.bodyLarge.fontSize * settings.fontFactor),+ lineHeight = (MaterialTheme.typography.bodyLarge.lineHeight * settings.fontFactor),+ ),+ color = MaterialTheme.colorScheme.onSurface,+ maxLines = 1,+ overflow = androidx.compose.ui.text.style.TextOverflow.Ellipsis,+ )+ }++ Row(+ modifier = Modifier.fillMaxWidth(),+ horizontalArrangement = Arrangement.SpaceBetween,+ verticalAlignment = Alignment.CenterVertically,+ ) {+ Column(modifier = Modifier.weight(1f)) {+ Text(+ text = stringResource(R.string.settings_tap_notification),+ style = MaterialTheme.typography.bodyMedium,+ color = MaterialTheme.colorScheme.onSurface,+ )+ Text(+ text = stringResource(R.string.settings_tap_notification_desc),+ style = MaterialTheme.typography.bodySmall,+ color = MaterialTheme.colorScheme.onSurfaceVariant,+ )+ }++ Switch(+ checked = settings.tapToTranslateEnabled,+ onCheckedChange = { checked ->+ if (checked) {+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU &&+ androidx.core.content.ContextCompat.checkSelfPermission(+ context,+ android.Manifest.permission.POST_NOTIFICATIONS,+ ) != android.content.pm.PackageManager.PERMISSION_GRANTED+ ) {+ notificationPermissionLauncher.launch(android.Manifest.permission.POST_NOTIFICATIONS)+ } else {+ onSettingsChange(settings.copy(tapToTranslateEnabled = true))+ TapToTranslateNotification.show(context)+ }+ } else {+ onSettingsChange(settings.copy(tapToTranslateEnabled = false))+ TapToTranslateNotification.hide(context)+ }+ },+ )+ }+ }+ }++ // Web Translator Section+ AppCard(+ modifier = Modifier.fillMaxWidth().testTag("export-section:Web Translator"),+ ) {+ Column(+ modifier = Modifier.padding(16.dp),+ verticalArrangement = Arrangement.spacedBy(8.dp),+ ) {+ Text(+ text = stringResource(R.string.settings_web_translator),+ style = MaterialTheme.typography.headlineSmall,+ color = MaterialTheme.colorScheme.primary,+ )++ WebTranslatorAssetRow(+ label = stringResource(R.string.settings_adblock_support),+ secondaryLabel = catalog?.supportSizeBytesByKind("adblock")?.let(::formatSize),+ installed = adblockInstalled,+ downloadState = adblockDownloadState,+ onDownload = { DownloadService.startAdblockDownload(context) },+ onDelete = onDeleteAdblockSupport,+ onCancel = { DownloadService.cancelAdblockDownload(context) },+ )++ Row(+ modifier = Modifier.fillMaxWidth(),+ horizontalArrangement = Arrangement.SpaceBetween,+ verticalAlignment = Alignment.CenterVertically,+ ) {+ Column(modifier = Modifier.weight(1f)) {+ Text(+ text = stringResource(R.string.settings_clear_browsing),+ style = MaterialTheme.typography.bodyMedium,+ color = MaterialTheme.colorScheme.onSurface,+ )+ Text(+ text = stringResource(R.string.settings_clear_browsing_desc),+ style = MaterialTheme.typography.bodySmall,+ color = MaterialTheme.colorScheme.onSurfaceVariant,+ )+ }+ Switch(+ checked = settings.clearWebTranslatorDataOnClose,+ onCheckedChange = { enabled ->+ onSettingsChange(settings.copy(clearWebTranslatorDataOnClose = enabled))+ },+ )+ }+ }+ }++ // Text to Speech Section+ AppCard(+ modifier = Modifier.fillMaxWidth().testTag("export-section:Text to speech"),+ ) {+ Column(+ modifier = Modifier.padding(16.dp),+ verticalArrangement = Arrangement.spacedBy(8.dp),+ ) {+ Text(+ text = stringResource(R.string.settings_tts_section),+ style = MaterialTheme.typography.headlineSmall,+ color = MaterialTheme.colorScheme.primary,+ )++ Row(+ modifier = Modifier.fillMaxWidth(),+ horizontalArrangement = Arrangement.SpaceBetween,+ verticalAlignment = Alignment.CenterVertically,+ ) {+ Text(+ text = stringResource(R.string.settings_tts_read_urls_hashtags),+ style = MaterialTheme.typography.bodyMedium,+ color = MaterialTheme.colorScheme.onSurface,+ modifier = Modifier.weight(1f).padding(end = 8.dp),+ )+ Switch(+ checked = settings.ttsReadUrlsAndHashtags,+ onCheckedChange = { enabled ->+ onSettingsChange(settings.copy(ttsReadUrlsAndHashtags = enabled))+ },+ )+ }+ }+ }++ AppCard(+ modifier = Modifier.fillMaxWidth().testTag("export-section:Popup"),+ ) {+ Column(+ modifier = Modifier.padding(16.dp),+ verticalArrangement = Arrangement.spacedBy(8.dp),+ ) {+ Text(+ text = stringResource(R.string.settings_popup_settings),+ style = MaterialTheme.typography.headlineSmall,+ color = MaterialTheme.colorScheme.primary,+ )++ Text(+ text = stringResource(R.string.settings_popup_desc),+ style = MaterialTheme.typography.bodyMedium,+ color = MaterialTheme.colorScheme.onSurfaceVariant,+ )++ Row(+ modifier = Modifier.fillMaxWidth(),+ horizontalArrangement = Arrangement.SpaceBetween,+ verticalAlignment = Alignment.CenterVertically,+ ) {+ Column(modifier = Modifier.weight(1f)) {+ Text(+ text = stringResource(R.string.settings_hide_input),+ style = MaterialTheme.typography.bodyMedium,+ color = MaterialTheme.colorScheme.onSurface,+ )+ }++ Switch(+ checked = settings.onlyShowOutputOnReadonlyModal,+ onCheckedChange = { checked ->+ onSettingsChange(settings.copy(onlyShowOutputOnReadonlyModal = checked))+ },+ )+ }++ var readonlyModalAlignmentExpanded by remember { mutableStateOf(false) }++ Text(+ text = stringResource(R.string.settings_popup_position),+ style = MaterialTheme.typography.bodyMedium,+ color = MaterialTheme.colorScheme.onSurface,+ )++ ExposedDropdownMenuBox(+ expanded = readonlyModalAlignmentExpanded,+ onExpandedChange = { readonlyModalAlignmentExpanded = it },+ modifier = Modifier.fillMaxWidth(),+ ) {+ OutlinedTextField(+ value = stringResource(settings.readonlyModalOutputAlignment.labelRes),+ onValueChange = {},+ readOnly = true,+ trailingIcon = {+ ExposedDropdownMenuDefaults.TrailingIcon(expanded = readonlyModalAlignmentExpanded)+ },+ modifier =+ Modifier+ .menuAnchor()+ .fillMaxWidth()+ .testTag("export-options:settings_popup_position"),+ colors = ExposedDropdownMenuDefaults.outlinedTextFieldColors(),+ )+ ExposedDropdownMenu(+ expanded = readonlyModalAlignmentExpanded,+ onDismissRequest = { readonlyModalAlignmentExpanded = false },+ ) {+ ReadonlyModalOutputAlignment.entries.forEach { alignment ->+ DropdownMenuItem(+ text = { Text(stringResource(alignment.labelRes)) },+ onClick = {+ onSettingsChange(settings.copy(readonlyModalOutputAlignment = alignment))+ readonlyModalAlignmentExpanded = false+ },+ )+ }+ }+ }++ Text(+ text = stringResource(R.string.settings_popup_size, (settings.readonlyModalCompactHeightFactor * 100).toInt()),+ style = MaterialTheme.typography.bodyMedium,+ color = MaterialTheme.colorScheme.onSurface,+ )++ Slider(+ value = settings.readonlyModalCompactHeightFactor,+ onValueChange = { value ->+ onSettingsChange(+ settings.copy(readonlyModalCompactHeightFactor = (value * 20f).roundToInt() / 20f),+ )+ },+ valueRange = 0.2f..0.8f,+ steps = 11,+ modifier = Modifier.fillMaxWidth(),+ )+ }+ }++ AppCard(+ modifier = Modifier.fillMaxWidth().testTag("export-section:Screen translation"),+ ) {+ Column(+ modifier = Modifier.padding(16.dp),+ verticalArrangement = Arrangement.spacedBy(8.dp),+ ) {+ Text(+ text = stringResource(R.string.settings_screen_translation),+ style = MaterialTheme.typography.headlineSmall,+ color = MaterialTheme.colorScheme.primary,+ )++ Text(+ text = stringResource(R.string.settings_screen_translation_desc),+ style = MaterialTheme.typography.bodyMedium,+ color = MaterialTheme.colorScheme.onSurfaceVariant,+ )++ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {+ Row(+ modifier = Modifier.fillMaxWidth(),+ horizontalArrangement = Arrangement.SpaceBetween,+ verticalAlignment = Alignment.CenterVertically,+ ) {+ Column(modifier = Modifier.weight(1f)) {+ Text(+ text = stringResource(R.string.settings_floating_button),+ style = MaterialTheme.typography.bodyMedium,+ color = MaterialTheme.colorScheme.onSurface,+ )+ Text(+ text = stringResource(R.string.settings_floating_button_desc),+ style = MaterialTheme.typography.bodySmall,+ color = MaterialTheme.colorScheme.onSurfaceVariant,+ )+ }++ TextButton(+ onClick = {+ context.startActivity(Intent(Settings.ACTION_ACCESSIBILITY_SETTINGS).addFlags(Intent.FLAG_ACTIVITY_NEW_TASK))+ },+ ) {+ Text(stringResource(R.string.common_manage))+ }+ }+ }++ Row(+ modifier = Modifier.fillMaxWidth(),+ horizontalArrangement = Arrangement.SpaceBetween,+ verticalAlignment = Alignment.CenterVertically,+ ) {+ Column(modifier = Modifier.weight(1f)) {+ Text(+ text = stringResource(R.string.settings_shortcut),+ style = MaterialTheme.typography.bodyMedium,+ color = MaterialTheme.colorScheme.onSurface,+ )+ Text(+ text = stringResource(R.string.settings_shortcut_desc),+ style = MaterialTheme.typography.bodySmall,+ color = MaterialTheme.colorScheme.onSurfaceVariant,+ )+ }++ TextButton(+ onClick = {+ if (shouldLaunchAssistantRoleRequest(context)) {+ val roleManager = context.getSystemService(RoleManager::class.java) ?: return@TextButton+ assistantRoleLauncher.launch(+ roleManager.createRequestRoleIntent(RoleManager.ROLE_ASSISTANT),+ )+ } else {+ openAssistantSettings(context)+ }+ },+ ) {+ Text(stringResource(R.string.common_manage))+ }+ }++ var assistantActionExpanded by remember { mutableStateOf(false) }++ Text(+ text = stringResource(R.string.settings_on_shortcut),+ style = MaterialTheme.typography.bodyMedium,+ color = MaterialTheme.colorScheme.onSurface,+ )++ ExposedDropdownMenuBox(+ expanded = assistantActionExpanded,+ onExpandedChange = { assistantActionExpanded = it },+ modifier = Modifier.fillMaxWidth(),+ ) {+ OutlinedTextField(+ value = stringResource(settings.assistantAction.labelRes),+ onValueChange = {},+ readOnly = true,+ trailingIcon = {+ ExposedDropdownMenuDefaults.TrailingIcon(expanded = assistantActionExpanded)+ },+ modifier =+ Modifier+ .menuAnchor()+ .fillMaxWidth(),+ colors = ExposedDropdownMenuDefaults.outlinedTextFieldColors(),+ )+ ExposedDropdownMenu(+ expanded = assistantActionExpanded,+ onDismissRequest = { assistantActionExpanded = false },+ ) {+ dev.davidv.translator.AssistantAction.entries.forEach { action ->+ DropdownMenuItem(+ text = { Text(stringResource(action.labelRes)) },+ onClick = {+ onSettingsChange(settings.copy(assistantAction = action))+ assistantActionExpanded = false+ },+ )+ }+ }+ }+ }+ }++ AppCard(+ modifier = Modifier.fillMaxWidth().testTag("export-section:Images"),+ ) {+ Column(+ modifier = Modifier.padding(16.dp),+ verticalArrangement = Arrangement.spacedBy(8.dp),+ ) {+ Text(+ text = stringResource(R.string.settings_ocr),+ style = MaterialTheme.typography.headlineSmall,+ color = MaterialTheme.colorScheme.primary,+ )++ // Background Mode+ var backgroundModeExpanded by remember { mutableStateOf(false) }++ Text(+ text = stringResource(R.string.settings_background_mode),+ style = MaterialTheme.typography.bodyMedium,+ color = MaterialTheme.colorScheme.onSurface,+ )++ ExposedDropdownMenuBox(+ expanded = backgroundModeExpanded,+ onExpandedChange = { backgroundModeExpanded = it },+ modifier = Modifier.fillMaxWidth(),+ ) {+ OutlinedTextField(+ value = stringResource(settings.backgroundMode.labelRes),+ onValueChange = {},+ readOnly = true,+ trailingIcon = { ExposedDropdownMenuDefaults.TrailingIcon(expanded = backgroundModeExpanded) },+ modifier =+ Modifier+ .menuAnchor()+ .fillMaxWidth()+ .testTag("export-options:settings_background_mode"),+ colors = ExposedDropdownMenuDefaults.outlinedTextFieldColors(),+ )+ ExposedDropdownMenu(+ expanded = backgroundModeExpanded,+ onDismissRequest = { backgroundModeExpanded = false },+ ) {+ BackgroundMode.entries.forEach { mode ->+ DropdownMenuItem(+ text = { Text(stringResource(mode.labelRes)) },+ onClick = {+ onSettingsChange(settings.copy(backgroundMode = mode))+ backgroundModeExpanded = false+ },+ )+ }+ }+ }++ // Min Confidence Slider+ Text(+ text = stringResource(R.string.settings_min_confidence, settings.minConfidence),+ style = MaterialTheme.typography.bodyMedium,+ color = MaterialTheme.colorScheme.onSurface,+ )++ Slider(+ value = settings.minConfidence.toFloat(),+ onValueChange = { value ->+ onSettingsChange(settings.copy(minConfidence = value.toInt()))+ },+ valueRange = 70f..100f,+ steps = 5,+ modifier = Modifier.fillMaxWidth(),+ )++ // Max Image Size Slider+ Text(+ text = stringResource(R.string.settings_max_image_size, settings.maxImageSize),+ style = MaterialTheme.typography.bodyMedium,+ color = MaterialTheme.colorScheme.onSurface,+ )++ Slider(+ value = settings.maxImageSize.toFloat(),+ onValueChange = { value ->+ onSettingsChange(settings.copy(maxImageSize = value.toInt()))+ },+ valueRange = 1300f..2000f,+ steps = 6,+ modifier = Modifier.fillMaxWidth(),+ )+ }+ }++ // Advanced Settings Section+ var advancedExpanded by remember { mutableStateOf(false) }+ AppCard(+ modifier = Modifier.fillMaxWidth().testTag("export-section:Advanced"),+ ) {+ Column(+ modifier = Modifier.padding(16.dp),+ verticalArrangement = Arrangement.spacedBy(8.dp),+ ) {+ // Clickable header+ Row(+ modifier =+ Modifier+ .fillMaxWidth()+ .clickable { advancedExpanded = !advancedExpanded },+ horizontalArrangement = Arrangement.SpaceBetween,+ verticalAlignment = Alignment.CenterVertically,+ ) {+ Text(+ text = stringResource(R.string.settings_advanced),+ style = MaterialTheme.typography.headlineSmall,+ color = MaterialTheme.colorScheme.primary,+ )++ Icon(+ painter =+ painterResource(+ id = if (advancedExpanded) R.drawable.expandless else R.drawable.expandmore,+ ),+ contentDescription = if (advancedExpanded) stringResource(R.string.a11y_collapse) else stringResource(R.string.a11y_expand),+ tint = MaterialTheme.colorScheme.primary,+ )+ }++ // Expandable content+ if (advancedExpanded) {+ // Catalog Index URL+ Text(+ text = stringResource(R.string.settings_catalog_url),+ style = MaterialTheme.typography.bodyMedium,+ color = MaterialTheme.colorScheme.onSurface,+ )++ OutlinedTextField(+ value = settings.catalogIndexUrl,+ onValueChange = {+ onSettingsChange(settings.copy(catalogIndexUrl = it))+ },+ modifier = Modifier.fillMaxWidth(),+ singleLine = true,+ )++ // External Storage Toggle+ Row(+ modifier = Modifier.fillMaxWidth(),+ horizontalArrangement = Arrangement.SpaceBetween,+ verticalAlignment = Alignment.CenterVertically,+ ) {+ Text(+ text = stringResource(R.string.settings_external_storage),+ style = MaterialTheme.typography.bodyMedium,+ color = MaterialTheme.colorScheme.onSurface,+ modifier = Modifier.weight(1f).padding(end = 8.dp),+ )++ Switch(+ checked = settings.useExternalStorage,+ onCheckedChange = { checked ->+ if (checked) {+ if (PermissionHelper.hasExternalStoragePermission(context)) {+ onSettingsChange(settings.copy(useExternalStorage = true))+ } else if (PermissionHelper.needsSpecialPermissionIntent()) {+ // Android 11+ - Show dialog first, then launch Settings+ showPermissionDialog = true+ } else {+ // Android 10 and below - Request runtime permissions+ val permissions = PermissionHelper.getExternalStoragePermissions()+ if (permissions.isNotEmpty()) {+ permissionLauncher.launch(permissions)+ } else {+ onSettingsChange(settings.copy(useExternalStorage = true))+ }+ }+ } else {+ onSettingsChange(settings.copy(useExternalStorage = false))+ }+ },+ )+ }++ // Disable CLD Toggle+ Row(+ modifier = Modifier.fillMaxWidth(),+ horizontalArrangement = Arrangement.SpaceBetween,+ verticalAlignment = Alignment.CenterVertically,+ ) {+ Text(+ text = stringResource(R.string.settings_disable_autodetect),+ style = MaterialTheme.typography.bodyMedium,+ color = MaterialTheme.colorScheme.onSurface,+ modifier = Modifier.weight(1f).padding(end = 8.dp),+ )++ Switch(+ checked = settings.disableCLD,+ onCheckedChange = { checked ->+ onSettingsChange(settings.copy(disableCLD = checked))+ },+ )+ }++ // Experimental screen-translate entry in the input source row+ Row(+ modifier = Modifier.fillMaxWidth(),+ horizontalArrangement = Arrangement.SpaceBetween,+ verticalAlignment = Alignment.CenterVertically,+ ) {+ Text(+ text = stringResource(R.string.settings_experimental_screen_translate),+ style = MaterialTheme.typography.bodyMedium,+ color = MaterialTheme.colorScheme.onSurface,+ modifier = Modifier.weight(1f).padding(end = 8.dp),+ )++ Switch(+ checked = settings.experimentalScreenTranslate,+ onCheckedChange = { checked ->+ onSettingsChange(settings.copy(experimentalScreenTranslate = checked))+ },+ )+ }++ // Multiple target languages (tabbed output)+ Row(+ modifier = Modifier.fillMaxWidth(),+ horizontalArrangement = Arrangement.SpaceBetween,+ verticalAlignment = Alignment.CenterVertically,+ ) {+ Text(+ text = stringResource(R.string.settings_multi_target),+ style = MaterialTheme.typography.bodyMedium,+ color = MaterialTheme.colorScheme.onSurface,+ modifier = Modifier.weight(1f).padding(end = 8.dp),+ )++ Switch(+ checked = settings.multiTargetEnabled,+ onCheckedChange = { checked ->+ onSettingsChange(settings.copy(multiTargetEnabled = checked))+ },+ )+ }++ // Show Transliteration for Output Toggle+ Row(+ modifier = Modifier.fillMaxWidth(),+ horizontalArrangement = Arrangement.SpaceBetween,+ verticalAlignment = Alignment.CenterVertically,+ ) {+ Text(+ text = stringResource(R.string.settings_translit_output),+ style = MaterialTheme.typography.bodyMedium,+ color = MaterialTheme.colorScheme.onSurface,+ modifier = Modifier.weight(1f).padding(end = 8.dp),+ )++ Switch(+ checked = settings.enableOutputTransliteration,+ onCheckedChange = { checked ->+ onSettingsChange(settings.copy(enableOutputTransliteration = checked))+ },+ )+ }++ // Show Transliteration on Input Toggle+ Row(+ modifier = Modifier.fillMaxWidth(),+ horizontalArrangement = Arrangement.SpaceBetween,+ verticalAlignment = Alignment.CenterVertically,+ ) {+ Text(+ text = stringResource(R.string.settings_translit_input),+ style = MaterialTheme.typography.bodyMedium,+ color = MaterialTheme.colorScheme.onSurface,+ modifier = Modifier.weight(1f).padding(end = 8.dp),+ )++ Switch(+ checked = settings.showTransliterationOnInput,+ onCheckedChange = { checked ->+ onSettingsChange(settings.copy(showTransliterationOnInput = checked))+ },+ )+ }++ // Add Spaces for Japanese Transliteration Toggle+ Row(+ modifier = Modifier.fillMaxWidth(),+ horizontalArrangement = Arrangement.SpaceBetween,+ verticalAlignment = Alignment.CenterVertically,+ ) {+ Text(+ text = stringResource(R.string.settings_translit_japanese_spaces),+ style = MaterialTheme.typography.bodyMedium,+ color = MaterialTheme.colorScheme.onSurface,+ modifier = Modifier.weight(1f).padding(end = 8.dp),+ )++ Switch(+ checked = settings.addSpacesForJapaneseTransliteration,+ onCheckedChange = { checked ->+ onSettingsChange(settings.copy(addSpacesForJapaneseTransliteration = checked))+ },+ )+ }++ // Translate images embedded in PDFs+ Row(+ modifier = Modifier.fillMaxWidth(),+ horizontalArrangement = Arrangement.SpaceBetween,+ verticalAlignment = Alignment.CenterVertically,+ ) {+ Text(+ text = stringResource(R.string.settings_translate_pdf_images),+ style = MaterialTheme.typography.bodyMedium,+ color = MaterialTheme.colorScheme.onSurface,+ modifier = Modifier.weight(1f).padding(end = 8.dp),+ )+ Switch(+ checked = settings.translatePdfImages,+ onCheckedChange = { checked ->+ onSettingsChange(settings.copy(translatePdfImages = checked))+ },+ )+ }++ Row(+ modifier = Modifier.fillMaxWidth(),+ horizontalArrangement = Arrangement.SpaceBetween,+ verticalAlignment = Alignment.CenterVertically,+ ) {+ Text(+ text = stringResource(R.string.settings_camera_live_default),+ style = MaterialTheme.typography.bodyMedium,+ color = MaterialTheme.colorScheme.onSurface,+ modifier = Modifier.weight(1f).padding(end = 8.dp),+ )+ Switch(+ checked = settings.liveCameraOverlayEnabled,+ onCheckedChange = { checked ->+ onSettingsChange(settings.copy(liveCameraOverlayEnabled = checked))+ },+ )+ }++ Row(+ modifier = Modifier.fillMaxWidth(),+ horizontalArrangement = Arrangement.SpaceBetween,+ verticalAlignment = Alignment.CenterVertically,+ ) {+ Column(modifier = Modifier.weight(1f).padding(end = 8.dp)) {+ Text(+ text = stringResource(R.string.settings_register_browser),+ style = MaterialTheme.typography.bodyMedium,+ color = MaterialTheme.colorScheme.onSurface,+ )+ Text(+ text = stringResource(R.string.settings_register_browser_desc),+ style = MaterialTheme.typography.bodySmall,+ color = MaterialTheme.colorScheme.onSurfaceVariant,+ )+ }+ Switch(+ checked = settings.registerAsBrowser,+ onCheckedChange = { checked ->+ onSettingsChange(settings.copy(registerAsBrowser = checked))+ },+ )+ }++ Row(+ modifier = Modifier.fillMaxWidth(),+ horizontalArrangement = Arrangement.SpaceBetween,+ verticalAlignment = Alignment.CenterVertically,+ ) {+ Column(modifier = Modifier.weight(1f).padding(end = 8.dp)) {+ Text(+ text = stringResource(R.string.settings_http_server),+ style = MaterialTheme.typography.bodyMedium,+ color = MaterialTheme.colorScheme.onSurface,+ )+ Text(+ text = stringResource(R.string.settings_http_server_desc),+ style = MaterialTheme.typography.bodySmall,+ color = MaterialTheme.colorScheme.onSurfaceVariant,+ )+ }+ Switch(+ checked = settings.httpServerEnabled,+ onCheckedChange = { checked ->+ onSettingsChange(settings.copy(httpServerEnabled = checked))+ },+ )+ }+ }+ }+ }++ if (settings.httpServerEnabled) {+ HttpServerCard(settings = settings, onSettingsChange = onSettingsChange)+ }++ AboutCard(+ onHowToUse = onHowToUse,+ onGetHelp = {+ val clipboard = context.getSystemService(Context.CLIPBOARD_SERVICE) as ClipboardManager+ clipboard.setPrimaryClip(ClipData.newPlainText("App logs", captureAppLogs()))+ Toast.makeText(context, context.getString(R.string.settings_logs_copied), Toast.LENGTH_SHORT).show()+ context.startActivity(+ Intent(Intent.ACTION_VIEW, Uri.parse("https://github.com/DavidVentura/offline-translator/issues")),+ )+ },+ onSupport = {+ context.startActivity(+ Intent(Intent.ACTION_VIEW, Uri.parse("https://liberapay.com/DavidV/")),+ )+ },+ )+ }+ }++ // Permission explanation dialog+ if (showPermissionDialog) {+ AlertDialog(+ onDismissRequest = {+ showPermissionDialog = false+ },+ title = { Text(stringResource(R.string.settings_external_storage_perm_title)) },+ text = {+ Text(stringResource(R.string.settings_external_storage_perm_body))+ },+ confirmButton = {+ TextButton(+ onClick = {+ showPermissionDialog = false+ val intent = PermissionHelper.createManageStorageIntent(context)+ manageStorageLauncher.launch(intent)+ },+ ) {+ Text(stringResource(R.string.common_ok))+ }+ },+ dismissButton = {+ TextButton(+ onClick = {+ showPermissionDialog = false+ },+ ) {+ Text(stringResource(R.string.common_cancel))+ }+ },+ )+ }+}++@Composable+private fun AboutCard(+ onHowToUse: () -> Unit,+ onGetHelp: () -> Unit,+ onSupport: () -> Unit,+) {+ val context = LocalContext.current+ val versionName =+ remember {+ runCatching {+ context.packageManager.getPackageInfo(context.packageName, 0).versionName+ }.getOrNull() ?: "unknown"+ }++ AppCard(+ modifier = Modifier.fillMaxWidth().testTag("export-section:About"),+ ) {+ Column(modifier = Modifier.padding(vertical = 16.dp)) {+ Text(+ text = stringResource(R.string.settings_about),+ style = MaterialTheme.typography.headlineSmall,+ color = MaterialTheme.colorScheme.primary,+ modifier = Modifier.padding(start = 16.dp, end = 16.dp, bottom = 8.dp),+ )++ AboutNavRow(label = stringResource(R.string.howto_title), iconRes = R.drawable.question, onClick = onHowToUse)+ AboutNavRow(label = stringResource(R.string.settings_about_get_help), iconRes = R.drawable.info, onClick = onGetHelp)+ AboutNavRow(label = stringResource(R.string.settings_about_support), iconRes = R.drawable.heart, onClick = onSupport)++ Text(+ text = stringResource(R.string.settings_version, versionName),+ style = MaterialTheme.typography.bodySmall,+ color = MaterialTheme.colorScheme.onSurfaceVariant,+ textAlign = androidx.compose.ui.text.style.TextAlign.Center,+ modifier = Modifier.fillMaxWidth().padding(top = 12.dp),+ )+ }+ }+}++@Composable+private fun AboutNavRow(+ label: String,+ iconRes: Int,+ onClick: () -> Unit,+) {+ Row(+ modifier =+ Modifier+ .fillMaxWidth()+ .clickable(onClick = onClick)+ .padding(horizontal = 16.dp, vertical = 12.dp),+ verticalAlignment = Alignment.CenterVertically,+ ) {+ Icon(+ painter = painterResource(id = iconRes),+ contentDescription = null,+ tint = MaterialTheme.colorScheme.onSurface,+ modifier = Modifier.size(24.dp),+ )+ Text(+ text = label,+ style = MaterialTheme.typography.bodyMedium,+ color = MaterialTheme.colorScheme.onSurface,+ modifier = Modifier.padding(start = 16.dp),+ )+ }+}++private fun captureAppLogs(): String =+ runCatching {+ val process = Runtime.getRuntime().exec(arrayOf("logcat", "-d", "-v", "threadtime", "-t", "2000"))+ process.inputStream.bufferedReader().use { it.readText() }+ }.getOrElse { "Failed to read logs: ${it.message}" }++@Composable+private fun WebTranslatorAssetRow(+ label: String,+ secondaryLabel: String?,+ installed: Boolean,+ downloadState: DownloadState,+ onDownload: () -> Unit,+ onDelete: () -> Unit,+ onCancel: () -> Unit,+) {+ Row(+ modifier = Modifier.fillMaxWidth(),+ horizontalArrangement = Arrangement.SpaceBetween,+ verticalAlignment = Alignment.CenterVertically,+ ) {+ Column(+ modifier = Modifier.weight(1f),+ verticalArrangement = Arrangement.spacedBy(2.dp),+ ) {+ Text(+ text = label,+ style = MaterialTheme.typography.bodyMedium,+ color = MaterialTheme.colorScheme.onSurface,+ )+ secondaryLabel?.let { size ->+ Text(+ text = size,+ style = MaterialTheme.typography.bodySmall,+ color = MaterialTheme.colorScheme.onSurfaceVariant,+ )+ }+ }++ SupportActionButton(+ downloadState = downloadState,+ installed = installed,+ onDownload = onDownload,+ onDelete = onDelete,+ onCancel = onCancel,+ )+ }+}++@Composable+private fun SupportActionButton(+ downloadState: DownloadState,+ installed: Boolean,+ onDownload: () -> Unit,+ onDelete: () -> Unit,+ onCancel: () -> Unit,+) {+ if (downloadState.isDownloading) {+ Box(+ contentAlignment = Alignment.Center,+ modifier = Modifier.size(40.dp),+ ) {+ val targetProgress =+ if (downloadState.totalSize > 0) {+ downloadState.downloaded.toFloat() / downloadState.totalSize.toFloat()+ } else {+ 0f+ }+ val animatedProgress by animateFloatAsState(+ targetValue = targetProgress,+ animationSpec = tween(durationMillis = 300),+ label = "adblock-progress",+ )+ CircularProgressIndicator(+ progress = { animatedProgress },+ modifier = Modifier.size(32.dp),+ )+ IconButton(+ onClick = onCancel,+ modifier = Modifier.size(32.dp),+ ) {+ Icon(+ painter = painterResource(id = R.drawable.cancel),+ contentDescription = stringResource(R.string.a11y_cancel_download),+ )+ }+ }+ return+ }++ IconButton(+ onClick = if (installed) onDelete else onDownload,+ modifier = Modifier.size(40.dp),+ ) {+ Icon(+ painter =+ painterResource(+ id =+ when {+ installed -> R.drawable.delete+ downloadState.isCancelled || downloadState.error != null -> R.drawable.refresh+ else -> R.drawable.add+ },+ ),+ contentDescription =+ when {+ installed -> stringResource(R.string.a11y_delete)+ downloadState.isCancelled || downloadState.error != null -> stringResource(R.string.a11y_retry_download)+ else -> stringResource(R.string.a11y_download)+ },+ )+ }+}++private fun formatSize(sizeBytes: Long): String {+ val units = listOf("B", "KB", "MB", "GB")+ var size = sizeBytes.toDouble()+ var unitIndex = 0+ while (size >= 1024 && unitIndex < units.lastIndex) {+ size /= 1024+ unitIndex+++ }+ return if (unitIndex == 0) {+ "${size.toLong()} ${units[unitIndex]}"+ } else {+ "%.1f %s".format(size, units[unitIndex])+ }+}++private fun shouldLaunchAssistantRoleRequest(context: Context): Boolean {+ if (Build.VERSION.SDK_INT < Build.VERSION_CODES.Q) return false+ if (getConfiguredAssistant(context).isNullOrBlank()) return false+ val roleManager = context.getSystemService(RoleManager::class.java) ?: return false+ return roleManager.isRoleAvailable(RoleManager.ROLE_ASSISTANT) &&+ !roleManager.isRoleHeld(RoleManager.ROLE_ASSISTANT)+}++private fun getConfiguredAssistant(context: Context): String? =+ Settings.Secure+ .getString(context.contentResolver, ASSISTANT_SETTING)+ ?.takeIf { it.isNotBlank() }++private fun openAssistantSettings(context: Context) {+ val settingsIntents =+ listOf(+ Intent(Settings.ACTION_VOICE_INPUT_SETTINGS),+ Intent(Settings.ACTION_MANAGE_DEFAULT_APPS_SETTINGS),+ Intent(Settings.ACTION_SETTINGS),+ )++ settingsIntents+ .firstOrNull { intent ->+ intent.resolveActivity(context.packageManager) != null+ }?.let { intent ->+ context.startActivity(intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK))+ }+}++private const val ASSISTANT_SETTING = "assistant"++private fun previewLanguage(+ code: String,+ name: String,+) = Language(+ code = code,+ displayName = name,+ shortDisplayName = name,+ script = Script.LATIN,+ writingSystem = singleScript(Script.LATIN),+ dictionaryCode = code,+)++@Preview(showBackground = true)+@Composable+fun SettingsScreenPreview() {+ val context = LocalContext.current+ val previewLangs =+ listOf(+ previewLanguage("en", "English"),+ previewLanguage("es", "Spanish"),+ previewLanguage("fr", "French"),+ )+ TranslatorTheme {+ SettingsScreen(+ settings = AppSettings(),+ languageMetadataManager = LanguageMetadataManager(context, kotlinx.coroutines.flow.MutableStateFlow(emptyList())),+ availableLanguages = previewLangs,+ catalog = null,+ adblockDownloadState = DownloadState(),+ adblockInstalled = false,+ onSettingsChange = {},+ onManageLanguages = {},+ onDeleteAdblockSupport = {},+ onHowToUse = {},+ )+ }+}++@Preview(+ showBackground = true,+ uiMode = android.content.res.Configuration.UI_MODE_NIGHT_YES,+)+@Composable+fun SettingsScreenDarkPreview() {+ val context = LocalContext.current+ val previewLangs =+ listOf(+ previewLanguage("en", "English"),+ previewLanguage("es", "Spanish"),+ previewLanguage("fr", "French"),+ )+ TranslatorTheme {+ SettingsScreen(+ settings = AppSettings(fontFactor = 3.0f),+ languageMetadataManager = LanguageMetadataManager(context, kotlinx.coroutines.flow.MutableStateFlow(emptyList())),+ availableLanguages = previewLangs,+ catalog = null,+ adblockDownloadState = DownloadState(),+ adblockInstalled = true,+ onSettingsChange = {},+ onManageLanguages = {},+ onDeleteAdblockSupport = {},+ onHowToUse = {},+ )+ }+}diff --git a/OCR-translation/src/main/java/dev/davidv/translator/ui/screens/TranslatorApp.kt b/OCR-translation/src/main/java/dev/davidv/translator/ui/screens/TranslatorApp.ktnew file mode 100644index 0000000..7095fc5--- /dev/null+++ b/OCR-translation/src/main/java/dev/davidv/translator/ui/screens/TranslatorApp.kt@@ -0,0 +1,968 @@+/*+ * Copyright (C) 2024 David V+ *+ * This program 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.+ *+ * This program 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 <https://www.gnu.org/licenses/>.+ */++package dev.davidv.translator.ui.screens++import android.app.Activity+import android.content.Context+import android.content.Intent+import android.graphics.Bitmap+import android.net.Uri+import android.util.Log+import android.view.Gravity+import android.view.ViewGroup+import android.view.WindowManager+import android.widget.Toast+import androidx.activity.compose.rememberLauncherForActivityResult+import androidx.activity.result.contract.ActivityResultContracts+import androidx.compose.animation.AnimatedVisibility+import androidx.compose.animation.core.animateFloatAsState+import androidx.compose.animation.core.tween+import androidx.compose.animation.slideOutVertically+import androidx.compose.foundation.clickable+import androidx.compose.foundation.interaction.MutableInteractionSource+import androidx.compose.foundation.layout.Arrangement+import androidx.compose.foundation.layout.Box+import androidx.compose.foundation.layout.Column+import androidx.compose.foundation.layout.Row+import androidx.compose.foundation.layout.fillMaxHeight+import androidx.compose.foundation.layout.fillMaxSize+import androidx.compose.foundation.layout.fillMaxWidth+import androidx.compose.foundation.layout.imePadding+import androidx.compose.foundation.layout.navigationBarsPadding+import androidx.compose.foundation.layout.padding+import androidx.compose.foundation.layout.statusBarsPadding+import androidx.compose.foundation.shape.RoundedCornerShape+import androidx.compose.material3.AlertDialog+import androidx.compose.material3.CircularProgressIndicator+import androidx.compose.material3.Icon+import androidx.compose.material3.IconButton+import androidx.compose.material3.LinearProgressIndicator+import androidx.compose.material3.Scaffold+import androidx.compose.material3.Text+import androidx.compose.material3.TextButton+import androidx.compose.runtime.Composable+import androidx.compose.runtime.DisposableEffect+import androidx.compose.runtime.LaunchedEffect+import androidx.compose.runtime.SideEffect+import androidx.compose.runtime.collectAsState+import androidx.compose.runtime.getValue+import androidx.compose.runtime.mutableStateOf+import androidx.compose.runtime.remember+import androidx.compose.runtime.rememberCoroutineScope+import androidx.compose.runtime.setValue+import androidx.compose.ui.Alignment+import androidx.compose.ui.Modifier+import androidx.compose.ui.draw.clip+import androidx.compose.ui.platform.LocalContext+import androidx.compose.ui.res.painterResource+import androidx.compose.ui.res.stringResource+import androidx.compose.ui.unit.dp+import androidx.core.content.ContextCompat.startActivity+import androidx.core.content.FileProvider+import androidx.navigation.compose.NavHost+import androidx.navigation.compose.composable+import androidx.navigation.compose.currentBackStackEntryAsState+import androidx.navigation.compose.rememberNavController+import dev.davidv.translator.AppSettings+import dev.davidv.translator.DocumentTranslationService+import dev.davidv.translator.DownloadService+import dev.davidv.translator.DownloadState+import dev.davidv.translator.Language+import dev.davidv.translator.LaunchMode+import dev.davidv.translator.PcmAudioPlayer+import dev.davidv.translator.R+import dev.davidv.translator.TranslatorMessage+import dev.davidv.translator.encodeVoiceOverride+import dev.davidv.translator.parseVoiceOverride+import dev.davidv.translator.ui.DocumentTranslationUiState+import dev.davidv.translator.ui.TranslatorViewModel+import dev.davidv.translator.ui.UiEvent+import dev.davidv.translator.ui.components.DocumentConfigureSheet+import kotlinx.coroutines.Dispatchers+import kotlinx.coroutines.MainScope+import kotlinx.coroutines.flow.StateFlow+import kotlinx.coroutines.flow.first+import kotlinx.coroutines.launch+import kotlinx.coroutines.withContext+import java.io.File+import java.io.FileOutputStream+import java.io.IOException+import java.text.SimpleDateFormat+import java.util.Date+import kotlin.math.roundToInt++private fun defaultVoiceNameForLanguage(packs: List<uniffi.translator_core.InstalledTtsPack>): String? =+ packs.firstOrNull()?.voices?.firstOrNull()?.name++private fun packsContainVoice(+ packs: List<uniffi.translator_core.InstalledTtsPack>,+ voiceName: String,+): Boolean = packs.any { pack -> pack.voices.any { it.name == voiceName } }++private enum class SpeechTarget { INPUT, OUTPUT }++private data class PendingDocumentSave(+ val path: String,+ val mimeType: String,+)++private fun quantizePlaybackSpeed(speed: Float): Float = ((speed.coerceIn(0.5f, 2.0f) * 10.0f).roundToInt() / 10.0f)++private fun ttsPlaybackSpeedFor(+ settings: AppSettings,+ language: Language,+ voiceName: String?,+): Float =+ voiceName+ ?.let { settings.ttsPlaybackSpeedOverrides[ttsPlaybackSpeedOverrideKey(language, it)] }+ ?: settings.ttsPlaybackSpeed++private fun ttsPlaybackSpeedOverrideKey(+ language: Language,+ voiceName: String,+): String = "${language.code}:$voiceName"++fun shareImageUri(+ uri: Uri,+ context: Context,+) {+ val intent = Intent(Intent.ACTION_SEND)+ intent.putExtra(Intent.EXTRA_STREAM, uri)+ intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION)+ intent.setType("image/jpeg")++ startActivity(context, intent, null)+}++fun openDocumentPath(+ path: String,+ mimeType: String,+ context: Context,+) {+ val uri =+ FileProvider.getUriForFile(+ context,+ "${context.packageName}.fileprovider",+ File(path),+ )+ val intent =+ Intent(Intent.ACTION_VIEW).apply {+ setDataAndType(uri, mimeType)+ addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION)+ }+ startActivity(context, Intent.createChooser(intent, "Open translated document"), null)+}++suspend fun saveDocumentPathToUri(+ path: String,+ uri: Uri,+ context: Context,+) {+ withContext(Dispatchers.IO) {+ File(path).inputStream().use { input ->+ val output = requireNotNull(context.contentResolver.openOutputStream(uri)) { "Unable to open output file" }+ output.use {+ input.copyTo(it)+ }+ }+ }+}++suspend fun saveImage(+ image: Bitmap,+ context: Context,+): Uri? =+ withContext(Dispatchers.IO) {+ val imagesFolder: File =+ File(+ context.cacheDir,+ "images",+ )+ var uri: Uri? = null+ try {+ imagesFolder.mkdirs()+ val date = Date()+ val sdf = SimpleDateFormat("yyyyMMdd-hhmmss")+ val dateString = sdf.format(date)+ val fileName = "shared_image-" + dateString + ".jpg"+ val file = File(imagesFolder, fileName)++ val stream = FileOutputStream(file)+ image.compress(Bitmap.CompressFormat.JPEG, 90, stream)+ stream.flush()+ stream.close()+ uri = FileProvider.getUriForFile(context, "${context.packageName}.fileprovider", file)+ } catch (e: IOException) {+ Log.e("Share", "IOException while trying to write file for sharing: " + e.message)+ }+ uri+ }++@Composable+private fun DocumentTranslationDialog(+ document: DocumentTranslationUiState,+ onDismiss: () -> Unit,+ onSave: (String, String, String) -> Unit,+ onOpen: (String, String) -> Unit,+) {+ val outputPath = document.outputPath+ val outputMimeType = document.outputMimeType+ val outputFileName = document.outputFileName ?: document.fileName++ AlertDialog(+ onDismissRequest = onDismiss,+ title = {+ Row(+ modifier = Modifier.fillMaxWidth(),+ verticalAlignment = Alignment.CenterVertically,+ ) {+ Text(+ text =+ if (document.isTranslating) {+ stringResource(R.string.doc_notif_translating)+ } else {+ stringResource(R.string.doc_notif_translated)+ },+ modifier = Modifier.weight(1f),+ )+ if (document.isTranslating) {+ IconButton(onClick = onDismiss) {+ Icon(+ painter = painterResource(R.drawable.cancel),+ contentDescription = stringResource(R.string.a11y_close),+ )+ }+ }+ }+ },+ text = {+ Column(verticalArrangement = Arrangement.spacedBy(8.dp)) {+ Row(+ modifier = Modifier.fillMaxWidth(),+ verticalAlignment = Alignment.CenterVertically,+ ) {+ Text(+ text = document.fileName,+ modifier = Modifier.weight(1f),+ )+ }+ if (document.isTranslating) {+ val phases = document.pdfPhases+ if (phases != null) {+ PdfPhaseFractionRow("Text", phases.textFraction)+ PdfPhaseRow("Images", phases.imageCurrent, phases.imageTotal)+ PdfPhaseRow("Bitmap pages", phases.rasterCurrent, phases.rasterTotal)+ } else {+ val progressFraction = document.progressFraction+ if (progressFraction != null) {+ LinearProgressIndicator(+ progress = { progressFraction },+ modifier = Modifier.fillMaxWidth(),+ )+ Text(stringResource(R.string.translator_percent, (progressFraction * 100).toInt()))+ } else {+ Text(stringResource(document.progressLabelRes))+ }+ }+ }+ if (document.errorMessage != null) {+ Text(document.errorMessage)+ } else if (outputPath != null) {+ Text(stringResource(R.string.translator_translated_file, outputFileName ?: ""))+ }+ }+ },+ confirmButton = {+ if (outputPath != null && outputMimeType != null) {+ TextButton(onClick = { onOpen(outputPath, outputMimeType) }) {+ Text(stringResource(R.string.common_open))+ }+ } else if (document.errorMessage != null) {+ TextButton(onClick = onDismiss) {+ Text(stringResource(R.string.common_close))+ }+ }+ },+ dismissButton = {+ if (outputPath != null && outputMimeType != null) {+ TextButton(onClick = { onSave(outputPath, outputMimeType, outputFileName) }) {+ Text(stringResource(R.string.common_save))+ }+ }+ },+ )+}++@Composable+private fun PdfPhaseRow(+ label: String,+ current: Int,+ total: Int,+) {+ val fraction = if (total > 0) (current.toFloat() / total.toFloat()).coerceIn(0f, 1f) else 0f+ Column(verticalArrangement = Arrangement.spacedBy(2.dp)) {+ Row(+ modifier = Modifier.fillMaxWidth(),+ verticalAlignment = Alignment.CenterVertically,+ ) {+ Text(label, modifier = Modifier.weight(1f))+ Text("$current/$total")+ }+ LinearProgressIndicator(+ progress = { fraction },+ modifier = Modifier.fillMaxWidth(),+ )+ }+}++@Composable+private fun PdfPhaseFractionRow(+ label: String,+ fraction: Float,+) {+ val f = fraction.coerceIn(0f, 1f)+ Column(verticalArrangement = Arrangement.spacedBy(2.dp)) {+ Row(+ modifier = Modifier.fillMaxWidth(),+ verticalAlignment = Alignment.CenterVertically,+ ) {+ Text(label, modifier = Modifier.weight(1f))+ Text("${(f * 100).toInt()}%")+ }+ LinearProgressIndicator(+ progress = { f },+ modifier = Modifier.fillMaxWidth(),+ )+ }+}++@Composable+fun TranslatorApp(+ viewModel: TranslatorViewModel,+ downloadServiceState: StateFlow<DownloadService?>,+ onClose: () -> Unit = {},+) {+ val navController = rememberNavController()+ val context = LocalContext.current+ val scope = rememberCoroutineScope()+ var isAudioPlaying by remember { mutableStateOf(false) }+ var isAudioLoading by remember { mutableStateOf(false) }+ var activeSpeechTarget by remember { mutableStateOf<SpeechTarget?>(null) }+ var pendingDocumentSave by remember { mutableStateOf<PendingDocumentSave?>(null) }+ val saveTranslatedDocument =+ rememberLauncherForActivityResult(ActivityResultContracts.StartActivityForResult()) { result ->+ val pending = pendingDocumentSave+ pendingDocumentSave = null+ val uri = result.data?.data+ if (result.resultCode == Activity.RESULT_OK && pending != null && uri != null) {+ scope.launch {+ try {+ saveDocumentPathToUri(pending.path, uri, context)+ Toast.makeText(context, context.getString(R.string.translator_document_saved), Toast.LENGTH_SHORT).show()+ } catch (e: Exception) {+ Log.e("DocumentSave", "Failed to save translated document", e)+ Toast.makeText(context, context.getString(R.string.translator_document_save_failed), Toast.LENGTH_SHORT).show()+ }+ }+ }+ }+ val pcmAudioPlayer =+ remember {+ PcmAudioPlayer { playing ->+ isAudioPlaying = playing+ if (playing) {+ isAudioLoading = false+ } else if (!playing) {+ isAudioLoading = false+ activeSpeechTarget = null+ }+ }+ }++ // Collect ViewModel state+ val input by viewModel.input.collectAsState()+ val inputTransliterated by viewModel.inputTransliterated.collectAsState()+ val output by viewModel.output.collectAsState()+ val from by viewModel.from.collectAsState()+ val to by viewModel.to.collectAsState()+ val targetTabs by viewModel.targets.collectAsState()+ val displayImage by viewModel.displayImage.collectAsState()+ val originalImage by viewModel.originalImage.collectAsState()+ val imageWordSelection by viewModel.imageWordSelection.collectAsState()+ val detectedRegions by viewModel.detectedRegions.collectAsState()+ val ocrReadingOrder by viewModel.ocrReadingOrder.collectAsState()+ val currentDetectedLanguage by viewModel.currentDetectedLanguage.collectAsState()+ val isAutoSource by viewModel.isAutoSource.collectAsState()+ val currentLaunchMode by viewModel.currentLaunchMode.collectAsState()+ val modalVisible by viewModel.modalVisible.collectAsState()+ val dictionaryWord by viewModel.dictionaryWord.collectAsState()+ val dictionaryStack by viewModel.dictionaryStack.collectAsState()+ val dictionaryLookupLanguage by viewModel.dictionaryLookupLanguage.collectAsState()+ val documentTranslation by viewModel.documentTranslation.collectAsState()++ val settings by viewModel.settingsManager.settings.collectAsState()+ val languageMetadata by viewModel.languageMetadataManager.metadata.collectAsState()+ val downloadService by downloadServiceState.collectAsState()+ val languageState by viewModel.languageStateManager.languageState.collectAsState()+ val downloadStates by downloadService?.downloadStates?.collectAsState() ?: remember {+ kotlinx.coroutines.flow.MutableStateFlow<Map<Language, DownloadState>>(emptyMap())+ }.collectAsState()+ val adblockDownloadState by downloadService?.adblockDownloadState?.collectAsState() ?: remember {+ kotlinx.coroutines.flow.MutableStateFlow(DownloadState())+ }.collectAsState()+ val isTranslating by viewModel.translationCoordinator.isTranslating.collectAsState()+ val ttsVoicesByLanguage by viewModel.ttsVoices.collectAsState()++ LaunchedEffect(to?.code, to?.let { languageState.availabilityFor(it)?.ttsFiles } == true) {+ val targetLanguage = to ?: return@LaunchedEffect+ if (languageState.availabilityFor(targetLanguage)?.ttsFiles == true) {+ viewModel.refreshTtsVoices(targetLanguage)+ } else {+ viewModel.clearTtsVoices(targetLanguage.code)+ }+ }++ LaunchedEffect(from?.code, from?.let { languageState.availabilityFor(it)?.ttsFiles } == true) {+ val sourceLanguage = from ?: return@LaunchedEffect+ if (languageState.availabilityFor(sourceLanguage)?.ttsFiles == true) {+ viewModel.refreshTtsVoices(sourceLanguage)+ } else {+ viewModel.clearTtsVoices(sourceLanguage.code)+ }+ }++ // Connect/disconnect download service+ LaunchedEffect(downloadService) {+ downloadService?.let { service ->+ viewModel.connectDownloadService(service)+ }+ }++ // Collect UI events (toasts, share intents)+ LaunchedEffect(Unit) {+ viewModel.uiEvents.collect { event ->+ when (event) {+ is UiEvent.ShowToast -> {+ Toast.makeText(context, event.message, Toast.LENGTH_SHORT).show()+ }+ UiEvent.AudioLoadingStarted -> {+ isAudioLoading = true+ }+ UiEvent.AudioLoadingStopped -> {+ isAudioLoading = false+ activeSpeechTarget = null+ }+ is UiEvent.ShareImage -> {+ val imageUri = saveImage(event.bitmap, context)+ if (imageUri != null) {+ shareImageUri(imageUri, context)+ }+ }+ is UiEvent.PlayAudio -> {+ pcmAudioPlayer.play(event.audioChunks) { message ->+ isAudioLoading = false+ activeSpeechTarget = null+ Toast.makeText(context, context.getString(R.string.translator_audio_playback_failed, message), Toast.LENGTH_SHORT).show()+ }+ }+ }+ }+ }++ DisposableEffect(pcmAudioPlayer) {+ onDispose {+ pcmAudioPlayer.release()+ }+ }++ val pendingDocument by viewModel.pendingDocument.collectAsState()+ pendingDocument?.let { pending ->+ val docCatalog = viewModel.languageStateManager.catalog.collectAsState().value+ val docAvailableLanguages =+ (languageState.translatorLanguages() + listOfNotNull(docCatalog?.english))+ .distinctBy { it.code }+ val initialFrom = from ?: docAvailableLanguages.firstOrNull()+ val initialTo = to ?: docCatalog?.english ?: docAvailableLanguages.firstOrNull()+ if (initialFrom != null && initialTo != null) {+ DocumentConfigureSheet(+ fileName = pending.displayName,+ fileSizeBytes = pending.sizeBytes,+ extension = pending.extension,+ initialFrom = initialFrom,+ initialTo = initialTo,+ availableLanguages = docAvailableLanguages,+ languageMetadata = languageMetadata,+ defaultTranslatePdfImages = settings.translatePdfImages,+ onDismiss = { viewModel.dismissPendingDocument() },+ onTranslate = { selFrom, selTo, txtLayout, translatePdfImages ->+ viewModel.startPendingDocumentTranslation(selFrom, selTo, txtLayout, translatePdfImages)+ },+ )+ }+ }++ documentTranslation?.let { document ->+ DocumentTranslationDialog(+ document = document,+ onDismiss = {+ if (document.isTranslating) {+ viewModel.cancelDocumentTranslation()+ } else {+ DocumentTranslationService.dismiss(context)+ viewModel.dismissDocumentTranslation()+ }+ },+ onSave = { path, mimeType, fileName ->+ pendingDocumentSave = PendingDocumentSave(path = path, mimeType = mimeType)+ saveTranslatedDocument.launch(+ Intent(Intent.ACTION_CREATE_DOCUMENT).apply {+ addCategory(Intent.CATEGORY_OPENABLE)+ type = mimeType+ putExtra(Intent.EXTRA_TITLE, fileName)+ },+ )+ },+ onOpen = { path, mimeType ->+ DocumentTranslationService.dismiss(context)+ viewModel.dismissDocumentTranslation()+ try {+ openDocumentPath(path, mimeType, context)+ } catch (e: Exception) {+ Toast.makeText(context, context.getString(R.string.translator_no_app_to_open), Toast.LENGTH_SHORT).show()+ }+ },+ )+ }++ // Retranslate when isTranslating becomes false (queued translation)+ LaunchedEffect(isTranslating) {+ if (!isTranslating) {+ viewModel.retranslateIfNeeded()+ }+ }++ val navigationState by viewModel.navigationState.collectAsState()++ // Map navigation state to route+ val startDestination =+ remember {+ when (navigationState) {+ TranslatorViewModel.NavigationState.LOADING -> "loading"+ TranslatorViewModel.NavigationState.NO_LANGUAGES -> "no_languages"+ TranslatorViewModel.NavigationState.READY -> "main"+ }+ }++ // The NavHost lives inside an AnimatedVisibility that only composes its content on a+ // later frame, so the graph is not set while the first effects run; keying on the+ // current entry re-runs these once the host is actually there.+ val currentBackStackEntry by navController.currentBackStackEntryAsState()++ LaunchedEffect(navigationState, currentBackStackEntry) {+ val currentRoute = currentBackStackEntry?.destination?.route+ val targetRoute =+ when (navigationState) {+ TranslatorViewModel.NavigationState.LOADING -> null+ TranslatorViewModel.NavigationState.NO_LANGUAGES -> "no_languages"+ TranslatorViewModel.NavigationState.READY -> "main"+ }+ if (targetRoute != null && currentRoute != targetRoute && currentRoute == "loading") {+ navController.navigate(targetRoute) {+ popUpTo(currentRoute!!) { inclusive = true }+ }+ }+ }++ LaunchedEffect(Unit) {+ viewModel.languageManagerRequests.collect {+ val entry = navController.currentBackStackEntryFlow.first { it.destination.route != "loading" }+ if (entry.destination.route != "language_manager") {+ navController.navigate("language_manager")+ }+ }+ }++ val isReadonlyPopup = currentLaunchMode == LaunchMode.ReadonlyModal++ val heightFactor by animateFloatAsState(+ targetValue =+ when {+ currentLaunchMode == LaunchMode.Normal -> 1f+ isReadonlyPopup -> settings.readonlyModalCompactHeightFactor+ else -> 0.6f+ },+ animationSpec = tween(300),+ label = "heightFactor",+ )+ val widthFactor by animateFloatAsState(+ targetValue = if (currentLaunchMode == LaunchMode.Normal) 1f else 0.9f,+ animationSpec = tween(300),+ label = "widthFactor",+ )+ val popupAlignment =+ when (settings.readonlyModalOutputAlignment) {+ dev.davidv.translator.ReadonlyModalOutputAlignment.TOP -> Alignment.TopCenter+ dev.davidv.translator.ReadonlyModalOutputAlignment.MIDDLE -> Alignment.Center+ dev.davidv.translator.ReadonlyModalOutputAlignment.BOTTOM -> Alignment.BottomCenter+ }++ SideEffect {+ val activity = context as? Activity ?: return@SideEffect+ val window = activity.window ?: return@SideEffect+ window.clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND)+ window.setDimAmount(0f)+ window.setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)+ window.setGravity(Gravity.CENTER)+ }++ Box(+ modifier = Modifier.fillMaxSize(),+ contentAlignment = Alignment.Center,+ ) {+ // Click-outside-to-dismiss (invisible)+ if (currentLaunchMode != LaunchMode.Normal) {+ Box(+ modifier =+ Modifier+ .fillMaxSize()+ .clickable(+ interactionSource = remember { MutableInteractionSource() },+ indication = null,+ ) {+ viewModel.setModalVisible(false)+ kotlinx.coroutines.MainScope().launch {+ kotlinx.coroutines.delay(400)+ onClose()+ }+ },+ )+ }++ val slideFromTop = popupAlignment != Alignment.BottomCenter+ val slideMultiplier = if (popupAlignment == Alignment.Center) 2.5f else 1.5f+ val modalTransitionState =+ remember { androidx.compose.animation.core.MutableTransitionState(false) }+ LaunchedEffect(modalVisible) { modalTransitionState.targetState = modalVisible }+ AnimatedVisibility(+ visibleState = modalTransitionState,+ modifier =+ Modifier+ .align(popupAlignment)+ .then(+ if (currentLaunchMode != LaunchMode.Normal) {+ Modifier+ .statusBarsPadding()+ .navigationBarsPadding()+ .padding(vertical = 8.dp)+ } else {+ Modifier+ },+ ),+ enter = androidx.compose.animation.EnterTransition.None,+ exit =+ slideOutVertically(+ animationSpec = tween(300),+ targetOffsetY = { fullHeight ->+ val sign = if (slideFromTop) -1 else 1+ (fullHeight * slideMultiplier).toInt() * sign+ },+ ),+ ) {+ Box(+ modifier =+ Modifier+ .fillMaxHeight(heightFactor)+ .fillMaxWidth(widthFactor)+ .then(+ if (currentLaunchMode == LaunchMode.Normal) {+ Modifier+ } else {+ Modifier.clip(RoundedCornerShape(10.dp))+ },+ ),+ ) {+ NavHost(+ navController = navController,+ startDestination = startDestination,+ ) {+ composable("loading") {+ Box(+ modifier = Modifier.fillMaxSize(),+ contentAlignment = Alignment.Center,+ ) {+ CircularProgressIndicator()+ }+ }++ composable("no_languages") {+ val currentDownloadService = downloadService+ if (currentDownloadService != null) {+ NoLanguagesScreen(+ settingsManager = viewModel.settingsManager,+ onDone = {+ if (languageState.hasLanguages) {+ MainScope().launch {+ navController.navigate("main") {+ popUpTo("no_languages") { inclusive = true }+ }+ }+ }+ },+ onSettings = {+ navController.navigate("settings")+ },+ languageStateManager = viewModel.languageStateManager,+ languageMetadataManager = viewModel.languageMetadataManager,+ downloadService = currentDownloadService,+ )+ }+ }++ composable("main") {+ // Safe to use from/to non-null here: navigationState is READY+ val currentFrom = from+ val currentTo = to+ if (currentFrom != null && currentTo != null) {+ val availableSourceTtsVoices = ttsVoicesByLanguage[currentFrom.code].orEmpty()+ val selectedSourceTtsVoiceName =+ parseVoiceOverride(settings.ttsVoiceOverrides[currentFrom.code])+ ?.voiceName+ ?.takeIf { voiceName -> packsContainVoice(availableSourceTtsVoices, voiceName) }+ ?: defaultVoiceNameForLanguage(availableSourceTtsVoices)+ val sourceTtsPlaybackSpeed = ttsPlaybackSpeedFor(settings, currentFrom, selectedSourceTtsVoiceName)+ val availableTtsVoices = ttsVoicesByLanguage[currentTo.code].orEmpty()+ val selectedTtsVoiceName =+ parseVoiceOverride(settings.ttsVoiceOverrides[currentTo.code])+ ?.voiceName+ ?.takeIf { voiceName -> packsContainVoice(availableTtsVoices, voiceName) }+ ?: defaultVoiceNameForLanguage(availableTtsVoices)+ val targetTtsPlaybackSpeed = ttsPlaybackSpeedFor(settings, currentTo, selectedTtsVoiceName)+ MainScreen(+ onSettings = { navController.navigate("settings") },+ onLiveCamera = { navController.navigate("live_camera") },+ input = input,+ inputTransliteration = inputTransliterated,+ output = output,+ from = currentFrom,+ to = currentTo,+ targetTabs = targetTabs?.tabs ?: listOf(currentTo),+ detectedLanguage = currentDetectedLanguage,+ displayImage = displayImage,+ originalImage = originalImage,+ imageWordSelection = imageWordSelection,+ detectedRegions = detectedRegions,+ ocrReadingOrder = ocrReadingOrder,+ isTranslating = viewModel.translationCoordinator.isTranslating,+ isOcrInProgress = viewModel.translationCoordinator.isOcrInProgress,+ dictionaryWord = dictionaryWord,+ dictionaryStack = dictionaryStack,+ dictionaryLookupLanguage = dictionaryLookupLanguage,+ isAudioPlaying = isAudioPlaying,+ isAudioLoading = isAudioLoading,+ isInputAudioPlaying = activeSpeechTarget == SpeechTarget.INPUT && isAudioPlaying,+ isInputAudioLoading = activeSpeechTarget == SpeechTarget.INPUT && isAudioLoading,+ isOutputAudioPlaying = activeSpeechTarget == SpeechTarget.OUTPUT && isAudioPlaying,+ isOutputAudioLoading = activeSpeechTarget == SpeechTarget.OUTPUT && isAudioLoading,+ onMessage = viewModel::handleMessage,+ onSteerPreview = viewModel::steerPreview,+ canSwapLanguages = viewModel.languageStateManager.canSwapLanguages(currentFrom, currentTo),+ onStopAudio = {+ isAudioLoading = false+ activeSpeechTarget = null+ pcmAudioPlayer.stop()+ },+ languageState = languageState,+ languageMetadata = languageMetadata,+ downloadStates = downloadStates,+ settings = settings,+ availableSourceTtsVoices = availableSourceTtsVoices,+ selectedSourceTtsVoiceName = selectedSourceTtsVoiceName,+ sourceTtsPlaybackSpeed = sourceTtsPlaybackSpeed,+ availableTtsVoices = availableTtsVoices,+ selectedTtsVoiceName = selectedTtsVoiceName,+ targetTtsPlaybackSpeed = targetTtsPlaybackSpeed,+ onTtsPlaybackSpeedChange = { newSpeed ->+ val voiceName = selectedTtsVoiceName+ val quantizedSpeed = quantizePlaybackSpeed(newSpeed)+ viewModel.settingsManager.updateSettings(+ if (voiceName != null) {+ settings.copy(+ ttsPlaybackSpeedOverrides =+ settings.ttsPlaybackSpeedOverrides ++ (ttsPlaybackSpeedOverrideKey(currentTo, voiceName) to quantizedSpeed),+ )+ } else {+ settings.copy(ttsPlaybackSpeed = quantizedSpeed)+ },+ )+ },+ onSourceTtsPlaybackSpeedChange = { newSpeed ->+ val voiceName = selectedSourceTtsVoiceName+ val quantizedSpeed = quantizePlaybackSpeed(newSpeed)+ viewModel.settingsManager.updateSettings(+ if (voiceName != null) {+ settings.copy(+ ttsPlaybackSpeedOverrides =+ settings.ttsPlaybackSpeedOverrides ++ (ttsPlaybackSpeedOverrideKey(currentFrom, voiceName) to quantizedSpeed),+ )+ } else {+ settings.copy(ttsPlaybackSpeed = quantizedSpeed)+ },+ )+ },+ onSourceTtsVoiceSelected = { packId, voiceName ->+ viewModel.settingsManager.updateSettings(+ settings.copy(+ ttsVoiceOverrides =+ settings.ttsVoiceOverrides ++ (currentFrom.code to encodeVoiceOverride(packId, voiceName)),+ ),+ )+ },+ onTtsVoiceSelected = { packId, voiceName ->+ viewModel.settingsManager.updateSettings(+ settings.copy(+ ttsVoiceOverrides =+ settings.ttsVoiceOverrides ++ (currentTo.code to encodeVoiceOverride(packId, voiceName)),+ ),+ )+ },+ onSpeakInput = { text, language ->+ activeSpeechTarget = SpeechTarget.INPUT+ viewModel.handleMessage(TranslatorMessage.SpeakTranslatedText(text, language))+ },+ onSpeakOutput = { text, language ->+ activeSpeechTarget = SpeechTarget.OUTPUT+ viewModel.handleMessage(TranslatorMessage.SpeakTranslatedText(text, language))+ },+ launchMode = currentLaunchMode,+ pendingSharedImage = viewModel.pendingSharedImage,+ isAutoSource = isAutoSource,+ )+ }+ }+ composable("language_manager") {+ val curDownloadService = downloadService+ val catalog = viewModel.languageStateManager.catalog.collectAsState().value+ if (curDownloadService != null && catalog != null) {+ val dictionaryDownloadStates by curDownloadService.dictionaryDownloadStates.collectAsState()+ val ttsDownloadStates by curDownloadService.ttsDownloadStates.collectAsState()+ val activeTtsPackIds by curDownloadService.activeTtsPackIds.collectAsState()+ val queuedTtsPackIds by curDownloadService.queuedTtsPackIds.collectAsState()+ val repairDownloadState by curDownloadService.repairDownloadState.collectAsState()+ Scaffold(+ modifier =+ Modifier+ .fillMaxSize()+ .navigationBarsPadding()+ .imePadding(),+ ) { padding ->+ Box(modifier = Modifier.padding(padding)) {+ LanguageAssetManagerScreen(+ context = context,+ languageStateManager = viewModel.languageStateManager,+ languageMetadataManager = viewModel.languageMetadataManager,+ settingsManager = viewModel.settingsManager,+ catalog = catalog,+ languageAvailabilityState = languageState,+ downloadStates = downloadStates,+ dictionaryDownloadStates = dictionaryDownloadStates,+ ttsDownloadStates = ttsDownloadStates,+ activeTtsPackIds = activeTtsPackIds,+ queuedTtsPackIds = queuedTtsPackIds,+ repairDownloadState = repairDownloadState,+ )+ }+ }+ }+ }+ composable("settings") {+ val catalog = viewModel.languageStateManager.catalog.collectAsState().value+ val englishLang = catalog?.english+ val availableWithEnglish =+ if (englishLang != null) {+ (languageState.translatorLanguages() + englishLang).distinctBy { it.code }+ } else {+ languageState.translatorLanguages()+ }+ val app = context.applicationContext as dev.davidv.translator.TranslatorApplication+ val adblockReady by app.adblockManager.ready.collectAsState()+ SettingsScreen(+ settings = settings,+ languageMetadataManager = viewModel.languageMetadataManager,+ availableLanguages = availableWithEnglish,+ catalog = catalog,+ adblockDownloadState = adblockDownloadState,+ adblockInstalled = adblockReady || catalog?.supportInstalledByKind("adblock") == true,+ onSettingsChange = { newSettings ->+ viewModel.settingsManager.updateSettings(newSettings)+ if (newSettings.defaultTargetLanguageCode != settings.defaultTargetLanguageCode) {+ val targetLang = catalog?.languageByCode(newSettings.defaultTargetLanguageCode)+ if (targetLang != null) {+ viewModel.handleMessage(dev.davidv.translator.TranslatorMessage.ToLang(targetLang))+ }+ }+ if (newSettings.useExternalStorage != settings.useExternalStorage) {+ viewModel.languageStateManager.refreshLanguageAvailability()+ }+ },+ onManageLanguages = {+ navController.navigate("language_manager")+ },+ onDeleteAdblockSupport = {+ viewModel.languageStateManager.deleteSupportByKind("adblock")+ app.adblockManager.reload()+ },+ onHowToUse = {+ navController.navigate("how_to_use")+ },+ )+ }+ composable("how_to_use") {+ HowToUseScreen(onBack = { navController.popBackStack() })+ }+ composable("live_camera") {+ val currentFrom = from+ val currentTo = to+ val liveCatalog by viewModel.languageStateManager.catalog.collectAsState()+ if (currentFrom != null && currentTo != null) {+ LiveCameraScreen(+ from = currentFrom,+ to = currentTo,+ isAutoSource = isAutoSource,+ canSwap = viewModel.languageStateManager.canSwapLanguages(currentFrom, currentTo),+ languageState = languageState,+ languageMetadata = languageMetadata,+ onMessage = viewModel::handleMessage,+ showAutoOption = !settings.disableCLD,+ liveOverlayDefaultEnabled = settings.liveCameraOverlayEnabled,+ catalog = liveCatalog,+ onClose = {+ navController.popBackStack("main", inclusive = false)+ },+ onImageCaptured = viewModel::setSharedImageUri,+ )+ }+ }+ }+ }+ }+ }+}diff --git a/OCR-translation/src/main/java/dev/davidv/translator/ui/theme/Color.kt b/OCR-translation/src/main/java/dev/davidv/translator/ui/theme/Color.ktnew file mode 100644index 0000000..5a360ad--- /dev/null+++ b/OCR-translation/src/main/java/dev/davidv/translator/ui/theme/Color.kt@@ -0,0 +1,28 @@+/*+ * Copyright (C) 2024 David V+ *+ * This program 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.+ *+ * This program 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 <https://www.gnu.org/licenses/>.+ */++package dev.davidv.translator.ui.theme++import androidx.compose.ui.graphics.Color++val Purple80 = Color(0xFFD0BCFF)+val PurpleGrey80 = Color(0xFFCCC2DC)+val Pink80 = Color(0xFFEFB8C8)++val Purple40 = Color(0xFF6650a4)+val PurpleGrey40 = Color(0xFF625b71)+val Pink40 = Color(0xFF7D5260)diff --git a/OCR-translation/src/main/java/dev/davidv/translator/ui/theme/Theme.kt b/OCR-translation/src/main/java/dev/davidv/translator/ui/theme/Theme.ktnew file mode 100644index 0000000..9dd353e--- /dev/null+++ b/OCR-translation/src/main/java/dev/davidv/translator/ui/theme/Theme.kt@@ -0,0 +1,67 @@+/*+ * Copyright (C) 2024 David V+ *+ * This program 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.+ *+ * This program 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 <https://www.gnu.org/licenses/>.+ */++package dev.davidv.translator.ui.theme++import android.os.Build+import androidx.compose.foundation.isSystemInDarkTheme+import androidx.compose.material3.MaterialTheme+import androidx.compose.material3.darkColorScheme+import androidx.compose.material3.dynamicDarkColorScheme+import androidx.compose.material3.dynamicLightColorScheme+import androidx.compose.material3.lightColorScheme+import androidx.compose.runtime.Composable+import androidx.compose.ui.platform.LocalContext++private val DarkColorScheme =+ darkColorScheme(+ primary = Purple80,+ secondary = PurpleGrey80,+ tertiary = Pink80,+ )++private val LightColorScheme =+ lightColorScheme(+ primary = Purple40,+ secondary = PurpleGrey40,+ tertiary = Pink40,+ )++@Composable+fun TranslatorTheme(+ darkTheme: Boolean = isSystemInDarkTheme(),+ // Dynamic color is available on Android 12++ dynamicColor: Boolean = true,+ content: @Composable () -> Unit,+) {+ val colorScheme =+ when {+ dynamicColor && Build.VERSION.SDK_INT >= Build.VERSION_CODES.S -> {+ val context = LocalContext.current+ if (darkTheme) dynamicDarkColorScheme(context) else dynamicLightColorScheme(context)+ }++ darkTheme -> DarkColorScheme+ else -> LightColorScheme+ }++ MaterialTheme(+ colorScheme = colorScheme,+ typography = Typography,+ content = content,+ )+}diff --git a/OCR-translation/src/main/java/dev/davidv/translator/ui/theme/Type.kt b/OCR-translation/src/main/java/dev/davidv/translator/ui/theme/Type.ktnew file mode 100644index 0000000..ea8ac5c--- /dev/null+++ b/OCR-translation/src/main/java/dev/davidv/translator/ui/theme/Type.kt@@ -0,0 +1,37 @@+/*+ * Copyright (C) 2024 David V+ *+ * This program 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.+ *+ * This program 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 <https://www.gnu.org/licenses/>.+ */++package dev.davidv.translator.ui.theme++import androidx.compose.material3.Typography+import androidx.compose.ui.text.TextStyle+import androidx.compose.ui.text.font.FontFamily+import androidx.compose.ui.text.font.FontWeight+import androidx.compose.ui.unit.sp++// Set of Material typography styles to start with+val Typography =+ Typography(+ bodyLarge =+ TextStyle(+ fontFamily = FontFamily.Default,+ fontWeight = FontWeight.Normal,+ fontSize = 16.sp,+ lineHeight = 24.sp,+ letterSpacing = 0.5.sp,+ ),+ )diff --git a/OCR-translation/src/main/jniLibs/arm64-v8a/libbindings.so b/OCR-translation/src/main/jniLibs/arm64-v8a/libbindings.sonew file mode 100644index 0000000..05467bfBinary files /dev/null and b/OCR-translation/src/main/jniLibs/arm64-v8a/libbindings.so differdiff --git a/OCR-translation/src/main/jniLibs/arm64-v8a/libc++_shared.so b/OCR-translation/src/main/jniLibs/arm64-v8a/libc++_shared.sonew file mode 100644index 0000000..a80c8b3Binary files /dev/null and b/OCR-translation/src/main/jniLibs/arm64-v8a/libc++_shared.so differdiff --git a/OCR-translation/src/main/model-converter/.cargo/config.toml b/OCR-translation/src/main/model-converter/.cargo/config.tomlnew file mode 100644index 0000000..b4813e0--- /dev/null+++ b/OCR-translation/src/main/model-converter/.cargo/config.toml@@ -0,0 +1,5 @@+[build]+rustflags = [+ "--remap-path-prefix=/home/vagrant/.cargo=/",+ "--remap-path-prefix=/usr/local/cargo=/",+]diff --git a/OCR-translation/src/main/model-converter/.gitignore b/OCR-translation/src/main/model-converter/.gitignorenew file mode 100644index 0000000..0c750b2--- /dev/null+++ b/OCR-translation/src/main/model-converter/.gitignore@@ -0,0 +1,2 @@+target/+jniLibs/diff --git a/OCR-translation/src/main/model-converter/Cargo.lock b/OCR-translation/src/main/model-converter/Cargo.locknew file mode 100644index 0000000..74b812e--- /dev/null+++ b/OCR-translation/src/main/model-converter/Cargo.lock@@ -0,0 +1,691 @@+# This file is automatically @generated by Cargo.+# It is not intended for manual editing.+version = 4++[[package]]+name = "aho-corasick"+version = "1.1.4"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "ddd31a130427c27518df266943a5308ed92d4b226cc639f5a8f1002816174301"+dependencies = [+ "memchr",+]++[[package]]+name = "autocfg"+version = "1.5.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "f2032f911046de80f0a198e0901378627c33f59ea0ac00e363d481118bd70a53"++[[package]]+name = "bindgen"+version = "0.69.5"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "271383c67ccabffb7381723dea0672a673f292304fcb45c01cc648c7a8d58088"+dependencies = [+ "bitflags",+ "cexpr",+ "clang-sys",+ "itertools",+ "lazy_static",+ "lazycell",+ "log",+ "prettyplease",+ "proc-macro2",+ "quote",+ "regex",+ "rustc-hash",+ "shlex 1.3.0",+ "syn",+ "which",+]++[[package]]+name = "bitflags"+version = "2.13.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "b4388bee8683e3d04af747c73422af53102d2bd24d9eadb6cbc100baef4b43f8"++[[package]]+name = "bytes"+version = "1.12.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "8ae3f5d315924270530207e2a68396c3cc547f6dca3fbdca317cfb1a51edb593"++[[package]]+name = "cc"+version = "1.2.65"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "e228eec9be7c17ccb640b59b36a5cd805ea2a564a4c5e162c2f659fea30d3b96"+dependencies = [+ "find-msvc-tools",+ "shlex 2.0.1",+]++[[package]]+name = "cesu8"+version = "1.1.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "6d43a04d8753f35258c91f8ec639f792891f748a1edbd759cf1dcea3382ad83c"++[[package]]+name = "cexpr"+version = "0.6.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "6fac387a98bb7c37292057cffc56d62ecb629900026402633ae9160df93a8766"+dependencies = [+ "nom",+]++[[package]]+name = "cfg-if"+version = "1.0.4"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801"++[[package]]+name = "clang-sys"+version = "1.8.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "0b023947811758c97c59bf9d1c188fd619ad4718dcaa767947df1cadb14f39f4"+dependencies = [+ "glob",+ "libc",+ "libloading",+]++[[package]]+name = "cmake"+version = "0.1.58"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "c0f78a02292a74a88ac736019ab962ece0bc380e3f977bf72e376c5d78ff0678"+dependencies = [+ "cc",+]++[[package]]+name = "combine"+version = "4.6.7"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "ba5a308b75df32fe02788e748662718f03fde005016435c444eea572398219fd"+dependencies = [+ "bytes",+ "memchr",+]++[[package]]+name = "either"+version = "1.16.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "91622ff5e7162018101f2fea40d6ebf4a78bbe5a49736a2020649edf9693679e"++[[package]]+name = "errno"+version = "0.3.14"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb"+dependencies = [+ "libc",+ "windows-sys 0.61.2",+]++[[package]]+name = "find-msvc-tools"+version = "0.1.9"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "5baebc0774151f905a1a2cc41989300b1e6fbb29aff0ceffa1064fdd3088d582"++[[package]]+name = "glob"+version = "0.3.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "0cc23270f6e1808e30a928bdc84dea0b9b4136a8bc82338574f23baf47bbd280"++[[package]]+name = "home"+version = "0.5.12"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "cc627f471c528ff0c4a49e1d5e60450c8f6461dd6d10ba9dcd3a61d3dff7728d"+dependencies = [+ "windows-sys 0.61.2",+]++[[package]]+name = "itertools"+version = "0.12.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "ba291022dbbd398a455acf126c1e341954079855bc60dfdda641363bd6922569"+dependencies = [+ "either",+]++[[package]]+name = "jni"+version = "0.21.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "1a87aa2bb7d2af34197c04845522473242e1aa17c12f4935d5856491a7fb8c97"+dependencies = [+ "cesu8",+ "cfg-if",+ "combine",+ "jni-sys 0.3.1",+ "log",+ "thiserror",+ "walkdir",+ "windows-sys 0.45.0",+]++[[package]]+name = "jni-sys"+version = "0.3.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "41a652e1f9b6e0275df1f15b32661cf0d4b78d4d87ddec5e0c3c20f097433258"+dependencies = [+ "jni-sys 0.4.1",+]++[[package]]+name = "jni-sys"+version = "0.4.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "c6377a88cb3910bee9b0fa88d4f42e1d2da8e79915598f65fb0c7ee14c878af2"+dependencies = [+ "jni-sys-macros",+]++[[package]]+name = "jni-sys-macros"+version = "0.4.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "38c0b942f458fe50cdac086d2f946512305e5631e720728f2a61aabcd47a6264"+dependencies = [+ "quote",+ "syn",+]++[[package]]+name = "lazy_static"+version = "1.5.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe"++[[package]]+name = "lazycell"+version = "1.3.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55"++[[package]]+name = "libc"+version = "0.2.186"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "68ab91017fe16c622486840e4c83c9a37afeff978bd239b5293d61ece587de66"++[[package]]+name = "libloading"+version = "0.8.9"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "d7c4b02199fee7c5d21a5ae7d8cfa79a6ef5bb2fc834d6e9058e89c825efdc55"+dependencies = [+ "cfg-if",+ "windows-link",+]++[[package]]+name = "linux-raw-sys"+version = "0.4.15"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "d26c52dbd32dccf2d10cac7725f8eae5296885fb5703b261f7d0a0739ec807ab"++[[package]]+name = "log"+version = "0.4.33"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "0ceec5bc11778974d1bcb055b18002eba7f4b3518b6a0081b3af5f21666da9ad"++[[package]]+name = "matrixmultiply"+version = "0.3.10"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "a06de3016e9fae57a36fd14dba131fccf49f74b40b7fbdb472f96e361ec71a08"+dependencies = [+ "autocfg",+ "rawpointer",+]++[[package]]+name = "memchr"+version = "2.8.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "88904434abc2901f197fe8cc55f0445e7ded921dba5911dad2e2b39b48e663c4"++[[package]]+name = "minimal-lexical"+version = "0.2.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a"++[[package]]+name = "mnn-sys"+version = "0.1.0"+source = "git+https://github.com/DavidVentura/mnn-sys#01b736b9e27320bdea6ab0eab207d6a934f4a515"+dependencies = [+ "bindgen",+ "cc",+ "cmake",+ "ndarray",+]++[[package]]+name = "model_converter"+version = "0.1.0"+dependencies = [+ "jni",+ "translator-convert",+]++[[package]]+name = "ndarray"+version = "0.16.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "882ed72dce9365842bf196bdeedf5055305f11fc8c03dee7bb0194a6cad34841"+dependencies = [+ "matrixmultiply",+ "num-complex",+ "num-integer",+ "num-traits",+ "portable-atomic",+ "portable-atomic-util",+ "rawpointer",+]++[[package]]+name = "nom"+version = "7.1.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a"+dependencies = [+ "memchr",+ "minimal-lexical",+]++[[package]]+name = "num-complex"+version = "0.4.6"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "73f88a1307638156682bada9d7604135552957b7818057dcef22705b4d509495"+dependencies = [+ "num-traits",+]++[[package]]+name = "num-integer"+version = "0.1.46"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "7969661fd2958a5cb096e56c8e1ad0444ac2bbcd0061bd28660485a44879858f"+dependencies = [+ "num-traits",+]++[[package]]+name = "num-traits"+version = "0.2.19"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841"+dependencies = [+ "autocfg",+]++[[package]]+name = "once_cell"+version = "1.21.4"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50"++[[package]]+name = "portable-atomic"+version = "1.13.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "c33a9471896f1c69cecef8d20cbe2f7accd12527ce60845ff44c153bb2a21b49"++[[package]]+name = "portable-atomic-util"+version = "0.2.7"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "c2a106d1259c23fac8e543272398ae0e3c0b8d33c88ed73d0cc71b0f1d902618"+dependencies = [+ "portable-atomic",+]++[[package]]+name = "prettyplease"+version = "0.2.37"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "479ca8adacdd7ce8f1fb39ce9ecccbfe93a3f1344b3d0d97f20bc0196208f62b"+dependencies = [+ "proc-macro2",+ "syn",+]++[[package]]+name = "proc-macro2"+version = "1.0.106"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "8fd00f0bb2e90d81d1044c2b32617f68fcb9fa3bb7640c23e9c748e53fb30934"+dependencies = [+ "unicode-ident",+]++[[package]]+name = "quote"+version = "1.0.46"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "dfbc457d0c7a0759a614551b11a6409e5951f6c7537be1f1b7682b9ae9230368"+dependencies = [+ "proc-macro2",+]++[[package]]+name = "rawpointer"+version = "0.2.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "60a357793950651c4ed0f3f52338f53b2f809f32d83a07f72909fa13e4c6c1e3"++[[package]]+name = "regex"+version = "1.12.4"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "f1292b7759ae1cb9ec195452d1390a074f0cd8541ab7a5a8c31cd6db45d4a6ba"+dependencies = [+ "aho-corasick",+ "memchr",+ "regex-automata",+ "regex-syntax",+]++[[package]]+name = "regex-automata"+version = "0.4.14"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "6e1dd4122fc1595e8162618945476892eefca7b88c52820e74af6262213cae8f"+dependencies = [+ "aho-corasick",+ "memchr",+ "regex-syntax",+]++[[package]]+name = "regex-syntax"+version = "0.8.11"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "d6f6ff9a378485b298a5286656da665ba74413d36db0979633275d2e708145d4"++[[package]]+name = "rustc-hash"+version = "1.1.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2"++[[package]]+name = "rustix"+version = "0.38.44"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "fdb5bc1ae2baa591800df16c9ca78619bf65c0488b41b96ccec5d11220d8c154"+dependencies = [+ "bitflags",+ "errno",+ "libc",+ "linux-raw-sys",+ "windows-sys 0.59.0",+]++[[package]]+name = "same-file"+version = "1.0.6"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502"+dependencies = [+ "winapi-util",+]++[[package]]+name = "shlex"+version = "1.3.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64"++[[package]]+name = "shlex"+version = "2.0.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "f8fadd59c855ef2080decdef8ff161eb6661b86933c9d82e5ba29dc602a55aba"++[[package]]+name = "syn"+version = "2.0.118"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "1b9ae57f904213ebb649ce6895b8a66c66f0203b9319718f69a5612a065b1422"+dependencies = [+ "proc-macro2",+ "quote",+ "unicode-ident",+]++[[package]]+name = "thiserror"+version = "1.0.69"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52"+dependencies = [+ "thiserror-impl",+]++[[package]]+name = "thiserror-impl"+version = "1.0.69"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1"+dependencies = [+ "proc-macro2",+ "quote",+ "syn",+]++[[package]]+name = "translator-convert"+version = "0.1.0"+source = "git+https://github.com/DavidVentura/translator-rs.git#27f5d691d5e5ed158227d8e1deeec271c70c5f3d"+dependencies = [+ "mnn-sys",+]++[[package]]+name = "unicode-ident"+version = "1.0.24"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75"++[[package]]+name = "walkdir"+version = "2.5.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b"+dependencies = [+ "same-file",+ "winapi-util",+]++[[package]]+name = "which"+version = "4.4.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "87ba24419a2078cd2b0f2ede2691b6c66d8e47836da3b6db8265ebad47afbfc7"+dependencies = [+ "either",+ "home",+ "once_cell",+ "rustix",+]++[[package]]+name = "winapi-util"+version = "0.1.11"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22"+dependencies = [+ "windows-sys 0.61.2",+]++[[package]]+name = "windows-link"+version = "0.2.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5"++[[package]]+name = "windows-sys"+version = "0.45.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0"+dependencies = [+ "windows-targets 0.42.2",+]++[[package]]+name = "windows-sys"+version = "0.59.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b"+dependencies = [+ "windows-targets 0.52.6",+]++[[package]]+name = "windows-sys"+version = "0.61.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc"+dependencies = [+ "windows-link",+]++[[package]]+name = "windows-targets"+version = "0.42.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "8e5180c00cd44c9b1c88adb3693291f1cd93605ded80c250a75d472756b4d071"+dependencies = [+ "windows_aarch64_gnullvm 0.42.2",+ "windows_aarch64_msvc 0.42.2",+ "windows_i686_gnu 0.42.2",+ "windows_i686_msvc 0.42.2",+ "windows_x86_64_gnu 0.42.2",+ "windows_x86_64_gnullvm 0.42.2",+ "windows_x86_64_msvc 0.42.2",+]++[[package]]+name = "windows-targets"+version = "0.52.6"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973"+dependencies = [+ "windows_aarch64_gnullvm 0.52.6",+ "windows_aarch64_msvc 0.52.6",+ "windows_i686_gnu 0.52.6",+ "windows_i686_gnullvm",+ "windows_i686_msvc 0.52.6",+ "windows_x86_64_gnu 0.52.6",+ "windows_x86_64_gnullvm 0.52.6",+ "windows_x86_64_msvc 0.52.6",+]++[[package]]+name = "windows_aarch64_gnullvm"+version = "0.42.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8"++[[package]]+name = "windows_aarch64_gnullvm"+version = "0.52.6"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3"++[[package]]+name = "windows_aarch64_msvc"+version = "0.42.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43"++[[package]]+name = "windows_aarch64_msvc"+version = "0.52.6"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469"++[[package]]+name = "windows_i686_gnu"+version = "0.42.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f"++[[package]]+name = "windows_i686_gnu"+version = "0.52.6"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b"++[[package]]+name = "windows_i686_gnullvm"+version = "0.52.6"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66"++[[package]]+name = "windows_i686_msvc"+version = "0.42.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060"++[[package]]+name = "windows_i686_msvc"+version = "0.52.6"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66"++[[package]]+name = "windows_x86_64_gnu"+version = "0.42.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36"++[[package]]+name = "windows_x86_64_gnu"+version = "0.52.6"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78"++[[package]]+name = "windows_x86_64_gnullvm"+version = "0.42.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3"++[[package]]+name = "windows_x86_64_gnullvm"+version = "0.52.6"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d"++[[package]]+name = "windows_x86_64_msvc"+version = "0.42.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0"++[[package]]+name = "windows_x86_64_msvc"+version = "0.52.6"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec"diff --git a/OCR-translation/src/main/model-converter/Cargo.toml b/OCR-translation/src/main/model-converter/Cargo.tomlnew file mode 100644index 0000000..7e60a33--- /dev/null+++ b/OCR-translation/src/main/model-converter/Cargo.toml@@ -0,0 +1,30 @@+[package]+name = "model_converter"+version = "0.1.0"+edition = "2024"++[lib]+crate-type = ["cdylib"]+name = "model_converter"+path = "src/lib.rs"++[dependencies]+jni = { version = "0.21", default-features = false }+translator-convert = { git = "https://github.com/DavidVentura/translator-rs.git" }+# translator-convert = { path = "/home/david/git/translator-rs/crates/translator-convert" }++# [patch."https://github.com/DavidVentura/mnn-sys"]+# mnn-sys = { path = "/home/david/git/mnn-sys" }++[profile.release]+lto = "thin"+debug = false+strip = "debuginfo"++# Match bindings: -sys build scripts (mnn) locate their target dir by matching+# the PROFILE env var against a path component, so keep the built-in dev/release+# names rather than a custom profile.+[profile.dev]+opt-level = 1+debug = false+strip = "debuginfo"diff --git a/OCR-translation/src/main/model-converter/src/lib.rs b/OCR-translation/src/main/model-converter/src/lib.rsnew file mode 100644index 0000000..c609b27--- /dev/null+++ b/OCR-translation/src/main/model-converter/src/lib.rs@@ -0,0 +1,43 @@+use std::path::Path;++use jni::JNIEnv;+use jni::objects::{JClass, JString};+use jni::sys::{jint, jstring};+use translator_convert::{WeightQuant, convert};++/// Convert one ONNX model to MNN. Returns `null` on success or a Java string+/// with the error message on failure. Lives in its own native lib (linking only+/// `translator-convert` → `mnn-sys`, never slimt) because the MNN converter's+/// full protobuf and sentencepiece's protobuf-lite cannot share a binary.+#[unsafe(no_mangle)]+pub extern "system" fn Java_dev_davidv_translator_ModelConverterJni_convert<'local>(+ mut env: JNIEnv<'local>,+ _class: JClass<'local>,+ onnx: JString<'local>,+ mnn: JString<'local>,+ quant_bits: jint,+) -> jstring {+ match run(&mut env, onnx, mnn, quant_bits) {+ Ok(()) => std::ptr::null_mut(),+ Err(message) => env+ .new_string(message)+ .map(|s| s.into_raw())+ .unwrap_or(std::ptr::null_mut()),+ }+}++fn run(+ env: &mut JNIEnv,+ onnx: JString,+ mnn: JString,+ quant_bits: jint,+) -> Result<(), String> {+ let onnx: String = env.get_string(&onnx).map_err(|error| error.to_string())?.into();+ let mnn: String = env.get_string(&mnn).map_err(|error| error.to_string())?.into();+ let quant = if quant_bits <= 0 {+ WeightQuant::None+ } else {+ WeightQuant::Bits(quant_bits as u8)+ };+ convert(Path::new(&onnx), Path::new(&mnn), quant).map_err(|error| error.to_string())+}diff --git a/OCR-translation/src/main/res/drawable-anydpi/add.xml b/OCR-translation/src/main/res/drawable-anydpi/add.xmlnew file mode 100644index 0000000..8318342--- /dev/null+++ b/OCR-translation/src/main/res/drawable-anydpi/add.xml@@ -0,0 +1,11 @@+<vector xmlns:android="http://schemas.android.com/apk/res/android"+ android:width="24dp"+ android:height="24dp"+ android:viewportWidth="960"+ android:viewportHeight="960"+ android:tint="#333333"+ android:alpha="0.6">+ <path+ android:pathData="M480,640 L280,440l56,-58 104,104v-326h80v326l104,-104 56,58 -200,200ZM240,800q-33,0 -56.5,-23.5T160,720v-120h80v120h480v-120h80v120q0,33 -23.5,56.5T720,800L240,800Z"+ android:fillColor="#e3e3e3"/>+</vector>diff --git a/OCR-translation/src/main/res/drawable-anydpi/camera.xml b/OCR-translation/src/main/res/drawable-anydpi/camera.xmlnew file mode 100644index 0000000..78d770f--- /dev/null+++ b/OCR-translation/src/main/res/drawable-anydpi/camera.xml@@ -0,0 +1,11 @@+<vector xmlns:android="http://schemas.android.com/apk/res/android"+ android:width="24dp"+ android:height="24dp"+ android:viewportWidth="960"+ android:viewportHeight="960"+ android:tint="#333333"+ android:alpha="0.6">+ <path+ android:pathData="M456,360h320q-27,-69 -82.5,-118.5T566,172L456,360ZM364,440 L524,164q-11,-2 -22,-3t-22,-1q-66,0 -123,25t-101,67l108,188ZM170,560h218L228,284q-32,41 -50,90.5T160,480q0,21 2.5,40.5T170,560ZM394,788 L502,600L184,600q27,69 82.5,118.5T394,788ZM480,800q66,0 123,-25t101,-67L596,520 436,796q11,2 21.5,3t22.5,1ZM732,676q32,-41 50,-90.5T800,480q0,-21 -2.5,-40.5T790,400L572,400l160,276ZM480,480ZM480,880q-82,0 -155,-31.5t-127.5,-86Q143,708 111.5,635T80,480q0,-83 31.5,-155.5t86,-127Q252,143 325,111.5T480,80q83,0 155.5,31.5t127,86q54.5,54.5 86,127T880,480q0,82 -31.5,155t-86,127.5q-54.5,54.5 -127,86T480,880Z"+ android:fillColor="#e3e3e3"/>+</vector>diff --git a/OCR-translation/src/main/res/drawable-anydpi/gallery.xml b/OCR-translation/src/main/res/drawable-anydpi/gallery.xmlnew file mode 100644index 0000000..0f5825b--- /dev/null+++ b/OCR-translation/src/main/res/drawable-anydpi/gallery.xml@@ -0,0 +1,11 @@+<vector xmlns:android="http://schemas.android.com/apk/res/android"+ android:width="24dp"+ android:height="24dp"+ android:viewportWidth="960"+ android:viewportHeight="960"+ android:tint="#333333"+ android:alpha="0.6">+ <path+ android:pathData="M360,560h400L622,380l-92,120 -62,-80 -108,140ZM320,720q-33,0 -56.5,-23.5T240,640v-480q0,-33 23.5,-56.5T320,80h480q33,0 56.5,23.5T880,160v480q0,33 -23.5,56.5T800,720L320,720ZM320,640h480v-480L320,160v480ZM160,880q-33,0 -56.5,-23.5T80,800v-560h80v560h560v80L160,880ZM320,160v480,-480Z"+ android:fillColor="#e3e3e3"/>+</vector>diff --git a/OCR-translation/src/main/res/drawable-hdpi/add.png b/OCR-translation/src/main/res/drawable-hdpi/add.pngnew file mode 100644index 0000000..7afe368Binary files /dev/null and b/OCR-translation/src/main/res/drawable-hdpi/add.png differdiff --git a/OCR-translation/src/main/res/drawable-hdpi/camera.png b/OCR-translation/src/main/res/drawable-hdpi/camera.pngnew file mode 100644index 0000000..2e9ea66Binary files /dev/null and b/OCR-translation/src/main/res/drawable-hdpi/camera.png differdiff --git a/OCR-translation/src/main/res/drawable-hdpi/gallery.png b/OCR-translation/src/main/res/drawable-hdpi/gallery.pngnew file mode 100644index 0000000..971005bBinary files /dev/null and b/OCR-translation/src/main/res/drawable-hdpi/gallery.png differdiff --git a/OCR-translation/src/main/res/drawable-mdpi/add.png b/OCR-translation/src/main/res/drawable-mdpi/add.pngnew file mode 100644index 0000000..52f2d3bBinary files /dev/null and b/OCR-translation/src/main/res/drawable-mdpi/add.png differdiff --git a/OCR-translation/src/main/res/drawable-mdpi/camera.png b/OCR-translation/src/main/res/drawable-mdpi/camera.pngnew file mode 100644index 0000000..ad365d3Binary files /dev/null and b/OCR-translation/src/main/res/drawable-mdpi/camera.png differdiff --git a/OCR-translation/src/main/res/drawable-mdpi/gallery.png b/OCR-translation/src/main/res/drawable-mdpi/gallery.pngnew file mode 100644index 0000000..00f1c71Binary files /dev/null and b/OCR-translation/src/main/res/drawable-mdpi/gallery.png differdiff --git a/OCR-translation/src/main/res/drawable-xhdpi/add.png b/OCR-translation/src/main/res/drawable-xhdpi/add.pngnew file mode 100644index 0000000..9bc8edbBinary files /dev/null and b/OCR-translation/src/main/res/drawable-xhdpi/add.png differdiff --git a/OCR-translation/src/main/res/drawable-xhdpi/camera.png b/OCR-translation/src/main/res/drawable-xhdpi/camera.pngnew file mode 100644index 0000000..52bc8edBinary files /dev/null and b/OCR-translation/src/main/res/drawable-xhdpi/camera.png differdiff --git a/OCR-translation/src/main/res/drawable-xhdpi/gallery.png b/OCR-translation/src/main/res/drawable-xhdpi/gallery.pngnew file mode 100644index 0000000..bd3bde9Binary files /dev/null and b/OCR-translation/src/main/res/drawable-xhdpi/gallery.png differdiff --git a/OCR-translation/src/main/res/drawable-xxhdpi/add.png b/OCR-translation/src/main/res/drawable-xxhdpi/add.pngnew file mode 100644index 0000000..7b9c7a9Binary files /dev/null and b/OCR-translation/src/main/res/drawable-xxhdpi/add.png differdiff --git a/OCR-translation/src/main/res/drawable-xxhdpi/camera.png b/OCR-translation/src/main/res/drawable-xxhdpi/camera.pngnew file mode 100644index 0000000..22b4337Binary files /dev/null and b/OCR-translation/src/main/res/drawable-xxhdpi/camera.png differdiff --git a/OCR-translation/src/main/res/drawable-xxhdpi/gallery.png b/OCR-translation/src/main/res/drawable-xxhdpi/gallery.pngnew file mode 100644index 0000000..e64194dBinary files /dev/null and b/OCR-translation/src/main/res/drawable-xxhdpi/gallery.png differdiff --git a/OCR-translation/src/main/res/drawable/activity_zone.xml b/OCR-translation/src/main/res/drawable/activity_zone.xmlnew file mode 100644index 0000000..fcf9d61--- /dev/null+++ b/OCR-translation/src/main/res/drawable/activity_zone.xml@@ -0,0 +1,9 @@+<vector xmlns:android="http://schemas.android.com/apk/res/android"+ android:width="24dp"+ android:height="24dp"+ android:viewportWidth="960"+ android:viewportHeight="960">+ <path+ android:fillColor="#FF1F1F1F"+ android:pathData="M200,880q-50,0 -85,-35t-35,-85q0,-39 22.5,-69.5T160,647v-334q-35,-13 -57.5,-43.5T80,200q0,-50 35,-85t85,-35q39,0 69.5,22.5T313,160h334q12,-35 42.5,-57.5T760,80q50,0 85,35t35,85q0,40 -22.5,70.5T800,313v334q35,13 57.5,43.5T880,760q0,50 -35,85t-85,35q-39,0 -69.5,-22.5T647,800L313,800q-13,35 -43.5,57.5T200,880ZM200,240q17,0 28.5,-11.5T240,200q0,-17 -11.5,-28.5T200,160q-17,0 -28.5,11.5T160,200q0,17 11.5,28.5T200,240Zm560,0q17,0 28.5,-11.5T800,200q0,-17 -11.5,-28.5T760,160q-17,0 -28.5,11.5T720,200q0,17 11.5,28.5T760,240ZM313,720h334q9,-26 28,-45t45,-28L720,313q-26,-9 -45,-28t-28,-45L313,240q-9,26 -28,45t-45,28v334q26,9 45,28t28,45Zm447,80q17,0 28.5,-11.5T800,760q0,-17 -11.5,-28.5T760,720q-17,0 -28.5,11.5T720,760q0,17 11.5,28.5T760,800Zm-560,0q17,0 28.5,-11.5T240,760q0,-17 -11.5,-28.5T200,720q-17,0 -28.5,11.5T160,760q0,17 11.5,28.5T200,800Zm0,-600Zm560,0Zm0,560Zm-560,0Z" />+</vector>diff --git a/OCR-translation/src/main/res/drawable/add_material.xml b/OCR-translation/src/main/res/drawable/add_material.xmlnew file mode 100644index 0000000..1d33193--- /dev/null+++ b/OCR-translation/src/main/res/drawable/add_material.xml@@ -0,0 +1,9 @@+<vector xmlns:android="http://schemas.android.com/apk/res/android"+ android:width="24dp"+ android:height="24dp"+ android:viewportWidth="960"+ android:viewportHeight="960">+ <path+ android:pathData="M440,520L200,520L200,440L440,440L440,200L520,200L520,440L760,440L760,520L520,520L520,760L440,760L440,520Z"+ android:fillColor="#e3e3e3"/>+</vector>diff --git a/OCR-translation/src/main/res/drawable/add_photo.xml b/OCR-translation/src/main/res/drawable/add_photo.xmlnew file mode 100644index 0000000..4787083--- /dev/null+++ b/OCR-translation/src/main/res/drawable/add_photo.xml@@ -0,0 +1,9 @@+<vector xmlns:android="http://schemas.android.com/apk/res/android"+ android:width="24dp"+ android:height="24dp"+ android:viewportWidth="960"+ android:viewportHeight="960">+ <path+ android:pathData="M440,520ZM120,840q-33,0 -56.5,-23.5T40,760v-480q0,-33 23.5,-56.5T120,200h126l74,-80h240v80L355,200l-73,80L120,280v480h640v-360h80v360q0,33 -23.5,56.5T760,840L120,840ZM760,280v-80h-80v-80h80v-80h80v80h80v80h-80v80h-80ZM440,700q75,0 127.5,-52.5T620,520q0,-75 -52.5,-127.5T440,340q-75,0 -127.5,52.5T260,520q0,75 52.5,127.5T440,700ZM440,620q-42,0 -71,-29t-29,-71q0,-42 29,-71t71,-29q42,0 71,29t29,71q0,42 -29,71t-71,29Z"+ android:fillColor="#e3e3e3"/>+</vector>diff --git a/OCR-translation/src/main/res/drawable/alt_route.xml b/OCR-translation/src/main/res/drawable/alt_route.xmlnew file mode 100644index 0000000..3523af4--- /dev/null+++ b/OCR-translation/src/main/res/drawable/alt_route.xml@@ -0,0 +1,11 @@+<vector xmlns:android="http://schemas.android.com/apk/res/android"+ android:width="24dp"+ android:height="24dp"+ android:viewportWidth="960"+ android:viewportHeight="960">+ <group android:translateY="960">+ <path+ android:fillColor="#FF000000"+ android:pathData="M450,-110v-170q0,-48 -16,-79t-49,-64l43,-43q13,11 27.5,30t24.5,35q17,-26 33.5,-45t31.5,-32q58,-47 83.5,-113.5T648,-766l-69,69q-9,9 -21,9t-21,-9q-9,-9 -9,-21t9,-21l120,-120q5,-5 10,-7t11,-2q6,0 11,2t10,7l120,120q9,9 9,21t-9,21q-9,9 -21,9t-21,-9l-69,-69q5,126 -24.5,198.5T585,-432q-44,40 -59.5,73T510,-280v170q0,13 -8.5,21.5T480,-80q-13,0 -21.5,-8.5T450,-110ZM258,-636q-4,-18 -6.5,-52.5T251,-765l-68,68q-9,9 -21,9t-21,-9q-9,-9 -9,-21t9,-21l120,-120q5,-5 10,-7t11,-2q6,0 11,2t10,7l120,120q9,9 9,21t-9,21q-9,9 -21,9t-21,-9l-69,-69q-2,38 -1,66.5t5,49.5l-58,14ZM342,-465q-17,-18 -37.5,-47.5T273,-577l59,-15q9,25 24,48t28,37l-42,42Z" />+ </group>+</vector>diff --git a/OCR-translation/src/main/res/drawable/arrow_back.xml b/OCR-translation/src/main/res/drawable/arrow_back.xmlnew file mode 100644index 0000000..da16eb9--- /dev/null+++ b/OCR-translation/src/main/res/drawable/arrow_back.xml@@ -0,0 +1,10 @@+<vector xmlns:android="http://schemas.android.com/apk/res/android"+ android:width="24dp"+ android:height="24dp"+ android:autoMirrored="true"+ android:viewportWidth="960"+ android:viewportHeight="960">+ <path+ android:pathData="m313,520 l224,224 -57,56 -320,-320 320,-320 57,56 -224,224h487v80L313,520Z"+ android:fillColor="#e3e3e3"/>+</vector>diff --git a/OCR-translation/src/main/res/drawable/attach_file_add.xml b/OCR-translation/src/main/res/drawable/attach_file_add.xmlnew file mode 100644index 0000000..c27b234--- /dev/null+++ b/OCR-translation/src/main/res/drawable/attach_file_add.xml@@ -0,0 +1,9 @@+<vector xmlns:android="http://schemas.android.com/apk/res/android"+ android:width="24dp"+ android:height="24dp"+ android:viewportWidth="960"+ android:viewportHeight="960">+ <path+ android:pathData="M640,440v-200h80v200h-80ZM440,716q-35,-10 -57.5,-39T360,610v-370h80v476ZM470,880q-104,0 -177,-73t-73,-177v-370q0,-75 52.5,-127.5T400,80q75,0 127.5,52.5T580,260v300h-80v-300q-1,-42 -29.5,-71T400,160q-42,0 -71,29t-29,71v370q-1,71 49,120.5T470,800q25,0 47.5,-6.5T560,774v89q-21,8 -43.5,12.5T470,880ZM640,840v-120h-120v-80h120v-120h80v120h120v80h-120v120h-80Z"+ android:fillColor="#e3e3e3"/>+</vector>diff --git a/OCR-translation/src/main/res/drawable/auto_awesome.xml b/OCR-translation/src/main/res/drawable/auto_awesome.xmlnew file mode 100644index 0000000..9687537--- /dev/null+++ b/OCR-translation/src/main/res/drawable/auto_awesome.xml@@ -0,0 +1,9 @@+<vector xmlns:android="http://schemas.android.com/apk/res/android"+ android:width="24dp"+ android:height="24dp"+ android:viewportWidth="24"+ android:viewportHeight="24">+ <path+ android:fillColor="#FF000000"+ android:pathData="M19,9l1.25,-2.75L23,5l-2.75,-1.25L19,1l-1.25,2.75L15,5l2.75,1.25L19,9zM11.5,9.5L9,4 6.5,9.5 1,12l5.5,2.5L9,20l2.5,-5.5L17,12 11.5,9.5zM19,15l-1.25,2.75L15,19l2.75,1.25L19,23l1.25,-2.75L23,19l-2.75,-1.25z" />+</vector>diff --git a/OCR-translation/src/main/res/drawable/cancel.xml b/OCR-translation/src/main/res/drawable/cancel.xmlnew file mode 100644index 0000000..9b5fccc--- /dev/null+++ b/OCR-translation/src/main/res/drawable/cancel.xml@@ -0,0 +1,9 @@+<vector xmlns:android="http://schemas.android.com/apk/res/android"+ android:width="24dp"+ android:height="24dp"+ android:viewportWidth="960"+ android:viewportHeight="960">+ <path+ android:pathData="m256,760 l-56,-56 224,-224 -224,-224 56,-56 224,224 224,-224 56,56 -224,224 224,224 -56,56 -224,-224 -224,224Z"+ android:fillColor="#e3e3e3"/>+</vector>diff --git a/OCR-translation/src/main/res/drawable/check.xml b/OCR-translation/src/main/res/drawable/check.xmlnew file mode 100644index 0000000..06c68ee--- /dev/null+++ b/OCR-translation/src/main/res/drawable/check.xml@@ -0,0 +1,9 @@+<vector xmlns:android="http://schemas.android.com/apk/res/android"+ android:width="24dp"+ android:height="24dp"+ android:viewportWidth="960"+ android:viewportHeight="960">+ <path+ android:fillColor="#FF000000"+ android:pathData="m424,664 l282,-282 -56,-56 -226,226 -114,-114 -56,56zM480,880q-83,0 -156,-31.5T197,763t-85.5,-127T80,480t31.5,-156T197,197t127,-85.5T480,80t156,31.5T763,197t85.5,127T880,480t-31.5,156T763,763t-127,85.5T480,880m0,-80q134,0 227,-93t93,-227 -93,-227 -227,-93 -227,93 -93,227 93,227 227,93m0,-320"/>+</vector>diff --git a/OCR-translation/src/main/res/drawable/check_plain.xml b/OCR-translation/src/main/res/drawable/check_plain.xmlnew file mode 100644index 0000000..a827090--- /dev/null+++ b/OCR-translation/src/main/res/drawable/check_plain.xml@@ -0,0 +1,9 @@+<vector xmlns:android="http://schemas.android.com/apk/res/android"+ android:width="24dp"+ android:height="24dp"+ android:viewportWidth="960"+ android:viewportHeight="960">+ <path+ android:fillColor="#FF000000"+ android:pathData="M382,720 L154,492l57,-57 171,171 367,-367 57,57z"/>+</vector>diff --git a/OCR-translation/src/main/res/drawable/chevron_right.xml b/OCR-translation/src/main/res/drawable/chevron_right.xmlnew file mode 100644index 0000000..5b9810c--- /dev/null+++ b/OCR-translation/src/main/res/drawable/chevron_right.xml@@ -0,0 +1,9 @@+<vector xmlns:android="http://schemas.android.com/apk/res/android"+ android:width="24dp"+ android:height="24dp"+ android:viewportWidth="960"+ android:viewportHeight="960">+ <path+ android:pathData="M504,480 L320,296l56,-56 240,240 -240,240 -56,-56 184,-184Z"+ android:fillColor="#e3e3e3"/>+</vector>diff --git a/OCR-translation/src/main/res/drawable/chrome_reader_mode.xml b/OCR-translation/src/main/res/drawable/chrome_reader_mode.xmlnew file mode 100644index 0000000..ab22290--- /dev/null+++ b/OCR-translation/src/main/res/drawable/chrome_reader_mode.xml@@ -0,0 +1,9 @@+<vector xmlns:android="http://schemas.android.com/apk/res/android"+ android:width="24dp"+ android:height="24dp"+ android:viewportWidth="960"+ android:viewportHeight="960">+ <path+ android:fillColor="#FF1F1F1F"+ android:pathData="M160,800q-33,0 -56.5,-23.5T80,720v-480q0,-33 23.5,-56.5T160,160h640q33,0 56.5,23.5T880,240v480q0,33 -23.5,56.5T800,800H160zM160,720h280v-480H160v480zM520,720h280v-480H520v480zM560,600h200v-60H560v60zM560,500h200v-60H560v60zM560,400h200v-60H560v60zM160,720v-480,480z" />+</vector>diff --git a/OCR-translation/src/main/res/drawable/compare.xml b/OCR-translation/src/main/res/drawable/compare.xmlnew file mode 100644index 0000000..980c13b--- /dev/null+++ b/OCR-translation/src/main/res/drawable/compare.xml@@ -0,0 +1,9 @@+<vector xmlns:android="http://schemas.android.com/apk/res/android"+ android:width="24dp"+ android:height="24dp"+ android:viewportWidth="960"+ android:viewportHeight="960">+ <path+ android:fillColor="#FF000000"+ android:pathData="m320,800 l-56,-57 103,-103L80,640v-80h287L264,457l56,-57 200,200zM640,560L440,360l200,-200 56,57 -103,103h287v80L593,400l103,103z"/>+</vector>diff --git a/OCR-translation/src/main/res/drawable/copy.xml b/OCR-translation/src/main/res/drawable/copy.xmlnew file mode 100644index 0000000..93e4185--- /dev/null+++ b/OCR-translation/src/main/res/drawable/copy.xml@@ -0,0 +1,9 @@+<vector xmlns:android="http://schemas.android.com/apk/res/android"+ android:width="24dp"+ android:height="24dp"+ android:viewportWidth="960"+ android:viewportHeight="960">+ <path+ android:fillColor="#FF000000"+ android:pathData="M360,720q-33,0 -56.5,-23.5T280,640v-480q0,-33 23.5,-56.5T360,80h360q33,0 56.5,23.5T800,160v480q0,33 -23.5,56.5T720,720zM360,640h360v-480L360,160zM200,880q-33,0 -56.5,-23.5T120,800v-560h80v560h440v80zM360,640v-480z"/>+</vector>diff --git a/OCR-translation/src/main/res/drawable/delete.xml b/OCR-translation/src/main/res/drawable/delete.xmlnew file mode 100644index 0000000..f32818a--- /dev/null+++ b/OCR-translation/src/main/res/drawable/delete.xml@@ -0,0 +1,9 @@+<vector xmlns:android="http://schemas.android.com/apk/res/android"+ android:width="24dp"+ android:height="24dp"+ android:viewportWidth="960"+ android:viewportHeight="960">+ <path+ android:pathData="M280,840q-33,0 -56.5,-23.5T200,760v-520h-40v-80h200v-40h240v40h200v80h-40v520q0,33 -23.5,56.5T680,840L280,840ZM680,240L280,240v520h400v-520ZM360,680h80v-360h-80v360ZM520,680h80v-360h-80v360ZM280,240v520,-520Z"+ android:fillColor="#e3e3e3"/>+</vector>diff --git a/OCR-translation/src/main/res/drawable/dictionary.xml b/OCR-translation/src/main/res/drawable/dictionary.xmlnew file mode 100644index 0000000..b0a42d8--- /dev/null+++ b/OCR-translation/src/main/res/drawable/dictionary.xml@@ -0,0 +1,9 @@+<vector xmlns:android="http://schemas.android.com/apk/res/android"+ android:width="24dp"+ android:height="24dp"+ android:viewportWidth="960"+ android:viewportHeight="960">+ <path+ android:pathData="M160,569h45l23,-66h104l24,66h44l-97,-258h-46l-97,258ZM241,466 L279,359h2l38,107h-78ZM560,396v-68q33,-14 67.5,-21t72.5,-7q26,0 51,4t49,10v64q-24,-9 -48.5,-13.5T700,360q-38,0 -73,9.5T560,396ZM560,616v-68q33,-14 67.5,-21t72.5,-7q26,0 51,4t49,10v64q-24,-9 -48.5,-13.5T700,580q-38,0 -73,9t-67,27ZM560,506v-68q33,-14 67.5,-21t72.5,-7q26,0 51,4t49,10v64q-24,-9 -48.5,-13.5T700,470q-38,0 -73,9.5T560,506ZM260,640q47,0 91.5,10.5T440,682v-394q-41,-24 -87,-36t-93,-12q-36,0 -71.5,7T120,268v396q35,-12 69.5,-18t70.5,-6ZM520,682q44,-21 88.5,-31.5T700,640q36,0 70.5,6t69.5,18v-396q-33,-14 -68.5,-21t-71.5,-7q-47,0 -93,12t-87,36v394ZM480,800q-48,-38 -104,-59t-116,-21q-42,0 -82.5,11T100,762q-21,11 -40.5,-1T40,726v-482q0,-11 5.5,-21T62,208q46,-24 96,-36t102,-12q58,0 113.5,15T480,220q51,-30 106.5,-45T700,160q52,0 102,12t96,36q11,5 16.5,15t5.5,21v482q0,23 -19.5,35t-40.5,1q-37,-20 -77.5,-31T700,720q-60,0 -116,21t-104,59ZM280,461Z"+ android:fillColor="#1f1f1f"/>+</vector>diff --git a/OCR-translation/src/main/res/drawable/dictionary_book.xml b/OCR-translation/src/main/res/drawable/dictionary_book.xmlnew file mode 100644index 0000000..edf52f6--- /dev/null+++ b/OCR-translation/src/main/res/drawable/dictionary_book.xml@@ -0,0 +1,11 @@+<vector xmlns:android="http://schemas.android.com/apk/res/android"+ android:width="24dp"+ android:height="24dp"+ android:viewportWidth="960"+ android:viewportHeight="960">+ <group android:translateY="960">+ <path+ android:fillColor="#FF000000"+ android:pathData="M160-391h45l23-66h104l24 66h44l-97-258h-46l-97 258Zm81-103 38-107h2l38 107h-78Zm319-70v-68q33-14 67.5-21t72.5-7q26 0 51 4t49 10v64q-24-9-48.5-13.5T700-600q-38 0-73 9.5T560-564Zm0 220v-68q33-14 67.5-21t72.5-7q26 0 51 4t49 10v64q-24-9-48.5-13.5T700-380q-38 0-73 9t-67 27Zm0-110v-68q33-14 67.5-21t72.5-7q26 0 51 4t49 10v64q-24-9-48.5-13.5T700-490q-38 0-73 9.5T560-454ZM260-320q47 0 91.5 10.5T440-278v-394q-41-24-87-36t-93-12q-36 0-71.5 7T120-692v396q35-12 69.5-18t70.5-6Zm260 42q44-21 88.5-31.5T700-320q36 0 70.5 6t69.5 18v-396q-33-14-68.5-21t-71.5-7q-47 0-93 12t-87 36v394Zm-40 118q-48-38-104-59t-116-21q-42 0-82.5 11T100-198q-21 11-40.5-1T40-234v-482q0-11 5.5-21T62-752q46-24 96-36t102-12q58 0 113.5 15T480-740q51-30 106.5-45T700-800q52 0 102 12t96 36q11 5 16.5 15t5.5 21v482q0 23-19.5 35t-40.5 1q-37-20-77.5-31T700-240q-60 0-116 21t-104 59ZM280-499Z" />+ </group>+</vector>diff --git a/OCR-translation/src/main/res/drawable/download.xml b/OCR-translation/src/main/res/drawable/download.xmlnew file mode 100644index 0000000..beda634--- /dev/null+++ b/OCR-translation/src/main/res/drawable/download.xml@@ -0,0 +1,10 @@+<?xml version="1.0" encoding="utf-8"?>+<vector xmlns:android="http://schemas.android.com/apk/res/android"+ android:width="24dp"+ android:height="24dp"+ android:viewportWidth="960"+ android:viewportHeight="960">+ <path+ android:fillColor="#000000"+ android:pathData="M480,640L240,400l56,-58 144,144v-326h80v326l144,-144 56,58L480,640ZM240,800q-33,0 -56.5,-23.5T160,720v-120h80v120h480v-120h80v120q0,33 -23.5,56.5T720,800H240Z" />+</vector>diff --git a/OCR-translation/src/main/res/drawable/draft.xml b/OCR-translation/src/main/res/drawable/draft.xmlnew file mode 100644index 0000000..b77e9fb--- /dev/null+++ b/OCR-translation/src/main/res/drawable/draft.xml@@ -0,0 +1,9 @@+<vector xmlns:android="http://schemas.android.com/apk/res/android"+ android:width="24dp"+ android:height="24dp"+ android:viewportWidth="960"+ android:viewportHeight="960">+ <path+ android:pathData="M240,880q-33,0 -56.5,-23.5T160,800v-640q0,-33 23.5,-56.5T240,80h320l240,240v480q0,33 -23.5,56.5T720,880H240ZM520,360v-200H240v640h480v-440H520ZM240,160v200,-200v640,-640Z"+ android:fillColor="#1f1f1f"/>+</vector>diff --git a/OCR-translation/src/main/res/drawable/example.png b/OCR-translation/src/main/res/drawable/example.pngnew file mode 100644index 0000000..89747f2Binary files /dev/null and b/OCR-translation/src/main/res/drawable/example.png differdiff --git a/OCR-translation/src/main/res/drawable/expand.xml b/OCR-translation/src/main/res/drawable/expand.xmlnew file mode 100644index 0000000..8e847ab--- /dev/null+++ b/OCR-translation/src/main/res/drawable/expand.xml@@ -0,0 +1,9 @@+<vector xmlns:android="http://schemas.android.com/apk/res/android"+ android:width="24dp"+ android:height="24dp"+ android:viewportWidth="960"+ android:viewportHeight="960">+ <path+ android:pathData="M200,760v-240h80v160h160v80L200,760ZM680,440v-160L520,280v-80h240v240h-80Z"+ android:fillColor="#1f1f1f"/>+</vector>diff --git a/OCR-translation/src/main/res/drawable/expandless.xml b/OCR-translation/src/main/res/drawable/expandless.xmlnew file mode 100644index 0000000..a874ea8--- /dev/null+++ b/OCR-translation/src/main/res/drawable/expandless.xml@@ -0,0 +1,9 @@+<vector xmlns:android="http://schemas.android.com/apk/res/android"+ android:width="24dp"+ android:height="24dp"+ android:viewportWidth="960"+ android:viewportHeight="960">+ <path+ android:pathData="M480,432 L296,616l-56,-56 240,-240 240,240 -56,56 -184,-184Z"+ android:fillColor="#e3e3e3"/>+</vector>diff --git a/OCR-translation/src/main/res/drawable/expandmore.xml b/OCR-translation/src/main/res/drawable/expandmore.xmlnew file mode 100644index 0000000..2aecc56--- /dev/null+++ b/OCR-translation/src/main/res/drawable/expandmore.xml@@ -0,0 +1,9 @@+<vector xmlns:android="http://schemas.android.com/apk/res/android"+ android:width="24dp"+ android:height="24dp"+ android:viewportWidth="960"+ android:viewportHeight="960">+ <path+ android:pathData="M480,616 L240,376l56,-56 184,184 184,-184 56,56 -240,240Z"+ android:fillColor="#e3e3e3"/>+</vector>diff --git a/OCR-translation/src/main/res/drawable/flash_off.xml b/OCR-translation/src/main/res/drawable/flash_off.xmlnew file mode 100644index 0000000..868645c--- /dev/null+++ b/OCR-translation/src/main/res/drawable/flash_off.xml@@ -0,0 +1,9 @@+<vector xmlns:android="http://schemas.android.com/apk/res/android"+ android:width="24dp"+ android:height="24dp"+ android:viewportWidth="24"+ android:viewportHeight="24">+ <path+ android:fillColor="#FF000000"+ android:pathData="M3.27,3L2,4.27l5,5V13h3v9l3.58,-6.14L17.73,20L19,18.73L3.27,3zM17,10h-4l4,-8H7v2.18l8.46,8.46L17,10z" />+</vector>diff --git a/OCR-translation/src/main/res/drawable/flash_on.xml b/OCR-translation/src/main/res/drawable/flash_on.xmlnew file mode 100644index 0000000..96b215f--- /dev/null+++ b/OCR-translation/src/main/res/drawable/flash_on.xml@@ -0,0 +1,9 @@+<vector xmlns:android="http://schemas.android.com/apk/res/android"+ android:width="24dp"+ android:height="24dp"+ android:viewportWidth="24"+ android:viewportHeight="24">+ <path+ android:fillColor="#FF000000"+ android:pathData="M7,2v11h3v9l7,-12h-4l4,-8z" />+</vector>diff --git a/OCR-translation/src/main/res/drawable/flip.xml b/OCR-translation/src/main/res/drawable/flip.xmlnew file mode 100644index 0000000..f8105bd--- /dev/null+++ b/OCR-translation/src/main/res/drawable/flip.xml@@ -0,0 +1,9 @@+<vector xmlns:android="http://schemas.android.com/apk/res/android"+ android:width="24dp"+ android:height="24dp"+ android:viewportWidth="960"+ android:viewportHeight="960">+ <path+ android:pathData="M440,840v-720h80v720h-80ZM200,720q-33,0 -56.5,-23.5T120,640v-320q0,-33 23.5,-56.5T200,240h160v80L200,320v320h160v80L200,720ZM600,720v-80h80v80h-80ZM760,720v-80h80q0,33 -23.5,56.5T760,720ZM600,320v-80h80v80h-80ZM760,320v-80q33,0 56.5,23.5T840,320h-80ZM760,520v-80h80v80h-80ZM600,520v-80h80v80h-80Z"+ android:fillColor="#1f1f1f"/>+</vector>diff --git a/OCR-translation/src/main/res/drawable/folder.xml b/OCR-translation/src/main/res/drawable/folder.xmlnew file mode 100644index 0000000..5642191--- /dev/null+++ b/OCR-translation/src/main/res/drawable/folder.xml@@ -0,0 +1,9 @@+<vector xmlns:android="http://schemas.android.com/apk/res/android"+ android:width="24dp"+ android:height="24dp"+ android:viewportWidth="960"+ android:viewportHeight="960">+ <path+ android:pathData="M160,800q-33,0 -56.5,-23.5T80,720v-480q0,-33 23.5,-56.5T160,160h240l80,80h320q33,0 56.5,23.5T880,320v400q0,33 -23.5,56.5T800,800L160,800ZM160,720h640v-400L447,320l-80,-80L160,240v480ZM160,720v-480,480Z"+ android:fillColor="#1f1f1f"/>+</vector>diff --git a/OCR-translation/src/main/res/drawable/heart.xml b/OCR-translation/src/main/res/drawable/heart.xmlnew file mode 100644index 0000000..875ea02--- /dev/null+++ b/OCR-translation/src/main/res/drawable/heart.xml@@ -0,0 +1,11 @@+<vector xmlns:android="http://schemas.android.com/apk/res/android"+ android:width="24dp"+ android:height="24dp"+ android:viewportWidth="960"+ android:viewportHeight="960">+ <group android:translateY="960">+ <path+ android:pathData="m480,-120 l-58,-52q-101,-91 -167,-157T150,-447.5Q111,-500 95.5,-544T80,-634q0,-94 63,-157t157,-63q52,0 99,22t81,62q34,-40 81,-62t99,-22q94,0 157,63t63,157q0,46 -15.5,90T810,-447.5Q771,-395 705,-329T538,-172l-58,52Z"+ android:fillColor="#1f1f1f"/>+ </group>+</vector>diff --git a/OCR-translation/src/main/res/drawable/help_outline.xml b/OCR-translation/src/main/res/drawable/help_outline.xmlnew file mode 100644index 0000000..95752d0--- /dev/null+++ b/OCR-translation/src/main/res/drawable/help_outline.xml@@ -0,0 +1,9 @@+<vector xmlns:android="http://schemas.android.com/apk/res/android"+ android:width="24dp"+ android:height="24dp"+ android:viewportWidth="24"+ android:viewportHeight="24">+ <path+ android:fillColor="#FF000000"+ android:pathData="M11,18h2v-2h-2v2zM12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM12,20c-4.41,0 -8,-3.59 -8,-8s3.59,-8 8,-8 8,3.59 8,8 -3.59,8 -8,8zM12,6c-2.21,0 -4,1.79 -4,4h2c0,-1.1 0.9,-2 2,-2s2,0.9 2,2c0,2 -3,1.75 -3,5h2c0,-2.25 3,-2.5 3,-5 0,-2.21 -1.79,-4 -4,-4z" />+</vector>diff --git a/OCR-translation/src/main/res/drawable/ic_translate_button.xml b/OCR-translation/src/main/res/drawable/ic_translate_button.xmlnew file mode 100644index 0000000..5da081e--- /dev/null+++ b/OCR-translation/src/main/res/drawable/ic_translate_button.xml@@ -0,0 +1,9 @@+<vector xmlns:android="http://schemas.android.com/apk/res/android"+ android:width="24dp"+ android:height="24dp"+ android:viewportWidth="960"+ android:viewportHeight="960">+ <path+ android:fillColor="#FF000000"+ android:pathData="m476,880 l182,-480h84L924,880h-84l-43,-122L603,758L560,880zM160,760l-56,-56 202,-202q-35,-35 -63.5,-80T190,320h84q20,39 40,68t48,58q33,-33 68.5,-92.5T484,240L40,240v-80h280v-80h80v80h280v80L564,240q-21,72 -63,148t-83,116l96,98 -30,82 -122,-125zM628,688h144l-72,-204z"/>+</vector>diff --git a/OCR-translation/src/main/res/drawable/info.xml b/OCR-translation/src/main/res/drawable/info.xmlnew file mode 100644index 0000000..7cb1809--- /dev/null+++ b/OCR-translation/src/main/res/drawable/info.xml@@ -0,0 +1,11 @@+<vector xmlns:android="http://schemas.android.com/apk/res/android"+ android:width="24dp"+ android:height="24dp"+ android:viewportWidth="960"+ android:viewportHeight="960">+ <group android:translateY="960">+ <path+ android:pathData="M480,-280q17,0 28.5,-11.5T520,-320v-160q0,-17 -11.5,-28.5T480,-520q-17,0 -28.5,11.5T440,-480v160q0,17 11.5,28.5T480,-280ZM480,-600q17,0 28.5,-11.5T520,-640q0,-17 -11.5,-28.5T480,-680q-17,0 -28.5,11.5T440,-640q0,17 11.5,28.5T480,-600ZM480,-80q-83,0 -156,-31.5T197,-197q-54,-54 -85.5,-127T80,-480q0,-83 31.5,-156T197,-763q54,-54 127,-85.5T480,-880q83,0 156,31.5T763,-763q54,54 85.5,127T880,-480q0,83 -31.5,156T763,-197q-54,54 -127,85.5T480,-80Z"+ android:fillColor="#1f1f1f"/>+ </group>+</vector>diff --git a/OCR-translation/src/main/res/drawable/list.xml b/OCR-translation/src/main/res/drawable/list.xmlnew file mode 100644index 0000000..302fa89--- /dev/null+++ b/OCR-translation/src/main/res/drawable/list.xml@@ -0,0 +1,11 @@+<vector xmlns:android="http://schemas.android.com/apk/res/android"+ android:width="24dp"+ android:height="24dp"+ android:viewportWidth="960"+ android:viewportHeight="960">+ <group android:translateY="960">+ <path+ android:fillColor="#FF000000"+ android:pathData="M280,-600v-80h560v80H280Zm0,160v-80h560v80H280Zm0,160v-80h560v80H280ZM160,-600q-17,0 -28.5,-11.5T120,-640q0,-17 11.5,-28.5T160,-680q17,0 28.5,11.5T200,-640q0,17 -11.5,28.5T160,-600Zm0,160q-17,0 -28.5,-11.5T120,-480q0,-17 11.5,-28.5T160,-520q17,0 28.5,11.5T200,-480q0,17 -11.5,28.5T160,-440Zm0,160q-17,0 -28.5,-11.5T120,-320q0,-17 11.5,-28.5T160,-360q17,0 28.5,11.5T200,-320q0,17 -11.5,28.5T160,-280Z" />+ </group>+</vector>diff --git a/OCR-translation/src/main/res/drawable/mic.xml b/OCR-translation/src/main/res/drawable/mic.xmlnew file mode 100644index 0000000..e2464bd--- /dev/null+++ b/OCR-translation/src/main/res/drawable/mic.xml@@ -0,0 +1,9 @@+<vector xmlns:android="http://schemas.android.com/apk/res/android"+ android:width="24dp"+ android:height="24dp"+ android:viewportWidth="960"+ android:viewportHeight="960">+ <path+ android:pathData="M480,560q-50,0 -85,-35t-35,-85v-240q0,-50 35,-85t85,-35q50,0 85,35t35,85v240q0,50 -35,85t-85,35ZM440,840v-123q-104,-14 -172,-93t-68,-184h80q0,83 58.5,141.5T480,640q83,0 141.5,-58.5T680,440h80q0,105 -68,184t-172,93v123h-80Z"+ android:fillColor="#e3e3e3"/>+</vector>diff --git a/OCR-translation/src/main/res/drawable/more_vert.xml b/OCR-translation/src/main/res/drawable/more_vert.xmlnew file mode 100644index 0000000..ede8386--- /dev/null+++ b/OCR-translation/src/main/res/drawable/more_vert.xml@@ -0,0 +1,9 @@+<vector xmlns:android="http://schemas.android.com/apk/res/android"+ android:width="24dp"+ android:height="24dp"+ android:viewportWidth="960"+ android:viewportHeight="960">+ <path+ android:pathData="M480,800q-33,0 -56.5,-23.5T400,720q0,-33 23.5,-56.5T480,640q33,0 56.5,23.5T560,720q0,33 -23.5,56.5T480,800ZM480,560q-33,0 -56.5,-23.5T400,480q0,-33 23.5,-56.5T480,400q33,0 56.5,23.5T560,480q0,33 -23.5,56.5T480,560ZM480,320q-33,0 -56.5,-23.5T400,240q0,-33 23.5,-56.5T480,160q33,0 56.5,23.5T560,240q0,33 -23.5,56.5T480,320Z"+ android:fillColor="#e3e3e3"/>+</vector>diff --git a/OCR-translation/src/main/res/drawable/open_in_full.xml b/OCR-translation/src/main/res/drawable/open_in_full.xmlnew file mode 100644index 0000000..7f60eac--- /dev/null+++ b/OCR-translation/src/main/res/drawable/open_in_full.xml@@ -0,0 +1,9 @@+<vector xmlns:android="http://schemas.android.com/apk/res/android"+ android:width="24dp"+ android:height="24dp"+ android:viewportWidth="960"+ android:viewportHeight="960">+ <path+ android:pathData="M120,840v-320h80v184l504,-504L520,200v-80h320v320h-80v-184L256,760h184v80L120,840Z"+ android:fillColor="#1f1f1f"/>+</vector>diff --git a/OCR-translation/src/main/res/drawable/paste.xml b/OCR-translation/src/main/res/drawable/paste.xmlnew file mode 100644index 0000000..a92ab85--- /dev/null+++ b/OCR-translation/src/main/res/drawable/paste.xml@@ -0,0 +1,9 @@+<vector xmlns:android="http://schemas.android.com/apk/res/android"+ android:width="24dp"+ android:height="24dp"+ android:viewportWidth="960"+ android:viewportHeight="960">+ <path+ android:pathData="M200,840q-33,0 -56.5,-23.5T120,760v-560q0,-33 23.5,-56.5T200,120h167q11,-35 43,-57.5t70,-22.5q40,0 71.5,22.5T594,120h166q33,0 56.5,23.5T840,200v560q0,33 -23.5,56.5T760,840L200,840ZM200,760h560v-560h-80v120L280,320v-120h-80v560ZM480,200q17,0 28.5,-11.5T520,160q0,-17 -11.5,-28.5T480,120q-17,0 -28.5,11.5T440,160q0,17 11.5,28.5T480,200Z"+ android:fillColor="#1f1f1f"/>+</vector>diff --git a/OCR-translation/src/main/res/drawable/pause.xml b/OCR-translation/src/main/res/drawable/pause.xmlnew file mode 100644index 0000000..c638ca0--- /dev/null+++ b/OCR-translation/src/main/res/drawable/pause.xml@@ -0,0 +1,9 @@+<vector xmlns:android="http://schemas.android.com/apk/res/android"+ android:width="24dp"+ android:height="24dp"+ android:viewportWidth="960"+ android:viewportHeight="960">+ <path+ android:pathData="M560,760v-560h160v560L560,760ZM240,760v-560h160v560L240,760Z"+ android:fillColor="#e3e3e3"/>+</vector>diff --git a/OCR-translation/src/main/res/drawable/play_arrow.xml b/OCR-translation/src/main/res/drawable/play_arrow.xmlnew file mode 100644index 0000000..04457ec--- /dev/null+++ b/OCR-translation/src/main/res/drawable/play_arrow.xml@@ -0,0 +1,10 @@+<?xml version="1.0" encoding="utf-8"?>+<vector xmlns:android="http://schemas.android.com/apk/res/android"+ android:width="24dp"+ android:height="24dp"+ android:viewportWidth="960"+ android:viewportHeight="960">+ <path+ android:fillColor="#000000"+ android:pathData="M320,853v-746l586,373 -586,373Z" />+</vector>diff --git a/OCR-translation/src/main/res/drawable/question.xml b/OCR-translation/src/main/res/drawable/question.xmlnew file mode 100644index 0000000..fb0e9c9--- /dev/null+++ b/OCR-translation/src/main/res/drawable/question.xml@@ -0,0 +1,9 @@+<vector xmlns:android="http://schemas.android.com/apk/res/android"+ android:width="24dp"+ android:height="24dp"+ android:viewportWidth="960"+ android:viewportHeight="960">+ <path+ android:pathData="M424,640q0,-81 14.5,-116.5T500,446q41,-36 62.5,-62.5T584,323q0,-41 -27.5,-68T480,228q-51,0 -77.5,31T365,322l-103,-44q21,-64 77,-111t141,-47q105,0 161.5,58.5T698,319q0,50 -21.5,85.5T609,485q-49,47 -59.5,71.5T539,640L424,640ZM480,880q-33,0 -56.5,-23.5T400,800q0,-33 23.5,-56.5T480,720q33,0 56.5,23.5T560,800q0,33 -23.5,56.5T480,880Z"+ android:fillColor="#1f1f1f"/>+</vector>diff --git a/OCR-translation/src/main/res/drawable/refresh.xml b/OCR-translation/src/main/res/drawable/refresh.xmlnew file mode 100644index 0000000..6bb671c--- /dev/null+++ b/OCR-translation/src/main/res/drawable/refresh.xml@@ -0,0 +1,9 @@+<vector xmlns:android="http://schemas.android.com/apk/res/android"+ android:width="24dp"+ android:height="24dp"+ android:viewportWidth="960"+ android:viewportHeight="960">+ <path+ android:pathData="M482,800q-134,0 -228,-93t-94,-227v-7l-64,64 -56,-56 160,-160 160,160 -56,56 -64,-64v7q0,100 70.5,170T482,720q26,0 51,-6t49,-18l60,60q-38,22 -78,33t-82,11ZM760,639L600,479l56,-56 64,64v-7q0,-100 -70.5,-170T478,240q-26,0 -51,6t-49,18l-60,-60q38,-22 78,-33t82,-11q134,0 228,93t94,227v7l64,-64 56,56 -160,160Z"+ android:fillColor="#e3e3e3"/>+</vector>diff --git a/OCR-translation/src/main/res/drawable/rotate_right.xml b/OCR-translation/src/main/res/drawable/rotate_right.xmlnew file mode 100644index 0000000..cd73557--- /dev/null+++ b/OCR-translation/src/main/res/drawable/rotate_right.xml@@ -0,0 +1,9 @@+<vector xmlns:android="http://schemas.android.com/apk/res/android"+ android:width="24dp"+ android:height="24dp"+ android:viewportWidth="24"+ android:viewportHeight="24">+ <path+ android:fillColor="#FF000000"+ android:pathData="M15.55,5.55L11,1v3.07C7.06,4.56 4,7.92 4,12s3.05,7.44 7,7.93v-2.02c-2.84,-0.48 -5,-2.94 -5,-5.91s2.16,-5.43 5,-5.91L11,10l4.55,-4.45zM19.93,11c-0.17,-1.39 -0.72,-2.73 -1.62,-3.89l-1.42,1.42c0.54,0.75 0.88,1.6 1.02,2.47h2.02zM13,17.9v2.02c1.39,-0.17 2.74,-0.71 3.9,-1.61l-1.44,-1.44c-0.75,0.54 -1.59,0.89 -2.46,1.03zM16.89,15.48l1.42,1.41c0.9,-1.16 1.45,-2.5 1.62,-3.89h-2.02c-0.14,0.87 -0.48,1.72 -1.02,2.48z" />+</vector>diff --git a/OCR-translation/src/main/res/drawable/selection_handle.xml b/OCR-translation/src/main/res/drawable/selection_handle.xmlnew file mode 100644index 0000000..fad2fda--- /dev/null+++ b/OCR-translation/src/main/res/drawable/selection_handle.xml@@ -0,0 +1,20 @@+<!--+ Solid map-pin handle for image text selection. Derived from Material Symbols "location_on"+ (FILL0), keeping only the outer teardrop contour — the inner circle and the ring's inner edge+ are dropped so it's a filled pin with no centre dot. The viewport is sized and the path+ translated so the pin's tip sits at the bottom-centre of the icon, so callers can anchor it at+ the bottom-centre without per-icon offsets.+-->+<vector xmlns:android="http://schemas.android.com/apk/res/android"+ android:width="24dp"+ android:height="24dp"+ android:viewportWidth="800"+ android:viewportHeight="800">+ <group+ android:translateX="-80"+ android:translateY="880">+ <path+ android:fillColor="#FF3B82F6"+ android:pathData="M480-80Q319-217 239.5-334.5T160-552q0-150 96.5-239T480-880q127 0 223.5 89T800-552q0 100-79.5 217.5T480-80Z" />+ </group>+</vector>diff --git a/OCR-translation/src/main/res/drawable/settings.xml b/OCR-translation/src/main/res/drawable/settings.xmlnew file mode 100644index 0000000..ea7c937--- /dev/null+++ b/OCR-translation/src/main/res/drawable/settings.xml@@ -0,0 +1,9 @@+<vector xmlns:android="http://schemas.android.com/apk/res/android"+ android:width="24dp"+ android:height="24dp"+ android:viewportWidth="960"+ android:viewportHeight="960">+ <path+ android:fillColor="#FF000000"+ android:pathData="m370,880 l-16,-128q-13,-5 -24.5,-12T307,725l-119,50L78,585l103,-78q-1,-7 -1,-13.5v-27q0,-6.5 1,-13.5L78,375l110,-190 119,50q11,-8 23,-15t24,-12l16,-128h220l16,128q13,5 24.5,12t22.5,15l119,-50 110,190 -103,78q1,7 1,13.5v27q0,6.5 -2,13.5l103,78 -110,190 -118,-50q-11,8 -23,15t-24,12L590,880zM440,800h79l14,-106q31,-8 57.5,-23.5T639,633l99,41 39,-68 -86,-65q5,-14 7,-29.5t2,-31.5 -2,-31.5 -7,-29.5l86,-65 -39,-68 -99,42q-22,-23 -48.5,-38.5T533,266l-13,-106h-79l-14,106q-31,8 -57.5,23.5T321,327l-99,-41 -39,68 86,64q-5,15 -7,30t-2,32q0,16 2,31t7,30l-86,65 39,68 99,-42q22,23 48.5,38.5T427,694zM482,620q58,0 99,-41t41,-99 -41,-99 -99,-41q-59,0 -99.5,41T342,480t40.5,99 99.5,41m-2,-140"/>+</vector>diff --git a/OCR-translation/src/main/res/drawable/settings_dot.xml b/OCR-translation/src/main/res/drawable/settings_dot.xmlnew file mode 100644index 0000000..ffb0457--- /dev/null+++ b/OCR-translation/src/main/res/drawable/settings_dot.xml@@ -0,0 +1,13 @@+<vector xmlns:android="http://schemas.android.com/apk/res/android"+ android:width="24dp"+ android:height="24dp"+ android:viewportWidth="960"+ android:viewportHeight="960">+ <path+ android:pathData="M370,80L353.98,207.97C345.98,211.3 338,215.33 330,220C322,224.67 314.36,229.67 307.03,235L187.97,185L77.97,375L181.02,452.97C180.35,457.64 180,462.15 180,466.48L180,493.52C180,497.85 180.35,502.36 181.02,507.03L77.97,585L187.97,775L307.03,725C314.36,730.33 321.86,735.33 329.53,740C337.2,744.67 345.32,748.7 353.98,752.03L370,880L590,880L606.02,752.03C614.02,748.7 622,744.67 630,740C638,735.33 645.64,730.33 652.97,725L771.02,775L881.02,585L777.97,507.03C779.3,502.36 780,497.85 780,493.52L780,466.48C780,462.15 779.65,457.64 778.98,452.97L882.03,375L775.55,191.02C769.56,204.95 761.08,217.83 749.53,229.38C725.54,253.37 696.46,265.31 662.19,265.31C627.91,265.31 598.76,253.37 574.77,229.38C550.77,205.38 538.75,176.23 538.75,141.95C538.75,118.63 546.39,98.56 557.5,80L370,80zM441.02,160L520,160L532.97,266.02C553.64,271.35 572.8,279.2 590.47,289.53C608.14,299.86 624.32,312.64 638.98,327.97L737.97,286.02L777.03,353.98L691.02,418.98C694.35,428.32 696.64,438.18 697.97,448.52C699.3,458.85 700,469.33 700,480C700,490.67 699.3,501.15 697.97,511.48C696.64,521.82 694.35,531.68 691.02,541.02L777.03,606.02L737.97,673.98L638.98,632.97C624.32,647.64 608.14,660.14 590.47,670.47C572.8,680.8 553.64,688.65 532.97,693.98L518.98,800L440,800L427.03,693.98C406.36,688.65 387.2,680.8 369.53,670.47C351.86,660.14 335.68,647.36 321.02,632.03L222.03,673.98L182.97,606.02L268.98,541.02C265.65,531.02 263.36,521.02 262.03,511.02C260.7,501.02 260,490.67 260,480C260,468.67 260.7,457.97 262.03,447.97C263.36,437.97 265.65,427.97 268.98,417.97L182.97,353.98L222.03,286.02L321.02,327.03C335.68,312.36 351.86,299.86 369.53,289.53C387.2,279.2 406.36,271.35 427.03,266.02L441.02,160zM482.03,340C442.7,340 409.5,353.68 382.5,381.02C355.5,408.35 342.03,441.33 342.03,480C342.03,518.67 355.5,551.65 382.5,578.98C409.5,606.32 442.7,620 482.03,620C520.7,620 553.68,606.32 581.02,578.98C608.35,551.65 622.03,518.67 622.03,480C622.03,441.33 608.35,408.35 581.02,381.02C553.68,353.68 520.7,340 482.03,340z"+ android:fillColor="#1f1f1f"/>+ <path+ android:pathData="m437.39,712.62c-89.45,0 -165.49,-32.47 -228.11,-97.41 -62.62,-64.94 -93.93,-143.79 -93.93,-236.56 0,-92.77 31.31,-171.63 93.93,-236.56 62.62,-64.94 138.65,-97.41 228.11,-97.41 89.45,0 165.49,32.47 228.11,97.41 62.62,64.94 93.93,143.79 93.93,236.56 0,92.77 -31.31,171.63 -93.93,236.56 -62.62,64.94 -138.65,97.41 -228.11,97.41z"+ android:strokeWidth="2.7329"+ android:fillColor="#ff0000"/>+</vector>diff --git a/OCR-translation/src/main/res/drawable/share.xml b/OCR-translation/src/main/res/drawable/share.xmlnew file mode 100644index 0000000..6430bc9--- /dev/null+++ b/OCR-translation/src/main/res/drawable/share.xml@@ -0,0 +1,9 @@+<vector xmlns:android="http://schemas.android.com/apk/res/android"+ android:width="24dp"+ android:height="24dp"+ android:viewportWidth="960"+ android:viewportHeight="960">+ <path+ android:pathData="M680,880q-50,0 -85,-35t-35,-85q0,-6 3,-28L282,568q-16,15 -37,23.5t-45,8.5q-50,0 -85,-35t-35,-85q0,-50 35,-85t85,-35q24,0 45,8.5t37,23.5l281,-164q-2,-7 -2.5,-13.5T560,200q0,-50 35,-85t85,-35q50,0 85,35t35,85q0,50 -35,85t-85,35q-24,0 -45,-8.5T598,288L317,452q2,7 2.5,13.5t0.5,14.5q0,8 -0.5,14.5T317,508l281,164q16,-15 37,-23.5t45,-8.5q50,0 85,35t35,85q0,50 -35,85t-85,35ZM680,800q17,0 28.5,-11.5T720,760q0,-17 -11.5,-28.5T680,720q-17,0 -28.5,11.5T640,760q0,17 11.5,28.5T680,800ZM200,520q17,0 28.5,-11.5T240,480q0,-17 -11.5,-28.5T200,440q-17,0 -28.5,11.5T160,480q0,17 11.5,28.5T200,520ZM680,240q17,0 28.5,-11.5T720,200q0,-17 -11.5,-28.5T680,160q-17,0 -28.5,11.5T640,200q0,17 11.5,28.5T680,240ZM680,760ZM200,480ZM680,200Z"+ android:fillColor="#1f1f1f"/>+</vector>diff --git a/OCR-translation/src/main/res/drawable/star.xml b/OCR-translation/src/main/res/drawable/star.xmlnew file mode 100644index 0000000..a74e9bc--- /dev/null+++ b/OCR-translation/src/main/res/drawable/star.xml@@ -0,0 +1,11 @@+<vector xmlns:android="http://schemas.android.com/apk/res/android"+ android:width="24dp"+ android:height="24dp"+ android:viewportWidth="960"+ android:viewportHeight="960">+ <path+ android:pathData="M233,840l65,-281L80,370l288,-25 112,-265 112,265 288,25 -218,189 65,281 -247,-149 -247,149Z"+ android:fillColor="@android:color/transparent"+ android:strokeColor="@android:color/primary_text_light"+ android:strokeWidth="50"/>+</vector>diff --git a/OCR-translation/src/main/res/drawable/star_filled.xml b/OCR-translation/src/main/res/drawable/star_filled.xmlnew file mode 100644index 0000000..cc87f33--- /dev/null+++ b/OCR-translation/src/main/res/drawable/star_filled.xml@@ -0,0 +1,11 @@+<vector xmlns:android="http://schemas.android.com/apk/res/android"+android:width="24dp"+android:height="24dp"+android:viewportWidth="960"+android:viewportHeight="960">+<path+ android:pathData="M233,840l65,-281L80,370l288,-25 112,-265 112,265 288,25 -218,189 65,281 -247,-149 -247,149Z"+ android:fillColor="#FFD700"+ android:strokeColor="#FFD700"+ android:strokeWidth="50"/>+</vector>diff --git a/OCR-translation/src/main/res/drawable/stop.xml b/OCR-translation/src/main/res/drawable/stop.xmlnew file mode 100644index 0000000..b384f8b--- /dev/null+++ b/OCR-translation/src/main/res/drawable/stop.xml@@ -0,0 +1,10 @@+<?xml version="1.0" encoding="utf-8"?>+<vector xmlns:android="http://schemas.android.com/apk/res/android"+ android:width="24dp"+ android:height="24dp"+ android:viewportWidth="960"+ android:viewportHeight="960">+ <path+ android:fillColor="#000000"+ android:pathData="M320,320v320-320Zm-80,400v-480h480v480H240Zm80,-80h320v-320H320v320Z" />+</vector>diff --git a/OCR-translation/src/main/res/drawable/swipe_vert.xml b/OCR-translation/src/main/res/drawable/swipe_vert.xmlnew file mode 100644index 0000000..94b73bd--- /dev/null+++ b/OCR-translation/src/main/res/drawable/swipe_vert.xml@@ -0,0 +1,9 @@+<vector xmlns:android="http://schemas.android.com/apk/res/android"+ android:width="24dp"+ android:height="24dp"+ android:viewportWidth="960"+ android:viewportHeight="960">+ <path+ android:pathData="M480,120 L600,280 L520,280 L520,460 L440,460 L440,280 L360,280 Z M520,500 L520,680 L600,680 L480,840 L360,680 L440,680 L440,500 Z"+ android:fillColor="#e3e3e3"/>+</vector>diff --git a/OCR-translation/src/main/res/drawable/text_rotate_vertical.xml b/OCR-translation/src/main/res/drawable/text_rotate_vertical.xmlnew file mode 100644index 0000000..020e8aa--- /dev/null+++ b/OCR-translation/src/main/res/drawable/text_rotate_vertical.xml@@ -0,0 +1,9 @@+<vector xmlns:android="http://schemas.android.com/apk/res/android"+ android:width="24dp"+ android:height="24dp"+ android:viewportWidth="960"+ android:viewportHeight="960">+ <path+ android:fillColor="#FF1F1F1F"+ android:pathData="M436,640l164,-440h80l164,440h-76l-40,-112H552l-40,112h-76zM574,464h132l-64,-182h-4l-64,182zM240,800L100,660l56,-56 44,42V120h80v526l44,-42 56,56 -140,140z" />+</vector>diff --git a/OCR-translation/src/main/res/drawable/text_rotation_auto.xml b/OCR-translation/src/main/res/drawable/text_rotation_auto.xmlnew file mode 100644index 0000000..9ae2b29--- /dev/null+++ b/OCR-translation/src/main/res/drawable/text_rotation_auto.xml@@ -0,0 +1,13 @@+<vector xmlns:android="http://schemas.android.com/apk/res/android"+ android:width="24dp"+ android:height="24dp"+ android:viewportWidth="960"+ android:viewportHeight="960">+ <!-- The "A" glyph from text_rotation_none, centered, with no direction+ arrow: reading order is decided automatically. -->+ <group android:translateY="140">+ <path+ android:fillColor="#FF1F1F1F"+ android:pathData="M276,560l164,-440h80l164,440h-76l-38,-112H392l-40,112h-76zM414,384h132l-64,-182h-4l-64,182z" />+ </group>+</vector>diff --git a/OCR-translation/src/main/res/drawable/text_rotation_none.xml b/OCR-translation/src/main/res/drawable/text_rotation_none.xmlnew file mode 100644index 0000000..0254766--- /dev/null+++ b/OCR-translation/src/main/res/drawable/text_rotation_none.xml@@ -0,0 +1,9 @@+<vector xmlns:android="http://schemas.android.com/apk/res/android"+ android:width="24dp"+ android:height="24dp"+ android:viewportWidth="960"+ android:viewportHeight="960">+ <path+ android:fillColor="#FF1F1F1F"+ android:pathData="M160,760v-80h528l-42,-42 56,-56 138,138 -138,138 -56,-56 42,-42H160zM276,560l164,-440h80l164,440h-76l-38,-112H392l-40,112h-76zM414,384h132l-64,-182h-4l-64,182z" />+</vector>diff --git a/OCR-translation/src/main/res/drawable/text_select_start.xml b/OCR-translation/src/main/res/drawable/text_select_start.xmlnew file mode 100644index 0000000..06c9eff--- /dev/null+++ b/OCR-translation/src/main/res/drawable/text_select_start.xml@@ -0,0 +1,9 @@+<vector xmlns:android="http://schemas.android.com/apk/res/android"+ android:width="24dp"+ android:height="24dp"+ android:viewportWidth="960"+ android:viewportHeight="960">+ <path+ android:pathData="M440,840v-80h80v80h-80Zm0,-640v-80h80v80h-80Zm160,640v-80h80v80h-80Zm0,-640v-80h80v80h-80Zm160,640v-80h80v80h-80Zm0,-160v-80h80v80h-80Zm0,-160v-80h80v80h-80Zm0,-160v-80h80v80h-80Zm0,-160v-80h80v80h-80ZM120,840v-80h80v-560h-80v-80h240v80h-80v560h80v80H120Z"+ android:fillColor="#e3e3e3"/>+</vector>diff --git a/OCR-translation/src/main/res/drawable/transparent_dialog_background.xml b/OCR-translation/src/main/res/drawable/transparent_dialog_background.xmlnew file mode 100644index 0000000..5ea1eb8--- /dev/null+++ b/OCR-translation/src/main/res/drawable/transparent_dialog_background.xml@@ -0,0 +1,5 @@+<?xml version="1.0" encoding="utf-8"?>+<shape xmlns:android="http://schemas.android.com/apk/res/android"+ android:shape="rectangle">+ <solid android:color="@android:color/transparent" />+</shape>diff --git a/OCR-translation/src/main/res/drawable/videocam.xml b/OCR-translation/src/main/res/drawable/videocam.xmlnew file mode 100644index 0000000..2852587--- /dev/null+++ b/OCR-translation/src/main/res/drawable/videocam.xml@@ -0,0 +1,9 @@+<vector xmlns:android="http://schemas.android.com/apk/res/android"+ android:width="24dp"+ android:height="24dp"+ android:viewportWidth="960"+ android:viewportHeight="960">+ <path+ android:pathData="M160,760q-33,0 -56.5,-23.5T80,680v-400q0,-33 23.5,-56.5T160,200h440q33,0 56.5,23.5T680,280v140l160,-160v440L680,540v140q0,33 -23.5,56.5T600,760L160,760Z"+ android:fillColor="#e3e3e3"/>+</vector>diff --git a/OCR-translation/src/main/res/drawable/volume_up.xml b/OCR-translation/src/main/res/drawable/volume_up.xmlnew file mode 100644index 0000000..702c5ab--- /dev/null+++ b/OCR-translation/src/main/res/drawable/volume_up.xml@@ -0,0 +1,10 @@+<?xml version="1.0" encoding="utf-8"?>+<vector xmlns:android="http://schemas.android.com/apk/res/android"+ android:width="24dp"+ android:height="24dp"+ android:viewportWidth="960"+ android:viewportHeight="960">+ <path+ android:fillColor="#000000"+ android:pathData="M560,829v-82q90,-26 145,-100t55,-168q0,-94 -55,-168T560,211v-82q124,28 202,125.5T840,479q0,127 -78,224.5T560,829ZM120,600v-240h160l200,-200v640L280,600H120Zm440,40v-322q47,22 73.5,66t26.5,96q0,51 -26.5,94.5T560,640ZM400,354l-86,86H200v80h114l86,86v-252ZM300,480Z" />+</vector>diff --git a/OCR-translation/src/main/res/layout/ucrop_view.xml b/OCR-translation/src/main/res/layout/ucrop_view.xmlnew file mode 100644index 0000000..c5f5133--- /dev/null+++ b/OCR-translation/src/main/res/layout/ucrop_view.xml@@ -0,0 +1,18 @@+<?xml version="1.0" encoding="utf-8"?>+<merge xmlns:android="http://schemas.android.com/apk/res/android"+ android:layout_width="match_parent"+ android:layout_height="match_parent">++ <dev.davidv.translator.ui.components.AppCropImageView+ android:id="@+id/image_view_crop"+ android:layout_width="match_parent"+ android:layout_height="match_parent"+ android:padding="@dimen/ucrop_padding_crop_frame"/>++ <com.yalantis.ucrop.view.OverlayView+ android:id="@+id/view_overlay"+ android:layout_width="match_parent"+ android:layout_height="match_parent"+ android:padding="@dimen/ucrop_padding_crop_frame"/>++</merge>diff --git a/OCR-translation/src/main/res/resources.properties b/OCR-translation/src/main/res/resources.propertiesnew file mode 100644index 0000000..467b3ef--- /dev/null+++ b/OCR-translation/src/main/res/resources.properties@@ -0,0 +1 @@+unqualifiedResLocale=en-USdiff --git a/OCR-translation/src/main/res/values-ar/strings.xml b/OCR-translation/src/main/res/values-ar/strings.xmlnew file mode 100644index 0000000..7ba8127--- /dev/null+++ b/OCR-translation/src/main/res/values-ar/strings.xml@@ -0,0 +1,315 @@+<?xml version="1.0" encoding="utf-8"?>+<resources>+ <string name="stop">أوقِف</string>+ <string name="pause">ألبِث</string>+ <string name="resume">استئناف</string>+ <string name="region_select_menu">حدّد منطقة الترجمة</string>+ <string name="screen_translate_needs_source">حدّد لغة المصدر</string>+ <string name="live_tile_label">ترجمة الشاشة مباشرةً</string>+ <string name="translate_text">ترجم</string>+ <string name="translate_link">ترجم الرابط</string>+ <string name="accessibility_service_description">فعّل هذه الخدمة لترجمة النص الظاهر على الشاشة. اضغط على زر الترجمة العائم لترجمة الشاشة الحالية، أو ابدأ ترجمة الشاشة المباشرة.</string>+ <string name="tap_to_translate_title">الترجمة السريعة مفعّلة</string>+ <string name="tap_to_translate_body">انقر لفتح نافذة المترجم المنبثقة</string>+ <string name="tap_to_translate_channel">الترجمة السريعة</string>+ <string name="tap_to_translate_channel_description">إشعار دائم للوصول السريع إلى نافذة المترجم المنبثقة</string>+ <string name="quick_tile_label">ترجم</string>+ <!-- common -->+ <string name="common_ok">موافق</string>+ <string name="common_cancel">إلغاء</string>+ <string name="common_done">تم</string>+ <string name="common_grant">منح</string>+ <string name="common_manage">أدِر</string>+ <!-- settings -->+ <string name="settings_title">الإعدادات</string>+ <string name="settings_languages">اللغات</string>+ <string name="settings_language_packs">حزم اللغات</string>+ <string name="settings_general">عام</string>+ <string name="settings_font_size">حجم الخط</string>+ <string name="settings_font_sample">هذا نص تجريبي</string>+ <string name="settings_tap_notification">إشعار الترجمة السريعة</string>+ <string name="settings_tap_notification_desc">إشعار دائم يفتح النافذة المنبثقة.</string>+ <string name="settings_web_translator">مترجم الويب</string>+ <string name="settings_clear_browsing">امحُ بيانات التصفح عند الإغلاق</string>+ <string name="settings_clear_browsing_desc">يحذف ملفات تعريف الارتباط والذاكرة المؤقتة والتخزين المحلي.</string>+ <string name="settings_tts_section">تحويل النص إلى كلام</string>+ <string name="settings_tts_read_urls_hashtags">اقرأ الروابط والوسوم</string>+ <string name="settings_popup_settings">النافذة المنبثقة</string>+ <string name="settings_popup_desc">تظهر النافذة المنبثقة عند اختيار \'ترجم\' من قائمة تحديد النص</string>+ <string name="settings_hide_input">أخفِ الإدخال</string>+ <string name="settings_popup_position">موضع النافذة المنبثقة</string>+ <string name="settings_popup_size">حجم النافذة المنبثقة: %1$d%%</string>+ <string name="settings_screen_translation">ترجمة الشاشة</string>+ <string name="settings_screen_translation_desc">ترجم النص مباشرةً فوق التطبيقات الأخرى.</string>+ <string name="settings_floating_button">زر دائم الظهور</string>+ <string name="settings_floating_button_desc">يتطلب دور إمكانية الوصول</string>+ <string name="settings_shortcut">ترجمة الشاشة عبر الاختصار</string>+ <string name="settings_shortcut_desc">اضغط مطولاً على زر الصفحة الرئيسية أو زر الطاقة للتفعيل</string>+ <string name="settings_on_shortcut">عند استدعاء الاختصار</string>+ <string name="settings_ocr">الصور</string>+ <string name="settings_background_mode">استبدال النص بـ</string>+ <string name="settings_min_confidence">أدنى ثقة: %1$d%%</string>+ <string name="settings_max_image_size">أقصى حجم للصورة: %1$dpx</string>+ <string name="settings_advanced">متقدّم</string>+ <string name="settings_catalog_url">رابط الفهرس المفصل</string>+ <string name="settings_external_storage">استخدم التخزين الخارجي</string>+ <string name="settings_disable_autodetect">عطّل الكشف التلقائي عن اللغة</string>+ <string name="settings_translit_output">اعرض الكتابة الصوتية للنص المترجَم</string>+ <string name="settings_translit_input">اعرض الكتابة الصوتية للنص الأصلي</string>+ <string name="settings_translit_japanese_spaces">أضف مسافات للكتابة الصوتية اليابانية</string>+ <string name="settings_translate_pdf_images">ترجم الصور في ملفات PDF</string>+ <string name="settings_camera_live_default">ترجم الكاميرا مباشرةً افتراضيًا</string>+ <string name="settings_register_browser">سجِّل كمتصفح</string>+ <string name="settings_register_browser_desc">اقترح ترجمة الروابط من التطبيقات الأخرى.</string>+ <string name="settings_external_storage_perm_title">إذن التخزين الخارجي</string>+ <string name="settings_about">عن</string>+ <string name="settings_version">الإصدار %1$s</string>+ <string name="settings_no_languages_available">لا توجد لغات متاحة</string>+ <string name="settings_default_from">لغة \'من\' الافتراضية</string>+ <string name="settings_default_to">لغة \'إلى\' الافتراضية</string>+ <string name="settings_adblock_support">حظر الإعلانات</string>+ <string name="settings_about_get_help">الحصول على مساعدة / الإبلاغ عن مشكلة</string>+ <string name="settings_logs_copied">نُسخ سجلات التطبيق إلى الحافظة</string>+ <string name="settings_about_support">ادعم التطوير</string>+ <string name="settings_external_storage_perm_body">لتخزين ملفات الترجمة في مجلد المستندات، يحتاج هذا التطبيق إلى إذن الوصول لإدارة جميع الملفات.\nسيتم نقلك إلى الإعدادات حيث يمكنك منح إذن \'السماح بالوصول لإدارة جميع الملفات\'.</string>+ <!-- language manager / setup / how-to -->+ <string name="langmgr_voices">الأصوات</string>+ <string name="langmgr_default">افتراضي</string>+ <string name="langmgr_filter">تصفية اللغات</string>+ <string name="langmgr_delete_shared_title">حذف القاموس المشترك؟</string>+ <string name="langmgr_delete_shared_body">هذا القاموس مشترك مع %1$s.\nسيؤدي حذفه إلى إزالة القاموس لهم جميعًا.</string>+ <string name="langmgr_download_size">نزِّل %1$s</string>+ <string name="langmgr_repair_needed">بعض الميزات المنزَّلة تنقصها ملفات ولن تعمل حتى يتم إصلاحها.</string>+ <string name="langmgr_repair_size">إصلاح %1$s</string>+ <string name="nolang_title">إعداد اللغة</string>+ <string name="nolang_prompt">نزِّل حزم اللغات لبدء الترجمة</string>+ <string name="howto_title">طريقة الاستخدام</string>+ <!-- image capture / voice / dictionary / language selector -->+ <string name="image_no_crop_remote">لا يمكن اقتصاص الصور البعيدة مباشرةً</string>+ <string name="image_open_failed">تعذّر فتح الملف</string>+ <string name="image_source_screen">الشاشة</string>+ <string name="image_source_document">مستند</string>+ <string name="image_source_photos">الصور</string>+ <string name="image_source_gallery">المعرض</string>+ <string name="image_source_camera">الكاميرا</string>+ <string name="voice_playback_speed">سرعة التشغيل</string>+ <string name="voice_label">الصوت</string>+ <string name="voice_default">الصوت الافتراضي</string>+ <string name="langsel_auto">✨ تلقائي</string>+ <string name="dict_also_as">أيضًا كـ:</string>+ <!-- camera / browser / screen translate -->+ <string name="camera_permission_rationale">إذن الكاميرا مطلوب للترجمة المباشرة.</string>+ <string name="camera_need_ocr_models">تحتاج إلى تنزيل نماذج التعرُّف على النص لهذه اللغة</string>+ <string name="browser_no_source_language">لا توجد لغة مصدر متاحة. ثبّت واحدة من الشاشة الرئيسية أولاً، أو حدّد لغة مصدر افتراضية في الإعدادات.</string>+ <string name="browser_reader_unavailable">وضع القارئ غير متاح لهذه الصفحة</string>+ <string name="browser_translate_image">ترجمة الصورة</string>+ <string name="screen_translating_notification">يترجم الشاشة</string>+ <!-- enums -->+ <string name="align_top">أعلى</string>+ <string name="align_middle">وسط</string>+ <string name="align_bottom">أسفل</string>+ <string name="assistant_action_still_image">ترجم مرة واحدة</string>+ <string name="assistant_action_live_screen">بدء الترجمة المباشرة</string>+ <string name="background_mode_white_on_black">أبيض على أسود</string>+ <string name="background_mode_black_on_white">أسود على أبيض</string>+ <string name="background_mode_auto_detect">ألوان الصورة الأصلية</string>+ <!-- tts / speech errors -->+ <string name="tts_nothing_to_speak">لا يوجد شيء لقراءته</string>+ <string name="tts_catalog_unavailable">الفهرس المفصل غير متاح</string>+ <string name="tts_no_voice">لا يوجد صوت مثبّت للغة %1$s</string>+ <string name="tts_synthesis_failed">فشل توليد الكلام للغة %1$s</string>+ <string name="tts_sample_fallback">هذا نموذج لتحويل النص إلى كلام من Offline Translator.</string>+ <!-- translation -->+ <string name="translation_error">خطأ في الترجمة: %1$s</string>+ <!-- download errors -->+ <string name="download_failed_core">فشل تنزيل %1$s</string>+ <string name="download_failed_ocr">فشل تنزيل التعرُّف على النص للغة %1$s</string>+ <string name="download_failed_ocr_batch">فشل التنزيل الدفعي للتعرُّف على النص</string>+ <string name="download_failed_dictionary">فشل تنزيل قاموس %1$s</string>+ <string name="download_failed_tts">فشل تنزيل الصوت للغة %1$s</string>+ <string name="download_failed_adblock">فشل تنزيل Adblock</string>+ <string name="download_failed_repair">فشل تنزيل الإصلاح</string>+ <string name="download_catalog_unavailable">الفهرس المفصل غير متاح</string>+ <string name="download_catalog_save_failed">تعذّر حفظ الفهرس المفصل</string>+ <string name="download_unknown_error">خطأ غير معروف</string>+ <string name="download_catalog_failed">تعذّر تنزيل الفهرس المفصل: %1$s</string>+ <!-- assistant overlay status -->+ <string name="assistant_invoke_prompt">استدعِ هذا المساعد فوق النص لترجمته</string>+ <string name="assistant_collecting_context">يجمّع محتوى الشاشة…</string>+ <string name="assistant_screenshot_disabled">الوصول إلى لقطة الشاشة معطّل لهذا المساعد. فعّله من إعدادات مساعد النظام.</string>+ <string name="assistant_no_screen_data">لم يستلم أي بيانات من الشاشة. فعّل \'استخدام لقطة الشاشة\' لهذا المساعد.</string>+ <string name="assistant_no_screenshot">لم يوفّر هذا التطبيق لقطة شاشة.</string>+ <string name="assistant_set_source_ocr">حدّد لغة مصدر افتراضية للتعرُّف على النص.</string>+ <string name="assistant_langs_not_ready">لغات الترجمة ليست جاهزة بعد. حاول مرة أخرى.</string>+ <string name="assistant_ocr_failed">فشل التعرُّف على النص</string>+ <string name="ocr_models_missing">ملفات التعرُّف على النص مفقودة. افتح إدارة اللغات في التطبيق للإصلاح.</string>+ <string name="assistant_set_source_live">حدّد لغة مصدر افتراضية في الإعدادات لاستخدام الترجمة المباشرة للشاشة.</string>+ <!-- migration gate -->+ <string name="migration_updating_speech_models">يحدِّث نماذج الكلام</string>+ <string name="migration_accept_convert">اقبل وحوّل</string>+ <string name="migration_delete_all">احذف الكل بدلاً من ذلك</string>+ <string name="migration_converting">يحوّل %1$d من %2$d</string>+ <string name="migration_optimizing">يحسِّن النماذج</string>+ <plurals name="migration_convert_prompt">+ <item quantity="zero">ليس لديك أي نماذج تحويل نص إلى كلام للتحويل إلى التنسيق الجديد. سيستغرق الأمر حوالي %2$d ثانية. ستوفّر %3$.0f ميجابايت من مساحة القرص.</item>+ <item quantity="one">لديك نموذج تحويل نص إلى كلام واحد %1$d للتحويل إلى تنسيق جديد. سيستغرق الأمر حوالي %2$d ثانية. ستوفّر %3$.0f ميجابايت من مساحة القرص.</item>+ <item quantity="two">لديك نموذجا تحويل نص إلى كلام %1$d للتحويل إلى تنسيق جديد. سيستغرق الأمر حوالي %2$d ثانية. ستوفّر %3$.0f ميجابايت من مساحة القرص.</item>+ <item quantity="few">لديك %1$d نماذج تحويل نص إلى كلام للتحويل إلى تنسيق جديد. سيستغرق الأمر حوالي %2$d ثانية. ستوفّر %3$.0f ميجابايت من مساحة القرص.</item>+ <item quantity="many">لديك %1$d نموذجًا لتحويل النص إلى كلام للتحويل إلى تنسيق جديد. سيستغرق الأمر حوالي %2$d ثانية. ستوفّر %3$.0f ميجابايت من مساحة القرص.</item>+ <item quantity="other">لديك %1$d نموذج تحويل نص إلى كلام للتحويل إلى تنسيق جديد. سيستغرق الأمر حوالي %2$d ثانية. ستوفّر %3$.0f ميجابايت من مساحة القرص.</item>+ </plurals>+ <!-- document translation notification + progress -->+ <string name="doc_notif_translating">يترجم الملف</string>+ <string name="doc_notif_translated">تُرجم الملف</string>+ <string name="doc_notif_phase_text">النص %1$d%%</string>+ <string name="doc_notif_phase_images">الصور %1$d/%2$d</string>+ <string name="doc_notif_phase_raster">الصفحات النقطية %1$d/%2$d</string>+ <string name="doc_notif_channel_name">ترجمة المستندات</string>+ <string name="doc_notif_channel_desc">يعرض التقدّم أثناء ترجمة المستندات</string>+ <string name="doc_progress_preparing">يحضر الملف</string>+ <string name="doc_progress_translating">يترجم</string>+ <string name="doc_progress_translated">تُرجم الملف</string>+ <string name="doc_progress_saving">يحفظ الملف المترجَم</string>+ <string name="doc_translation_failed">فشلت ترجمة المستند</string>+ <string name="doc_url_unsupported">نزِّل المستند وافتحه بالتطبيق بدلاً من ذلك</string>+ <!-- document configure sheet -->+ <string name="document_wrap_columns">التفاف عند %1$d أعمدة</string>+ <string name="document_translate_pdf_images">ترجم الصور في PDF</string>+ <string name="layout_preserve">حافظ على فواصل الأسطر</string>+ <string name="layout_reflow">إعادة التدفّق إلى فقرات</string>+ <string name="layout_reflow_wrap">إعادة التدفّق والالتفاف</string>+ <!-- common (additional) -->+ <string name="common_open">افتح</string>+ <string name="common_close">أغلِق</string>+ <string name="common_save">احفظ</string>+ <!-- translator app -->+ <string name="translator_translated_file">الملف المترجَم: %1$s</string>+ <string name="translator_document_saved">حُفظ المستند</string>+ <string name="translator_document_save_failed">تعذّر حفظ المستند</string>+ <string name="translator_audio_playback_failed">فشل تشغيل الصوت: %1$s</string>+ <string name="translator_no_app_to_open">لا يوجد تطبيق لفتح هذا الملف</string>+ <!-- document alignment -->+ <string name="docalign_decode_failed">تعذّر فك ترميز الصورة.</string>+ <string name="docalign_detecting">جارٍ اكتشاف الزوايا…</string>+ <string name="docalign_redetecting">جارٍ إعادة الاكتشاف…</string>+ <string name="docalign_help">يؤدي رسم محيط دقيق حول المستند إلى تحسين جودة التعرُّف. من المهم أن تكون الخطوط موازية للنص.\n\nعادةً ما يؤدي التقريب أو التحريك إلى التقاط المستند تلقائيًا، لكن يمكنك التعديل يدويًا إذا لم يُعثر عليه.</string>+ <!-- how to use -->+ <string name="howto_section_other_apps">من تطبيقات أخرى</string>+ <string name="howto_share_title">المشاركة للترجمة</string>+ <string name="howto_share_body">شارك النصوص أو الروابط أو الصور من أي تطبيق لترجمتها.</string>+ <string name="howto_copy_title">ترجم دون مغادرة التطبيقات الأخرى</string>+ <string name="howto_copy_body">حدّد نصًا على أي تطبيق، ثم اضغط على \"ترجم\" في شريط النسخ لرؤية الترجمة في نافذة منبثقة مضغوطة.</string>+ <string name="howto_section_in_app">داخل التطبيق</string>+ <string name="howto_docs_title">ترجم المستندات والصور</string>+ <string name="howto_docs_body">افتح تبويب المستندات لترجمة ملفات الصور أو EPUB وPDF وTXT.</string>+ <string name="howto_dict_title">البحث في القاموس</string>+ <string name="howto_dict_body">اضغط مطولاً على أي كلمة، ثم اضغط على «القاموس» للاطلاع على تعريفها. أو يمكنك النقر على زر القاموس، ثم انقر على أي كلمة. البيانات مأخوذة من Wiktionary.</string>+ <string name="howto_voice_title">تغيير الصوت أو السرعة</string>+ <string name="howto_voice_body">اضغط مطولاً على زر التشغيل لاختيار صوت مختلف أو ضبط سرعة التشغيل.</string>+ <!-- feature row labels -->+ <string name="feature_translation">الترجمة</string>+ <string name="feature_dictionary">القاموس</string>+ <string name="feature_tts">الصوت</string>+ <!-- misc -->+ <string name="main_input_placeholder">أدخل النص</string>+ <string name="aidl_target_unavailable">لغة الهدف غير متاحة</string>+ <string name="voice_section_downloaded">نُزَّل</string>+ <string name="voice_section_available">متاح</string>+ <string name="detected_translate_from">ترجم مِن</string>+ <string name="detected_missing_language">لغة مفقودة</string>+ <string name="langmgr_ocr_upgrade_available">يتوفر نموذج مُحسَّن للكشف عن النص.</string>+ <string name="image_crop_action">قص</string>+ <string name="a11y_cancel">ألغِ</string>+ <string name="a11y_region_reset">صفّر إلى وضع ملء الشاشة</string>+ <string name="a11y_region_confirm">أكّد المنطقة</string>+ <string name="a11y_translate_screen_live">ترجم الشاشة مباشرةً</string>+ <string name="a11y_refresh">حدِّث</string>+ <string name="a11y_set_translation_area">حدّد منطقة الترجمة</string>+ <string name="a11y_show_original">أظهر الأصلية</string>+ <string name="a11y_pause_resume">إيقاف مؤقت أو استئناف</string>+ <string name="a11y_primary_input">المدخلات الأولية</string>+ <string name="a11y_help">مساعدة</string>+ <string name="a11y_rotate_90">دوّر 90 درجة</string>+ <string name="a11y_switch_rectangular_crop">بدّل إلى القص المستطيل</string>+ <string name="a11y_detect_document_corners">اكتشف أركان المستند</string>+ <string name="a11y_cancel_download">ألغِ التنزيل</string>+ <string name="a11y_delete_language">احذف اللغة</string>+ <string name="a11y_retry_download">أعد محاولة التنزيل</string>+ <string name="a11y_download">نزِّل</string>+ <string name="a11y_share_image">شارك الصورة</string>+ <string name="a11y_close_fullscreen">أغلِق وضع العرض بملء الشاشة</string>+ <string name="a11y_translation_output">إخراج الترجمة</string>+ <string name="a11y_output_textview">عرض النص الناتج</string>+ <string name="a11y_copy_translation">انسخ الترجمة</string>+ <string name="a11y_source_document">المستند</string>+ <string name="a11y_source_photos">الصور</string>+ <string name="a11y_source_gallery">المعرض</string>+ <string name="a11y_source_camera">الكاميرا</string>+ <string name="a11y_back">ارجع</string>+ <string name="a11y_reverse_translation_direction">اعكس اتجاه الترجمة</string>+ <string name="a11y_settings">الإعدادات</string>+ <string name="a11y_close">أغلِق</string>+ <string name="a11y_dictionary_status">حالة القاموس</string>+ <string name="a11y_dictionary_entry">مدخل القاموس</string>+ <string name="a11y_tts_status">حالة تحويل النص إلى كلام</string>+ <string name="a11y_main_screen">الشاشة الرئيسية</string>+ <string name="a11y_translate_image_or_file">ترجم صورة أو ملف</string>+ <string name="a11y_replace_text">استبدل النص</string>+ <string name="a11y_clear_input">امحُ الإدخال</string>+ <string name="a11y_paste">ألصِق</string>+ <string name="a11y_voice_input">الإدخال الصوتي</string>+ <string name="a11y_detected_language_toast">إشعار منبثق باللغة المكتشفة</string>+ <string name="a11y_switch_detected_language">بدّل إلى اللغة المكتشفة</string>+ <string name="a11y_torch_on">أشعل الشعلة</string>+ <string name="a11y_torch_off">أطفئ الشعلة</string>+ <string name="a11y_live_overlay_on">شغّل التراكب المباشر</string>+ <string name="a11y_live_overlay_off">عطّل التراكب المباشر</string>+ <string name="a11y_collapse">اطوِ</string>+ <string name="a11y_expand">وسِّع</string>+ <string name="a11y_delete">احذف</string>+ <string name="a11y_favorite_remove">أزِل من المفضلة</string>+ <string name="a11y_favorite_add">أضف إلى المفضلات</string>+ <string name="a11y_download_feature">ميزة التنزيل</string>+ <string name="a11y_show_translated_image">أظهر الصورة المترجمة</string>+ <string name="a11y_show_original_image">أظهر الصورة الأصلية</string>+ <string name="a11y_stop_audio">أوقِف الصوت</string>+ <string name="a11y_speak_input">الإدخال الكلامي</string>+ <string name="a11y_speak_translation">ترجمة الكلام</string>+ <string name="a11y_original_image">الصورة الأصلية</string>+ <string name="a11y_translated_image">الصورة المُترجمة</string>+ <string name="a11y_zoomable_original_image">الصورة الأصلية القابلة للتقريب</string>+ <string name="a11y_zoomable_translated_image">الصورة المُترجمة القابلة للتقريب</string>+ <string name="settings_experimental_screen_translate">ترجمة الشاشة (تجريبي)</string>+ <string name="settings_multi_target">لغات مستهدفة متعدّدة</string>+ <string name="a11y_add_target_language">أضف اللغة المستهدفة</string>+ <string name="a11y_remove_target_language">أزِل اللغة المستهدفة</string>+ <string name="feature_unavailable_tts">ميزة تحويل النص إلى كلام غير متوفرة، نزّلها من صفحة إدارة اللغات</string>+ <string name="feature_unavailable_dictionary">القاموس غير متوفر، نزّلها من صفحة إدارة اللغات</string>+ <string name="howto_alt_title">اختر كلمات بديلة</string>+ <string name="howto_alt_body">انقر على زر البدائل، ثم اضغط على أي كلمة لاستبدالها. قد يقدم النموذج بعض البدائل، وإلا فيمكنك إدخال بدائلك. وسيتم إعادة ترجمة بقية الجملة لتتوافق مع ذلك.</string>+ <string name="a11y_alternatives_mode_on">اخرج من وضع البدائل</string>+ <string name="a11y_alternatives_mode_off">وضع البدائل: انقر على كلمة ما للاطّلاع على ترجمات أخرى</string>+ <string name="a11y_close_alternatives">أغلِق البدائل</string>+ <string name="alt_custom_entry">اكتب ما تريد…</string>+ <string name="alt_custom_label">كلمتك</string>+ <string name="alt_custom_preview_label">معاينة</string>+ <string name="a11y_dictionary_mode_on">اخرج من وضع القاموس</string>+ <string name="a11y_dictionary_mode_off">وضع القاموس: انقر على كلمة ما للبحث عنها</string>+ <string name="settings_http_server">فعِّل خادم HTTP متوافق مع LibreTranslate</string>+ <string name="settings_http_server_desc">يسمح للتطبيقات الأخرى بطلب الترجمات برمجيًّا</string>+ <string name="settings_http_server_port">المنفذ</string>+ <string name="settings_http_server_bind">ربط على</string>+ <string name="settings_http_server_bind_localhost">localhost</string>+ <string name="settings_http_server_bind_all">كل الواجهات</string>+ <string name="http_server_notif_channel_name">API الترجمة</string>+ <string name="http_server_notif_channel_desc">تُعرض أثناء تشغيل الخادم المتوافق مع LibreTranslate</string>+ <string name="http_server_notif_running">API الترجمة</string>+ <string name="http_server_notif_text">يسمع على %1$s: %2$d</string>+ <string name="http_server_notif_error">فشل التشغيل على المنفذ %1$d</string>+ <string name="a11y_select_text">حدّد نصًا</string>+ <string name="http_server_notif_disable">عطِّل</string>+ <string name="a11y_resize_split">أعد تحجيم مناطق الإدخال والإخراج</string>+ <string name="langmgr_translation_upgrade_available">تتوفّر ترجمة مُحسّنة لـ: %1$s</string>+ <string name="download_failed_translation_batch">فشل تنزيل تحديث الترجمة</string>+ <string name="settings_http_server_title">خادم API</string>+</resources>diff --git a/OCR-translation/src/main/res/values-bn/strings.xml b/OCR-translation/src/main/res/values-bn/strings.xmlnew file mode 100644index 0000000..8305a04--- /dev/null+++ b/OCR-translation/src/main/res/values-bn/strings.xml@@ -0,0 +1,217 @@+<?xml version="1.0" encoding="utf-8"?>+<resources>+ <string name="stop">বন্ধ করুন</string>+ <string name="pause">থামান</string>+ <string name="resume">আবার চালু করুন</string>+ <string name="region_select_menu">অনুবাদের এলাকা ঠিক করুন</string>+ <string name="screen_translate_needs_source">উৎস ভাষা নির্দিষ্ট করুন</string>+ <string name="live_tile_label">স্ক্রিন লাইভ অনুবাদ করুন</string>+ <string name="translate_text">অনুবাদ করুন</string>+ <string name="translate_link">লিঙ্ক অনুবাদ করুন</string>+ <string name="accessibility_service_description">স্ক্রিনের লেখা অনুবাদ করতে এই সেবাটি চালু করুন। বর্তমান স্ক্রিন অনুবাদ করতে ভাসমান অনুবাদ বোতামে চাপুন, অথবা একটি লাইভ স্ক্রিন অনুবাদ শুরু করুন।</string>+ <string name="tap_to_translate_title">দ্রুত অনুবাদ চালু আছে</string>+ <string name="tap_to_translate_body">অনুবাদক পপআপ খুলতে চাপুন</string>+ <string name="tap_to_translate_channel">দ্রুত অনুবাদ</string>+ <string name="tap_to_translate_channel_description">অনুবাদক পপআপে দ্রুত পৌঁছানোর জন্য স্থায়ী বিজ্ঞপ্তি</string>+ <string name="quick_tile_label">অনুবাদ করুন</string>+ <!-- common -->+ <string name="common_ok">ঠিক আছে</string>+ <string name="common_cancel">বাতিল করুন</string>+ <string name="common_done">সম্পন্ন</string>+ <string name="common_grant">অনুমতি দিন</string>+ <string name="common_manage">পরিচালনা করুন</string>+ <!-- settings -->+ <string name="settings_title">সেটিংস</string>+ <string name="settings_languages">ভাষা</string>+ <string name="settings_language_packs">ভাষা প্যাক</string>+ <string name="settings_general">সাধারণ</string>+ <string name="settings_font_size">ফন্টের আকার</string>+ <string name="settings_font_sample">এটি একটি উদাহরণমূলক লেখা</string>+ <string name="settings_tap_notification">দ্রুত অনুবাদ বিজ্ঞপ্তি</string>+ <string name="settings_tap_notification_desc">স্থায়ী বিজ্ঞপ্তি যা পপআপ খোলে।</string>+ <string name="settings_web_translator">ওয়েব অনুবাদক</string>+ <string name="settings_clear_browsing">বন্ধ করার সময় ব্রাউজিং তথ্য মুছুন</string>+ <string name="settings_clear_browsing_desc">কুকি, ক্যাশ এবং লোকাল স্টোরেজ মুছে ফেলে।</string>+ <string name="settings_tts_section">টেক্সট থেকে স্পিচ</string>+ <string name="settings_tts_read_urls_hashtags">URL এবং হ্যাশট্যাগ পড়ুন</string>+ <string name="settings_popup_settings">পপআপ</string>+ <string name="settings_popup_desc">লেখা নির্বাচন মেনু থেকে \'অনুবাদ করুন\' বেছে নিলে পপআপ দেখা যায়</string>+ <string name="settings_hide_input">ইনপুট লুকান</string>+ <string name="settings_popup_position">পপআপের অবস্থান</string>+ <string name="settings_popup_size">পপআপের আকার: %1$d%%</string>+ <string name="settings_screen_translation">স্ক্রিন অনুবাদ</string>+ <string name="settings_screen_translation_desc">অন্য অ্যাপের উপরেই সরাসরি লেখা অনুবাদ করুন।</string>+ <string name="settings_floating_button">সবসময় চালু বোতাম</string>+ <string name="settings_floating_button_desc">অ্যাক্সেসিবিলিটি ভূমিকা প্রয়োজন</string>+ <string name="settings_shortcut">শর্টকাটে স্ক্রিন অনুবাদ করুন</string>+ <string name="settings_shortcut_desc">চালু করতে হোম বা পাওয়ার বোতাম চেপে ধরুন</string>+ <string name="settings_on_shortcut">শর্টকাট চালু করলে</string>+ <string name="settings_ocr">ছবি</string>+ <string name="settings_background_mode">লেখা প্রতিস্থাপন করুন যা দিয়ে</string>+ <string name="settings_min_confidence">সর্বনিম্ন নির্ভরযোগ্যতা: %1$d%%</string>+ <string name="settings_max_image_size">সর্বোচ্চ ছবির আকার: %1$dpx</string>+ <string name="settings_advanced">উন্নত</string>+ <string name="settings_catalog_url">ক্যাটালগ URL</string>+ <string name="settings_external_storage">বাহ্যিক স্টোরেজ ব্যবহার করুন</string>+ <string name="settings_disable_autodetect">স্বয়ংক্রিয় ভাষা শনাক্তকরণ বন্ধ করুন</string>+ <string name="settings_translit_output">অনুবাদ করা লেখার প্রতিবর্ণীকরণ দেখান</string>+ <string name="settings_translit_input">মূল লেখার প্রতিবর্ণীকরণ দেখান</string>+ <string name="settings_translit_japanese_spaces">জাপানি প্রতিবর্ণীকরণে ফাঁকা স্থান যোগ করুন</string>+ <string name="settings_translate_pdf_images">PDF-এর ছবি অনুবাদ করুন</string>+ <string name="settings_camera_live_default">ডিফল্টভাবে ক্যামেরা লাইভ অনুবাদ করুন</string>+ <string name="settings_register_browser">ব্রাউজার হিসেবে নিবন্ধন করুন</string>+ <string name="settings_register_browser_desc">অন্য অ্যাপ থেকে লিঙ্ক অনুবাদের প্রস্তাব দিন।</string>+ <string name="settings_external_storage_perm_title">বাহ্যিক স্টোরেজ অনুমতি</string>+ <string name="settings_about">সম্পর্কে</string>+ <string name="settings_version">সংস্করণ %1$s</string>+ <string name="settings_no_languages_available">কোনো ভাষা পাওয়া যায়নি</string>+ <string name="settings_default_from">ডিফল্ট \'যে ভাষা থেকে\'</string>+ <string name="settings_default_to">ডিফল্ট \'যে ভাষায়\'</string>+ <string name="settings_adblock_support">বিজ্ঞাপন ব্লক করা</string>+ <string name="settings_about_get_help">সাহায্য নিন / সমস্যা জানান</string>+ <string name="settings_logs_copied">অ্যাপ লগ ক্লিপবোর্ডে কপি করা হয়েছে</string>+ <string name="settings_about_support">উন্নয়নে সহায়তা করুন</string>+ <string name="settings_external_storage_perm_body">আপনার Documents ফোল্ডারে অনুবাদ ফাইল রাখতে এই অ্যাপের সব ফাইল পরিচালনার অনুমতি প্রয়োজন।\nআপনাকে সেটিংসে নিয়ে যাওয়া হবে, যেখানে আপনি \'সব ফাইল পরিচালনার অনুমতি দিন\' অনুমতিটি দিতে পারবেন।</string>+ <!-- language manager / setup / how-to -->+ <string name="langmgr_voices">কণ্ঠস্বর</string>+ <string name="langmgr_default">ডিফল্ট</string>+ <string name="langmgr_filter">ভাষা ছাঁকুন</string>+ <string name="langmgr_delete_shared_title">শেয়ার করা অভিধান মুছবেন?</string>+ <string name="langmgr_delete_shared_body">এই অভিধানটি %1$s-এর সাথে শেয়ার করা।\nএটি মুছলে সবার জন্যই অভিধানটি মুছে যাবে।</string>+ <string name="langmgr_download_size">%1$s ডাউনলোড করুন</string>+ <string name="langmgr_repair_needed">কিছু ডাউনলোড করা ফিচারের ফাইল অনুপস্থিত এবং মেরামত না করা পর্যন্ত কাজ করবে না।</string>+ <string name="langmgr_repair_size">%1$s মেরামত করুন</string>+ <string name="nolang_title">ভাষা সেটআপ</string>+ <string name="nolang_prompt">অনুবাদ শুরু করতে ভাষা প্যাক ডাউনলোড করুন</string>+ <string name="howto_title">যেভাবে ব্যবহার করবেন</string>+ <!-- image capture / voice / dictionary / language selector -->+ <string name="image_no_crop_remote">দূরবর্তী ছবি সরাসরি ক্রপ করা যায় না</string>+ <string name="image_open_failed">ফাইল খুলতে ব্যর্থ</string>+ <string name="image_source_screen">স্ক্রিন</string>+ <string name="image_source_document">ডকুমেন্ট</string>+ <string name="image_source_photos">ফটো</string>+ <string name="image_source_gallery">গ্যালারি</string>+ <string name="image_source_camera">ক্যামেরা</string>+ <string name="voice_playback_speed">চালানোর গতি</string>+ <string name="voice_label">কণ্ঠস্বর</string>+ <string name="voice_default">ডিফল্ট কণ্ঠস্বর</string>+ <string name="langsel_auto">✨ স্বয়ংক্রিয়</string>+ <string name="dict_also_as">এভাবেও:</string>+ <!-- camera / browser / screen translate -->+ <string name="camera_permission_rationale">লাইভ অনুবাদের জন্য ক্যামেরার অনুমতি প্রয়োজন।</string>+ <string name="camera_need_ocr_models">এই ভাষার জন্য আপনাকে লেখা শনাক্তকরণ মডেল ডাউনলোড করতে হবে</string>+ <string name="browser_no_source_language">কোনো উৎস ভাষা নেই। প্রথমে মূল স্ক্রিন থেকে একটি ইনস্টল করুন, অথবা সেটিংসে একটি ডিফল্ট উৎস ভাষা ঠিক করুন।</string>+ <string name="browser_reader_unavailable">এই পৃষ্ঠার জন্য রিডার মোড পাওয়া যাচ্ছে না</string>+ <string name="browser_translate_image">ছবি অনুবাদ করুন</string>+ <string name="screen_translating_notification">স্ক্রিন অনুবাদ করা হচ্ছে</string>+ <!-- enums -->+ <string name="align_top">উপরে</string>+ <string name="align_middle">মাঝে</string>+ <string name="align_bottom">নিচে</string>+ <string name="assistant_action_still_image">একবার অনুবাদ করুন</string>+ <string name="assistant_action_live_screen">লাইভ অনুবাদ শুরু করুন</string>+ <string name="background_mode_white_on_black">কালোর উপর সাদা</string>+ <string name="background_mode_black_on_white">সাদার উপর কালো</string>+ <string name="background_mode_auto_detect">রঙ স্বয়ংক্রিয়ভাবে শনাক্ত করুন</string>+ <!-- tts / speech errors -->+ <string name="tts_nothing_to_speak">বলার মতো কিছু নেই</string>+ <string name="tts_catalog_unavailable">ক্যাটালগ পাওয়া যাচ্ছে না</string>+ <string name="tts_no_voice">%1$s-এর জন্য কোনো ভয়েস ইনস্টল করা নেই</string>+ <string name="tts_synthesis_failed">%1$s-এর জন্য কণ্ঠ তৈরি করতে ব্যর্থ</string>+ <string name="tts_sample_fallback">এটি Offline Translator থেকে একটি লেখা-থেকে-কণ্ঠ নমুনা।</string>+ <!-- translation -->+ <string name="translation_error">অনুবাদে সমস্যা: %1$s</string>+ <!-- download errors -->+ <string name="download_failed_core">%1$s ডাউনলোড ব্যর্থ</string>+ <string name="download_failed_ocr">%1$s লেখা শনাক্তকরণ ডাউনলোড ব্যর্থ</string>+ <string name="download_failed_ocr_batch">লেখা শনাক্তকরণ ব্যাচ ডাউনলোড ব্যর্থ</string>+ <string name="download_failed_dictionary">%1$s অভিধান ডাউনলোড ব্যর্থ</string>+ <string name="download_failed_tts">%1$s ভয়েস ডাউনলোড ব্যর্থ</string>+ <string name="download_failed_adblock">Adblock ডাউনলোড ব্যর্থ</string>+ <string name="download_failed_repair">মেরামত ডাউনলোড ব্যর্থ</string>+ <string name="download_catalog_unavailable">ক্যাটালগ পাওয়া যাচ্ছে না</string>+ <string name="download_catalog_save_failed">ক্যাটালগ সংরক্ষণ করতে ব্যর্থ</string>+ <string name="download_unknown_error">অজানা সমস্যা</string>+ <string name="download_catalog_failed">ক্যাটালগ ডাউনলোড করতে ব্যর্থ: %1$s</string>+ <!-- assistant overlay status -->+ <string name="assistant_invoke_prompt">লেখা অনুবাদ করতে তার উপরে এই অ্যাসিস্ট্যান্ট চালু করুন</string>+ <string name="assistant_collecting_context">স্ক্রিনের তথ্য সংগ্রহ করা হচ্ছে…</string>+ <string name="assistant_screenshot_disabled">এই অ্যাসিস্ট্যান্টের জন্য স্ক্রিনশট অ্যাক্সেস বন্ধ আছে। সিস্টেম অ্যাসিস্ট্যান্ট সেটিংসে এটি চালু করুন।</string>+ <string name="assistant_no_screen_data">কোনো স্ক্রিন তথ্য পাওয়া যায়নি। এই অ্যাসিস্ট্যান্টের জন্য \'স্ক্রিনশট ব্যবহার করুন\' চালু করুন।</string>+ <string name="assistant_no_screenshot">এই অ্যাপ কোনো স্ক্রিনশট দেয়নি।</string>+ <string name="assistant_set_source_ocr">লেখা শনাক্তকরণের জন্য একটি ডিফল্ট উৎস ভাষা ঠিক করুন।</string>+ <string name="assistant_langs_not_ready">অনুবাদের ভাষা এখনো প্রস্তুত নয়। আবার চেষ্টা করুন।</string>+ <string name="assistant_ocr_failed">লেখা শনাক্তকরণ ব্যর্থ</string>+ <string name="ocr_models_missing">লেখা শনাক্তকরণের মডেল অনুপস্থিত। মেরামত করতে অ্যাপে ভাষা ব্যবস্থাপনা খুলুন।</string>+ <string name="assistant_set_source_live">লাইভ স্ক্রিন অনুবাদ ব্যবহার করতে সেটিংসে একটি ডিফল্ট উৎস ভাষা ঠিক করুন।</string>+ <!-- migration gate -->+ <string name="migration_updating_speech_models">কণ্ঠ মডেল আপডেট করা হচ্ছে</string>+ <string name="migration_accept_convert">মেনে নিন এবং রূপান্তর করুন</string>+ <string name="migration_delete_all">বরং সব মুছে ফেলুন</string>+ <string name="migration_converting">%2$d-এর %1$d রূপান্তর করা হচ্ছে</string>+ <string name="migration_optimizing">মডেল অপ্টিমাইজ করা হচ্ছে</string>+ <plurals name="migration_convert_prompt">+ <item quantity="one">নতুন ফরম্যাটে রূপান্তর করার জন্য আপনার %1$d টি লেখা-থেকে-কণ্ঠ মডেল আছে। এতে আনুমানিক %2$d সেকেন্ড লাগবে। আপনি %3$.0f MB ডিস্ক জায়গা সাশ্রয় করবেন।</item>+ <item quantity="other">নতুন ফরম্যাটে রূপান্তর করার জন্য আপনার %1$d টি লেখা-থেকে-কণ্ঠ মডেল আছে। এতে আনুমানিক %2$d সেকেন্ড লাগবে। আপনি %3$.0f MB ডিস্ক জায়গা সাশ্রয় করবেন।</item>+ </plurals>+ <!-- document translation notification + progress -->+ <string name="doc_notif_translating">ফাইল অনুবাদ করা হচ্ছে</string>+ <string name="doc_notif_translated">অনুবাদ করা ফাইল</string>+ <string name="doc_notif_phase_text">লেখা %1$d%%</string>+ <string name="doc_notif_phase_images">ছবি %1$d/%2$d</string>+ <string name="doc_notif_phase_raster">বিটম্যাপ পৃষ্ঠা %1$d/%2$d</string>+ <string name="doc_notif_channel_name">ডকুমেন্ট অনুবাদ</string>+ <string name="doc_notif_channel_desc">ডকুমেন্ট অনুবাদের সময় অগ্রগতি দেখায়</string>+ <string name="doc_progress_preparing">ফাইল প্রস্তুত করা হচ্ছে</string>+ <string name="doc_progress_translating">অনুবাদ করা হচ্ছে</string>+ <string name="doc_progress_translated">অনুবাদ করা ফাইল</string>+ <string name="doc_progress_saving">অনুবাদ করা ফাইল সংরক্ষণ করা হচ্ছে</string>+ <string name="doc_translation_failed">ডকুমেন্ট অনুবাদ ব্যর্থ</string>+ <string name="doc_url_unsupported">ডকুমেন্টটি ডাউনলোড করে অ্যাপ দিয়ে খুলুন</string>+ <!-- document configure sheet -->+ <string name="document_wrap_columns">%1$d কলামে মুড়ুন</string>+ <string name="document_translate_pdf_images">PDF-এর ছবি অনুবাদ করুন</string>+ <string name="layout_preserve">লাইন ব্রেক বজায় রাখুন</string>+ <string name="layout_reflow">অনুচ্ছেদে পুনর্বিন্যাস করুন</string>+ <string name="layout_reflow_wrap">পুনর্বিন্যাস ও মুড়ুন</string>+ <!-- common (additional) -->+ <string name="common_open">খুলুন</string>+ <string name="common_close">বন্ধ করুন</string>+ <string name="common_save">সংরক্ষণ করুন</string>+ <!-- translator app -->+ <string name="translator_translated_file">অনুবাদ করা ফাইল: %1$s</string>+ <string name="translator_document_saved">ডকুমেন্ট সংরক্ষিত হয়েছে</string>+ <string name="translator_document_save_failed">ডকুমেন্ট সংরক্ষণ করতে ব্যর্থ</string>+ <string name="translator_audio_playback_failed">অডিও চালাতে ব্যর্থ: %1$s</string>+ <string name="translator_no_app_to_open">এই ফাইল খোলার মতো কোনো অ্যাপ পাওয়া যায়নি</string>+ <!-- document alignment -->+ <string name="docalign_decode_failed">ছবি ডিকোড করা যায়নি।</string>+ <string name="docalign_detecting">কোণ শনাক্ত করা হচ্ছে…</string>+ <string name="docalign_redetecting">আবার শনাক্ত করা হচ্ছে…</string>+ <string name="docalign_help">ডকুমেন্টের চারপাশে নিখুঁত একটি সীমারেখা শনাক্তকরণের মান উন্নত করে। লাইনগুলো লেখার সমান্তরাল থাকা জরুরি।\n\nজুম বা প্যান করলে সাধারণত অ্যালগরিদম নিজে থেকেই ডকুমেন্টটি ধরে ফেলে, তবে খুঁজে না পেলে আপনি হাতে করেও সমন্বয় করতে পারেন।</string>+ <!-- how to use -->+ <string name="howto_section_other_apps">অন্য অ্যাপ থেকে</string>+ <string name="howto_share_title">অনুবাদ করতে শেয়ার করুন</string>+ <string name="howto_share_body">যেকোনো অ্যাপ থেকে লেখা, লিঙ্ক বা ছবি শেয়ার করে অনুবাদ করুন।</string>+ <string name="howto_copy_title">অন্য অ্যাপ ছেড়ে না গিয়েই অনুবাদ করুন</string>+ <string name="howto_copy_body">যেকোনো জায়গায় লেখা নির্বাচন করুন, তারপর কপি টুলবারে \"অনুবাদ করুন\" চাপলে একটি ছোট পপআপে অনুবাদ দেখতে পাবেন।</string>+ <string name="howto_section_in_app">অ্যাপের ভেতরে</string>+ <string name="howto_docs_title">ডকুমেন্ট অনুবাদ করুন</string>+ <string name="howto_docs_body">EPUB, PDF এবং TXT ফাইল অনুবাদ করতে Documents ট্যাব খুলুন।</string>+ <string name="howto_dict_title">অভিধানে খুঁজুন</string>+ <string name="howto_dict_body">অনুবাদের যেকোনো শব্দ চেপে ধরে তার অর্থ দেখুন। তথ্য Wiktionary থেকে নেওয়া।</string>+ <string name="howto_voice_title">কণ্ঠস্বর বা গতি বদলান</string>+ <string name="howto_voice_body">আলাদা ভয়েস বেছে নিতে বা চালানোর গতি বদলাতে প্লে বোতামটি চেপে ধরুন।</string>+ <!-- feature row labels -->+ <string name="feature_translation">অনুবাদ</string>+ <string name="feature_dictionary">অভিধান</string>+ <string name="feature_tts">কণ্ঠস্বর</string>+ <!-- misc -->+ <string name="main_input_placeholder">লেখা লিখুন</string>+ <string name="aidl_target_unavailable">লক্ষ্য ভাষা পাওয়া যাচ্ছে না</string>+ <string name="voice_section_downloaded">ডাউনলোড করা হয়েছে</string>+ <string name="voice_section_available">উপলব্ধ</string>+ <string name="detected_translate_from">যা থেকে অনুবাদ করুন</string>+ <string name="detected_missing_language">ভাষা অনুপস্থিত</string>+ <string name="langmgr_ocr_upgrade_available">একটি উন্নত টেক্সট শনাক্তকরণ মডেল উপলব্ধ।</string>+</resources>diff --git a/OCR-translation/src/main/res/values-de/strings.xml b/OCR-translation/src/main/res/values-de/strings.xmlnew file mode 100644index 0000000..cebeabf--- /dev/null+++ b/OCR-translation/src/main/res/values-de/strings.xml@@ -0,0 +1,217 @@+<?xml version="1.0" encoding="utf-8"?>+<resources>+ <string name="stop">Stopp</string>+ <string name="pause">Pause</string>+ <string name="resume">Fortsetzen</string>+ <string name="region_select_menu">Übersetzungsbereich festlegen</string>+ <string name="screen_translate_needs_source">Quellsprache angeben</string>+ <string name="live_tile_label">Bildschirm live übersetzen</string>+ <string name="translate_text">Übersetzen</string>+ <string name="translate_link">Link übersetzen</string>+ <string name="accessibility_service_description">Aktiviere diesen Dienst, um Text auf dem Bildschirm zu übersetzen. Tippe auf die schwebende Übersetzen-Taste, um den aktuellen Bildschirm zu übersetzen, oder starte eine Live-Übersetzung des Bildschirms.</string>+ <string name="tap_to_translate_title">Schnellübersetzung ist an</string>+ <string name="tap_to_translate_body">Tippen, um das Übersetzer-Popup zu öffnen</string>+ <string name="tap_to_translate_channel">Schnellübersetzung</string>+ <string name="tap_to_translate_channel_description">Dauerhafte Benachrichtigung für schnellen Zugriff auf das Übersetzer-Popup</string>+ <string name="quick_tile_label">Übersetzen</string>+ <!-- common -->+ <string name="common_ok">OK</string>+ <string name="common_cancel">Abbrechen</string>+ <string name="common_done">Fertig</string>+ <string name="common_grant">Erlauben</string>+ <string name="common_manage">Verwalten</string>+ <!-- settings -->+ <string name="settings_title">Einstellungen</string>+ <string name="settings_languages">Sprachen</string>+ <string name="settings_language_packs">Sprachpakete</string>+ <string name="settings_general">Allgemein</string>+ <string name="settings_font_size">Schriftgröße</string>+ <string name="settings_font_sample">Dies ist ein Beispieltext</string>+ <string name="settings_tap_notification">Schnellübersetzung-Benachrichtigung</string>+ <string name="settings_tap_notification_desc">Dauerhafte Benachrichtigung, die das Popup öffnet.</string>+ <string name="settings_web_translator">Web-Übersetzer</string>+ <string name="settings_clear_browsing">Browserdaten beim Schließen löschen</string>+ <string name="settings_clear_browsing_desc">Löscht Cookies, Cache und lokalen Speicher.</string>+ <string name="settings_tts_section">Sprachausgabe</string>+ <string name="settings_tts_read_urls_hashtags">URLs und Hashtags vorlesen</string>+ <string name="settings_popup_settings">Popup</string>+ <string name="settings_popup_desc">Das Popup erscheint, wenn du \'Übersetzen\' im Textauswahl-Menü wählst</string>+ <string name="settings_hide_input">Eingabe ausblenden</string>+ <string name="settings_popup_position">Popup-Position</string>+ <string name="settings_popup_size">Popup-Größe: %1$d%%</string>+ <string name="settings_screen_translation">Bildschirmübersetzung</string>+ <string name="settings_screen_translation_desc">Text direkt über anderen Apps übersetzen.</string>+ <string name="settings_floating_button">Immer sichtbare Taste</string>+ <string name="settings_floating_button_desc">Benötigt Bedienungshilfe-Berechtigung</string>+ <string name="settings_shortcut">Bildschirm per Tastenkürzel übersetzen</string>+ <string name="settings_shortcut_desc">Home- oder Power-Taste lang drücken zum Auslösen</string>+ <string name="settings_on_shortcut">Bei Tastenkürzel-Aufruf</string>+ <string name="settings_ocr">Bilder</string>+ <string name="settings_background_mode">Text ersetzen durch</string>+ <string name="settings_min_confidence">Min. Konfidenz: %1$d%%</string>+ <string name="settings_max_image_size">Max. Bildgröße: %1$dpx</string>+ <string name="settings_advanced">Erweitert</string>+ <string name="settings_catalog_url">Katalog-URL</string>+ <string name="settings_external_storage">Externen Speicher verwenden</string>+ <string name="settings_disable_autodetect">Automatische Spracherkennung deaktivieren</string>+ <string name="settings_translit_output">Transliteration für übersetzten Text anzeigen</string>+ <string name="settings_translit_input">Transliteration für Originaltext anzeigen</string>+ <string name="settings_translit_japanese_spaces">Leerzeichen für japanische Transliteration hinzufügen</string>+ <string name="settings_translate_pdf_images">Bilder in PDFs übersetzen</string>+ <string name="settings_camera_live_default">Kamera standardmäßig live übersetzen</string>+ <string name="settings_register_browser">Als Browser registrieren</string>+ <string name="settings_register_browser_desc">Anbieten, Links aus anderen Apps zu übersetzen.</string>+ <string name="settings_external_storage_perm_title">Berechtigung für externen Speicher</string>+ <string name="settings_about">Über</string>+ <string name="settings_version">Version %1$s</string>+ <string name="settings_no_languages_available">Keine Sprachen verfügbar</string>+ <string name="settings_default_from">Standard-\'Von\'-Sprache</string>+ <string name="settings_default_to">Standard-\'Nach\'-Sprache</string>+ <string name="settings_adblock_support">Werbeblockierung</string>+ <string name="settings_about_get_help">Hilfe holen / Problem melden</string>+ <string name="settings_logs_copied">App-Protokolle in die Zwischenablage kopiert</string>+ <string name="settings_about_support">Entwicklung unterstützen</string>+ <string name="settings_external_storage_perm_body">Um Übersetzungsdateien in deinem Dokumente-Ordner zu speichern, braucht diese App Zugriff zur Verwaltung aller Dateien.\nDu wirst zu den Einstellungen geleitet, wo du die Berechtigung \'Zugriff zur Verwaltung aller Dateien erlauben\' erteilen kannst.</string>+ <!-- language manager / setup / how-to -->+ <string name="langmgr_voices">Stimmen</string>+ <string name="langmgr_default">STANDARD</string>+ <string name="langmgr_filter">Sprachen filtern</string>+ <string name="langmgr_delete_shared_title">Gemeinsames Wörterbuch löschen?</string>+ <string name="langmgr_delete_shared_body">Dieses Wörterbuch wird mit %1$s geteilt.\nWenn du es löschst, wird es für alle entfernt.</string>+ <string name="langmgr_download_size">%1$s herunterladen</string>+ <string name="langmgr_repair_needed">Bei einigen heruntergeladenen Funktionen fehlen Dateien, die erst nach einer Reparatur funktionieren.</string>+ <string name="langmgr_repair_size">%1$s reparieren</string>+ <string name="nolang_title">Spracheinrichtung</string>+ <string name="nolang_prompt">Lade Sprachpakete herunter, um mit dem Übersetzen zu beginnen</string>+ <string name="howto_title">Anleitung</string>+ <!-- image capture / voice / dictionary / language selector -->+ <string name="image_no_crop_remote">Entfernte Bilder können nicht direkt zugeschnitten werden</string>+ <string name="image_open_failed">Datei konnte nicht geöffnet werden</string>+ <string name="image_source_screen">Bildschirm</string>+ <string name="image_source_document">Dokument</string>+ <string name="image_source_photos">Fotos</string>+ <string name="image_source_gallery">Galerie</string>+ <string name="image_source_camera">Kamera</string>+ <string name="voice_playback_speed">Wiedergabegeschwindigkeit</string>+ <string name="voice_label">Stimme</string>+ <string name="voice_default">Standardstimme</string>+ <string name="langsel_auto">✨ Auto</string>+ <string name="dict_also_as">Auch als:</string>+ <!-- camera / browser / screen translate -->+ <string name="camera_permission_rationale">Für die Live-Übersetzung wird die Kamera-Berechtigung benötigt.</string>+ <string name="camera_need_ocr_models">Du musst die Texterkennungsmodelle für diese Sprache herunterladen</string>+ <string name="browser_no_source_language">Keine Quellsprache verfügbar. Installiere zuerst eine über den Hauptbildschirm oder lege eine Standard-Quellsprache in den Einstellungen fest.</string>+ <string name="browser_reader_unavailable">Lesemodus für diese Seite nicht verfügbar</string>+ <string name="browser_translate_image">Bild übersetzen</string>+ <string name="screen_translating_notification">Bildschirm wird übersetzt</string>+ <!-- enums -->+ <string name="align_top">Oben</string>+ <string name="align_middle">Mitte</string>+ <string name="align_bottom">Unten</string>+ <string name="assistant_action_still_image">Einmal übersetzen</string>+ <string name="assistant_action_live_screen">Live-Übersetzung starten</string>+ <string name="background_mode_white_on_black">Weiß auf Schwarz</string>+ <string name="background_mode_black_on_white">Schwarz auf Weiß</string>+ <string name="background_mode_auto_detect">Farben automatisch erkennen</string>+ <!-- tts / speech errors -->+ <string name="tts_nothing_to_speak">Nichts vorzulesen</string>+ <string name="tts_catalog_unavailable">Katalog nicht verfügbar</string>+ <string name="tts_no_voice">Keine Stimme für %1$s installiert</string>+ <string name="tts_synthesis_failed">Sprachsynthese für %1$s fehlgeschlagen</string>+ <string name="tts_sample_fallback">Dies ist ein Sprachausgabe-Beispiel von Offline Translator.</string>+ <!-- translation -->+ <string name="translation_error">Übersetzungsfehler: %1$s</string>+ <!-- download errors -->+ <string name="download_failed_core">%1$s-Download fehlgeschlagen</string>+ <string name="download_failed_ocr">Download der Texterkennung für %1$s fehlgeschlagen</string>+ <string name="download_failed_ocr_batch">Stapeldownload der Texterkennung fehlgeschlagen</string>+ <string name="download_failed_dictionary">%1$s-Wörterbuch-Download fehlgeschlagen</string>+ <string name="download_failed_tts">Download der Stimme für %1$s fehlgeschlagen</string>+ <string name="download_failed_adblock">Adblock-Download fehlgeschlagen</string>+ <string name="download_failed_repair">Reparatur-Download fehlgeschlagen</string>+ <string name="download_catalog_unavailable">Katalog nicht verfügbar</string>+ <string name="download_catalog_save_failed">Katalog konnte nicht gespeichert werden</string>+ <string name="download_unknown_error">Unbekannter Fehler</string>+ <string name="download_catalog_failed">Katalog konnte nicht heruntergeladen werden: %1$s</string>+ <!-- assistant overlay status -->+ <string name="assistant_invoke_prompt">Rufe diesen Assistenten über Text auf, um ihn zu übersetzen</string>+ <string name="assistant_collecting_context">Bildschirmkontext wird gesammelt…</string>+ <string name="assistant_screenshot_disabled">Der Screenshot-Zugriff ist für diesen Assistenten deaktiviert. Aktiviere ihn in den System-Assistenteneinstellungen.</string>+ <string name="assistant_no_screen_data">Keine Bildschirmdaten empfangen. Aktiviere \'Screenshot verwenden\' für diesen Assistenten.</string>+ <string name="assistant_no_screenshot">Diese App hat keinen Screenshot bereitgestellt.</string>+ <string name="assistant_set_source_ocr">Lege eine Standard-Quellsprache für die Texterkennung fest.</string>+ <string name="assistant_langs_not_ready">Die Übersetzungssprachen sind noch nicht bereit. Versuche es erneut.</string>+ <string name="assistant_ocr_failed">Texterkennung fehlgeschlagen</string>+ <string name="ocr_models_missing">Texterkennungsmodelle fehlen. Öffne die Sprachverwaltung in der App, um sie zu reparieren.</string>+ <string name="assistant_set_source_live">Lege in den Einstellungen eine Standard-Quellsprache fest, um die Live-Bildschirmübersetzung zu nutzen.</string>+ <!-- migration gate -->+ <string name="migration_updating_speech_models">Sprachmodelle werden aktualisiert</string>+ <string name="migration_accept_convert">Annehmen und umwandeln</string>+ <string name="migration_delete_all">Stattdessen alle löschen</string>+ <string name="migration_converting">%1$d von %2$d wird umgewandelt</string>+ <string name="migration_optimizing">Modelle werden optimiert</string>+ <plurals name="migration_convert_prompt">+ <item quantity="one">Du hast %1$d Sprachausgabe-Modell, das in ein neues Format umgewandelt werden muss. Es dauert etwa %2$d Sekunden. Du sparst %3$.0f MB Speicherplatz.</item>+ <item quantity="other">Du hast %1$d Sprachausgabe-Modelle, die in ein neues Format umgewandelt werden müssen. Es dauert etwa %2$d Sekunden. Du sparst %3$.0f MB Speicherplatz.</item>+ </plurals>+ <!-- document translation notification + progress -->+ <string name="doc_notif_translating">Datei wird übersetzt</string>+ <string name="doc_notif_translated">Datei übersetzt</string>+ <string name="doc_notif_phase_text">Text %1$d%%</string>+ <string name="doc_notif_phase_images">Bilder %1$d/%2$d</string>+ <string name="doc_notif_phase_raster">Bitmap-Seiten %1$d/%2$d</string>+ <string name="doc_notif_channel_name">Dokumentübersetzung</string>+ <string name="doc_notif_channel_desc">Zeigt den Fortschritt beim Übersetzen von Dokumenten</string>+ <string name="doc_progress_preparing">Datei wird vorbereitet</string>+ <string name="doc_progress_translating">Wird übersetzt</string>+ <string name="doc_progress_translated">Datei übersetzt</string>+ <string name="doc_progress_saving">Übersetzte Datei wird gespeichert</string>+ <string name="doc_translation_failed">Dokumentübersetzung fehlgeschlagen</string>+ <string name="doc_url_unsupported">Lade das Dokument herunter und öffne es stattdessen mit der App</string>+ <!-- document configure sheet -->+ <string name="document_wrap_columns">Bei %1$d Spalten umbrechen</string>+ <string name="document_translate_pdf_images">Bilder in PDF übersetzen</string>+ <string name="layout_preserve">Zeilenumbrüche beibehalten</string>+ <string name="layout_reflow">In Absätze umfließen</string>+ <string name="layout_reflow_wrap">Umfließen und umbrechen</string>+ <!-- common (additional) -->+ <string name="common_open">Öffnen</string>+ <string name="common_close">Schließen</string>+ <string name="common_save">Speichern</string>+ <!-- translator app -->+ <string name="translator_translated_file">Übersetzte Datei: %1$s</string>+ <string name="translator_document_saved">Dokument gespeichert</string>+ <string name="translator_document_save_failed">Dokument konnte nicht gespeichert werden</string>+ <string name="translator_audio_playback_failed">Audiowiedergabe fehlgeschlagen: %1$s</string>+ <string name="translator_no_app_to_open">Keine App gefunden, um diese Datei zu öffnen</string>+ <!-- document alignment -->+ <string name="docalign_decode_failed">Bild konnte nicht dekodiert werden.</string>+ <string name="docalign_detecting">Ecken werden erkannt…</string>+ <string name="docalign_redetecting">Erneute Erkennung…</string>+ <string name="docalign_help">Ein genauer Rahmen um das Dokument verbessert die Erkennungsqualität. Wichtig ist, dass die Linien parallel zum Text verlaufen.\n\nZoomen oder Verschieben lässt den Algorithmus das Dokument meist automatisch erfassen, aber du kannst es bei Bedarf weiterhin manuell anpassen.</string>+ <!-- how to use -->+ <string name="howto_section_other_apps">Aus anderen Apps</string>+ <string name="howto_share_title">Zum Übersetzen teilen</string>+ <string name="howto_share_body">Teile Text, Links oder Bilder aus jeder App, um sie zu übersetzen.</string>+ <string name="howto_copy_title">Übersetzen, ohne andere Apps zu verlassen</string>+ <string name="howto_copy_body">Markiere irgendwo Text und tippe dann auf \"Übersetzen\" in der Kopierleiste, um die Übersetzung in einem kompakten Popup zu sehen.</string>+ <string name="howto_section_in_app">In der App</string>+ <string name="howto_docs_title">Dokumente übersetzen</string>+ <string name="howto_docs_body">Öffne den Tab Dokumente, um EPUB-, PDF- und TXT-Dateien zu übersetzen.</string>+ <string name="howto_dict_title">Wörterbuch nachschlagen</string>+ <string name="howto_dict_body">Drücke lange auf ein beliebiges Wort in einer Übersetzung, um seine Definition zu sehen. Daten von Wiktionary.</string>+ <string name="howto_voice_title">Stimme oder Geschwindigkeit ändern</string>+ <string name="howto_voice_body">Drücke lange auf die Wiedergabetaste, um eine andere Stimme zu wählen oder die Wiedergabegeschwindigkeit anzupassen.</string>+ <!-- feature row labels -->+ <string name="feature_translation">Übersetzung</string>+ <string name="feature_dictionary">Wörterbuch</string>+ <string name="feature_tts">Stimme</string>+ <!-- misc -->+ <string name="main_input_placeholder">Text eingeben</string>+ <string name="aidl_target_unavailable">Zielsprache nicht verfügbar</string>+ <string name="voice_section_downloaded">HERUNTERGELADEN</string>+ <string name="voice_section_available">VERFÜGBAR</string>+ <string name="detected_translate_from">Übersetzen aus</string>+ <string name="detected_missing_language">Sprache fehlt</string>+ <string name="langmgr_ocr_upgrade_available">Ein verbessertes Texterkennungsmodell ist verfügbar.</string>+</resources>diff --git a/OCR-translation/src/main/res/values-es/strings.xml b/OCR-translation/src/main/res/values-es/strings.xmlnew file mode 100644index 0000000..c24e0eb--- /dev/null+++ b/OCR-translation/src/main/res/values-es/strings.xml@@ -0,0 +1,217 @@+<?xml version="1.0" encoding="utf-8"?>+<resources>+ <string name="stop">Detener</string>+ <string name="pause">Pausar</string>+ <string name="resume">Reanudar</string>+ <string name="region_select_menu">Definir área de traducción</string>+ <string name="screen_translate_needs_source">Especifica el idioma de origen</string>+ <string name="live_tile_label">Traducir pantalla en vivo</string>+ <string name="translate_text">Traducir</string>+ <string name="translate_link">Traducir enlace</string>+ <string name="accessibility_service_description">Activa este servicio para traducir el texto en pantalla. Toca el botón flotante de traducir para traducir la pantalla actual o inicia una traducción de pantalla en vivo.</string>+ <string name="tap_to_translate_title">Traducción rápida activada</string>+ <string name="tap_to_translate_body">Toca para abrir la ventana del traductor</string>+ <string name="tap_to_translate_channel">Traducción rápida</string>+ <string name="tap_to_translate_channel_description">Notificación persistente para acceder rápidamente a la ventana del traductor</string>+ <string name="quick_tile_label">Traducir</string>+ <!-- common -->+ <string name="common_ok">Aceptar</string>+ <string name="common_cancel">Cancelar</string>+ <string name="common_done">Listo</string>+ <string name="common_grant">Conceder</string>+ <string name="common_manage">Gestionar</string>+ <!-- settings -->+ <string name="settings_title">Ajustes</string>+ <string name="settings_languages">Idiomas</string>+ <string name="settings_language_packs">Paquetes de idioma</string>+ <string name="settings_general">General</string>+ <string name="settings_font_size">Tamaño de fuente</string>+ <string name="settings_font_sample">Este es un texto de ejemplo</string>+ <string name="settings_tap_notification">Notificación para traducción rápida</string>+ <string name="settings_tap_notification_desc">Notificación persistente que abre la ventana emergente.</string>+ <string name="settings_web_translator">Traductor web</string>+ <string name="settings_clear_browsing">Borrar datos de navegación al cerrar</string>+ <string name="settings_clear_browsing_desc">Elimina cookies, caché y almacenamiento local.</string>+ <string name="settings_tts_section">Texto a voz</string>+ <string name="settings_tts_read_urls_hashtags">Leer URLs y hashtags</string>+ <string name="settings_popup_settings">Ventana emergente</string>+ <string name="settings_popup_desc">La ventana emergente aparece al elegir \'Traducir\' en el menú de selección de texto</string>+ <string name="settings_hide_input">Ocultar entrada</string>+ <string name="settings_popup_position">Posición de la ventana emergente</string>+ <string name="settings_popup_size">Tamaño de la ventana: %1$d%%</string>+ <string name="settings_screen_translation">Traducción de pantalla</string>+ <string name="settings_screen_translation_desc">Traduce texto directamente sobre otras apps.</string>+ <string name="settings_floating_button">Botón siempre visible</string>+ <string name="settings_floating_button_desc">Requiere permiso de accesibilidad</string>+ <string name="settings_shortcut">Traducir pantalla con acceso directo</string>+ <string name="settings_shortcut_desc">Mantén pulsado inicio o encendido para activar</string>+ <string name="settings_on_shortcut">Al activar el acceso directo</string>+ <string name="settings_ocr">Imágenes</string>+ <string name="settings_background_mode">Reemplazar texto con</string>+ <string name="settings_min_confidence">Confianza mínima: %1$d%%</string>+ <string name="settings_max_image_size">Tamaño máx. de imagen: %1$dpx</string>+ <string name="settings_advanced">Avanzado</string>+ <string name="settings_catalog_url">URL del catálogo</string>+ <string name="settings_external_storage">Usar almacenamiento externo</string>+ <string name="settings_disable_autodetect">Desactivar la detección automática de idioma</string>+ <string name="settings_translit_output">Mostrar transliteración del texto traducido</string>+ <string name="settings_translit_input">Mostrar transliteración del texto original</string>+ <string name="settings_translit_japanese_spaces">Añadir espacios en la transliteración del japonés</string>+ <string name="settings_translate_pdf_images">Traducir imágenes en PDF</string>+ <string name="settings_camera_live_default">Traducir la cámara en vivo por defecto</string>+ <string name="settings_register_browser">Registrar como navegador</string>+ <string name="settings_register_browser_desc">Ofrecer traducir enlaces de otras apps.</string>+ <string name="settings_external_storage_perm_title">Permiso de almacenamiento externo</string>+ <string name="settings_about">Acerca de</string>+ <string name="settings_version">Versión %1$s</string>+ <string name="settings_no_languages_available">No hay idiomas disponibles</string>+ <string name="settings_default_from">Idioma de origen predeterminado</string>+ <string name="settings_default_to">Idioma de destino predeterminado</string>+ <string name="settings_adblock_support">Bloquear anuncios</string>+ <string name="settings_about_get_help">Obtener ayuda / informar de un problema</string>+ <string name="settings_logs_copied">Registros de la app copiados al portapapeles</string>+ <string name="settings_about_support">Apoyar el desarrollo</string>+ <string name="settings_external_storage_perm_body">Para guardar los archivos de traducción en tu carpeta Documentos, esta app necesita acceso para gestionar todos los archivos.\nSe te llevará a Ajustes, donde podrás conceder el permiso \'Permitir acceso para gestionar todos los archivos\'.</string>+ <!-- language manager / setup / how-to -->+ <string name="langmgr_voices">Voces</string>+ <string name="langmgr_default">PREDET.</string>+ <string name="langmgr_filter">Filtrar idiomas</string>+ <string name="langmgr_delete_shared_title">¿Eliminar diccionario compartido?</string>+ <string name="langmgr_delete_shared_body">Este diccionario se comparte con %1$s.\nSi lo eliminas, se eliminará el diccionario para todos ellos.</string>+ <string name="langmgr_download_size">Descargar %1$s</string>+ <string name="langmgr_repair_needed">A algunas funciones descargadas les faltan archivos y no funcionarán hasta que se reparen.</string>+ <string name="langmgr_repair_size">Reparar %1$s</string>+ <string name="nolang_title">Configuración de idiomas</string>+ <string name="nolang_prompt">Descarga paquetes de idioma para empezar a traducir</string>+ <string name="howto_title">Cómo usar</string>+ <!-- image capture / voice / dictionary / language selector -->+ <string name="image_no_crop_remote">Las imágenes remotas no se pueden recortar directamente</string>+ <string name="image_open_failed">No se pudo abrir el archivo</string>+ <string name="image_source_screen">Pantalla</string>+ <string name="image_source_document">Documento</string>+ <string name="image_source_photos">Fotos</string>+ <string name="image_source_gallery">Galería</string>+ <string name="image_source_camera">Cámara</string>+ <string name="voice_playback_speed">Velocidad de reproducción</string>+ <string name="voice_label">Voz</string>+ <string name="voice_default">Voz predeterminada</string>+ <string name="langsel_auto">✨ Auto</string>+ <string name="dict_also_as">También como:</string>+ <!-- camera / browser / screen translate -->+ <string name="camera_permission_rationale">Se necesita permiso de cámara para la traducción en vivo.</string>+ <string name="camera_need_ocr_models">Necesitas descargar los modelos de reconocimiento de texto para este idioma</string>+ <string name="browser_no_source_language">No hay idioma de origen disponible. Instala uno desde la pantalla principal o define un idioma de origen predeterminado en los ajustes.</string>+ <string name="browser_reader_unavailable">El modo lector no está disponible para esta página</string>+ <string name="browser_translate_image">Traducir imagen</string>+ <string name="screen_translating_notification">Traduciendo pantalla</string>+ <!-- enums -->+ <string name="align_top">Arriba</string>+ <string name="align_middle">Centro</string>+ <string name="align_bottom">Abajo</string>+ <string name="assistant_action_still_image">Traducir una vez</string>+ <string name="assistant_action_live_screen">Iniciar traducción en vivo</string>+ <string name="background_mode_white_on_black">Blanco sobre negro</string>+ <string name="background_mode_black_on_white">Negro sobre blanco</string>+ <string name="background_mode_auto_detect">Colores de la imagen original</string>+ <!-- tts / speech errors -->+ <string name="tts_nothing_to_speak">No hay nada que leer</string>+ <string name="tts_catalog_unavailable">Catálogo no disponible</string>+ <string name="tts_no_voice">No hay voz instalada para %1$s</string>+ <string name="tts_synthesis_failed">Falló la síntesis de voz para %1$s</string>+ <string name="tts_sample_fallback">Esta es una muestra de texto a voz de Offline Translator.</string>+ <!-- translation -->+ <string name="translation_error">Error de traducción: %1$s</string>+ <!-- download errors -->+ <string name="download_failed_core">Falló la descarga de %1$s</string>+ <string name="download_failed_ocr">Falló la descarga del reconocimiento de texto de %1$s</string>+ <string name="download_failed_ocr_batch">Falló la descarga por lotes del reconocimiento de texto</string>+ <string name="download_failed_dictionary">Falló la descarga del diccionario de %1$s</string>+ <string name="download_failed_tts">Falló la descarga de la voz de %1$s</string>+ <string name="download_failed_adblock">Falló la descarga de Adblock</string>+ <string name="download_failed_repair">Falló la descarga de reparación</string>+ <string name="download_catalog_unavailable">Catálogo no disponible</string>+ <string name="download_catalog_save_failed">No se pudo guardar el catálogo</string>+ <string name="download_unknown_error">Error desconocido</string>+ <string name="download_catalog_failed">No se pudo descargar el catálogo: %1$s</string>+ <!-- assistant overlay status -->+ <string name="assistant_invoke_prompt">Invoca este asistente sobre un texto para traducirlo</string>+ <string name="assistant_collecting_context">Recopilando el contexto de la pantalla…</string>+ <string name="assistant_screenshot_disabled">El acceso a capturas de pantalla está desactivado para este asistente. Actívalo en los ajustes del asistente del sistema.</string>+ <string name="assistant_no_screen_data">No se recibieron datos de la pantalla. Activa \'Usar captura de pantalla\' para este asistente.</string>+ <string name="assistant_no_screenshot">Esta app no proporcionó una captura de pantalla.</string>+ <string name="assistant_set_source_ocr">Define un idioma de origen predeterminado para el reconocimiento de texto.</string>+ <string name="assistant_langs_not_ready">Los idiomas de traducción aún no están listos. Inténtalo de nuevo.</string>+ <string name="assistant_ocr_failed">Error de reconocimiento de texto</string>+ <string name="ocr_models_missing">Faltan los modelos de reconocimiento de texto. Abre Gestionar idiomas en la app para repararlos.</string>+ <string name="assistant_set_source_live">Define un idioma de origen predeterminado en Ajustes para usar la traducción de pantalla en vivo.</string>+ <!-- migration gate -->+ <string name="migration_updating_speech_models">Actualizando modelos de voz</string>+ <string name="migration_accept_convert">Aceptar y convertir</string>+ <string name="migration_delete_all">Eliminar todo</string>+ <string name="migration_converting">Convirtiendo %1$d de %2$d</string>+ <string name="migration_optimizing">Optimizando modelos</string>+ <plurals name="migration_convert_prompt">+ <item quantity="one">Tienes %1$d modelo de texto a voz para convertir a un nuevo formato. Tardará aproximadamente %2$d segundos. Ahorrarás %3$.0f MB de espacio en disco.</item>+ <item quantity="other">Tienes %1$d modelos de texto a voz para convertir a un nuevo formato. Tardará aproximadamente %2$d segundos. Ahorrarás %3$.0f MB de espacio en disco.</item>+ </plurals>+ <!-- document translation notification + progress -->+ <string name="doc_notif_translating">Traduciendo archivo</string>+ <string name="doc_notif_translated">Archivo traducido</string>+ <string name="doc_notif_phase_text">Texto %1$d%%</string>+ <string name="doc_notif_phase_images">Imágenes %1$d/%2$d</string>+ <string name="doc_notif_phase_raster">Páginas de mapa de bits %1$d/%2$d</string>+ <string name="doc_notif_channel_name">Traducción de documentos</string>+ <string name="doc_notif_channel_desc">Muestra el progreso mientras se traducen documentos</string>+ <string name="doc_progress_preparing">Preparando archivo</string>+ <string name="doc_progress_translating">Traduciendo</string>+ <string name="doc_progress_translated">Archivo traducido</string>+ <string name="doc_progress_saving">Guardando archivo traducido</string>+ <string name="doc_translation_failed">Falló la traducción del documento</string>+ <string name="doc_url_unsupported">Descarga el documento y ábrelo con la app en su lugar</string>+ <!-- document configure sheet -->+ <string name="document_wrap_columns">Ajustar a %1$d columnas</string>+ <string name="document_translate_pdf_images">Traducir imágenes en el PDF</string>+ <string name="layout_preserve">Conservar saltos de línea</string>+ <string name="layout_reflow">Reorganizar en párrafos</string>+ <string name="layout_reflow_wrap">Reorganizar y ajustar</string>+ <!-- common (additional) -->+ <string name="common_open">Abrir</string>+ <string name="common_close">Cerrar</string>+ <string name="common_save">Guardar</string>+ <!-- translator app -->+ <string name="translator_translated_file">Archivo traducido: %1$s</string>+ <string name="translator_document_saved">Documento guardado</string>+ <string name="translator_document_save_failed">No se pudo guardar el documento</string>+ <string name="translator_audio_playback_failed">Falló la reproducción de audio: %1$s</string>+ <string name="translator_no_app_to_open">No se encontró ninguna app para abrir este archivo</string>+ <!-- document alignment -->+ <string name="docalign_decode_failed">No se pudo decodificar la imagen.</string>+ <string name="docalign_detecting">Detectando esquinas…</string>+ <string name="docalign_redetecting">Volviendo a detectar…</string>+ <string name="docalign_help">Un perímetro preciso alrededor del documento mejora la calidad del reconocimiento. Es importante que las líneas estén paralelas al texto.\n\nAl hacer zoom o desplazar la imagen, el algoritmo suele detectar el documento automáticamente, pero puedes ajustarlo manualmente si no se encuentra.</string>+ <!-- how to use -->+ <string name="howto_section_other_apps">Desde otras apps</string>+ <string name="howto_share_title">Traduce con solo compartir</string>+ <string name="howto_share_body">Comparte texto, enlaces o imágenes desde cualquier app para traducirlos.</string>+ <string name="howto_copy_title">Traduce sin salir de otras apps</string>+ <string name="howto_copy_body">Selecciona texto en cualquier lugar y toca \"Traducir\" en el menú de selección de texto para ver la traducción en una ventana compacta.</string>+ <string name="howto_section_in_app">Dentro de la app</string>+ <string name="howto_docs_title">Traducir documentos e imágenes</string>+ <string name="howto_docs_body">Abre la pestaña Documentos para traducir imágenes o archivos EPUB, PDF y TXT.</string>+ <string name="howto_dict_title">Búsqueda en el diccionario</string>+ <string name="howto_dict_body">Mantén pulsada cualquier palabra de una traducción para ver su definición. Datos obtenidos de Wiktionary.</string>+ <string name="howto_voice_title">Cambiar voz o velocidad</string>+ <string name="howto_voice_body">Mantén pulsado el botón de reproducción para elegir otra voz o ajustar la velocidad de reproducción.</string>+ <!-- feature row labels -->+ <string name="feature_translation">Traducción</string>+ <string name="feature_dictionary">Diccionario</string>+ <string name="feature_tts">Voz</string>+ <!-- misc -->+ <string name="main_input_placeholder">Ingrese texto</string>+ <string name="aidl_target_unavailable">Idioma de destino no disponible</string>+ <string name="voice_section_downloaded">DESCARGADO</string>+ <string name="voice_section_available">DISPONIBLE</string>+ <string name="detected_translate_from">Traducir desde</string>+ <string name="detected_missing_language">Idioma no disponible</string>+ <string name="langmgr_ocr_upgrade_available">Hay disponible un modelo de detección de texto mejorado.</string>+</resources>diff --git a/OCR-translation/src/main/res/values-et/strings.xml b/OCR-translation/src/main/res/values-et/strings.xmlnew file mode 100644index 0000000..231c1e1--- /dev/null+++ b/OCR-translation/src/main/res/values-et/strings.xml@@ -0,0 +1,198 @@+<?xml version="1.0" encoding="utf-8"?>+<resources>+ <string name="stop">Lõpeta</string>+ <string name="pause">Peata</string>+ <string name="resume">Jätka</string>+ <string name="region_select_menu">Määratle tõlgitav ala</string>+ <string name="screen_translate_needs_source">Määratle lähtekeel</string>+ <string name="common_ok">Sobib</string>+ <string name="common_cancel">Katkesta</string>+ <string name="common_done">Valmis</string>+ <string name="live_tile_label">Tõlgi ekraanivaadet reaalajas</string>+ <string name="translate_text">Tõlgi</string>+ <string name="settings_title">Seadistused</string>+ <string name="settings_languages">Keeled</string>+ <string name="settings_language_packs">Keelepakid</string>+ <string name="settings_general">Üldseadistused</string>+ <string name="settings_font_size">Kirjatüübi suurus</string>+ <string name="settings_font_sample">See on üks rõõmus näidistekst</string>+ <string name="settings_logs_copied">Rakenduse logid kopeeriti lõikelauale</string>+ <string name="langmgr_default">VAIKIMISI</string>+ <string name="langmgr_filter">Filtreeri keeli</string>+ <string name="langmgr_ocr_upgrade_available">Saadaval on täiustatud tekstituvastuse mudel.</string>+ <string name="langmgr_delete_shared_title">Kas kustutad jagatud sõnastiku?</string>+ <string name="langmgr_delete_shared_body">See sõnastik on jagatud järgnevalt: %1$s.\nKustutades eemaldad ta kõigi jaoks.</string>+ <string name="langmgr_download_size">Laadi %1$s alla</string>+ <string name="langmgr_repair_needed">Mõnel allalaaditud funktsioonil puuduvad failid ja need ei tööta enne parandamist.</string>+ <string name="langmgr_repair_size">Paranda %1$s</string>+ <string name="nolang_title">Keelte seadistus</string>+ <string name="nolang_prompt">Alustamaks tõlkimisega laadi alla keelepakid</string>+ <string name="howto_title">Lühike kasutusjuhend</string>+ <string name="common_grant">Anna õigused</string>+ <string name="common_manage">Halda</string>+ <string name="settings_about">Rakenduse teave</string>+ <string name="settings_version">Versioon %1$s</string>+ <string name="settings_no_languages_available">Ühtegi keelt pole saadaval</string>+ <string name="settings_default_from">Vaikimisi lähtekeel</string>+ <string name="settings_default_to">Vaikimisi sihtkeel</string>+ <string name="settings_adblock_support">Reklaamide blokeerimine</string>+ <string name="settings_about_get_help">Kasutajatugi ja vigadest teatamine</string>+ <string name="voice_section_downloaded">ALLALAADITUD</string>+ <string name="voice_section_available">SAADAVAL</string>+ <string name="doc_notif_translating">Tõlgin faili</string>+ <string name="doc_notif_translated">Tõlgitud fail</string>+ <string name="doc_notif_phase_text">Tekst %1$d%%</string>+ <string name="doc_notif_phase_images">Pildid %1$d/%2$d</string>+ <string name="doc_notif_phase_raster">Rasterlehed %1$d/%2$d</string>+ <string name="document_translate_pdf_images">Tõlgi PDF-failis leiduvad pildid</string>+ <string name="layout_preserve">Säilita reavahetused</string>+ <string name="common_open">Ava</string>+ <string name="common_close">Sulge</string>+ <string name="common_save">Salvesta</string>+ <string name="howto_docs_title">Dokumentide ja piltide tõlkimine</string>+ <string name="howto_docs_body">EPUB- PDF- ja TXT-vormingus failide tõlkimiseks ava vahekaart Dokumendid.</string>+ <string name="howto_dict_title">Otsing sõnastikust</string>+ <string name="howto_dict_body">Pika vajutusega sõnal saad näha tema selgitust. Andmed on pärist Wiktionary\'st.</string>+ <string name="howto_voice_title">Hääle või esituskiiruse muutmine</string>+ <string name="howto_voice_body">Pika vajutusega esitusnupul saad valida muu hääle või kohendada taasesituse kiirust.</string>+ <string name="feature_translation">Tõlge</string>+ <string name="feature_dictionary">Sõnastik</string>+ <string name="feature_tts">Hääl</string>+ <string name="detected_translate_from">Tõlke lähtekeel</string>+ <string name="detected_missing_language">Keel on puudu</string>+ <string name="main_input_placeholder">Sisesta tekst</string>+ <string name="aidl_target_unavailable">Sihtkeelt pole saadaval</string>+ <string name="translate_link">Tõlgi lingi alusel</string>+ <string name="quick_tile_label">Tõlgi</string>+ <string name="tap_to_translate_title">Kiirtõlkimine on lülitatud sisse</string>+ <string name="tap_to_translate_channel">Kiirtõlkimine</string>+ <string name="tap_to_translate_body">Tõlkimise hüpikakna avamiseks klõpsa</string>+ <string name="tap_to_translate_channel_description">Püsiteavitus kiirligipääsuks tõlkimise hüpikaknale</string>+ <string name="settings_tap_notification_desc">Püsiteavitus, mis avab hüpikakna.</string>+ <string name="settings_tap_notification">Kiirtõlkimise teavitus</string>+ <string name="settings_web_translator">Tõlge veebist</string>+ <string name="settings_clear_browsing">Sulgemisel kustuta veebibrauseri andmed</string>+ <string name="settings_clear_browsing_desc">Kustutab küpsised, puhverdatud andmed ja kohaliku andmeruumi.</string>+ <string name="settings_tts_section">Tekst kõneks</string>+ <string name="settings_tts_read_urls_hashtags">Loe ette URL-id ja teemaviited</string>+ <string name="settings_popup_settings">Hüpikaken</string>+ <string name="settings_popup_desc">Hüpikaken avaneb valimisel tekstivaliku menüüst „Tõlgi“</string>+ <string name="settings_hide_input">Peida sisend</string>+ <string name="settings_popup_position">Hüpikakna asukoht</string>+ <string name="settings_popup_size">Hüpikakna mõõdud: %1$d%%</string>+ <string name="settings_screen_translation">Ekraanivaate tõlge</string>+ <string name="settings_screen_translation_desc">Tõlgi teksti otse teisete rakenduste peal.</string>+ <string name="settings_floating_button">„Alati pealmine“ nupp</string>+ <string name="settings_floating_button_desc">Eeldab hõlbustuse/juurdepääsetavuse rolli olemasolu</string>+ <string name="settings_ocr">Pildid</string>+ <string name="settings_background_mode">Asenda tekst</string>+ <string name="settings_min_confidence">Väikseim tuvastuskindlus: %1$d%%</string>+ <string name="settings_max_image_size">Pildi suurim mõõt: %1$dpx</string>+ <string name="settings_advanced">Seadistused oskuskasutajatele</string>+ <string name="settings_catalog_url">Kataloogi võrguaadress</string>+ <string name="settings_external_storage">Kasuta välist andmeruumi</string>+ <string name="settings_disable_autodetect">Lülita automaatne keeletuvastus välja</string>+ <string name="settings_translit_output">Näita tõlgitud teksti puhul transliteratsiooni</string>+ <string name="settings_translit_input">Näita lähteteksti puhul transliteratsiooni</string>+ <string name="settings_translit_japanese_spaces">Lisa tühikud jaapani keele transliteratsiooni</string>+ <string name="settings_translate_pdf_images">Tõlgi PDF-failides leiduvaid pilte</string>+ <string name="settings_camera_live_default">Vaikimisi tõlgi kaamerapilt reaalajas</string>+ <string name="settings_register_browser">Registreeri veebibrauserina</string>+ <string name="settings_register_browser_desc">See võimaldab pakkuda linkide tõlketeenust teistest rakendustest.</string>+ <string name="settings_external_storage_perm_title">Välise andmeruumi õigused</string>+ <string name="langmgr_voices">Kõnesüsneesi hääled</string>+ <string name="settings_about_support">Toeta rakenduse arendust</string>+ <string name="settings_external_storage_perm_body">Et salvestada tõlkefailid kausta „Dokumendid“, vajab see rakendus juurdepääsu kõigi failide haldamiseks.\nSuuname sind seadistustesse, kus saad anda loa „Luba juurdepääs kõigi failide haldamiseks“.</string>+ <string name="image_no_crop_remote">Kaugsüsteemis asuvaid pilte ei saa otse kadreerida</string>+ <string name="image_source_screen">Ekraan</string>+ <string name="image_source_document">Dokument</string>+ <string name="image_source_photos">Fotod</string>+ <string name="image_source_gallery">Galerii</string>+ <string name="image_source_camera">Kaamera</string>+ <string name="voice_playback_speed">Taasesituse kiirus</string>+ <string name="voice_label">Hääl</string>+ <string name="langsel_auto">✨ Automaatne</string>+ <string name="voice_default">Vaikimisi hääl</string>+ <string name="dict_also_as">Lisaks vormingus:</string>+ <string name="camera_permission_rationale">Reaalajas tõlkimiseks on vaja õigus kaamera kasutamiseks.</string>+ <string name="camera_need_ocr_models">Sa pead laadima alla selle keele tekstituvastuse mudelid</string>+ <string name="browser_reader_unavailable">Lugemisrežiim pole selle leha jaoks saadaval</string>+ <string name="browser_translate_image">Tõlgi pildi sisu</string>+ <string name="screen_translating_notification">Ekraanivaate tõlkimine on töös</string>+ <string name="align_top">Ülal</string>+ <string name="align_middle">Keskel</string>+ <string name="align_bottom">All</string>+ <string name="assistant_action_still_image">Tõlgi üks kord</string>+ <string name="assistant_action_live_screen">Alusta tõlget reaalajas</string>+ <string name="background_mode_white_on_black">Valge mustal taustal</string>+ <string name="background_mode_black_on_white">Must valgel taustal</string>+ <string name="background_mode_auto_detect">Pildi algsed värvid</string>+ <string name="tts_catalog_unavailable">Kataloog pole saadaval</string>+ <string name="tts_no_voice">Häält pole paigaldatud keelele: %1$s</string>+ <string name="tts_synthesis_failed">Kõnesüntees ei toiminud antud keele puhul: %1$s</string>+ <string name="tts_sample_fallback">See on kõnesünteesi näide rakendusest Offline Translator.</string>+ <string name="translation_error">Tõlkeviga: %1$s</string>+ <string name="download_failed_core">Allalaadimine ei õnnestunud: %1$s</string>+ <string name="download_failed_ocr">%1$s tekstituvastuse allalaadimine ei õnnestunud</string>+ <string name="download_failed_ocr_batch">Tekstituvastuse allalaadimine pakina ei õnnestunud</string>+ <string name="download_failed_dictionary">Sõnastiku allalaadimine ei õnnestunud: %1$s</string>+ <string name="download_failed_tts">%1$s hääle allalaadimine ei õnnestunud</string>+ <string name="download_failed_adblock">Reklaamiblokeerija andmete allalaadimine ei õnnestunud</string>+ <string name="download_failed_repair">Paranduse allalaadimine ei õnnestunud</string>+ <string name="download_catalog_unavailable">Kataloog pole saadaval</string>+ <string name="download_catalog_save_failed">Kataloogi salvestamine ei õnnestunud</string>+ <string name="download_unknown_error">Tundmatu viga</string>+ <string name="download_catalog_failed">Kataloogi allalaadimine ei õnnestunud: %1$s</string>+ <string name="doc_progress_preparing">Valmistan faili ette</string>+ <string name="doc_notif_channel_desc">Näitab dokumentide tõlkimise edenemist</string>+ <string name="doc_notif_channel_name">Dokumentide tõlge</string>+ <string name="doc_progress_translating">Tõlgin</string>+ <string name="doc_progress_translated">Tõlgitud fail</string>+ <string name="doc_progress_saving">Salvestan tõlgitud faili</string>+ <string name="doc_translation_failed">Dokumendi tõlkimine ei õnnestunud</string>+ <string name="doc_url_unsupported">Selle asemel laadi dokument alla ja ava rakendusega</string>+ <string name="document_wrap_columns">Murra read %1$d. veeru kohalt</string>+ <string name="layout_reflow">Jaga tekst lõikudeks</string>+ <string name="layout_reflow_wrap">Jaga tekst lõikudeks ja murra read</string>+ <string name="translator_translated_file">Tõlgitud fail: %1$s</string>+ <string name="translator_document_saved">Dokument on salvestatud</string>+ <string name="translator_document_save_failed">Dokumendi salvestamine ei õnnestunud</string>+ <string name="translator_audio_playback_failed">Heli taasesitamine ei õnnestunud: %1$s</string>+ <string name="translator_no_app_to_open">Selle faili avamiseks ei leidu rakendust</string>+ <string name="docalign_decode_failed">Pildi dekodeerimine ei õnnestunud.</string>+ <string name="docalign_detecting">Tuvastan nurki…</string>+ <string name="docalign_redetecting">Tuvastan uuesti…</string>+ <string name="accessibility_service_description">Lülita see teenus sisse, kui soovid tõlkida ekraanil leiduvat teksti. Kui soovid hetkel nähtava ekraanivaate tõlkimist, siis klõpsa ujuvat tõlkenuppu. Lisaks saad alustada pidevat tõlget reaalajas.</string>+ <string name="settings_shortcut">Kasuta otselinki tõlkimise käivitamiseks</string>+ <string name="settings_shortcut_desc">Selleks vajuta pikalt avalehe või toitenuppu</string>+ <string name="settings_on_shortcut">Otslingi käivitamisel</string>+ <string name="image_open_failed">Faili avamine ei õnnestunud</string>+ <string name="browser_no_source_language">Ühtegi lähtekeelt pole saadaval. Esmalt paigalda mõni soovitud keel rakenduse avavaatest või vali seadistustest vaikimisi tõlkekeel.</string>+ <string name="tts_nothing_to_speak">Kõnesünteesi mudelil pole sisu, mida rääkida</string>+ <string name="assistant_invoke_prompt">Tõlkimiseks käivita see abiline teksti peal</string>+ <string name="assistant_collecting_context">Kogun ekraanivaate sisu…</string>+ <string name="assistant_screenshot_disabled">Ligipääs ekraanitõmmisele on selle abilise jaoks keelatud. Palun lülita selline võimalus süteemi seadistustest sisse.</string>+ <string name="assistant_no_screen_data">Ekraaniandmete tuvastamine ei õnnestunud. Palun kontrolli, et sellel abilisel on lubatud „Luba ekraanihõive“ õigused.</string>+ <string name="assistant_no_screenshot">See rakendus ei teinud ekraanitõmmist.</string>+ <string name="assistant_set_source_ocr">Seadista vaikimisi keel optilise märgituvastuse jaoks.</string>+ <string name="assistant_langs_not_ready">Tõlkekeeled pole veel valmis. Palun proovi uuesti.</string>+ <string name="assistant_ocr_failed">Optiline märgituvastus ei toiminud</string>+ <string name="ocr_models_missing">Optilise märgituvastuse mudelid puuduvad. Parandamiseks ava rakenduses keeltehaldus.</string>+ <string name="assistant_set_source_live">Reaalajas ekraanitõlke jaoks määratle Seadistustest vaikimisi lähtekeel.</string>+ <string name="migration_updating_speech_models">Uuendan kõnemudeleid</string>+ <string name="migration_accept_convert">Nõustu ja teisenda</string>+ <string name="migration_delete_all">Selle asemel kustuta kõik</string>+ <string name="migration_converting">Teisendan: %1$d / %2$d</string>+ <string name="migration_optimizing">Optimeerin mudeleid</string>+ <plurals name="migration_convert_prompt">+ <item quantity="one">Uude vormingusse teisendamiseks on sul %1$d kõnesünteesi mudel. Selleks kulub umbes %2$d sekundit ja sa säästad %3$.0f MB andmeruumi.</item>+ <item quantity="other">Uude vormingusse teisendamiseks on sul %1$d kõnesünteesi mudelit. Selleks kulub umbes %2$d sekundit ja sa säästad %3$.0f MB andmeruumi.</item>+ </plurals>+ <string name="docalign_help">Dokumenti ümbritsev täpne perimeeter parandab tuvastuse kvaliteeti. On oluline, et jooned asuks tekstiga rööpselt.\n\nSuurendamine või pildi nihutamine tekitab olukorra, kus algoritm tuvastab dokumendi automaatselt, aga muul juhul saad seda ka käsitsi kohendada.</string>+ <string name="howto_section_other_apps">Muudest rakendustest</string>+ <string name="howto_share_title">Tõlkimiseks jagamine</string>+ <string name="howto_share_body">Tõlkimiseks ükspuha mis rakenduse sisu jaga sealt teksti, linke või pilte.</string>+ <string name="howto_copy_title">Tõlkimine rakendusest väljumata</string>+ <string name="howto_copy_body">Vali mis iganes rakenduses soovitud tekst, klõpsa kopeerimise tööriistaribalt „Tõlgi“ ja näed kompaktses hüpikaknas tõlget.</string>+ <string name="howto_section_in_app">Rakenduse seest</string>+</resources>diff --git a/OCR-translation/src/main/res/values-fa/strings.xml b/OCR-translation/src/main/res/values-fa/strings.xmlnew file mode 100644index 0000000..663fd79--- /dev/null+++ b/OCR-translation/src/main/res/values-fa/strings.xml@@ -0,0 +1,217 @@+<?xml version="1.0" encoding="utf-8"?>+<resources>+ <string name="stop">توقف</string>+ <string name="pause">مکث</string>+ <string name="resume">ادامه</string>+ <string name="region_select_menu">تعیین محدوده ترجمه</string>+ <string name="screen_translate_needs_source">زبان مبدأ را مشخص کنید</string>+ <string name="live_tile_label">ترجمه زنده صفحه</string>+ <string name="translate_text">ترجمه</string>+ <string name="translate_link">ترجمه پیوند</string>+ <string name="accessibility_service_description">این سرویس را فعال کنید تا متن روی صفحه ترجمه شود. برای ترجمه صفحه فعلی روی دکمه شناور ترجمه بزنید، یا یک ترجمه زنده صفحه را شروع کنید.</string>+ <string name="tap_to_translate_title">ترجمه سریع روشن است</string>+ <string name="tap_to_translate_body">برای باز کردن پنجره مترجم بزنید</string>+ <string name="tap_to_translate_channel">ترجمه سریع</string>+ <string name="tap_to_translate_channel_description">اعلان همیشگی برای دسترسی سریع به پنجره مترجم</string>+ <string name="quick_tile_label">ترجمه</string>+ <!-- common -->+ <string name="common_ok">تأیید</string>+ <string name="common_cancel">لغو</string>+ <string name="common_done">انجام شد</string>+ <string name="common_grant">اعطا</string>+ <string name="common_manage">مدیریت</string>+ <!-- settings -->+ <string name="settings_title">تنظیمات</string>+ <string name="settings_languages">زبانها</string>+ <string name="settings_language_packs">بستههای زبان</string>+ <string name="settings_general">عمومی</string>+ <string name="settings_font_size">اندازه فونت</string>+ <string name="settings_font_sample">این یک متن نمونه است</string>+ <string name="settings_tap_notification">اعلان ترجمه سریع</string>+ <string name="settings_tap_notification_desc">اعلان همیشگی که پنجره را باز میکند.</string>+ <string name="settings_web_translator">مترجم وب</string>+ <string name="settings_clear_browsing">پاک کردن دادههای مرور هنگام بستن</string>+ <string name="settings_clear_browsing_desc">کوکیها، حافظه پنهان و ذخیرهسازی محلی را حذف میکند.</string>+ <string name="settings_tts_section">تبدیل متن به گفتار</string>+ <string name="settings_tts_read_urls_hashtags">خواندن نشانیها و هشتگها</string>+ <string name="settings_popup_settings">پنجره بازشو</string>+ <string name="settings_popup_desc">هنگام انتخاب \'ترجمه\' از منوی انتخاب متن، پنجره بازشو نمایش داده میشود</string>+ <string name="settings_hide_input">پنهان کردن ورودی</string>+ <string name="settings_popup_position">موقعیت پنجره بازشو</string>+ <string name="settings_popup_size">اندازه پنجره: %1$d%%</string>+ <string name="settings_screen_translation">ترجمه صفحه</string>+ <string name="settings_screen_translation_desc">متن را مستقیماً روی برنامههای دیگر ترجمه کنید.</string>+ <string name="settings_floating_button">دکمه همیشهفعال</string>+ <string name="settings_floating_button_desc">به مجوز دسترسپذیری نیاز دارد</string>+ <string name="settings_shortcut">ترجمه صفحه با میانبر</string>+ <string name="settings_shortcut_desc">برای فعالسازی، دکمه خانه یا روشن/خاموش را نگه دارید</string>+ <string name="settings_on_shortcut">هنگام فراخوانی میانبر</string>+ <string name="settings_ocr">تصاویر</string>+ <string name="settings_background_mode">جایگزینی متن با</string>+ <string name="settings_min_confidence">حداقل اطمینان: %1$d%%</string>+ <string name="settings_max_image_size">حداکثر اندازه تصویر: %1$dpx</string>+ <string name="settings_advanced">پیشرفته</string>+ <string name="settings_catalog_url">نشانی کاتالوگ (URL)</string>+ <string name="settings_external_storage">استفاده از حافظه خارجی</string>+ <string name="settings_disable_autodetect">غیرفعال کردن تشخیص خودکار زبان</string>+ <string name="settings_translit_output">نمایش آوانگاری متن ترجمهشده</string>+ <string name="settings_translit_input">نمایش آوانگاری متن اصلی</string>+ <string name="settings_translit_japanese_spaces">افزودن فاصله در آوانگاری ژاپنی</string>+ <string name="settings_translate_pdf_images">ترجمه تصاویر داخل فایلهای PDF</string>+ <string name="settings_camera_live_default">ترجمه زنده دوربین بهصورت پیشفرض</string>+ <string name="settings_register_browser">ثبت بهعنوان مرورگر</string>+ <string name="settings_register_browser_desc">پیشنهاد ترجمه پیوندهای برنامههای دیگر.</string>+ <string name="settings_external_storage_perm_title">مجوز حافظه خارجی</string>+ <string name="settings_about">درباره</string>+ <string name="settings_version">نسخه %1$s</string>+ <string name="settings_no_languages_available">هیچ زبانی در دسترس نیست</string>+ <string name="settings_default_from">زبان مبدأ پیشفرض</string>+ <string name="settings_default_to">زبان مقصد پیشفرض</string>+ <string name="settings_adblock_support">مسدود کردن تبلیغات</string>+ <string name="settings_about_get_help">دریافت کمک / گزارش مشکل</string>+ <string name="settings_logs_copied">گزارشهای برنامه در کلیپبورد کپی شد</string>+ <string name="settings_about_support">حمایت از توسعه</string>+ <string name="settings_external_storage_perm_body">برای ذخیره فایلهای ترجمه در پوشه اسناد شما، این برنامه به دسترسی برای مدیریت همه فایلها نیاز دارد.\nبه تنظیمات هدایت میشوید تا بتوانید مجوز \'اجازه دسترسی برای مدیریت همه فایلها\' را اعطا کنید.</string>+ <!-- language manager / setup / how-to -->+ <string name="langmgr_voices">صداها</string>+ <string name="voice_section_downloaded">دانلودشده</string>+ <string name="voice_section_available">در دسترس</string>+ <string name="langmgr_default">پیشفرض</string>+ <string name="langmgr_filter">فیلتر زبانها</string>+ <string name="langmgr_ocr_upgrade_available">یک مدل بهبودیافته برای شناسایی متن در دسترس است.</string>+ <string name="langmgr_delete_shared_title">دیکشنری مشترک حذف شود؟</string>+ <string name="langmgr_delete_shared_body">این دیکشنری با %1$s به اشتراک گذاشته شده است.\nبا حذف آن، دیکشنری برای همه آنها حذف میشود.</string>+ <string name="langmgr_download_size">دانلود %1$s</string>+ <string name="langmgr_repair_needed">برخی از قابلیتهای دانلودشده فایلهای ناقص دارند و تا زمان تعمیر کار نمیکنند.</string>+ <string name="langmgr_repair_size">تعمیر %1$s</string>+ <string name="nolang_title">راهاندازی زبان</string>+ <string name="nolang_prompt">برای شروع ترجمه، بستههای زبان را دانلود کنید</string>+ <string name="howto_title">نحوه استفاده</string>+ <!-- image capture / voice / dictionary / language selector -->+ <string name="image_no_crop_remote">تصاویر آنلاین را نمیتوان مستقیماً برش داد</string>+ <string name="image_open_failed">باز کردن فایل ناموفق بود</string>+ <string name="image_source_screen">صفحه</string>+ <string name="image_source_document">سند</string>+ <string name="image_source_photos">عکسها</string>+ <string name="image_source_gallery">گالری</string>+ <string name="image_source_camera">دوربین</string>+ <string name="voice_playback_speed">سرعت پخش</string>+ <string name="voice_label">صدا</string>+ <string name="voice_default">صدای پیشفرض</string>+ <string name="langsel_auto">✨ خودکار</string>+ <string name="dict_also_as">همچنین بهشکل:</string>+ <!-- camera / browser / screen translate -->+ <string name="camera_permission_rationale">برای ترجمه زنده به مجوز دوربین نیاز است.</string>+ <string name="camera_need_ocr_models">باید مدلهای شناسایی متن (برای تصاویر) این زبان را دانلود کنید</string>+ <string name="browser_no_source_language">هیچ زبان مبدئی در دسترس نیست. ابتدا یکی را از صفحه اصلی نصب کنید، یا در تنظیمات یک زبان مبدأ پیشفرض تعیین کنید.</string>+ <string name="browser_reader_unavailable">حالت خواندن برای این صفحه در دسترس نیست</string>+ <string name="browser_translate_image">ترجمه تصویر</string>+ <string name="screen_translating_notification">در حال ترجمه صفحه</string>+ <!-- enums -->+ <string name="align_top">بالا</string>+ <string name="align_middle">وسط</string>+ <string name="align_bottom">پایین</string>+ <string name="assistant_action_still_image">یکبار ترجمه کن</string>+ <string name="assistant_action_live_screen">شروع ترجمه زنده</string>+ <string name="background_mode_white_on_black">سفید روی سیاه</string>+ <string name="background_mode_black_on_white">سیاه روی سفید</string>+ <string name="background_mode_auto_detect">رنگهای تصویر اصلی</string>+ <!-- tts / speech errors -->+ <string name="tts_nothing_to_speak">چیزی برای خواندن وجود ندارد</string>+ <string name="tts_catalog_unavailable">کاتالوگ در دسترس نیست</string>+ <string name="tts_no_voice">هیچ صدایی برای %1$s نصب نشده است</string>+ <string name="tts_synthesis_failed">تولید گفتار برای %1$s ناموفق بود</string>+ <string name="tts_sample_fallback">این یک نمونه صدای Offline Translator است.</string>+ <!-- translation -->+ <string name="translation_error">خطای ترجمه: %1$s</string>+ <!-- download errors -->+ <string name="download_failed_core">دانلود %1$s ناموفق بود</string>+ <string name="download_failed_ocr">دانلود مدل شناسایی متن %1$s ناموفق بود</string>+ <string name="download_failed_ocr_batch">دانلود دستهای مدلهای شناسایی متن ناموفق بود</string>+ <string name="download_failed_dictionary">دانلود دیکشنری %1$s ناموفق بود</string>+ <string name="download_failed_tts">دانلود صدای %1$s ناموفق بود</string>+ <string name="download_failed_adblock">دانلود مسدودکننده تبلیغات ناموفق بود</string>+ <string name="download_failed_repair">دانلود تعمیر ناموفق بود</string>+ <string name="download_catalog_unavailable">کاتالوگ در دسترس نیست</string>+ <string name="download_catalog_save_failed">ذخیره کاتالوگ ناموفق بود</string>+ <string name="download_unknown_error">خطای ناشناخته</string>+ <string name="download_catalog_failed">دانلود کاتالوگ ناموفق بود: %1$s</string>+ <!-- assistant overlay status -->+ <string name="assistant_invoke_prompt">این دستیار را روی یک متن فعال کنید تا آن را ترجمه کند</string>+ <string name="assistant_collecting_context">در حال جمعآوری محتوای صفحه…</string>+ <string name="assistant_screenshot_disabled">دسترسی به اسکرینشات برای این دستیار غیرفعال است. آن را در تنظیمات دستیار سیستم فعال کنید.</string>+ <string name="assistant_no_screen_data">هیچ دادهای از صفحه دریافت نشد. \'استفاده از اسکرینشات\' را برای این دستیار فعال کنید.</string>+ <string name="assistant_no_screenshot">این برنامه اسکرینشاتی ارائه نکرد.</string>+ <string name="assistant_set_source_ocr">یک زبان مبدأ پیشفرض برای شناسایی متن تعیین کنید.</string>+ <string name="assistant_langs_not_ready">زبانهای ترجمه هنوز آماده نیستند. دوباره تلاش کنید.</string>+ <string name="assistant_ocr_failed">شناسایی متن ناموفق بود</string>+ <string name="ocr_models_missing">مدلهای شناسایی متن موجود نیستند. برای تعمیر، مدیریت زبانها را در برنامه باز کنید.</string>+ <string name="assistant_set_source_live">برای استفاده از ترجمه زنده صفحه، در تنظیمات یک زبان مبدأ پیشفرض تعیین کنید.</string>+ <!-- migration gate -->+ <string name="migration_updating_speech_models">در حال بهروزرسانی مدلهای گفتار</string>+ <string name="migration_accept_convert">پذیرفتن و تبدیل</string>+ <string name="migration_delete_all">در عوض همه را حذف کن</string>+ <string name="migration_converting">در حال تبدیل %1$d از %2$d</string>+ <string name="migration_optimizing">در حال بهینهسازی مدلها</string>+ <plurals name="migration_convert_prompt">+ <item quantity="one">شما %1$d مدل گفتار برای تبدیل به قالب جدید دارید. این کار حدوداً %2$d ثانیه طول میکشد. شما %3$.0f مگابایت فضای دیسک را آزاد خواهید کرد.</item>+ <item quantity="other">شما %1$d مدل گفتار برای تبدیل به قالب جدید دارید. این کار حدوداً %2$d ثانیه طول میکشد. شما %3$.0f مگابایت فضای دیسک را آزاد خواهید کرد.</item>+ </plurals>+ <!-- document translation notification + progress -->+ <string name="doc_notif_translating">در حال ترجمه فایل</string>+ <string name="doc_notif_translated">فایل ترجمه شد</string>+ <string name="doc_notif_phase_text">متن %1$d%%</string>+ <string name="doc_notif_phase_images">تصاویر %1$d/%2$d</string>+ <string name="doc_notif_phase_raster">صفحات تصویری %1$d/%2$d</string>+ <string name="doc_notif_channel_name">ترجمه سند</string>+ <string name="doc_notif_channel_desc">پیشرفت را هنگام ترجمه اسناد نمایش میدهد</string>+ <string name="doc_progress_preparing">در حال آمادهسازی فایل</string>+ <string name="doc_progress_translating">در حال ترجمه</string>+ <string name="doc_progress_translated">فایل ترجمه شد</string>+ <string name="doc_progress_saving">در حال ذخیره فایل ترجمهشده</string>+ <string name="doc_translation_failed">ترجمه سند ناموفق بود</string>+ <string name="doc_url_unsupported">بهجای آن، سند را دانلود کنید و با برنامه باز کنید</string>+ <!-- document configure sheet -->+ <string name="document_wrap_columns">شکستن خط در %1$d ستون</string>+ <string name="document_translate_pdf_images">ترجمه تصاویر داخل PDF</string>+ <string name="layout_preserve">حفظ شکست خطها</string>+ <string name="layout_reflow">بازچینش در پاراگرافها</string>+ <string name="layout_reflow_wrap">بازچینش و شکستن خط</string>+ <!-- common (additional) -->+ <string name="common_open">باز کردن</string>+ <string name="common_close">بستن</string>+ <string name="common_save">ذخیره</string>+ <!-- translator app -->+ <string name="translator_translated_file">فایل ترجمهشده: %1$s</string>+ <string name="translator_document_saved">سند ذخیره شد</string>+ <string name="translator_document_save_failed">ذخیره سند ناموفق بود</string>+ <string name="translator_audio_playback_failed">پخش صدا ناموفق بود: %1$s</string>+ <string name="translator_no_app_to_open">هیچ برنامهای برای باز کردن این فایل پیدا نشد</string>+ <!-- document alignment -->+ <string name="docalign_decode_failed">رمزگشایی تصویر ممکن نشد.</string>+ <string name="docalign_detecting">در حال تشخیص گوشهها…</string>+ <string name="docalign_redetecting">در حال تشخیص دوباره…</string>+ <string name="docalign_help">یک محدوده دقیق دور سند، کیفیت شناسایی متن را بهتر میکند. مهم است که خطها موازی با متن باشند.\n\nبزرگنمایی یا جابهجایی معمولاً باعث میشود الگوریتم سند را بهصورت خودکار تشخیص دهد، اما اگر پیدا نشد میتوانید آن را دستی تنظیم کنید.</string>+ <!-- how to use -->+ <string name="howto_section_other_apps">از برنامههای دیگر</string>+ <string name="howto_share_title">برای ترجمه به اشتراک بگذارید</string>+ <string name="howto_share_body">متن، پیوند یا تصویر را از هر برنامهای به اشتراک بگذارید تا ترجمه شود.</string>+ <string name="howto_copy_title">ترجمه بدون خروج از برنامههای دیگر</string>+ <string name="howto_copy_body">در هر جایی متن را انتخاب کنید، سپس در نوار کپی روی \"ترجمه\" بزنید تا ترجمه را در یک پنجره کوچک ببینید.</string>+ <string name="howto_section_in_app">داخل برنامه</string>+ <string name="howto_docs_title">ترجمه اسناد و تصاویر</string>+ <string name="howto_docs_body">برای ترجمه تصاویر یا فایلهای EPUB، PDF و TXT، زبانه اسناد را باز کنید.</string>+ <string name="howto_dict_title">جستجو در دیکشنری</string>+ <string name="howto_dict_body">روی هر واژه در یک ترجمه نگه دارید تا تعریف آن را ببینید. دادهها از Wiktionary گرفته شدهاند.</string>+ <string name="howto_voice_title">تغییر صدا یا سرعت</string>+ <string name="howto_voice_body">دکمه پخش را نگه دارید تا صدای دیگری انتخاب کنید یا سرعت پخش را تنظیم کنید.</string>+ <!-- feature row labels -->+ <string name="feature_translation">ترجمه</string>+ <string name="feature_dictionary">دیکشنری</string>+ <string name="feature_tts">صدا</string>+ <!-- misc -->+ <string name="detected_translate_from">ترجمه از</string>+ <string name="detected_missing_language">زبان موجود نیست</string>+ <string name="main_input_placeholder">متن را وارد کنید</string>+ <string name="aidl_target_unavailable">زبان مقصد در دسترس نیست</string>+</resources>diff --git a/OCR-translation/src/main/res/values-fi/strings.xml b/OCR-translation/src/main/res/values-fi/strings.xmlnew file mode 100644index 0000000..0418958--- /dev/null+++ b/OCR-translation/src/main/res/values-fi/strings.xml@@ -0,0 +1,217 @@+<?xml version="1.0" encoding="utf-8"?>+<resources>+ <string name="stop">Pysäytä</string>+ <string name="pause">Keskeytä</string>+ <string name="resume">Jatka</string>+ <string name="region_select_menu">Aseta käännösalue</string>+ <string name="screen_translate_needs_source">Määritä lähdekieli</string>+ <string name="live_tile_label">Käännä näyttö reaaliajassa</string>+ <string name="translate_text">Käännä</string>+ <string name="translate_link">Käännä linkki</string>+ <string name="accessibility_service_description">Ota tämä palvelu käyttöön kääntääksesi näytöllä olevaa tekstiä. Napauta kelluvaa käännöspainiketta kääntääksesi nykyisen näytön tai aloita reaaliaikainen näytön kääntäminen.</string>+ <string name="tap_to_translate_title">Pikakäännös on käytössä</string>+ <string name="tap_to_translate_body">Napauta avataksesi käännösikkunan</string>+ <string name="tap_to_translate_channel">Pikakäännös</string>+ <string name="tap_to_translate_channel_description">Pysyvä ilmoitus käännösikkunan nopeaa avaamista varten</string>+ <string name="quick_tile_label">Käännä</string>+ <!-- common -->+ <string name="common_ok">OK</string>+ <string name="common_cancel">Peruuta</string>+ <string name="common_done">Valmis</string>+ <string name="common_grant">Myönnä</string>+ <string name="common_manage">Hallitse</string>+ <!-- settings -->+ <string name="settings_title">Asetukset</string>+ <string name="settings_languages">Kielet</string>+ <string name="settings_language_packs">Kielipaketit</string>+ <string name="settings_general">Yleiset</string>+ <string name="settings_font_size">Fonttikoko</string>+ <string name="settings_font_sample">Tämä on esimerkkitekstiä</string>+ <string name="settings_tap_notification">Pikakäännös-ilmoitus</string>+ <string name="settings_tap_notification_desc">Pysyvä ilmoitus, joka avaa ponnahdusikkunan.</string>+ <string name="settings_web_translator">Verkkokääntäjä</string>+ <string name="settings_clear_browsing">Tyhjennä selaustiedot suljettaessa</string>+ <string name="settings_clear_browsing_desc">Poistaa evästeet, välimuistin ja paikallisen tallennustilan.</string>+ <string name="settings_tts_section">Tekstistä puheeksi</string>+ <string name="settings_tts_read_urls_hashtags">Lue URL-osoitteet ja hashtagit</string>+ <string name="settings_popup_settings">Ponnahdusikkuna</string>+ <string name="settings_popup_desc">Ponnahdusikkuna avautuu, kun valitset \'Käännä\' tekstin valintavalikosta</string>+ <string name="settings_hide_input">Piilota syöte</string>+ <string name="settings_popup_position">Ponnahdusikkunan sijainti</string>+ <string name="settings_popup_size">Ponnahdusikkunan koko: %1$d%%</string>+ <string name="settings_screen_translation">Näytön kääntäminen</string>+ <string name="settings_screen_translation_desc">Käännä tekstiä suoraan muiden sovellusten päällä.</string>+ <string name="settings_floating_button">Aina näkyvä painike</string>+ <string name="settings_floating_button_desc">Vaatii esteettömyysroolin</string>+ <string name="settings_shortcut">Käännä näyttö pikatoiminnolla</string>+ <string name="settings_shortcut_desc">Pidä koti- tai virtapainiketta pohjassa käynnistääksesi</string>+ <string name="settings_on_shortcut">Pikatoiminnon käynnistyessä</string>+ <string name="settings_ocr">Kuvat</string>+ <string name="settings_background_mode">Korvaa teksti tyylillä</string>+ <string name="settings_min_confidence">Vähimmäisvarmuus: %1$d%%</string>+ <string name="settings_max_image_size">Kuvan enimmäiskoko: %1$dpx</string>+ <string name="settings_advanced">Lisäasetukset</string>+ <string name="settings_catalog_url">Luettelon URL</string>+ <string name="settings_external_storage">Käytä ulkoista tallennustilaa</string>+ <string name="settings_disable_autodetect">Poista automaattinen kielentunnistus käytöstä</string>+ <string name="settings_translit_output">Näytä translitterointi käännetylle tekstille</string>+ <string name="settings_translit_input">Näytä translitterointi alkuperäiselle tekstille</string>+ <string name="settings_translit_japanese_spaces">Lisää välilyönnit japanin translitterointiin</string>+ <string name="settings_translate_pdf_images">Käännä PDF-tiedostojen kuvat</string>+ <string name="settings_camera_live_default">Käännä kamera reaaliajassa oletuksena</string>+ <string name="settings_register_browser">Rekisteröidy selaimeksi</string>+ <string name="settings_register_browser_desc">Tarjoa linkkien kääntämistä muista sovelluksista.</string>+ <string name="settings_external_storage_perm_title">Ulkoisen tallennustilan käyttöoikeus</string>+ <string name="settings_about">Tietoja</string>+ <string name="settings_version">Versio %1$s</string>+ <string name="settings_no_languages_available">Ei kieliä saatavilla</string>+ <string name="settings_default_from">Oletuskieli \'mistä\'</string>+ <string name="settings_default_to">Oletuskieli \'mihin\'</string>+ <string name="settings_adblock_support">Mainosten esto</string>+ <string name="settings_about_get_help">Hae apua / ilmoita ongelmasta</string>+ <string name="settings_logs_copied">Sovelluslokit kopioitu leikepöydälle</string>+ <string name="settings_about_support">Tue kehitystä</string>+ <string name="settings_external_storage_perm_body">Tallentaakseen käännöstiedostot Tiedostot-kansioosi tämä sovellus tarvitsee oikeuden hallita kaikkia tiedostoja.\nSinut ohjataan Asetuksiin, jossa voit myöntää \'Salli kaikkien tiedostojen hallinta\' -oikeuden.</string>+ <!-- language manager / setup / how-to -->+ <string name="langmgr_voices">Äänet</string>+ <string name="langmgr_default">OLETUS</string>+ <string name="langmgr_filter">Suodata kieliä</string>+ <string name="langmgr_delete_shared_title">Poistetaanko jaettu sanakirja?</string>+ <string name="langmgr_delete_shared_body">Tämä sanakirja on jaettu seuraavien kanssa: %1$s.\nSen poistaminen poistaa sanakirjan niiltä kaikilta.</string>+ <string name="langmgr_download_size">Lataa %1$s</string>+ <string name="langmgr_repair_needed">Joistakin ladatuista ominaisuuksista puuttuu tiedostoja, eivätkä ne toimi ennen korjausta.</string>+ <string name="langmgr_repair_size">Korjaa %1$s</string>+ <string name="nolang_title">Kielten määritys</string>+ <string name="nolang_prompt">Lataa kielipaketteja aloittaaksesi kääntämisen</string>+ <string name="howto_title">Käyttöohjeet</string>+ <!-- image capture / voice / dictionary / language selector -->+ <string name="image_no_crop_remote">Etäkuvia ei voi rajata suoraan</string>+ <string name="image_open_failed">Tiedoston avaaminen epäonnistui</string>+ <string name="image_source_screen">Näyttö</string>+ <string name="image_source_document">Asiakirja</string>+ <string name="image_source_photos">Kuvat</string>+ <string name="image_source_gallery">Galleria</string>+ <string name="image_source_camera">Kamera</string>+ <string name="voice_playback_speed">Toistonopeus</string>+ <string name="voice_label">Ääni</string>+ <string name="voice_default">Oletusääni</string>+ <string name="langsel_auto">✨ Automaattinen</string>+ <string name="dict_also_as">Myös muodossa:</string>+ <!-- camera / browser / screen translate -->+ <string name="camera_permission_rationale">Kameran käyttöoikeus tarvitaan reaaliaikaiseen kääntämiseen.</string>+ <string name="camera_need_ocr_models">Sinun täytyy ladata tekstintunnistusmallit tälle kielelle</string>+ <string name="browser_no_source_language">Lähdekieltä ei ole saatavilla. Asenna sellainen ensin päänäytöltä tai aseta oletuslähdekieli asetuksissa.</string>+ <string name="browser_reader_unavailable">Lukutila ei ole käytettävissä tällä sivulla</string>+ <string name="browser_translate_image">Käännä kuva</string>+ <string name="screen_translating_notification">Käännetään näyttöä</string>+ <!-- enums -->+ <string name="align_top">Ylhäällä</string>+ <string name="align_middle">Keskellä</string>+ <string name="align_bottom">Alhaalla</string>+ <string name="assistant_action_still_image">Käännä kerran</string>+ <string name="assistant_action_live_screen">Aloita reaaliaikainen kääntäminen</string>+ <string name="background_mode_white_on_black">Valkoinen mustalla</string>+ <string name="background_mode_black_on_white">Musta valkoisella</string>+ <string name="background_mode_auto_detect">Tunnista värit automaattisesti</string>+ <!-- tts / speech errors -->+ <string name="tts_nothing_to_speak">Ei mitään puhuttavaa</string>+ <string name="tts_catalog_unavailable">Luettelo ei ole saatavilla</string>+ <string name="tts_no_voice">Kielelle %1$s ei ole asennettu ääntä</string>+ <string name="tts_synthesis_failed">Puhesynteesi epäonnistui kielelle %1$s</string>+ <string name="tts_sample_fallback">Tämä on tekstistä puheeksi -näyte sovelluksesta Offline Translator.</string>+ <!-- translation -->+ <string name="translation_error">Käännösvirhe: %1$s</string>+ <!-- download errors -->+ <string name="download_failed_core">%1$s lataus epäonnistui</string>+ <string name="download_failed_ocr">%1$s tekstintunnistuksen lataus epäonnistui</string>+ <string name="download_failed_ocr_batch">Tekstintunnistuksen erälataus epäonnistui</string>+ <string name="download_failed_dictionary">%1$s sanakirjan lataus epäonnistui</string>+ <string name="download_failed_tts">%1$s äänen lataus epäonnistui</string>+ <string name="download_failed_adblock">Adblock-lataus epäonnistui</string>+ <string name="download_failed_repair">Korjauksen lataus epäonnistui</string>+ <string name="download_catalog_unavailable">Luettelo ei ole saatavilla</string>+ <string name="download_catalog_save_failed">Luettelon tallentaminen epäonnistui</string>+ <string name="download_unknown_error">Tuntematon virhe</string>+ <string name="download_catalog_failed">Luettelon lataaminen epäonnistui: %1$s</string>+ <!-- assistant overlay status -->+ <string name="assistant_invoke_prompt">Käynnistä tämä avustaja tekstin päällä kääntääksesi sen</string>+ <string name="assistant_collecting_context">Kerätään näytön sisältöä…</string>+ <string name="assistant_screenshot_disabled">Kuvakaappausten käyttö on poistettu käytöstä tältä avustajalta. Ota se käyttöön järjestelmän avustaja-asetuksissa.</string>+ <string name="assistant_no_screen_data">Näytön tietoja ei vastaanotettu. Ota \'Käytä kuvakaappausta\' käyttöön tälle avustajalle.</string>+ <string name="assistant_no_screenshot">Tämä sovellus ei tarjonnut kuvakaappausta.</string>+ <string name="assistant_set_source_ocr">Aseta oletuslähdekieli tekstintunnistukselle.</string>+ <string name="assistant_langs_not_ready">Käännöskielet eivät ole vielä valmiina. Yritä uudelleen.</string>+ <string name="assistant_ocr_failed">Tekstintunnistus epäonnistui</string>+ <string name="ocr_models_missing">Tekstintunnistusmallit puuttuvat. Avaa sovelluksessa kielten hallinta korjataksesi ne.</string>+ <string name="assistant_set_source_live">Aseta oletuslähdekieli asetuksissa käyttääksesi reaaliaikaista näytön kääntämistä.</string>+ <!-- migration gate -->+ <string name="migration_updating_speech_models">Päivitetään puhemalleja</string>+ <string name="migration_accept_convert">Hyväksy ja muunna</string>+ <string name="migration_delete_all">Poista sen sijaan kaikki</string>+ <string name="migration_converting">Muunnetaan %1$d / %2$d</string>+ <string name="migration_optimizing">Optimoidaan malleja</string>+ <plurals name="migration_convert_prompt">+ <item quantity="one">Sinulla on %1$d tekstistä puheeksi -malli muunnettavana uuteen muotoon. Se kestää noin %2$d sekuntia. Säästät %3$.0f Mt levytilaa.</item>+ <item quantity="other">Sinulla on %1$d tekstistä puheeksi -mallia muunnettavana uuteen muotoon. Se kestää noin %2$d sekuntia. Säästät %3$.0f Mt levytilaa.</item>+ </plurals>+ <!-- document translation notification + progress -->+ <string name="doc_notif_translating">Käännetään tiedostoa</string>+ <string name="doc_notif_translated">Tiedosto käännetty</string>+ <string name="doc_notif_phase_text">Teksti %1$d%%</string>+ <string name="doc_notif_phase_images">Kuvat %1$d/%2$d</string>+ <string name="doc_notif_phase_raster">Bittikarttasivut %1$d/%2$d</string>+ <string name="doc_notif_channel_name">Asiakirjan kääntäminen</string>+ <string name="doc_notif_channel_desc">Näyttää edistymisen asiakirjoja käännettäessä</string>+ <string name="doc_progress_preparing">Valmistellaan tiedostoa</string>+ <string name="doc_progress_translating">Käännetään</string>+ <string name="doc_progress_translated">Tiedosto käännetty</string>+ <string name="doc_progress_saving">Tallennetaan käännettyä tiedostoa</string>+ <string name="doc_translation_failed">Asiakirjan kääntäminen epäonnistui</string>+ <string name="doc_url_unsupported">Lataa asiakirja ja avaa se sen sijaan sovelluksella</string>+ <!-- document configure sheet -->+ <string name="document_wrap_columns">Rivitä %1$d sarakkeen kohdalla</string>+ <string name="document_translate_pdf_images">Käännä PDF:n kuvat</string>+ <string name="layout_preserve">Säilytä rivinvaihdot</string>+ <string name="layout_reflow">Muotoile uudelleen kappaleiksi</string>+ <string name="layout_reflow_wrap">Muotoile uudelleen ja rivitä</string>+ <!-- common (additional) -->+ <string name="common_open">Avaa</string>+ <string name="common_close">Sulje</string>+ <string name="common_save">Tallenna</string>+ <!-- translator app -->+ <string name="translator_translated_file">Käännetty tiedosto: %1$s</string>+ <string name="translator_document_saved">Asiakirja tallennettu</string>+ <string name="translator_document_save_failed">Asiakirjan tallentaminen epäonnistui</string>+ <string name="translator_audio_playback_failed">Äänen toisto epäonnistui: %1$s</string>+ <string name="translator_no_app_to_open">Tämän tiedoston avaamiseen ei löytynyt sovellusta</string>+ <!-- document alignment -->+ <string name="docalign_decode_failed">Kuvaa ei voi purkaa.</string>+ <string name="docalign_detecting">Tunnistetaan kulmia…</string>+ <string name="docalign_redetecting">Tunnistetaan uudelleen…</string>+ <string name="docalign_help">Tarkka reunaviiva asiakirjan ympärillä parantaa tunnistuksen laatua. On tärkeää, että viivat ovat yhdensuuntaisia tekstin kanssa.\n\nZoomaaminen tai panorointi saa algoritmin yleensä tunnistamaan asiakirjan automaattisesti, mutta voit silti säätää sitä manuaalisesti, jos sitä ei löydy.</string>+ <!-- how to use -->+ <string name="howto_section_other_apps">Muista sovelluksista</string>+ <string name="howto_share_title">Jaa kääntääksesi</string>+ <string name="howto_share_body">Jaa tekstiä, linkkejä tai kuvia mistä tahansa sovelluksesta kääntääksesi ne.</string>+ <string name="howto_copy_title">Käännä poistumatta muista sovelluksista</string>+ <string name="howto_copy_body">Valitse tekstiä missä tahansa ja napauta sitten \"Käännä\" kopiointityökalurivillä nähdäksesi käännöksen pienessä ponnahdusikkunassa.</string>+ <string name="howto_section_in_app">Sovelluksen sisällä</string>+ <string name="howto_docs_title">Käännä asiakirjoja</string>+ <string name="howto_docs_body">Avaa Asiakirjat-välilehti kääntääksesi EPUB-, PDF- ja TXT-tiedostoja.</string>+ <string name="howto_dict_title">Sanakirjahaku</string>+ <string name="howto_dict_body">Paina pitkään mitä tahansa käännöksen sanaa nähdäksesi sen määritelmän. Tiedot peräisin Wiktionarysta.</string>+ <string name="howto_voice_title">Vaihda ääntä tai nopeutta</string>+ <string name="howto_voice_body">Paina pitkään toistopainiketta valitaksesi eri äänen tai säätääksesi toistonopeutta.</string>+ <!-- feature row labels -->+ <string name="feature_translation">Käännös</string>+ <string name="feature_dictionary">Sanakirja</string>+ <string name="feature_tts">Ääni</string>+ <!-- misc -->+ <string name="main_input_placeholder">Kirjoita tekstiä</string>+ <string name="aidl_target_unavailable">Kohdekieli ei ole saatavilla</string>+ <string name="voice_section_downloaded">LADATTU</string>+ <string name="voice_section_available">SAATAVILLA</string>+ <string name="detected_translate_from">Käännä kielestä</string>+ <string name="detected_missing_language">Kieli puuttuu</string>+ <string name="langmgr_ocr_upgrade_available">Parannettu tekstintunnistusmalli on saatavilla.</string>+</resources>diff --git a/OCR-translation/src/main/res/values-fr/strings.xml b/OCR-translation/src/main/res/values-fr/strings.xmlnew file mode 100644index 0000000..96add02--- /dev/null+++ b/OCR-translation/src/main/res/values-fr/strings.xml@@ -0,0 +1,217 @@+<?xml version="1.0" encoding="utf-8"?>+<resources>+ <string name="stop">Arrêter</string>+ <string name="pause">Pause</string>+ <string name="resume">Reprendre</string>+ <string name="region_select_menu">Définir la zone de traduction</string>+ <string name="screen_translate_needs_source">Précisez la langue source</string>+ <string name="live_tile_label">Traduire l\'écran en direct</string>+ <string name="translate_text">Traduire</string>+ <string name="translate_link">Traduire le lien</string>+ <string name="accessibility_service_description">Activez ce service pour traduire le texte à l\'écran. Touchez le bouton de traduction flottant pour traduire l\'écran actuel, ou démarrez une traduction d\'écran en direct.</string>+ <string name="tap_to_translate_title">Traduction rapide activée</string>+ <string name="tap_to_translate_body">Touchez pour ouvrir la fenêtre du traducteur</string>+ <string name="tap_to_translate_channel">Traduction rapide</string>+ <string name="tap_to_translate_channel_description">Notification permanente pour un accès rapide à la fenêtre du traducteur</string>+ <string name="quick_tile_label">Traduire</string>+ <!-- common -->+ <string name="common_ok">OK</string>+ <string name="common_cancel">Annuler</string>+ <string name="common_done">Terminé</string>+ <string name="common_grant">Autoriser</string>+ <string name="common_manage">Gérer</string>+ <!-- settings -->+ <string name="settings_title">Paramètres</string>+ <string name="settings_languages">Langues</string>+ <string name="settings_language_packs">Packs de langues</string>+ <string name="settings_general">Général</string>+ <string name="settings_font_size">Taille de police</string>+ <string name="settings_font_sample">Ceci est un exemple de texte</string>+ <string name="settings_tap_notification">Notification de traduction rapide</string>+ <string name="settings_tap_notification_desc">Notification permanente qui ouvre la fenêtre.</string>+ <string name="settings_web_translator">Traducteur web</string>+ <string name="settings_clear_browsing">Effacer les données de navigation à la fermeture</string>+ <string name="settings_clear_browsing_desc">Supprime les cookies, le cache et le stockage local.</string>+ <string name="settings_tts_section">Synthèse vocale</string>+ <string name="settings_tts_read_urls_hashtags">Lire les URL et les hashtags</string>+ <string name="settings_popup_settings">Fenêtre contextuelle</string>+ <string name="settings_popup_desc">La fenêtre apparaît lorsque vous choisissez \'Traduire\' dans le menu de sélection de texte</string>+ <string name="settings_hide_input">Masquer la saisie</string>+ <string name="settings_popup_position">Position de la fenêtre</string>+ <string name="settings_popup_size">Taille de la fenêtre : %1$d%%</string>+ <string name="settings_screen_translation">Traduction d\'écran</string>+ <string name="settings_screen_translation_desc">Traduisez le texte directement par-dessus les autres applis.</string>+ <string name="settings_floating_button">Bouton toujours visible</string>+ <string name="settings_floating_button_desc">Nécessite le rôle d\'accessibilité</string>+ <string name="settings_shortcut">Traduire l\'écran via un raccourci</string>+ <string name="settings_shortcut_desc">Appui long sur accueil ou marche pour déclencher</string>+ <string name="settings_on_shortcut">À l\'activation du raccourci</string>+ <string name="settings_ocr">Images</string>+ <string name="settings_background_mode">Remplacer le texte par</string>+ <string name="settings_min_confidence">Confiance min. : %1$d%%</string>+ <string name="settings_max_image_size">Taille max. d\'image : %1$dpx</string>+ <string name="settings_advanced">Avancé</string>+ <string name="settings_catalog_url">URL du catalogue</string>+ <string name="settings_external_storage">Utiliser le stockage externe</string>+ <string name="settings_disable_autodetect">Désactiver la détection automatique de la langue</string>+ <string name="settings_translit_output">Afficher la translittération du texte traduit</string>+ <string name="settings_translit_input">Afficher la translittération du texte d\'origine</string>+ <string name="settings_translit_japanese_spaces">Ajouter des espaces pour la translittération du japonais</string>+ <string name="settings_translate_pdf_images">Traduire les images dans les PDF</string>+ <string name="settings_camera_live_default">Traduire la caméra en direct par défaut</string>+ <string name="settings_register_browser">S\'enregistrer comme navigateur</string>+ <string name="settings_register_browser_desc">Proposer de traduire les liens provenant d\'autres applis.</string>+ <string name="settings_external_storage_perm_title">Autorisation de stockage externe</string>+ <string name="settings_about">À propos</string>+ <string name="settings_version">Version %1$s</string>+ <string name="settings_no_languages_available">Aucune langue disponible</string>+ <string name="settings_default_from">Langue \'source\' par défaut</string>+ <string name="settings_default_to">Langue \'cible\' par défaut</string>+ <string name="settings_adblock_support">Blocage des publicités</string>+ <string name="settings_about_get_help">Obtenir de l\'aide / signaler un problème</string>+ <string name="settings_logs_copied">Journaux de l\'app copiés dans le presse-papiers</string>+ <string name="settings_about_support">Soutenir le développement</string>+ <string name="settings_external_storage_perm_body">Pour stocker les fichiers de traduction dans votre dossier Documents, cette appli a besoin d\'accéder à la gestion de tous les fichiers.\nVous serez dirigé vers les Paramètres où vous pourrez accorder l\'autorisation \'Autoriser l\'accès pour gérer tous les fichiers\'.</string>+ <!-- language manager / setup / how-to -->+ <string name="langmgr_voices">Voix</string>+ <string name="langmgr_default">PAR DÉFAUT</string>+ <string name="langmgr_filter">Filtrer les langues</string>+ <string name="langmgr_delete_shared_title">Supprimer le dictionnaire partagé ?</string>+ <string name="langmgr_delete_shared_body">Ce dictionnaire est partagé avec %1$s.\nLe supprimer le retirera pour toutes ces langues.</string>+ <string name="langmgr_download_size">Télécharger %1$s</string>+ <string name="langmgr_repair_needed">Certaines fonctionnalités téléchargées ont des fichiers manquants et ne fonctionneront pas tant qu\'elles ne sont pas réparées.</string>+ <string name="langmgr_repair_size">Réparer %1$s</string>+ <string name="nolang_title">Configuration des langues</string>+ <string name="nolang_prompt">Téléchargez des packs de langues pour commencer à traduire</string>+ <string name="howto_title">Comment utiliser</string>+ <!-- image capture / voice / dictionary / language selector -->+ <string name="image_no_crop_remote">Les images distantes ne peuvent pas être recadrées directement</string>+ <string name="image_open_failed">Échec de l\'ouverture du fichier</string>+ <string name="image_source_screen">Écran</string>+ <string name="image_source_document">Document</string>+ <string name="image_source_photos">Photos</string>+ <string name="image_source_gallery">Galerie</string>+ <string name="image_source_camera">Caméra</string>+ <string name="voice_playback_speed">Vitesse de lecture</string>+ <string name="voice_label">Voix</string>+ <string name="voice_default">Voix par défaut</string>+ <string name="langsel_auto">✨ Auto</string>+ <string name="dict_also_as">Aussi comme :</string>+ <!-- camera / browser / screen translate -->+ <string name="camera_permission_rationale">L\'autorisation de la caméra est nécessaire pour la traduction en direct.</string>+ <string name="camera_need_ocr_models">Vous devez télécharger les modèles de reconnaissance de texte pour cette langue</string>+ <string name="browser_no_source_language">Aucune langue source disponible. Installez-en une depuis l\'écran principal, ou définissez une langue source par défaut dans les paramètres.</string>+ <string name="browser_reader_unavailable">Mode lecture indisponible pour cette page</string>+ <string name="browser_translate_image">Traduire l\'image</string>+ <string name="screen_translating_notification">Traduction de l\'écran</string>+ <!-- enums -->+ <string name="align_top">Haut</string>+ <string name="align_middle">Milieu</string>+ <string name="align_bottom">Bas</string>+ <string name="assistant_action_still_image">Traduire une fois</string>+ <string name="assistant_action_live_screen">Démarrer la traduction en direct</string>+ <string name="background_mode_white_on_black">Blanc sur noir</string>+ <string name="background_mode_black_on_white">Noir sur blanc</string>+ <string name="background_mode_auto_detect">Couleurs initiales de l\'image</string>+ <!-- tts / speech errors -->+ <string name="tts_nothing_to_speak">Rien à lire</string>+ <string name="tts_catalog_unavailable">Catalogue indisponible</string>+ <string name="tts_no_voice">Aucune voix installée pour %1$s</string>+ <string name="tts_synthesis_failed">Échec de la synthèse vocale pour %1$s</string>+ <string name="tts_sample_fallback">Ceci est un échantillon de synthèse vocale d\'Offline Translator.</string>+ <!-- translation -->+ <string name="translation_error">Erreur de traduction : %1$s</string>+ <!-- download errors -->+ <string name="download_failed_core">Échec du téléchargement de %1$s</string>+ <string name="download_failed_ocr">Échec du téléchargement de la reconnaissance de texte pour %1$s</string>+ <string name="download_failed_ocr_batch">Échec du téléchargement du lot de reconnaissance de texte</string>+ <string name="download_failed_dictionary">Échec du téléchargement du dictionnaire %1$s</string>+ <string name="download_failed_tts">Échec du téléchargement de la voix pour %1$s</string>+ <string name="download_failed_adblock">Échec du téléchargement d\'Adblock</string>+ <string name="download_failed_repair">Échec du téléchargement de réparation</string>+ <string name="download_catalog_unavailable">Catalogue indisponible</string>+ <string name="download_catalog_save_failed">Échec de l\'enregistrement du catalogue</string>+ <string name="download_unknown_error">Erreur inconnue</string>+ <string name="download_catalog_failed">Échec du téléchargement du catalogue : %1$s</string>+ <!-- assistant overlay status -->+ <string name="assistant_invoke_prompt">Lancez cet assistant par-dessus du texte pour le traduire</string>+ <string name="assistant_collecting_context">Collecte du contexte de l\'écran…</string>+ <string name="assistant_screenshot_disabled">L\'accès aux captures d\'écran est désactivé pour cet assistant. Activez-le dans les paramètres de l\'assistant système.</string>+ <string name="assistant_no_screen_data">Aucune donnée d\'écran reçue. Activez \'Utiliser la capture d\'écran\' pour cet assistant.</string>+ <string name="assistant_no_screenshot">Cette appli n\'a pas fourni de capture d\'écran.</string>+ <string name="assistant_set_source_ocr">Définissez une langue source par défaut pour la reconnaissance de texte.</string>+ <string name="assistant_langs_not_ready">Les langues de traduction ne sont pas encore prêtes. Réessayez.</string>+ <string name="assistant_ocr_failed">Échec de la reconnaissance de texte</string>+ <string name="ocr_models_missing">Les modèles de reconnaissance de texte sont manquants. Ouvrez Gérer les langues dans l\'application pour réparer.</string>+ <string name="assistant_set_source_live">Définissez une langue source par défaut dans les Paramètres pour utiliser la traduction d\'écran en direct.</string>+ <!-- migration gate -->+ <string name="migration_updating_speech_models">Mise à jour des modèles vocaux</string>+ <string name="migration_accept_convert">Accepter et convertir</string>+ <string name="migration_delete_all">Tout supprimer à la place</string>+ <string name="migration_converting">Conversion de %1$d sur %2$d</string>+ <string name="migration_optimizing">Optimisation des modèles</string>+ <plurals name="migration_convert_prompt">+ <item quantity="one">Vous avez %1$d modèle de synthèse vocale à convertir vers un nouveau format. Cela prendra environ %2$d secondes. Vous économiserez %3$.0f Mo d\'espace disque.</item>+ <item quantity="other">Vous avez %1$d modèles de synthèse vocale à convertir vers un nouveau format. Cela prendra environ %2$d secondes. Vous économiserez %3$.0f Mo d\'espace disque.</item>+ </plurals>+ <!-- document translation notification + progress -->+ <string name="doc_notif_translating">Traduction du fichier</string>+ <string name="doc_notif_translated">Fichier traduit</string>+ <string name="doc_notif_phase_text">Texte %1$d%%</string>+ <string name="doc_notif_phase_images">Images %1$d/%2$d</string>+ <string name="doc_notif_phase_raster">Pages bitmap %1$d/%2$d</string>+ <string name="doc_notif_channel_name">Traduction de documents</string>+ <string name="doc_notif_channel_desc">Affiche la progression pendant la traduction des documents</string>+ <string name="doc_progress_preparing">Préparation du fichier</string>+ <string name="doc_progress_translating">Traduction en cours</string>+ <string name="doc_progress_translated">Fichier traduit</string>+ <string name="doc_progress_saving">Enregistrement du fichier traduit</string>+ <string name="doc_translation_failed">Échec de la traduction du document</string>+ <string name="doc_url_unsupported">Téléchargez le document et ouvrez-le avec l\'appli à la place</string>+ <!-- document configure sheet -->+ <string name="document_wrap_columns">Retour à la ligne à %1$d colonnes</string>+ <string name="document_translate_pdf_images">Traduire les images dans le PDF</string>+ <string name="layout_preserve">Conserver les sauts de ligne</string>+ <string name="layout_reflow">Réorganiser en paragraphes</string>+ <string name="layout_reflow_wrap">Réorganiser et ajuster</string>+ <!-- common (additional) -->+ <string name="common_open">Ouvrir</string>+ <string name="common_close">Fermer</string>+ <string name="common_save">Enregistrer</string>+ <!-- translator app -->+ <string name="translator_translated_file">Fichier traduit : %1$s</string>+ <string name="translator_document_saved">Document enregistré</string>+ <string name="translator_document_save_failed">Échec de l\'enregistrement du document</string>+ <string name="translator_audio_playback_failed">Échec de la lecture audio : %1$s</string>+ <string name="translator_no_app_to_open">Aucune appli trouvée pour ouvrir ce fichier</string>+ <!-- document alignment -->+ <string name="docalign_decode_failed">Impossible de décoder l\'image.</string>+ <string name="docalign_detecting">Détection des coins…</string>+ <string name="docalign_redetecting">Nouvelle détection…</string>+ <string name="docalign_help">Un périmètre précis autour du document améliore la qualité de la reconnaissance. Il est important que les lignes soient parallèles au texte.\n\nLe zoom ou le déplacement permet généralement à l\'algorithme de détecter automatiquement le document, mais vous pouvez toujours ajuster manuellement s\'il n\'est pas trouvé.</string>+ <!-- how to use -->+ <string name="howto_section_other_apps">Depuis d\'autres applis</string>+ <string name="howto_share_title">Partager pour traduire</string>+ <string name="howto_share_body">Partagez du texte, des liens ou des images depuis n\'importe quelle appli pour les traduire.</string>+ <string name="howto_copy_title">Traduire sans quitter les autres applis</string>+ <string name="howto_copy_body">Sélectionnez du texte n\'importe où, puis touchez \"Traduire\" dans la barre d\'outils de copie pour voir la traduction dans une fenêtre compacte.</string>+ <string name="howto_section_in_app">Dans l\'appli</string>+ <string name="howto_docs_title">Traduire des documents et images</string>+ <string name="howto_docs_body">Ouvrez l\'onglet Documents pour traduire des images ou des fichiers EPUB, PDF et TXT.</string>+ <string name="howto_dict_title">Recherche dans le dictionnaire</string>+ <string name="howto_dict_body">Appui long sur un mot d\'une traduction pour voir sa définition. Données issues de Wiktionary.</string>+ <string name="howto_voice_title">Changer de voix ou de vitesse</string>+ <string name="howto_voice_body">Appui long sur le bouton de lecture pour choisir une autre voix ou ajuster la vitesse de lecture.</string>+ <!-- feature row labels -->+ <string name="feature_translation">Traduction</string>+ <string name="feature_dictionary">Dictionnaire</string>+ <string name="feature_tts">Voix</string>+ <!-- misc -->+ <string name="main_input_placeholder">Saisissez du texte</string>+ <string name="aidl_target_unavailable">Langue cible non disponible</string>+ <string name="voice_section_downloaded">TÉLÉCHARGÉ</string>+ <string name="voice_section_available">DISPONIBLE</string>+ <string name="detected_translate_from">Traduire depuis</string>+ <string name="detected_missing_language">Langue manquante</string>+ <string name="langmgr_ocr_upgrade_available">Un modèle de détection de texte amélioré est disponible.</string>+</resources>diff --git a/OCR-translation/src/main/res/values-gu/strings.xml b/OCR-translation/src/main/res/values-gu/strings.xmlnew file mode 100644index 0000000..b83c644--- /dev/null+++ b/OCR-translation/src/main/res/values-gu/strings.xml@@ -0,0 +1,217 @@+<?xml version="1.0" encoding="utf-8"?>+<resources>+ <string name="stop">બંધ કરો</string>+ <string name="pause">થોભો</string>+ <string name="resume">ફરી શરૂ કરો</string>+ <string name="region_select_menu">અનુવાદનો વિસ્તાર નક્કી કરો</string>+ <string name="screen_translate_needs_source">કઈ ભાષામાંથી અનુવાદ કરવો એ જણાવો</string>+ <string name="live_tile_label">સ્ક્રીન લાઇવ અનુવાદ કરો</string>+ <string name="translate_text">અનુવાદ કરો</string>+ <string name="translate_link">લિંકનો અનુવાદ કરો</string>+ <string name="accessibility_service_description">સ્ક્રીન પરના લખાણનો અનુવાદ કરવા આ સેવા ચાલુ કરો. હાલની સ્ક્રીનનો અનુવાદ કરવા ફ્લોટિંગ અનુવાદ બટન દબાવો, અથવા લાઇવ સ્ક્રીન અનુવાદ શરૂ કરો.</string>+ <string name="tap_to_translate_title">ઝડપી અનુવાદ ચાલુ છે</string>+ <string name="tap_to_translate_body">અનુવાદક પોપઅપ ખોલવા દબાવો</string>+ <string name="tap_to_translate_channel">ઝડપી અનુવાદ</string>+ <string name="tap_to_translate_channel_description">અનુવાદક પોપઅપ ઝડપથી ખોલવા માટેનું કાયમી નોટિફિકેશન</string>+ <string name="quick_tile_label">અનુવાદ કરો</string>+ <!-- common -->+ <string name="common_ok">OK</string>+ <string name="common_cancel">રદ કરો</string>+ <string name="common_done">થઈ ગયું</string>+ <string name="common_grant">પરવાનગી આપો</string>+ <string name="common_manage">મેનેજ કરો</string>+ <!-- settings -->+ <string name="settings_title">સેટિંગ્સ</string>+ <string name="settings_languages">ભાષાઓ</string>+ <string name="settings_language_packs">ભાષા પૅક</string>+ <string name="settings_general">સામાન્ય</string>+ <string name="settings_font_size">ફોન્ટ સાઇઝ</string>+ <string name="settings_font_sample">આ થોડું ઉદાહરણ માટેનું લખાણ છે</string>+ <string name="settings_tap_notification">ઝડપી અનુવાદ નોટિફિકેશન</string>+ <string name="settings_tap_notification_desc">પોપઅપ ખોલતું કાયમી નોટિફિકેશન.</string>+ <string name="settings_web_translator">વેબ અનુવાદક</string>+ <string name="settings_clear_browsing">બંધ કરતી વખતે બ્રાઉઝિંગ ડેટા સાફ કરો</string>+ <string name="settings_clear_browsing_desc">કૂકીઝ, કૅશ અને લોકલ સ્ટોરેજ ડિલીટ કરે છે.</string>+ <string name="settings_tts_section">ટેક્સ્ટ થી સ્પીચ</string>+ <string name="settings_tts_read_urls_hashtags">URL અને હૅશટૅગ વાંચો</string>+ <string name="settings_popup_settings">પોપઅપ</string>+ <string name="settings_popup_desc">લખાણ પસંદ કરવાના મેનૂમાંથી \'અનુવાદ કરો\' પસંદ કરો ત્યારે પોપઅપ દેખાય છે</string>+ <string name="settings_hide_input">ઇનપુટ છુપાવો</string>+ <string name="settings_popup_position">પોપઅપ સ્થાન</string>+ <string name="settings_popup_size">પોપઅપ સાઇઝ: %1$d%%</string>+ <string name="settings_screen_translation">સ્ક્રીન અનુવાદ</string>+ <string name="settings_screen_translation_desc">બીજી ઍપ્સની ઉપર સીધેસીધો લખાણનો અનુવાદ કરો.</string>+ <string name="settings_floating_button">હંમેશાં દેખાતું બટન</string>+ <string name="settings_floating_button_desc">ઍક્સેસિબિલિટી પરવાનગી જરૂરી છે</string>+ <string name="settings_shortcut">શૉર્ટકટથી સ્ક્રીન અનુવાદ કરો</string>+ <string name="settings_shortcut_desc">શરૂ કરવા હોમ કે પાવર બટન દબાવી રાખો</string>+ <string name="settings_on_shortcut">શૉર્ટકટ વાપરો ત્યારે</string>+ <string name="settings_ocr">ઇમેજ</string>+ <string name="settings_background_mode">લખાણ આનાથી બદલો</string>+ <string name="settings_min_confidence">ઓછામાં ઓછી ખાતરી: %1$d%%</string>+ <string name="settings_max_image_size">વધુમાં વધુ ઇમેજ સાઇઝ: %1$dpx</string>+ <string name="settings_advanced">એડવાન્સ્ડ</string>+ <string name="settings_catalog_url">કૅટલૉગ URL</string>+ <string name="settings_external_storage">એક્સટર્નલ સ્ટોરેજ વાપરો</string>+ <string name="settings_disable_autodetect">ભાષા આપમેળે ઓળખવાનું બંધ કરો</string>+ <string name="settings_translit_output">અનુવાદ કરેલા લખાણનું લિપ્યંતર બતાવો</string>+ <string name="settings_translit_input">મૂળ લખાણનું લિપ્યંતર બતાવો</string>+ <string name="settings_translit_japanese_spaces">જાપાનીઝ લિપ્યંતરમાં જગ્યા ઉમેરો</string>+ <string name="settings_translate_pdf_images">PDF માંની ઇમેજનો અનુવાદ કરો</string>+ <string name="settings_camera_live_default">ડિફૉલ્ટ રીતે કૅમેરા લાઇવ અનુવાદ કરો</string>+ <string name="settings_register_browser">બ્રાઉઝર તરીકે રજિસ્ટર કરો</string>+ <string name="settings_register_browser_desc">બીજી ઍપ્સની લિંકનો અનુવાદ કરવાનું સૂચવો.</string>+ <string name="settings_external_storage_perm_title">એક્સટર્નલ સ્ટોરેજની પરવાનગી</string>+ <string name="settings_about">વિશે</string>+ <string name="settings_version">વર્ઝન %1$s</string>+ <string name="settings_no_languages_available">કોઈ ભાષા ઉપલબ્ધ નથી</string>+ <string name="settings_default_from">ડિફૉલ્ટ \'જેમાંથી\' ભાષા</string>+ <string name="settings_default_to">ડિફૉલ્ટ \'જેમાં\' ભાષા</string>+ <string name="settings_adblock_support">જાહેરાતો બ્લૉક કરો</string>+ <string name="settings_about_get_help">મદદ મેળવો / સમસ્યા જણાવો</string>+ <string name="settings_logs_copied">ઍપના લૉગ ક્લિપબોર્ડ પર કૉપિ થયા</string>+ <string name="settings_about_support">ડેવલપમેન્ટને સપોર્ટ કરો</string>+ <string name="settings_external_storage_perm_body">તમારા Documents ફોલ્ડરમાં અનુવાદની ફાઇલો સાચવવા માટે, આ ઍપને બધી ફાઇલો મેનેજ કરવાની પરવાનગી જોઈએ છે.\nતમને સેટિંગ્સમાં લઈ જવાશે, જ્યાં તમે \'બધી ફાઇલો મેનેજ કરવાની પરવાનગી આપો\' એ પરવાનગી આપી શકશો.</string>+ <!-- language manager / setup / how-to -->+ <string name="langmgr_voices">અવાજ</string>+ <string name="voice_section_downloaded">ડાઉનલોડ કરેલા</string>+ <string name="voice_section_available">ઉપલબ્ધ</string>+ <string name="langmgr_default">ડિફૉલ્ટ</string>+ <string name="langmgr_filter">ભાષાઓ ફિલ્ટર કરો</string>+ <string name="langmgr_ocr_upgrade_available">લખાણ ઓળખવા માટેનું વધુ સારું મૉડેલ ઉપલબ્ધ છે.</string>+ <string name="langmgr_delete_shared_title">શૅર કરેલો ડિક્શનરી ડિલીટ કરવો છે?</string>+ <string name="langmgr_delete_shared_body">આ ડિક્શનરી %1$s સાથે શૅર કરેલો છે.\nએ ડિલીટ કરવાથી એ બધા માટે ડિક્શનરી હટી જશે.</string>+ <string name="langmgr_download_size">%1$s ડાઉનલોડ કરો</string>+ <string name="langmgr_repair_needed">કેટલીક ડાઉનલોડ કરેલી સુવિધાઓની ફાઇલો ખૂટે છે અને સમારકામ ન થાય ત્યાં સુધી કામ કરશે નહીં.</string>+ <string name="langmgr_repair_size">%1$s સમારકામ કરો</string>+ <string name="nolang_title">ભાષા સેટઅપ</string>+ <string name="nolang_prompt">અનુવાદ શરૂ કરવા ભાષા પૅક ડાઉનલોડ કરો</string>+ <string name="howto_title">કેવી રીતે વાપરવું</string>+ <!-- image capture / voice / dictionary / language selector -->+ <string name="image_no_crop_remote">રિમોટ ઇમેજ સીધેસીધી ક્રૉપ કરી શકાતી નથી</string>+ <string name="image_open_failed">ફાઇલ ખોલવામાં નિષ્ફળ</string>+ <string name="image_source_screen">સ્ક્રીન</string>+ <string name="image_source_document">ડૉક્યુમેન્ટ</string>+ <string name="image_source_photos">ફોટા</string>+ <string name="image_source_gallery">ગૅલેરી</string>+ <string name="image_source_camera">કૅમેરા</string>+ <string name="voice_playback_speed">પ્લેબૅક સ્પીડ</string>+ <string name="voice_label">અવાજ</string>+ <string name="voice_default">ડિફૉલ્ટ અવાજ</string>+ <string name="langsel_auto">✨ ઑટો</string>+ <string name="dict_also_as">આ રીતે પણ:</string>+ <!-- camera / browser / screen translate -->+ <string name="camera_permission_rationale">લાઇવ અનુવાદ માટે કૅમેરાની પરવાનગી જરૂરી છે.</string>+ <string name="camera_need_ocr_models">આ ભાષા માટે તમારે લખાણ ઓળખવાનાં મૉડેલ ડાઉનલોડ કરવાં પડશે</string>+ <string name="browser_no_source_language">કોઈ સ્રોત ભાષા ઉપલબ્ધ નથી. પહેલાં મુખ્ય સ્ક્રીન પરથી એક ઇન્સ્ટૉલ કરો, અથવા સેટિંગ્સમાં ડિફૉલ્ટ સ્રોત ભાષા સેટ કરો.</string>+ <string name="browser_reader_unavailable">આ પેજ માટે રીડર મોડ ઉપલબ્ધ નથી</string>+ <string name="browser_translate_image">ઇમેજનો અનુવાદ કરો</string>+ <string name="screen_translating_notification">સ્ક્રીનનો અનુવાદ થઈ રહ્યો છે</string>+ <!-- enums -->+ <string name="align_top">ઉપર</string>+ <string name="align_middle">વચ્ચે</string>+ <string name="align_bottom">નીચે</string>+ <string name="assistant_action_still_image">એક વાર અનુવાદ કરો</string>+ <string name="assistant_action_live_screen">લાઇવ અનુવાદ શરૂ કરો</string>+ <string name="background_mode_white_on_black">કાળા પર સફેદ</string>+ <string name="background_mode_black_on_white">સફેદ પર કાળું</string>+ <string name="background_mode_auto_detect">મૂળ ઇમેજના રંગ</string>+ <!-- tts / speech errors -->+ <string name="tts_nothing_to_speak">બોલવા માટે કંઈ નથી</string>+ <string name="tts_catalog_unavailable">કૅટલૉગ ઉપલબ્ધ નથી</string>+ <string name="tts_no_voice">%1$s માટે કોઈ અવાજ ઇન્સ્ટૉલ કરેલો નથી</string>+ <string name="tts_synthesis_failed">%1$s માટે અવાજ બનાવવામાં નિષ્ફળ</string>+ <string name="tts_sample_fallback">આ Offline Translator નો અવાજનો નમૂનો છે.</string>+ <!-- translation -->+ <string name="translation_error">અનુવાદમાં ભૂલ: %1$s</string>+ <!-- download errors -->+ <string name="download_failed_core">%1$s ડાઉનલોડ નિષ્ફળ</string>+ <string name="download_failed_ocr">%1$s ની લખાણ-ઓળખ ડાઉનલોડ નિષ્ફળ</string>+ <string name="download_failed_ocr_batch">લખાણ-ઓળખનું બૅચ ડાઉનલોડ નિષ્ફળ</string>+ <string name="download_failed_dictionary">%1$s ડિક્શનરી ડાઉનલોડ નિષ્ફળ</string>+ <string name="download_failed_tts">%1$s અવાજ ડાઉનલોડ નિષ્ફળ</string>+ <string name="download_failed_adblock">જાહેરાત-બ્લૉક ડાઉનલોડ નિષ્ફળ</string>+ <string name="download_failed_repair">સમારકામ ડાઉનલોડ નિષ્ફળ</string>+ <string name="download_catalog_unavailable">કૅટલૉગ ઉપલબ્ધ નથી</string>+ <string name="download_catalog_save_failed">કૅટલૉગ સાચવવામાં નિષ્ફળ</string>+ <string name="download_unknown_error">અજાણી ભૂલ</string>+ <string name="download_catalog_failed">કૅટલૉગ ડાઉનલોડ કરવામાં નિષ્ફળ: %1$s</string>+ <!-- assistant overlay status -->+ <string name="assistant_invoke_prompt">લખાણનો અનુવાદ કરવા તેની ઉપર આ આસિસ્ટન્ટ ચાલુ કરો</string>+ <string name="assistant_collecting_context">સ્ક્રીનની માહિતી ભેગી થઈ રહી છે…</string>+ <string name="assistant_screenshot_disabled">આ આસિસ્ટન્ટ માટે સ્ક્રીનશૉટની ઍક્સેસ બંધ છે. એ સિસ્ટમ આસિસ્ટન્ટ સેટિંગ્સમાં ચાલુ કરો.</string>+ <string name="assistant_no_screen_data">સ્ક્રીનનો કોઈ ડેટા મળ્યો નથી. આ આસિસ્ટન્ટ માટે \'સ્ક્રીનશૉટ વાપરો\' ચાલુ કરો.</string>+ <string name="assistant_no_screenshot">આ ઍપે કોઈ સ્ક્રીનશૉટ આપ્યો નથી.</string>+ <string name="assistant_set_source_ocr">ઇમેજમાંથી લખાણ ઓળખવા માટે ડિફૉલ્ટ સ્રોત ભાષા સેટ કરો.</string>+ <string name="assistant_langs_not_ready">અનુવાદની ભાષાઓ હજી તૈયાર નથી. ફરી પ્રયત્ન કરો.</string>+ <string name="assistant_ocr_failed">લખાણ ઓળખવામાં નિષ્ફળ</string>+ <string name="ocr_models_missing">લખાણ ઓળખવાના મૉડલ ખૂટે છે. સમારકામ માટે એપમાં ભાષા વ્યવસ્થાપન ખોલો.</string>+ <string name="assistant_set_source_live">લાઇવ સ્ક્રીન અનુવાદ વાપરવા સેટિંગ્સમાં ડિફૉલ્ટ સ્રોત ભાષા સેટ કરો.</string>+ <!-- migration gate -->+ <string name="migration_updating_speech_models">અવાજનાં મૉડેલ અપડેટ થઈ રહ્યાં છે</string>+ <string name="migration_accept_convert">સ્વીકારો અને કન્વર્ટ કરો</string>+ <string name="migration_delete_all">તેના બદલે બધું ડિલીટ કરો</string>+ <string name="migration_converting">%2$d માંથી %1$d કન્વર્ટ થઈ રહ્યું છે</string>+ <string name="migration_optimizing">મૉડેલ ઑપ્ટિમાઇઝ થઈ રહ્યાં છે</string>+ <plurals name="migration_convert_prompt">+ <item quantity="one">તમારી પાસે %1$d અવાજનું મૉડેલ નવા ફૉર્મેટમાં કન્વર્ટ કરવાનું છે. એમાં આશરે %2$d સેકન્ડ લાગશે. તમે %3$.0f MB ડિસ્ક જગ્યા બચાવશો.</item>+ <item quantity="other">તમારી પાસે %1$d અવાજનાં મૉડેલ નવા ફૉર્મેટમાં કન્વર્ટ કરવાનાં છે. એમાં આશરે %2$d સેકન્ડ લાગશે. તમે %3$.0f MB ડિસ્ક જગ્યા બચાવશો.</item>+ </plurals>+ <!-- document translation notification + progress -->+ <string name="doc_notif_translating">ફાઇલનો અનુવાદ થઈ રહ્યો છે</string>+ <string name="doc_notif_translated">ફાઇલનો અનુવાદ થઈ ગયો</string>+ <string name="doc_notif_phase_text">લખાણ %1$d%%</string>+ <string name="doc_notif_phase_images">ઇમેજ %1$d/%2$d</string>+ <string name="doc_notif_phase_raster">બિટમૅપ પાનાં %1$d/%2$d</string>+ <string name="doc_notif_channel_name">ડૉક્યુમેન્ટ અનુવાદ</string>+ <string name="doc_notif_channel_desc">ડૉક્યુમેન્ટનો અનુવાદ થાય ત્યારે પ્રગતિ બતાવે છે</string>+ <string name="doc_progress_preparing">ફાઇલ તૈયાર થઈ રહી છે</string>+ <string name="doc_progress_translating">અનુવાદ થઈ રહ્યો છે</string>+ <string name="doc_progress_translated">ફાઇલનો અનુવાદ થઈ ગયો</string>+ <string name="doc_progress_saving">અનુવાદ કરેલી ફાઇલ સાચવાઈ રહી છે</string>+ <string name="doc_translation_failed">ડૉક્યુમેન્ટનો અનુવાદ નિષ્ફળ</string>+ <string name="doc_url_unsupported">તેના બદલે ડૉક્યુમેન્ટ ડાઉનલોડ કરીને ઍપથી ખોલો</string>+ <!-- document configure sheet -->+ <string name="document_wrap_columns">%1$d કૉલમ પર લપેટો</string>+ <string name="document_translate_pdf_images">PDF માંની ઇમેજનો અનુવાદ કરો</string>+ <string name="layout_preserve">લાઇન બ્રેક જાળવી રાખો</string>+ <string name="layout_reflow">ફકરામાં ગોઠવો</string>+ <string name="layout_reflow_wrap">ગોઠવો અને લપેટો</string>+ <!-- common (additional) -->+ <string name="common_open">ખોલો</string>+ <string name="common_close">બંધ કરો</string>+ <string name="common_save">સાચવો</string>+ <!-- translator app -->+ <string name="translator_translated_file">અનુવાદ કરેલી ફાઇલ: %1$s</string>+ <string name="translator_document_saved">ડૉક્યુમેન્ટ સચવાયું</string>+ <string name="translator_document_save_failed">ડૉક્યુમેન્ટ સાચવવામાં નિષ્ફળ</string>+ <string name="translator_audio_playback_failed">ઑડિયો પ્લેબૅક નિષ્ફળ: %1$s</string>+ <string name="translator_no_app_to_open">આ ફાઇલ ખોલવા માટે કોઈ ઍપ મળી નથી</string>+ <!-- document alignment -->+ <string name="docalign_decode_failed">ઇમેજ ડિકોડ કરી શકાઈ નહીં.</string>+ <string name="docalign_detecting">ખૂણા શોધાઈ રહ્યા છે…</string>+ <string name="docalign_redetecting">ફરી શોધાઈ રહ્યું છે…</string>+ <string name="docalign_help">ડૉક્યુમેન્ટની ફરતે ચોક્કસ કિનારી હોય તો ઓળખ વધુ સારી થાય છે. લાઇન લખાણને સમાંતર હોય એ જરૂરી છે.\n\nઝૂમ કરવાથી કે ખસેડવાથી મોટેભાગે અલ્ગોરિધમ આપમેળે ડૉક્યુમેન્ટ પકડી લે છે, પણ ન મળે તો તમે જાતે પણ ગોઠવી શકો છો.</string>+ <!-- how to use -->+ <string name="howto_section_other_apps">બીજી ઍપ્સમાંથી</string>+ <string name="howto_share_title">શૅર કરીને અનુવાદ કરો</string>+ <string name="howto_share_body">કોઈપણ ઍપમાંથી લખાણ, લિંક કે ઇમેજ શૅર કરો અને તેનો અનુવાદ કરો.</string>+ <string name="howto_copy_title">બીજી ઍપ્સ છોડ્યા વગર અનુવાદ કરો</string>+ <string name="howto_copy_body">ગમે ત્યાં લખાણ પસંદ કરો, પછી કૉપિ ટૂલબારમાં \"અનુવાદ કરો\" દબાવો અને નાના પોપઅપમાં અનુવાદ જુઓ.</string>+ <string name="howto_section_in_app">ઍપની અંદર</string>+ <string name="howto_docs_title">ડૉક્યુમેન્ટ અને ઇમેજનો અનુવાદ કરો</string>+ <string name="howto_docs_body">ઇમેજ અથવા EPUB, PDF અને TXT ફાઇલોનો અનુવાદ કરવા Documents ટૅબ ખોલો.</string>+ <string name="howto_dict_title">ડિક્શનરીમાં શોધ</string>+ <string name="howto_dict_body">અનુવાદમાંના કોઈપણ શબ્દ પર તેનો અર્થ જોવા દબાવી રાખો. ડેટા Wiktionary માંથી લીધેલો છે.</string>+ <string name="howto_voice_title">અવાજ કે સ્પીડ બદલો</string>+ <string name="howto_voice_body">બીજો અવાજ પસંદ કરવા કે પ્લેબૅક સ્પીડ બદલવા પ્લે બટન દબાવી રાખો.</string>+ <!-- feature row labels -->+ <string name="feature_translation">અનુવાદ</string>+ <string name="feature_dictionary">ડિક્શનરી</string>+ <string name="feature_tts">અવાજ</string>+ <!-- misc -->+ <string name="detected_translate_from">આમાંથી અનુવાદ કરો</string>+ <string name="detected_missing_language">ભાષા ઉપલબ્ધ નથી</string>+ <string name="main_input_placeholder">લખાણ લખો</string>+ <string name="aidl_target_unavailable">લક્ષ્ય ભાષા ઉપલબ્ધ નથી</string>+</resources>diff --git a/OCR-translation/src/main/res/values-hi/strings.xml b/OCR-translation/src/main/res/values-hi/strings.xmlnew file mode 100644index 0000000..1a1bbe3--- /dev/null+++ b/OCR-translation/src/main/res/values-hi/strings.xml@@ -0,0 +1,217 @@+<?xml version="1.0" encoding="utf-8"?>+<resources>+ <string name="stop">रोकें</string>+ <string name="pause">रुकें</string>+ <string name="resume">फिर से शुरू करें</string>+ <string name="region_select_menu">अनुवाद क्षेत्र चुनें</string>+ <string name="screen_translate_needs_source">स्रोत भाषा बताएं</string>+ <string name="live_tile_label">स्क्रीन का लाइव अनुवाद करें</string>+ <string name="translate_text">अनुवाद करें</string>+ <string name="translate_link">लिंक का अनुवाद करें</string>+ <string name="accessibility_service_description">स्क्रीन पर टेक्स्ट का अनुवाद करने के लिए यह सेवा चालू करें। मौजूदा स्क्रीन का अनुवाद करने के लिए तैरते अनुवाद बटन पर टैप करें, या लाइव स्क्रीन अनुवाद शुरू करें।</string>+ <string name="tap_to_translate_title">क्विक अनुवाद चालू है</string>+ <string name="tap_to_translate_body">अनुवादक पॉपअप खोलने के लिए टैप करें</string>+ <string name="tap_to_translate_channel">क्विक अनुवाद</string>+ <string name="tap_to_translate_channel_description">अनुवादक पॉपअप तक तुरंत पहुंच के लिए स्थायी सूचना</string>+ <string name="quick_tile_label">अनुवाद करें</string>+ <!-- common -->+ <string name="common_ok">ठीक है</string>+ <string name="common_cancel">रद्द करें</string>+ <string name="common_done">हो गया</string>+ <string name="common_grant">अनुमति दें</string>+ <string name="common_manage">प्रबंधित करें</string>+ <!-- settings -->+ <string name="settings_title">सेटिंग्स</string>+ <string name="settings_languages">भाषाएं</string>+ <string name="settings_language_packs">भाषा पैक</string>+ <string name="settings_general">सामान्य</string>+ <string name="settings_font_size">फ़ॉन्ट आकार</string>+ <string name="settings_font_sample">यह कुछ उदाहरण टेक्स्ट है</string>+ <string name="settings_tap_notification">क्विक अनुवाद सूचना</string>+ <string name="settings_tap_notification_desc">स्थायी सूचना जो पॉपअप खोलती है।</string>+ <string name="settings_web_translator">वेब अनुवादक</string>+ <string name="settings_clear_browsing">बंद करने पर ब्राउज़िंग डेटा साफ़ करें</string>+ <string name="settings_clear_browsing_desc">कुकीज़, कैश और लोकल स्टोरेज मिटाता है।</string>+ <string name="settings_tts_section">टेक्स्ट-टू-स्पीच</string>+ <string name="settings_tts_read_urls_hashtags">URL और हैशटैग पढ़ें</string>+ <string name="settings_popup_settings">पॉपअप</string>+ <string name="settings_popup_desc">टेक्स्ट चयन मेनू से \'अनुवाद करें\' चुनने पर पॉपअप दिखता है</string>+ <string name="settings_hide_input">इनपुट छिपाएं</string>+ <string name="settings_popup_position">पॉपअप की स्थिति</string>+ <string name="settings_popup_size">पॉपअप आकार: %1$d%%</string>+ <string name="settings_screen_translation">स्क्रीन अनुवाद</string>+ <string name="settings_screen_translation_desc">दूसरे ऐप्स के ऊपर सीधे टेक्स्ट का अनुवाद करें।</string>+ <string name="settings_floating_button">हमेशा चालू बटन</string>+ <string name="settings_floating_button_desc">एक्सेसिबिलिटी भूमिका जरूरी है</string>+ <string name="settings_shortcut">शॉर्टकट पर स्क्रीन अनुवाद करें</string>+ <string name="settings_shortcut_desc">चालू करने के लिए होम या पावर देर तक दबाएं</string>+ <string name="settings_on_shortcut">शॉर्टकट चलाने पर</string>+ <string name="settings_ocr">इमेज</string>+ <string name="settings_background_mode">टेक्स्ट को इससे बदलें</string>+ <string name="settings_min_confidence">न्यूनतम भरोसा: %1$d%%</string>+ <string name="settings_max_image_size">अधिकतम इमेज आकार: %1$dpx</string>+ <string name="settings_advanced">उन्नत</string>+ <string name="settings_catalog_url">कैटलॉग URL</string>+ <string name="settings_external_storage">बाहरी स्टोरेज इस्तेमाल करें</string>+ <string name="settings_disable_autodetect">अपने आप भाषा पहचान बंद करें</string>+ <string name="settings_translit_output">अनुवादित टेक्स्ट के लिए लिप्यंतरण दिखाएं</string>+ <string name="settings_translit_input">मूल टेक्स्ट के लिए लिप्यंतरण दिखाएं</string>+ <string name="settings_translit_japanese_spaces">जापानी लिप्यंतरण के लिए स्पेस जोड़ें</string>+ <string name="settings_translate_pdf_images">PDF में इमेज का अनुवाद करें</string>+ <string name="settings_camera_live_default">डिफ़ॉल्ट रूप से कैमरे का लाइव अनुवाद करें</string>+ <string name="settings_register_browser">ब्राउज़र के रूप में रजिस्टर करें</string>+ <string name="settings_register_browser_desc">दूसरे ऐप्स से लिंक का अनुवाद करने की पेशकश करें।</string>+ <string name="settings_external_storage_perm_title">बाहरी स्टोरेज अनुमति</string>+ <string name="settings_about">परिचय</string>+ <string name="settings_version">संस्करण %1$s</string>+ <string name="settings_no_languages_available">कोई भाषा उपलब्ध नहीं</string>+ <string name="settings_default_from">डिफ़ॉल्ट \'से\' भाषा</string>+ <string name="settings_default_to">डिफ़ॉल्ट \'में\' भाषा</string>+ <string name="settings_adblock_support">विज्ञापन रोकना</string>+ <string name="settings_about_get_help">मदद पाएं / समस्या बताएं</string>+ <string name="settings_logs_copied">ऐप लॉग क्लिपबोर्ड पर कॉपी किए गए</string>+ <string name="settings_about_support">विकास में सहयोग दें</string>+ <string name="settings_external_storage_perm_body">अनुवाद फ़ाइलें आपके Documents फ़ोल्डर में रखने के लिए, इस ऐप को सभी फ़ाइलें प्रबंधित करने की पहुंच चाहिए।\nआपको सेटिंग्स में ले जाया जाएगा जहां आप \'सभी फ़ाइलें प्रबंधित करने की अनुमति दें\' दे सकते हैं।</string>+ <!-- language manager / setup / how-to -->+ <string name="langmgr_voices">आवाज़ें</string>+ <string name="langmgr_default">डिफ़ॉल्ट</string>+ <string name="langmgr_filter">भाषाएं छांटें</string>+ <string name="langmgr_delete_shared_title">साझा शब्दकोश हटाएं?</string>+ <string name="langmgr_delete_shared_body">यह शब्दकोश %1$s के साथ साझा है।\nइसे हटाने पर सबके लिए यह शब्दकोश हट जाएगा।</string>+ <string name="langmgr_download_size">%1$s डाउनलोड करें</string>+ <string name="langmgr_repair_needed">कुछ डाउनलोड की गई सुविधाओं की फ़ाइलें गायब हैं और मरम्मत होने तक काम नहीं करेंगी।</string>+ <string name="langmgr_repair_size">%1$s मरम्मत करें</string>+ <string name="nolang_title">भाषा सेटअप</string>+ <string name="nolang_prompt">अनुवाद शुरू करने के लिए भाषा पैक डाउनलोड करें</string>+ <string name="howto_title">कैसे इस्तेमाल करें</string>+ <!-- image capture / voice / dictionary / language selector -->+ <string name="image_no_crop_remote">रिमोट इमेज को सीधे क्रॉप नहीं किया जा सकता</string>+ <string name="image_open_failed">फ़ाइल खोलने में विफल</string>+ <string name="image_source_screen">स्क्रीन</string>+ <string name="image_source_document">दस्तावेज़</string>+ <string name="image_source_photos">फ़ोटो</string>+ <string name="image_source_gallery">गैलरी</string>+ <string name="image_source_camera">कैमरा</string>+ <string name="voice_playback_speed">प्लेबैक गति</string>+ <string name="voice_label">आवाज़</string>+ <string name="voice_default">डिफ़ॉल्ट आवाज़</string>+ <string name="langsel_auto">✨ अपने आप</string>+ <string name="dict_also_as">इस रूप में भी:</string>+ <!-- camera / browser / screen translate -->+ <string name="camera_permission_rationale">लाइव अनुवाद के लिए कैमरा अनुमति चाहिए।</string>+ <string name="camera_need_ocr_models">इस भाषा के लिए आपको टेक्स्ट पहचान मॉडल डाउनलोड करने होंगे</string>+ <string name="browser_no_source_language">कोई स्रोत भाषा उपलब्ध नहीं। पहले मुख्य स्क्रीन से एक इंस्टॉल करें, या सेटिंग्स में डिफ़ॉल्ट स्रोत भाषा सेट करें।</string>+ <string name="browser_reader_unavailable">इस पेज के लिए रीडर मोड उपलब्ध नहीं</string>+ <string name="browser_translate_image">इमेज का अनुवाद करें</string>+ <string name="screen_translating_notification">स्क्रीन का अनुवाद हो रहा है</string>+ <!-- enums -->+ <string name="align_top">ऊपर</string>+ <string name="align_middle">बीच में</string>+ <string name="align_bottom">नीचे</string>+ <string name="assistant_action_still_image">एक बार अनुवाद करें</string>+ <string name="assistant_action_live_screen">लाइव अनुवाद शुरू करें</string>+ <string name="background_mode_white_on_black">काले पर सफ़ेद</string>+ <string name="background_mode_black_on_white">सफ़ेद पर काला</string>+ <string name="background_mode_auto_detect">रंग अपने आप पहचानें</string>+ <!-- tts / speech errors -->+ <string name="tts_nothing_to_speak">बोलने के लिए कुछ नहीं</string>+ <string name="tts_catalog_unavailable">कैटलॉग उपलब्ध नहीं</string>+ <string name="tts_no_voice">%1$s के लिए कोई आवाज़ इंस्टॉल नहीं है</string>+ <string name="tts_synthesis_failed">%1$s के लिए आवाज़ बनाना विफल रहा</string>+ <string name="tts_sample_fallback">यह Offline Translator का एक टेक्स्ट-टू-स्पीच नमूना है।</string>+ <!-- translation -->+ <string name="translation_error">अनुवाद त्रुटि: %1$s</string>+ <!-- download errors -->+ <string name="download_failed_core">%1$s डाउनलोड विफल</string>+ <string name="download_failed_ocr">%1$s टेक्स्ट पहचान डाउनलोड विफल</string>+ <string name="download_failed_ocr_batch">टेक्स्ट पहचान बैच डाउनलोड विफल</string>+ <string name="download_failed_dictionary">%1$s शब्दकोश डाउनलोड विफल</string>+ <string name="download_failed_tts">%1$s आवाज़ डाउनलोड विफल</string>+ <string name="download_failed_adblock">Adblock डाउनलोड विफल</string>+ <string name="download_failed_repair">मरम्मत डाउनलोड विफल</string>+ <string name="download_catalog_unavailable">कैटलॉग उपलब्ध नहीं</string>+ <string name="download_catalog_save_failed">कैटलॉग सहेजने में विफल</string>+ <string name="download_unknown_error">अज्ञात त्रुटि</string>+ <string name="download_catalog_failed">कैटलॉग डाउनलोड करने में विफल: %1$s</string>+ <!-- assistant overlay status -->+ <string name="assistant_invoke_prompt">किसी टेक्स्ट का अनुवाद करने के लिए उसके ऊपर इस सहायक को चलाएं</string>+ <string name="assistant_collecting_context">स्क्रीन की जानकारी इकट्ठा हो रही है…</string>+ <string name="assistant_screenshot_disabled">इस सहायक के लिए स्क्रीनशॉट पहुंच बंद है। इसे सिस्टम सहायक सेटिंग्स में चालू करें।</string>+ <string name="assistant_no_screen_data">कोई स्क्रीन डेटा नहीं मिला। इस सहायक के लिए \'स्क्रीनशॉट इस्तेमाल करें\' चालू करें।</string>+ <string name="assistant_no_screenshot">इस ऐप ने स्क्रीनशॉट नहीं दिया।</string>+ <string name="assistant_set_source_ocr">टेक्स्ट पहचान के लिए डिफ़ॉल्ट स्रोत भाषा सेट करें।</string>+ <string name="assistant_langs_not_ready">अनुवाद भाषाएं अभी तैयार नहीं हैं। फिर से कोशिश करें।</string>+ <string name="assistant_ocr_failed">टेक्स्ट पहचान विफल</string>+ <string name="ocr_models_missing">टेक्स्ट पहचान मॉडल गायब हैं। मरम्मत के लिए ऐप में भाषा प्रबंधन खोलें।</string>+ <string name="assistant_set_source_live">लाइव स्क्रीन अनुवाद इस्तेमाल करने के लिए सेटिंग्स में डिफ़ॉल्ट स्रोत भाषा सेट करें।</string>+ <!-- migration gate -->+ <string name="migration_updating_speech_models">स्पीच मॉडल अपडेट हो रहे हैं</string>+ <string name="migration_accept_convert">स्वीकार करें और बदलें</string>+ <string name="migration_delete_all">इसके बजाय सब हटाएं</string>+ <string name="migration_converting">%2$d में से %1$d बदला जा रहा है</string>+ <string name="migration_optimizing">मॉडल ऑप्टिमाइज़ हो रहे हैं</string>+ <plurals name="migration_convert_prompt">+ <item quantity="one">आपके पास नए फ़ॉर्मेट में बदलने के लिए %1$d टेक्स्ट-टू-स्पीच मॉडल है। इसमें लगभग %2$d सेकंड लगेंगे। आप %3$.0f MB डिस्क जगह बचाएंगे।</item>+ <item quantity="other">आपके पास नए फ़ॉर्मेट में बदलने के लिए %1$d टेक्स्ट-टू-स्पीच मॉडल हैं। इसमें लगभग %2$d सेकंड लगेंगे। आप %3$.0f MB डिस्क जगह बचाएंगे।</item>+ </plurals>+ <!-- document translation notification + progress -->+ <string name="doc_notif_translating">फ़ाइल का अनुवाद हो रहा है</string>+ <string name="doc_notif_translated">फ़ाइल का अनुवाद हो गया</string>+ <string name="doc_notif_phase_text">टेक्स्ट %1$d%%</string>+ <string name="doc_notif_phase_images">इमेज %1$d/%2$d</string>+ <string name="doc_notif_phase_raster">बिटमैप पेज %1$d/%2$d</string>+ <string name="doc_notif_channel_name">दस्तावेज़ अनुवाद</string>+ <string name="doc_notif_channel_desc">दस्तावेज़ों के अनुवाद के दौरान प्रगति दिखाता है</string>+ <string name="doc_progress_preparing">फ़ाइल तैयार हो रही है</string>+ <string name="doc_progress_translating">अनुवाद हो रहा है</string>+ <string name="doc_progress_translated">फ़ाइल का अनुवाद हो गया</string>+ <string name="doc_progress_saving">अनुवादित फ़ाइल सहेजी जा रही है</string>+ <string name="doc_translation_failed">दस्तावेज़ अनुवाद विफल</string>+ <string name="doc_url_unsupported">दस्तावेज़ डाउनलोड करें और उसे इस ऐप से खोलें</string>+ <!-- document configure sheet -->+ <string name="document_wrap_columns">%1$d कॉलम पर लपेटें</string>+ <string name="document_translate_pdf_images">PDF में इमेज का अनुवाद करें</string>+ <string name="layout_preserve">लाइन ब्रेक बनाए रखें</string>+ <string name="layout_reflow">पैराग्राफ़ में फिर से व्यवस्थित करें</string>+ <string name="layout_reflow_wrap">फिर से व्यवस्थित करें और लपेटें</string>+ <!-- common (additional) -->+ <string name="common_open">खोलें</string>+ <string name="common_close">बंद करें</string>+ <string name="common_save">सहेजें</string>+ <!-- translator app -->+ <string name="translator_translated_file">अनुवादित फ़ाइल: %1$s</string>+ <string name="translator_document_saved">दस्तावेज़ सहेजा गया</string>+ <string name="translator_document_save_failed">दस्तावेज़ सहेजने में विफल</string>+ <string name="translator_audio_playback_failed">ऑडियो प्लेबैक विफल: %1$s</string>+ <string name="translator_no_app_to_open">इस फ़ाइल को खोलने के लिए कोई ऐप नहीं मिला</string>+ <!-- document alignment -->+ <string name="docalign_decode_failed">इमेज डिकोड नहीं हो सकी।</string>+ <string name="docalign_detecting">कोने पहचाने जा रहे हैं…</string>+ <string name="docalign_redetecting">फिर से पहचाना जा रहा है…</string>+ <string name="docalign_help">दस्तावेज़ के चारों ओर सटीक परिधि पहचान की गुणवत्ता बेहतर करती है। यह जरूरी है कि लाइनें टेक्स्ट के समानांतर हों।\n\nज़ूम या पैन करने से आमतौर पर एल्गोरिदम अपने आप दस्तावेज़ पकड़ लेता है, लेकिन न मिलने पर आप इसे खुद भी समायोजित कर सकते हैं।</string>+ <!-- how to use -->+ <string name="howto_section_other_apps">दूसरे ऐप्स से</string>+ <string name="howto_share_title">अनुवाद के लिए साझा करें</string>+ <string name="howto_share_body">किसी भी ऐप से टेक्स्ट, लिंक या इमेज साझा करके उनका अनुवाद करें।</string>+ <string name="howto_copy_title">दूसरे ऐप्स छोड़े बिना अनुवाद करें</string>+ <string name="howto_copy_body">कहीं भी टेक्स्ट चुनें, फिर कॉपी टूलबार में \"अनुवाद करें\" पर टैप करके अनुवाद एक छोटे पॉपअप में देखें।</string>+ <string name="howto_section_in_app">ऐप के भीतर</string>+ <string name="howto_docs_title">दस्तावेज़ों का अनुवाद करें</string>+ <string name="howto_docs_body">EPUB, PDF और TXT फ़ाइलों का अनुवाद करने के लिए Documents टैब खोलें।</string>+ <string name="howto_dict_title">शब्दकोश में देखें</string>+ <string name="howto_dict_body">किसी अनुवाद में किसी भी शब्द को देर तक दबाकर उसका अर्थ देखें। डेटा Wiktionary से लिया गया है।</string>+ <string name="howto_voice_title">आवाज़ या गति बदलें</string>+ <string name="howto_voice_body">अलग आवाज़ चुनने या प्लेबैक गति बदलने के लिए प्ले बटन को देर तक दबाएं।</string>+ <!-- feature row labels -->+ <string name="feature_translation">अनुवाद</string>+ <string name="feature_dictionary">शब्दकोश</string>+ <string name="feature_tts">आवाज़</string>+ <!-- misc -->+ <string name="main_input_placeholder">टेक्स्ट डालें</string>+ <string name="aidl_target_unavailable">लक्ष्य भाषा उपलब्ध नहीं</string>+ <string name="voice_section_downloaded">डाउनलोड किया गया</string>+ <string name="voice_section_available">उपलब्ध</string>+ <string name="detected_translate_from">इससे अनुवाद करें</string>+ <string name="detected_missing_language">भाषा अनुपलब्ध</string>+ <string name="langmgr_ocr_upgrade_available">एक बेहतर टेक्स्ट पहचान मॉडल उपलब्ध है।</string>+</resources>diff --git a/OCR-translation/src/main/res/values-in/strings.xml b/OCR-translation/src/main/res/values-in/strings.xmlnew file mode 100644index 0000000..173718a--- /dev/null+++ b/OCR-translation/src/main/res/values-in/strings.xml@@ -0,0 +1,310 @@+<?xml version="1.0" encoding="utf-8"?>+<resources>+ <string name="stop">Berhenti</string>+ <string name="pause">Jeda</string>+ <string name="resume">Lanjutkan</string>+ <string name="region_select_menu">Atur area terjemahan</string>+ <string name="screen_translate_needs_source">Tentukan bahasa sumber</string>+ <string name="live_tile_label">Terjemahkan layar secara langsung</string>+ <string name="translate_text">Terjemahkan</string>+ <string name="translate_link">Terjemahkan tautan</string>+ <string name="accessibility_service_description">Aktifkan layanan ini untuk menerjemahkan teks di layar. Ketuk tombol terjemah mengambang untuk menerjemahkan layar saat ini, atau mulai terjemahan layar secara langsung.</string>+ <string name="tap_to_translate_title">Terjemah Cepat aktif</string>+ <string name="tap_to_translate_body">Ketuk untuk membuka jendela penerjemah</string>+ <string name="tap_to_translate_channel">Terjemah Cepat</string>+ <string name="tap_to_translate_channel_description">Notifikasi tetap untuk akses cepat ke jendela penerjemah</string>+ <string name="quick_tile_label">Terjemahkan</string>+ <!-- common -->+ <string name="common_ok">OK</string>+ <string name="common_cancel">Batal</string>+ <string name="common_done">Selesai</string>+ <string name="common_grant">Beri izin</string>+ <string name="common_manage">Kelola</string>+ <!-- settings -->+ <string name="settings_title">Pengaturan</string>+ <string name="settings_languages">Bahasa</string>+ <string name="settings_language_packs">Paket Bahasa</string>+ <string name="settings_general">Umum</string>+ <string name="settings_font_size">Ukuran Font</string>+ <string name="settings_font_sample">Ini adalah contoh teks</string>+ <string name="settings_tap_notification">Notifikasi Terjemah Cepat</string>+ <string name="settings_tap_notification_desc">Notifikasi tetap yang membuka jendela popup.</string>+ <string name="settings_web_translator">Penerjemah Web</string>+ <string name="settings_clear_browsing">Hapus data penjelajahan saat ditutup</string>+ <string name="settings_clear_browsing_desc">Menghapus cookie, cache, dan penyimpanan lokal.</string>+ <string name="settings_tts_section">Teks ke ucapan</string>+ <string name="settings_tts_read_urls_hashtags">Baca URL dan tagar</string>+ <string name="settings_popup_settings">Popup</string>+ <string name="settings_popup_desc">Popup muncul saat memilih \'Terjemahkan\' dari menu pilihan teks</string>+ <string name="settings_hide_input">Sembunyikan input</string>+ <string name="settings_popup_position">Posisi popup</string>+ <string name="settings_popup_size">Ukuran popup: %1$d%%</string>+ <string name="settings_screen_translation">Terjemahan layar</string>+ <string name="settings_screen_translation_desc">Terjemahkan teks langsung di atas aplikasi lain.</string>+ <string name="settings_floating_button">Tombol selalu aktif</string>+ <string name="settings_floating_button_desc">Memerlukan izin aksesibilitas</string>+ <string name="settings_shortcut">Terjemahkan layar lewat pintasan</string>+ <string name="settings_shortcut_desc">Tekan lama tombol beranda atau daya untuk memicu</string>+ <string name="settings_on_shortcut">Saat pintasan dijalankan</string>+ <string name="settings_ocr">Gambar</string>+ <string name="settings_background_mode">Ganti teks dengan</string>+ <string name="settings_min_confidence">Keyakinan Min.: %1$d%%</string>+ <string name="settings_max_image_size">Ukuran Gambar Maks.: %1$dpx</string>+ <string name="settings_advanced">Lanjutan</string>+ <string name="settings_catalog_url">URL katalog</string>+ <string name="settings_external_storage">Gunakan penyimpanan eksternal</string>+ <string name="settings_disable_autodetect">Nonaktifkan deteksi bahasa otomatis</string>+ <string name="settings_translit_output">Tampilkan transliterasi untuk teks terjemahan</string>+ <string name="settings_translit_input">Tampilkan transliterasi untuk teks asli</string>+ <string name="settings_translit_japanese_spaces">Tambahkan spasi untuk transliterasi bahasa Jepang</string>+ <string name="settings_translate_pdf_images">Terjemahkan gambar dalam PDF</string>+ <string name="settings_camera_live_default">Terjemahkan kamera secara langsung secara bawaan</string>+ <string name="settings_register_browser">Daftarkan sebagai peramban</string>+ <string name="settings_register_browser_desc">Tawarkan untuk menerjemahkan tautan dari aplikasi lain.</string>+ <string name="settings_external_storage_perm_title">Izin Penyimpanan Eksternal</string>+ <string name="settings_about">Tentang</string>+ <string name="settings_version">Versi %1$s</string>+ <string name="settings_no_languages_available">Tidak ada bahasa yang tersedia</string>+ <string name="settings_default_from">Bahasa \'dari\' bawaan</string>+ <string name="settings_default_to">Bahasa \'ke\' bawaan</string>+ <string name="settings_adblock_support">Pemblokiran iklan</string>+ <string name="settings_about_get_help">Dapatkan bantuan / laporkan masalah</string>+ <string name="settings_logs_copied">Log aplikasi disalin ke papan klip</string>+ <string name="settings_about_support">Dukung pengembangan</string>+ <string name="settings_external_storage_perm_body">Untuk menyimpan berkas terjemahan di folder Dokumen, aplikasi ini memerlukan akses untuk mengelola semua berkas.\nKamu akan dibawa ke Pengaturan tempat kamu dapat memberikan izin \'Izinkan akses untuk mengelola semua berkas\'.</string>+ <!-- language manager / setup / how-to -->+ <string name="langmgr_voices">Suara</string>+ <string name="voice_section_downloaded">TERUNDUH</string>+ <string name="voice_section_available">TERSEDIA</string>+ <string name="langmgr_default">BAWAAN</string>+ <string name="langmgr_filter">Saring bahasa</string>+ <string name="langmgr_ocr_upgrade_available">Tersedia model deteksi teks yang lebih baik.</string>+ <string name="langmgr_delete_shared_title">Hapus kamus bersama?</string>+ <string name="langmgr_delete_shared_body">Kamus ini dibagikan dengan %1$s.\nMenghapusnya akan menghilangkan kamus untuk semuanya.</string>+ <string name="langmgr_download_size">Unduh %1$s</string>+ <string name="langmgr_repair_needed">Beberapa fitur yang diunduh kehilangan berkas dan tidak akan berfungsi hingga diperbaiki.</string>+ <string name="langmgr_repair_size">Perbaiki %1$s</string>+ <string name="nolang_title">Penyiapan Bahasa</string>+ <string name="nolang_prompt">Unduh paket bahasa untuk mulai menerjemahkan</string>+ <string name="howto_title">Cara penggunaan</string>+ <!-- image capture / voice / dictionary / language selector -->+ <string name="image_no_crop_remote">Gambar jarak jauh tidak dapat dipangkas secara langsung</string>+ <string name="image_open_failed">Gagal membuka berkas</string>+ <string name="image_source_screen">Layar</string>+ <string name="image_source_document">Dokumen</string>+ <string name="image_source_photos">Foto</string>+ <string name="image_source_gallery">Galeri</string>+ <string name="image_source_camera">Kamera</string>+ <string name="voice_playback_speed">Kecepatan pemutaran</string>+ <string name="voice_label">Suara</string>+ <string name="voice_default">Suara bawaan</string>+ <string name="langsel_auto">✨ Otomatis</string>+ <string name="dict_also_as">Juga sebagai:</string>+ <!-- camera / browser / screen translate -->+ <string name="camera_permission_rationale">Izin kamera diperlukan untuk terjemahan langsung.</string>+ <string name="camera_need_ocr_models">Kamu perlu mengunduh model pengenalan teks (untuk gambar) untuk bahasa ini</string>+ <string name="browser_no_source_language">Tidak ada bahasa sumber yang tersedia. Pasang satu dari layar utama terlebih dahulu, atau tetapkan bahasa sumber bawaan di pengaturan.</string>+ <string name="browser_reader_unavailable">Mode baca tidak tersedia untuk halaman ini</string>+ <string name="browser_translate_image">Terjemahkan gambar</string>+ <string name="screen_translating_notification">Menerjemahkan layar</string>+ <!-- enums -->+ <string name="align_top">Atas</string>+ <string name="align_middle">Tengah</string>+ <string name="align_bottom">Bawah</string>+ <string name="assistant_action_still_image">Terjemahkan sekali</string>+ <string name="assistant_action_live_screen">Mulai terjemahan langsung</string>+ <string name="background_mode_white_on_black">Putih di Hitam</string>+ <string name="background_mode_black_on_white">Hitam di Putih</string>+ <string name="background_mode_auto_detect">Warna Gambar Asli</string>+ <!-- tts / speech errors -->+ <string name="tts_nothing_to_speak">Tidak ada yang bisa diucapkan</string>+ <string name="tts_catalog_unavailable">Katalog tidak tersedia</string>+ <string name="tts_no_voice">Tidak ada suara yang terpasang untuk %1$s</string>+ <string name="tts_synthesis_failed">Sintesis suara gagal untuk %1$s</string>+ <string name="tts_sample_fallback">Ini adalah contoh suara dari Offline Translator.</string>+ <!-- translation -->+ <string name="translation_error">Kesalahan terjemahan: %1$s</string>+ <!-- download errors -->+ <string name="download_failed_core">Unduhan %1$s gagal</string>+ <string name="download_failed_ocr">Unduhan pengenalan teks %1$s gagal</string>+ <string name="download_failed_ocr_batch">Unduhan batch pengenalan teks gagal</string>+ <string name="download_failed_dictionary">Unduhan kamus %1$s gagal</string>+ <string name="download_failed_tts">Unduhan suara %1$s gagal</string>+ <string name="download_failed_adblock">Unduhan pemblokir iklan gagal</string>+ <string name="download_failed_repair">Unduhan perbaikan gagal</string>+ <string name="download_catalog_unavailable">Katalog tidak tersedia</string>+ <string name="download_catalog_save_failed">Gagal menyimpan katalog</string>+ <string name="download_unknown_error">Kesalahan tidak diketahui</string>+ <string name="download_catalog_failed">Gagal mengunduh katalog: %1$s</string>+ <!-- assistant overlay status -->+ <string name="assistant_invoke_prompt">Panggil asisten ini di atas teks untuk menerjemahkannya</string>+ <string name="assistant_collecting_context">Mengumpulkan konteks layar…</string>+ <string name="assistant_screenshot_disabled">Akses tangkapan layar dinonaktifkan untuk asisten ini. Aktifkan di pengaturan asisten sistem.</string>+ <string name="assistant_no_screen_data">Tidak ada data layar yang diterima. Aktifkan \'Gunakan tangkapan layar\' untuk asisten ini.</string>+ <string name="assistant_no_screenshot">Aplikasi ini tidak menyediakan tangkapan layar.</string>+ <string name="assistant_set_source_ocr">Tetapkan bahasa sumber bawaan untuk pengenalan teks.</string>+ <string name="assistant_langs_not_ready">Bahasa terjemahan belum siap. Coba lagi.</string>+ <string name="assistant_ocr_failed">Pengenalan teks gagal</string>+ <string name="ocr_models_missing">Model pengenalan teks tidak ada. Buka Kelola bahasa di aplikasi untuk memperbaiki.</string>+ <string name="assistant_set_source_live">Tetapkan bahasa sumber bawaan di Pengaturan untuk menggunakan terjemahan layar langsung.</string>+ <!-- migration gate -->+ <string name="migration_updating_speech_models">Memperbarui model suara</string>+ <string name="migration_accept_convert">Terima dan konversi</string>+ <string name="migration_delete_all">Hapus semua saja</string>+ <string name="migration_converting">Mengonversi %1$d dari %2$d</string>+ <string name="migration_optimizing">Mengoptimalkan model</string>+ <plurals name="migration_convert_prompt">+ <item quantity="other">Kamu memiliki %1$d model suara untuk dikonversi ke format baru. Ini akan memakan waktu sekitar %2$d detik. Kamu akan menghemat %3$.0f MB ruang penyimpanan.</item>+ </plurals>+ <!-- document translation notification + progress -->+ <string name="doc_notif_translating">Menerjemahkan berkas</string>+ <string name="doc_notif_translated">Berkas diterjemahkan</string>+ <string name="doc_notif_phase_text">Teks %1$d%%</string>+ <string name="doc_notif_phase_images">Gambar %1$d/%2$d</string>+ <string name="doc_notif_phase_raster">Halaman bitmap %1$d/%2$d</string>+ <string name="doc_notif_channel_name">Terjemahan dokumen</string>+ <string name="doc_notif_channel_desc">Menampilkan kemajuan saat menerjemahkan dokumen</string>+ <string name="doc_progress_preparing">Menyiapkan berkas</string>+ <string name="doc_progress_translating">Menerjemahkan</string>+ <string name="doc_progress_translated">Berkas diterjemahkan</string>+ <string name="doc_progress_saving">Menyimpan berkas terjemahan</string>+ <string name="doc_translation_failed">Terjemahan dokumen gagal</string>+ <string name="doc_url_unsupported">Unduh dokumen lalu buka dengan aplikasi ini</string>+ <!-- document configure sheet -->+ <string name="document_wrap_columns">Bungkus pada %1$d kolom</string>+ <string name="document_translate_pdf_images">Terjemahkan gambar dalam PDF</string>+ <string name="layout_preserve">Pertahankan pemutus baris</string>+ <string name="layout_reflow">Atur ulang menjadi paragraf</string>+ <string name="layout_reflow_wrap">Atur ulang dan bungkus</string>+ <!-- common (additional) -->+ <string name="common_open">Buka</string>+ <string name="common_close">Tutup</string>+ <string name="common_save">Simpan</string>+ <!-- translator app -->+ <string name="translator_translated_file">Berkas diterjemahkan: %1$s</string>+ <string name="translator_document_saved">Dokumen disimpan</string>+ <string name="translator_document_save_failed">Gagal menyimpan dokumen</string>+ <string name="translator_audio_playback_failed">Pemutaran audio gagal: %1$s</string>+ <string name="translator_no_app_to_open">Tidak ada aplikasi yang ditemukan untuk membuka berkas ini</string>+ <!-- document alignment -->+ <string name="docalign_decode_failed">Tidak dapat mendekode gambar.</string>+ <string name="docalign_detecting">Mendeteksi sudut…</string>+ <string name="docalign_redetecting">Mendeteksi ulang…</string>+ <string name="docalign_help">Batas yang tepat di sekeliling dokumen meningkatkan kualitas pengenalan. Penting agar garis-garisnya sejajar dengan teks.\n\nMemperbesar atau menggeser biasanya membuat algoritme otomatis menangkap dokumen, tetapi kamu tetap dapat menyesuaikannya secara manual jika tidak ditemukan.</string>+ <!-- how to use -->+ <string name="howto_section_other_apps">Dari aplikasi lain</string>+ <string name="howto_share_title">Bagikan untuk menerjemahkan</string>+ <string name="howto_share_body">Bagikan teks, tautan, atau gambar dari aplikasi mana pun untuk menerjemahkannya.</string>+ <string name="howto_copy_title">Terjemahkan tanpa keluar dari aplikasi lain</string>+ <string name="howto_copy_body">Pilih teks di aplikasi apa pun, lalu ketuk \"Terjemahkan\" di bilah alat salin untuk melihat terjemahan dalam pop-up ringkas.</string>+ <string name="howto_section_in_app">Di dalam aplikasi</string>+ <string name="howto_docs_title">Terjemahkan dokumen dan gambar</string>+ <string name="howto_docs_body">Buka tab Dokumen untuk menerjemahkan gambar atau berkas EPUB, PDF, dan TXT.</string>+ <string name="howto_dict_title">Pencarian kamus</string>+ <string name="howto_dict_body">Tekan lama kata apa pun, lalu ketuk \"Kamus\" untuk melihat definisinya. Atau, ketuk tombol kamus, lalu ketuk kata apa pun. Data bersumber dari Wiktionary.</string>+ <string name="howto_voice_title">Ubah suara atau kecepatan</string>+ <string name="howto_voice_body">Tekan lama tombol putar untuk memilih suara lain atau menyesuaikan kecepatan pemutaran.</string>+ <!-- feature row labels -->+ <string name="feature_translation">Terjemahan</string>+ <string name="feature_dictionary">Kamus</string>+ <string name="feature_tts">Suara</string>+ <!-- misc -->+ <string name="detected_translate_from">Terjemahkan dari</string>+ <string name="detected_missing_language">Bahasa tidak tersedia</string>+ <string name="main_input_placeholder">Masukkan teks</string>+ <string name="aidl_target_unavailable">Bahasa tujuan tidak tersedia</string>+ <string name="settings_experimental_screen_translate">Terjemahan layar (eksperimental)</string>+ <string name="settings_multi_target">Beberapa bahasa target</string>+ <string name="a11y_add_target_language">Tambah bahasa target</string>+ <string name="a11y_remove_target_language">Hapus bahasa target</string>+ <string name="feature_unavailable_tts">Text-to-speech tidak tersedia, unduh dari halaman kelola bahasa</string>+ <string name="feature_unavailable_dictionary">Kamus tidak tersedia, unduh dari halaman kelola bahasa</string>+ <string name="langmgr_translation_upgrade_available">Terjemahan yang ditingkatkan tersedia untuk: %1$s</string>+ <string name="image_crop_action">Potong</string>+ <string name="download_failed_translation_batch">Pengunduhan peningkatan terjemahan gagal</string>+ <string name="howto_alt_title">Pilih kata alternatif</string>+ <string name="howto_alt_body">Ketuk tombol alternatif, lalu ketuk kata apa pun untuk menggantinya. Model mungkin menyediakan beberapa alternatif, jika tidak, Anda dapat mengisinya sendiri. Sisa kalimat diterjemahkan ulang agar sesuai.</string>+ <string name="a11y_cancel">Batal</string>+ <string name="a11y_region_reset">Atur ulang ke layar penuh</string>+ <string name="a11y_region_confirm">Konfirmasi wilayah</string>+ <string name="a11y_translate_screen_live">Terjemahkan layar secara langsung</string>+ <string name="a11y_refresh">Segarkan</string>+ <string name="a11y_select_text">Pilih teks</string>+ <string name="a11y_set_translation_area">Atur area terjemahan</string>+ <string name="a11y_show_original">Tampilkan asli</string>+ <string name="a11y_pause_resume">Jeda atau lanjutkan</string>+ <string name="a11y_primary_input">Input utama</string>+ <string name="a11y_help">Bantuan</string>+ <string name="a11y_rotate_90">Putar 90 derajat</string>+ <string name="a11y_switch_rectangular_crop">Beralih ke potongan persegi panjang</string>+ <string name="a11y_detect_document_corners">Deteksi sudut dokumen</string>+ <string name="a11y_cancel_download">Batal Unduh</string>+ <string name="a11y_delete_language">Hapus Bahasa</string>+ <string name="a11y_retry_download">Coba Unduh Lagi</string>+ <string name="a11y_download">Unduh</string>+ <string name="a11y_share_image">Bagikan gambar</string>+ <string name="a11y_close_fullscreen">Tutup tampilan layar penuh</string>+ <string name="a11y_translation_output">Output terjemahan</string>+ <string name="a11y_output_textview">Tampilan teks output</string>+ <string name="a11y_copy_translation">Salin terjemahan</string>+ <string name="a11y_alternatives_mode_on">Keluar dari mode alternatif</string>+ <string name="a11y_alternatives_mode_off">Mode alternatif: ketuk kata untuk melihat terjemahan lain</string>+ <string name="a11y_close_alternatives">Tutup alternatif</string>+ <string name="alt_custom_entry">Ketik sendiri…</string>+ <string name="alt_custom_label">Kata Anda</string>+ <string name="alt_custom_preview_label">Pratinjau</string>+ <string name="a11y_dictionary_mode_on">Keluar dari mode kamus</string>+ <string name="a11y_dictionary_mode_off">Mode kamus: ketuk kata untuk mencarinya</string>+ <string name="a11y_source_document">Dokumen</string>+ <string name="a11y_source_photos">Foto</string>+ <string name="a11y_source_gallery">Galeri</string>+ <string name="a11y_source_camera">Kamera</string>+ <string name="a11y_back">Kembali</string>+ <string name="a11y_reverse_translation_direction">Balik arah terjemahan</string>+ <string name="a11y_settings">Pengaturan</string>+ <string name="a11y_close">Tutup</string>+ <string name="a11y_dictionary_status">Status Kamus</string>+ <string name="a11y_dictionary_entry">Entri Kamus</string>+ <string name="a11y_tts_status">Status Text-to-speech</string>+ <string name="a11y_main_screen">Layar utama</string>+ <string name="a11y_translate_image_or_file">Terjemahkan gambar atau file</string>+ <string name="a11y_replace_text">Ganti teks</string>+ <string name="a11y_clear_input">Hapus input</string>+ <string name="a11y_resize_split">Ubah ukuran area input dan output</string>+ <string name="a11y_paste">Tempel</string>+ <string name="a11y_voice_input">Input suara</string>+ <string name="a11y_detected_language_toast">Pemberitahuan bahasa terdeteksi</string>+ <string name="a11y_switch_detected_language">Beralih ke bahasa terdeteksi</string>+ <string name="a11y_torch_on">Lampu nyala</string>+ <string name="a11y_torch_off">Lampu mati</string>+ <string name="a11y_live_overlay_on">Overlay langsung aktif</string>+ <string name="a11y_live_overlay_off">Overlay langsung mati</string>+ <string name="a11y_collapse">Ciutkan</string>+ <string name="a11y_expand">Luaskan</string>+ <string name="a11y_delete">Hapus</string>+ <string name="a11y_favorite_remove">Hapus dari favorit</string>+ <string name="a11y_favorite_add">Tambahkan ke favorit</string>+ <string name="a11y_download_feature">Unduh Fitur</string>+ <string name="a11y_show_translated_image">Tampilkan gambar terjemahan</string>+ <string name="a11y_show_original_image">Tampilkan gambar asli</string>+ <string name="a11y_stop_audio">Hentikan audio</string>+ <string name="a11y_speak_input">Ucapkan input</string>+ <string name="a11y_speak_translation">Ucapkan terjemahan</string>+ <string name="a11y_original_image">Gambar asli</string>+ <string name="a11y_translated_image">Gambar terjemahan</string>+ <string name="a11y_zoomable_original_image">Gambar asli yang dapat diperbesar</string>+ <string name="a11y_zoomable_translated_image">Gambar terjemahan yang dapat diperbesar</string>+ <string name="settings_http_server">Aktifkan server HTTP yang kompatibel dengan LibreTranslate</string>+ <string name="settings_http_server_desc">Memungkinkan aplikasi lain meminta terjemahan secara terprogram</string>+ <string name="settings_http_server_port">Port</string>+ <string name="settings_http_server_bind">Ikat pada</string>+ <string name="settings_http_server_bind_localhost">localhost</string>+ <string name="settings_http_server_bind_all">semua antarmuka</string>+ <string name="settings_http_server_title">Server API</string>+ <string name="http_server_notif_channel_name">API Terjemahan</string>+ <string name="http_server_notif_channel_desc">Ditampilkan saat server yang kompatibel dengan LibreTranslate berjalan</string>+ <string name="http_server_notif_running">API Terjemahan</string>+ <string name="http_server_notif_text">Mendengarkan pada %1$s:%2$d</string>+ <string name="http_server_notif_error">Gagal memulai pada port %1$d</string>+ <string name="http_server_notif_disable">Nonaktifkan</string>+</resources>diff --git a/OCR-translation/src/main/res/values-it/strings.xml b/OCR-translation/src/main/res/values-it/strings.xmlnew file mode 100644index 0000000..c9b4db6--- /dev/null+++ b/OCR-translation/src/main/res/values-it/strings.xml@@ -0,0 +1,298 @@+<?xml version="1.0" encoding="utf-8"?>+<resources>+ <string name="stop">Interrompi</string>+ <string name="pause">Pausa</string>+ <string name="resume">Riprendi</string>+ <string name="region_select_menu">Imposta area di traduzione</string>+ <string name="screen_translate_needs_source">Specifica la lingua di partenza</string>+ <string name="live_tile_label">Traduci schermo in tempo reale</string>+ <string name="translate_text">Traduci</string>+ <string name="translate_link">Traduci link</string>+ <string name="accessibility_service_description">Attiva questo servizio per tradurre il testo sullo schermo. Tocca il pulsante di traduzione fluttuante per tradurre lo schermo attuale, oppure avvia una traduzione dello schermo in tempo reale.</string>+ <string name="tap_to_translate_title">Traduzione rapida attiva</string>+ <string name="tap_to_translate_body">Tocca per aprire il popup del traduttore</string>+ <string name="tap_to_translate_channel">Traduzione rapida</string>+ <string name="tap_to_translate_channel_description">Notifica persistente per un accesso rapido al popup del traduttore</string>+ <string name="quick_tile_label">Traduci</string>+ <!-- common -->+ <string name="common_ok">OK</string>+ <string name="common_cancel">Annulla</string>+ <string name="common_done">Fatto</string>+ <string name="common_grant">Concedi</string>+ <string name="common_manage">Gestisci</string>+ <!-- settings -->+ <string name="settings_title">Impostazioni</string>+ <string name="settings_languages">Lingue</string>+ <string name="settings_language_packs">Pacchetti lingua</string>+ <string name="settings_general">Generali</string>+ <string name="settings_font_size">Dimensione del carattere</string>+ <string name="settings_font_sample">Questo è un testo di esempio</string>+ <string name="settings_tap_notification">Notifica Traduzione rapida</string>+ <string name="settings_tap_notification_desc">Notifica persistente che apre il popup.</string>+ <string name="settings_web_translator">Traduttore web</string>+ <string name="settings_clear_browsing">Cancella i dati di navigazione alla chiusura</string>+ <string name="settings_clear_browsing_desc">Elimina cookie, cache e archiviazione locale.</string>+ <string name="settings_tts_section">Sintesi vocale</string>+ <string name="settings_tts_read_urls_hashtags">Leggi URL e hashtag</string>+ <string name="settings_popup_settings">Popup</string>+ <string name="settings_popup_desc">Il popup compare quando selezioni \'Traduci\' dal menu di selezione del testo</string>+ <string name="settings_hide_input">Nascondi l\'input</string>+ <string name="settings_popup_position">Posizione del popup</string>+ <string name="settings_popup_size">Dimensione del popup: %1$d%%</string>+ <string name="settings_screen_translation">Traduzione dello schermo</string>+ <string name="settings_screen_translation_desc">Traduci il testo direttamente sopra le altre app.</string>+ <string name="settings_floating_button">Pulsante sempre attivo</string>+ <string name="settings_floating_button_desc">Richiede il ruolo di accessibilità</string>+ <string name="settings_shortcut">Traduci lo schermo con scorciatoia</string>+ <string name="settings_shortcut_desc">Tieni premuto home o accensione per attivare</string>+ <string name="settings_on_shortcut">All\'attivazione della scorciatoia</string>+ <string name="settings_ocr">Immagini</string>+ <string name="settings_background_mode">Sostituisci il testo con</string>+ <string name="settings_min_confidence">Affidabilità minima: %1$d%%</string>+ <string name="settings_max_image_size">Dimensione massima immagine: %1$dpx</string>+ <string name="settings_advanced">Avanzate</string>+ <string name="settings_catalog_url">URL del catalogo</string>+ <string name="settings_external_storage">Usa archiviazione esterna</string>+ <string name="settings_disable_autodetect">Disattiva il rilevamento automatico della lingua</string>+ <string name="settings_translit_output">Mostra la traslitterazione del testo tradotto</string>+ <string name="settings_translit_input">Mostra la traslitterazione del testo originale</string>+ <string name="settings_translit_japanese_spaces">Aggiungi spazi per la traslitterazione del giapponese</string>+ <string name="settings_translate_pdf_images">Traduci le immagini nei PDF</string>+ <string name="settings_camera_live_default">Traduci la fotocamera in tempo reale per impostazione predefinita</string>+ <string name="settings_register_browser">Registra come browser</string>+ <string name="settings_register_browser_desc">Proponi di tradurre i link da altre app.</string>+ <string name="settings_external_storage_perm_title">Autorizzazione archiviazione esterna</string>+ <string name="settings_about">Informazioni</string>+ <string name="settings_version">Versione %1$s</string>+ <string name="settings_no_languages_available">Nessuna lingua disponibile</string>+ <string name="settings_default_from">Lingua \'di partenza\' predefinita</string>+ <string name="settings_default_to">Lingua \'di arrivo\' predefinita</string>+ <string name="settings_adblock_support">Blocco pubblicità</string>+ <string name="settings_about_get_help">Ottieni aiuto / segnala un problema</string>+ <string name="settings_logs_copied">Log dell\'app copiati negli appunti</string>+ <string name="settings_about_support">Sostieni lo sviluppo</string>+ <string name="settings_external_storage_perm_body">Per salvare i file di traduzione nella cartella Documenti, questa app ha bisogno dell\'accesso per gestire tutti i file.\nVerrai portato alle Impostazioni dove potrai concedere l\'autorizzazione \'Consenti l\'accesso per gestire tutti i file\'.</string>+ <!-- language manager / setup / how-to -->+ <string name="langmgr_voices">Voci</string>+ <string name="langmgr_default">PREDEFINITA</string>+ <string name="langmgr_filter">Filtra le lingue</string>+ <string name="langmgr_delete_shared_title">Eliminare il dizionario condiviso?</string>+ <string name="langmgr_delete_shared_body">Questo dizionario è condiviso con %1$s.\nEliminandolo verrà rimosso il dizionario per tutti.</string>+ <string name="langmgr_download_size">Scarica %1$s</string>+ <string name="langmgr_repair_needed">Ad alcune funzionalità scaricate mancano dei file e non funzioneranno finché non verranno riparate.</string>+ <string name="langmgr_repair_size">Ripara %1$s</string>+ <string name="nolang_title">Configurazione lingua</string>+ <string name="nolang_prompt">Scarica i pacchetti lingua per iniziare a tradurre</string>+ <string name="howto_title">Come si usa</string>+ <!-- image capture / voice / dictionary / language selector -->+ <string name="image_no_crop_remote">Le immagini remote non possono essere ritagliate direttamente</string>+ <string name="image_open_failed">Impossibile aprire il file</string>+ <string name="image_source_screen">Schermo</string>+ <string name="image_source_document">Documento</string>+ <string name="image_source_photos">Foto</string>+ <string name="image_source_gallery">Galleria</string>+ <string name="image_source_camera">Fotocamera</string>+ <string name="voice_playback_speed">Velocità di riproduzione</string>+ <string name="voice_label">Voce</string>+ <string name="voice_default">Voce predefinita</string>+ <string name="langsel_auto">✨ Auto</string>+ <string name="dict_also_as">Anche come:</string>+ <!-- camera / browser / screen translate -->+ <string name="camera_permission_rationale">L\'autorizzazione per la fotocamera è necessaria per la traduzione in tempo reale.</string>+ <string name="camera_need_ocr_models">Devi scaricare i modelli di riconoscimento del testo per questa lingua</string>+ <string name="browser_no_source_language">Nessuna lingua di partenza disponibile. Installane una dalla schermata principale, oppure imposta una lingua di partenza predefinita nelle impostazioni.</string>+ <string name="browser_reader_unavailable">Modalità lettura non disponibile per questa pagina</string>+ <string name="browser_translate_image">Traduci immagine</string>+ <string name="screen_translating_notification">Traduzione dello schermo in corso</string>+ <!-- enums -->+ <string name="align_top">In alto</string>+ <string name="align_middle">Al centro</string>+ <string name="align_bottom">In basso</string>+ <string name="assistant_action_still_image">Traduci una volta</string>+ <string name="assistant_action_live_screen">Avvia traduzione in tempo reale</string>+ <string name="background_mode_white_on_black">Bianco su nero</string>+ <string name="background_mode_black_on_white">Nero su bianco</string>+ <string name="background_mode_auto_detect">Colori originali dell\'immagine</string>+ <!-- tts / speech errors -->+ <string name="tts_nothing_to_speak">Niente da pronunciare</string>+ <string name="tts_catalog_unavailable">Catalogo non disponibile</string>+ <string name="tts_no_voice">Nessuna voce installata per %1$s</string>+ <string name="tts_synthesis_failed">Sintesi vocale non riuscita per %1$s</string>+ <string name="tts_sample_fallback">Questo è un esempio di sintesi vocale di Offline Translator.</string>+ <!-- translation -->+ <string name="translation_error">Errore di traduzione: %1$s</string>+ <!-- download errors -->+ <string name="download_failed_core">Download di %1$s non riuscito</string>+ <string name="download_failed_ocr">Download del riconoscimento del testo di %1$s non riuscito</string>+ <string name="download_failed_ocr_batch">Download batch del riconoscimento del testo non riuscito</string>+ <string name="download_failed_dictionary">Download del dizionario di %1$s non riuscito</string>+ <string name="download_failed_tts">Download della voce di %1$s non riuscito</string>+ <string name="download_failed_adblock">Download Adblock non riuscito</string>+ <string name="download_failed_repair">Download della riparazione non riuscito</string>+ <string name="download_catalog_unavailable">Catalogo non disponibile</string>+ <string name="download_catalog_save_failed">Impossibile salvare il catalogo</string>+ <string name="download_unknown_error">Errore sconosciuto</string>+ <string name="download_catalog_failed">Impossibile scaricare il catalogo: %1$s</string>+ <!-- assistant overlay status -->+ <string name="assistant_invoke_prompt">Richiama questo assistente sopra il testo per tradurlo</string>+ <string name="assistant_collecting_context">Raccolta del contesto dello schermo…</string>+ <string name="assistant_screenshot_disabled">L\'accesso agli screenshot è disattivato per questo assistente. Attivalo nelle impostazioni dell\'assistente di sistema.</string>+ <string name="assistant_no_screen_data">Nessun dato dello schermo ricevuto. Attiva \'Usa screenshot\' per questo assistente.</string>+ <string name="assistant_no_screenshot">Questa app non ha fornito uno screenshot.</string>+ <string name="assistant_set_source_ocr">Imposta una lingua di partenza predefinita per il riconoscimento del testo.</string>+ <string name="assistant_langs_not_ready">Le lingue di traduzione non sono ancora pronte. Riprova.</string>+ <string name="assistant_ocr_failed">Riconoscimento del testo non riuscito</string>+ <string name="ocr_models_missing">Mancano i modelli di riconoscimento del testo. Apri Gestisci lingue nell\'app per ripararli.</string>+ <string name="assistant_set_source_live">Imposta una lingua di partenza predefinita nelle Impostazioni per usare la traduzione dello schermo in tempo reale.</string>+ <!-- migration gate -->+ <string name="migration_updating_speech_models">Aggiornamento dei modelli vocali</string>+ <string name="migration_accept_convert">Accetta e converti</string>+ <string name="migration_delete_all">Elimina tutto invece</string>+ <string name="migration_converting">Conversione di %1$d su %2$d</string>+ <string name="migration_optimizing">Ottimizzazione dei modelli</string>+ <plurals name="migration_convert_prompt">+ <item quantity="one">Hai %1$d modello di sintesi vocale da convertire in un nuovo formato. Richiederà circa %2$d secondi. Risparmierai %3$.0f MB di spazio su disco.</item>+ <item quantity="other">Hai %1$d modelli di sintesi vocale da convertire in un nuovo formato. Richiederà circa %2$d secondi. Risparmierai %3$.0f MB di spazio su disco.</item>+ </plurals>+ <!-- document translation notification + progress -->+ <string name="doc_notif_translating">Traduzione del file in corso</string>+ <string name="doc_notif_translated">File tradotto</string>+ <string name="doc_notif_phase_text">Testo %1$d%%</string>+ <string name="doc_notif_phase_images">Immagini %1$d/%2$d</string>+ <string name="doc_notif_phase_raster">Pagine bitmap %1$d/%2$d</string>+ <string name="doc_notif_channel_name">Traduzione di documenti</string>+ <string name="doc_notif_channel_desc">Mostra l\'avanzamento durante la traduzione dei documenti</string>+ <string name="doc_progress_preparing">Preparazione del file</string>+ <string name="doc_progress_translating">Traduzione in corso</string>+ <string name="doc_progress_translated">File tradotto</string>+ <string name="doc_progress_saving">Salvataggio del file tradotto</string>+ <string name="doc_translation_failed">Traduzione del documento non riuscita</string>+ <string name="doc_url_unsupported">Scarica il documento e aprilo con l\'app</string>+ <!-- document configure sheet -->+ <string name="document_wrap_columns">A capo a %1$d colonne</string>+ <string name="document_translate_pdf_images">Traduci le immagini nel PDF</string>+ <string name="layout_preserve">Mantieni le interruzioni di riga</string>+ <string name="layout_reflow">Riadatta in paragrafi</string>+ <string name="layout_reflow_wrap">Riadatta e manda a capo</string>+ <!-- common (additional) -->+ <string name="common_open">Apri</string>+ <string name="common_close">Chiudi</string>+ <string name="common_save">Salva</string>+ <!-- translator app -->+ <string name="translator_translated_file">File tradotto: %1$s</string>+ <string name="translator_document_saved">Documento salvato</string>+ <string name="translator_document_save_failed">Impossibile salvare il documento</string>+ <string name="translator_audio_playback_failed">Riproduzione audio non riuscita: %1$s</string>+ <string name="translator_no_app_to_open">Nessuna app trovata per aprire questo file</string>+ <!-- document alignment -->+ <string name="docalign_decode_failed">Impossibile decodificare l\'immagine.</string>+ <string name="docalign_detecting">Rilevamento degli angoli…</string>+ <string name="docalign_redetecting">Nuovo rilevamento…</string>+ <string name="docalign_help">Un perimetro preciso attorno al documento migliora la qualità del riconoscimento. È importante che le linee siano parallele al testo.\n\nLo zoom o lo spostamento di solito permettono all\'algoritmo di rilevare automaticamente il documento, ma puoi comunque regolarlo manualmente se non viene trovato.</string>+ <!-- how to use -->+ <string name="howto_section_other_apps">Da altre app</string>+ <string name="howto_share_title">Condividi per tradurre</string>+ <string name="howto_share_body">Condividi testo, link o immagini da qualsiasi app per tradurli.</string>+ <string name="howto_copy_title">Traduci senza uscire dalle altre app</string>+ <string name="howto_copy_body">Seleziona del testo in qualunque app, poi tocca \"Traduci\" nella barra degli strumenti di copia per vedere la traduzione in un popup compatto.</string>+ <string name="howto_section_in_app">Nell\'app</string>+ <string name="howto_docs_title">Traduci documenti e immagini</string>+ <string name="howto_docs_body">Apri la scheda Documenti per tradurre immagini o file EPUB, PDF e TXT.</string>+ <string name="howto_dict_title">Ricerca nel dizionario</string>+ <string name="howto_dict_body">Tieni premuta una parola, poi premi \"Dizionario\" per vederne la definizione. Altrimenti, tocca il pulsante dizionario e tocca una parola. Dati forniti da Wiktionary.</string>+ <string name="howto_voice_title">Cambia voce o velocità</string>+ <string name="howto_voice_body">Tieni premuto il pulsante di riproduzione per scegliere una voce diversa o regolare la velocità di riproduzione.</string>+ <!-- feature row labels -->+ <string name="feature_translation">Traduzione</string>+ <string name="feature_dictionary">Dizionario</string>+ <string name="feature_tts">Voce</string>+ <!-- misc -->+ <string name="main_input_placeholder">Inserisci il testo</string>+ <string name="aidl_target_unavailable">Lingua di destinazione non disponibile</string>+ <string name="voice_section_downloaded">SCARICATO</string>+ <string name="voice_section_available">DISPONIBILE</string>+ <string name="detected_translate_from">Traduci da</string>+ <string name="detected_missing_language">Lingua mancante</string>+ <string name="langmgr_ocr_upgrade_available">È disponibile un modello di rilevamento del testo migliorato.</string>+ <string name="settings_experimental_screen_translate">Traduzione schermo (sperimentale)</string>+ <string name="feature_unavailable_tts">Sintetizzatore vocale non disponibile, scaricalo dalla pagina di gestione delle lingue</string>+ <string name="feature_unavailable_dictionary">Ddizionario non disponibile, scaricalo dalla pagina di gestione delle lingue</string>+ <string name="image_crop_action">Taglia</string>+ <string name="howto_alt_title">Scegli parole alternative</string>+ <string name="howto_alt_body">Tocca il pulsante delle alternative, quindi tocca qualsiasi parola per sostituirla. Il modello può fornire alcune alternative, altrimenti puoi scegliere la tua. Il resto della frase si ritraduce per corrispondere.</string>+ <string name="a11y_cancel">Annulla</string>+ <string name="a11y_region_reset">Ripristina schermo intero</string>+ <string name="a11y_region_confirm">Conferma regione</string>+ <string name="a11y_translate_screen_live">Traduci schermo in tempo reale</string>+ <string name="a11y_refresh">Ricarica</string>+ <string name="a11y_set_translation_area">Imposta area traduzione</string>+ <string name="a11y_retry_download">Riprova scaricamento</string>+ <string name="a11y_download">Scarica</string>+ <string name="a11y_share_image">Condividi immagine</string>+ <string name="a11y_close_fullscreen">Chiudi visualizzazione schermo intero</string>+ <string name="a11y_translation_output">Output traduzione</string>+ <string name="a11y_copy_translation">Copia traduzione</string>+ <string name="a11y_alternatives_mode_on">Esci da modalità alternativa</string>+ <string name="a11y_alternatives_mode_off">Modalità alternativa: tocca una parola per vedere altre traduzioni</string>+ <string name="a11y_close_alternatives">Chiudi alternative</string>+ <string name="alt_custom_entry">Scrivi la tua…</string>+ <string name="alt_custom_label">La tua parola</string>+ <string name="alt_custom_preview_label">Anteprima</string>+ <string name="a11y_dictionary_mode_on">Esci da modalità dizionario</string>+ <string name="a11y_dictionary_mode_off">Modalità dizionario: tocca una parola per cercarla</string>+ <string name="a11y_source_document">Documento</string>+ <string name="a11y_source_photos">Foto</string>+ <string name="a11y_source_gallery">Galleria</string>+ <string name="a11y_source_camera">Fotocamera</string>+ <string name="a11y_back">Indietro</string>+ <string name="a11y_reverse_translation_direction">Direzione traduzione inversa</string>+ <string name="a11y_settings">Impostazioni</string>+ <string name="a11y_close">Chiudi</string>+ <string name="a11y_dictionary_status">Stato Dizionario</string>+ <string name="a11y_dictionary_entry">Voce Dizionario</string>+ <string name="a11y_tts_status">Stato Sintetizzatore Vocale</string>+ <string name="a11y_main_screen">Schermata principale</string>+ <string name="a11y_translate_image_or_file">Traduci immagine o file</string>+ <string name="a11y_clear_input">Pulisci input</string>+ <string name="a11y_paste">Incolla</string>+ <string name="a11y_voice_input">Input vocale</string>+ <string name="a11y_torch_on">Torcia accesa</string>+ <string name="a11y_torch_off">Torcia spenta</string>+ <string name="a11y_collapse">Chiudi</string>+ <string name="a11y_expand">Espandi</string>+ <string name="a11y_delete">Cancella</string>+ <string name="a11y_favorite_remove">Togli dai preferiti</string>+ <string name="a11y_favorite_add">Aggiungi ai preferiti</string>+ <string name="a11y_download_feature">Scarica funzionalità</string>+ <string name="a11y_show_translated_image">Mostra immagine tradotta</string>+ <string name="a11y_show_original_image">Mostra immagine originale</string>+ <string name="a11y_stop_audio">Ferma audio</string>+ <string name="a11y_speak_input">Riproduci input</string>+ <string name="a11y_speak_translation">Riproduci traduzione</string>+ <string name="a11y_original_image">Immagine originale</string>+ <string name="a11y_translated_image">Immagine tradotta</string>+ <string name="a11y_zoomable_original_image">Immagine originale zoomabile</string>+ <string name="a11y_zoomable_translated_image">Immagine tradotta zoomabile</string>+ <string name="settings_http_server">Abilita server HTTP compatibile con LibreTranslate</string>+ <string name="settings_http_server_desc">Consente ad altre app di richiedere traduzioni programmaticamente</string>+ <string name="settings_http_server_port">Porta</string>+ <string name="settings_http_server_bind">Collega su</string>+ <string name="settings_http_server_bind_all">tutte le interfacce</string>+ <string name="http_server_notif_channel_name">API traduzione</string>+ <string name="http_server_notif_channel_desc">Mostrato mentre il server compatibile LibreTranslate è in esecuzione</string>+ <string name="http_server_notif_running">API traduzione</string>+ <string name="http_server_notif_text">In ascolto su %1$s:%2$d</string>+ <string name="http_server_notif_error">Impossibile avviare sulla porta %1$d</string>+ <string name="settings_multi_target">Lingue di destinazione multiple</string>+ <string name="a11y_add_target_language">Aggiungi lingua di destinazione</string>+ <string name="a11y_remove_target_language">Rimuovi lingua di destinazione</string>+ <string name="a11y_show_original">Mostra originale</string>+ <string name="a11y_pause_resume">Pausa o riprendi</string>+ <string name="a11y_help">Aiuto</string>+ <string name="a11y_primary_input">Input principale</string>+ <string name="a11y_rotate_90">Ruota di 90 gradi</string>+ <string name="a11y_cancel_download">Annulla Scaricamento</string>+ <string name="a11y_delete_language">Cancella Lingua</string>+ <string name="a11y_replace_text">Sostituisci testo</string>+ <string name="settings_http_server_bind_localhost">localhost</string>+</resources>diff --git a/OCR-translation/src/main/res/values-ja/strings.xml b/OCR-translation/src/main/res/values-ja/strings.xmlnew file mode 100644index 0000000..ec38dfd--- /dev/null+++ b/OCR-translation/src/main/res/values-ja/strings.xml@@ -0,0 +1,216 @@+<?xml version="1.0" encoding="utf-8"?>+<resources>+ <string name="stop">停止</string>+ <string name="pause">一時停止</string>+ <string name="resume">再開</string>+ <string name="region_select_menu">翻訳する範囲を指定</string>+ <string name="screen_translate_needs_source">翻訳元の言語を指定してください</string>+ <string name="live_tile_label">画面をリアルタイム翻訳</string>+ <string name="translate_text">翻訳</string>+ <string name="translate_link">リンクを翻訳</string>+ <string name="accessibility_service_description">画面上の文字を翻訳するには、このサービスを有効にしてください。フローティングの翻訳ボタンをタップすると現在の画面を翻訳でき、画面のリアルタイム翻訳を開始することもできます。</string>+ <string name="tap_to_translate_title">クイック翻訳がオンです</string>+ <string name="tap_to_translate_body">タップして翻訳ポップアップを開きます</string>+ <string name="tap_to_translate_channel">クイック翻訳</string>+ <string name="tap_to_translate_channel_description">翻訳ポップアップにすぐアクセスするための常駐通知です</string>+ <string name="quick_tile_label">翻訳</string>+ <!-- common -->+ <string name="common_ok">OK</string>+ <string name="common_cancel">キャンセル</string>+ <string name="common_done">完了</string>+ <string name="common_grant">許可</string>+ <string name="common_manage">管理</string>+ <!-- settings -->+ <string name="settings_title">設定</string>+ <string name="settings_languages">言語</string>+ <string name="settings_language_packs">言語パック</string>+ <string name="settings_general">一般</string>+ <string name="settings_font_size">文字サイズ</string>+ <string name="settings_font_sample">これはサンプルのテキストです</string>+ <string name="settings_tap_notification">クイック翻訳の通知</string>+ <string name="settings_tap_notification_desc">ポップアップを開く常駐通知です。</string>+ <string name="settings_web_translator">ウェブ翻訳</string>+ <string name="settings_clear_browsing">終了時に閲覧データを消去</string>+ <string name="settings_clear_browsing_desc">Cookie、キャッシュ、ローカルストレージを削除します。</string>+ <string name="settings_tts_section">テキスト読み上げ</string>+ <string name="settings_tts_read_urls_hashtags">URL とハッシュタグを読み上げる</string>+ <string name="settings_popup_settings">ポップアップ</string>+ <string name="settings_popup_desc">テキスト選択メニューで\'翻訳\'を選ぶとポップアップが表示されます</string>+ <string name="settings_hide_input">入力を非表示</string>+ <string name="settings_popup_position">ポップアップの位置</string>+ <string name="settings_popup_size">ポップアップのサイズ: %1$d%%</string>+ <string name="settings_screen_translation">画面翻訳</string>+ <string name="settings_screen_translation_desc">他のアプリの上に直接、翻訳した文字を表示します。</string>+ <string name="settings_floating_button">常時表示ボタン</string>+ <string name="settings_floating_button_desc">ユーザー補助の権限が必要です</string>+ <string name="settings_shortcut">ショートカットで画面を翻訳</string>+ <string name="settings_shortcut_desc">ホームまたは電源ボタンの長押しで起動します</string>+ <string name="settings_on_shortcut">ショートカット起動時</string>+ <string name="settings_ocr">画像</string>+ <string name="settings_background_mode">文字を置き換える背景</string>+ <string name="settings_min_confidence">最小信頼度: %1$d%%</string>+ <string name="settings_max_image_size">最大画像サイズ: %1$dpx</string>+ <string name="settings_advanced">詳細設定</string>+ <string name="settings_catalog_url">カタログ URL</string>+ <string name="settings_external_storage">外部ストレージを使う</string>+ <string name="settings_disable_autodetect">言語の自動検出を無効にする</string>+ <string name="settings_translit_output">翻訳後の文字に発音表記を表示</string>+ <string name="settings_translit_input">元の文字に発音表記を表示</string>+ <string name="settings_translit_japanese_spaces">日本語の発音表記にスペースを追加</string>+ <string name="settings_translate_pdf_images">PDF 内の画像も翻訳</string>+ <string name="settings_camera_live_default">カメラを最初からリアルタイム翻訳</string>+ <string name="settings_register_browser">ブラウザーとして登録</string>+ <string name="settings_register_browser_desc">他のアプリからのリンクを翻訳できるようにします。</string>+ <string name="settings_external_storage_perm_title">外部ストレージの権限</string>+ <string name="settings_about">アプリについて</string>+ <string name="settings_version">バージョン %1$s</string>+ <string name="settings_no_languages_available">利用できる言語がありません</string>+ <string name="settings_default_from">既定の\'翻訳元\'言語</string>+ <string name="settings_default_to">既定の\'翻訳先\'言語</string>+ <string name="settings_adblock_support">広告ブロック</string>+ <string name="settings_about_get_help">ヘルプ / 問題を報告</string>+ <string name="settings_logs_copied">アプリのログをクリップボードにコピーしました</string>+ <string name="settings_about_support">開発を支援する</string>+ <string name="settings_external_storage_perm_body">翻訳ファイルをドキュメントフォルダに保存するには、すべてのファイルを管理する権限が必要です。\n設定画面が開くので、\'すべてのファイルへのアクセスを許可\'を有効にしてください。</string>+ <!-- language manager / setup / how-to -->+ <string name="langmgr_voices">音声</string>+ <string name="langmgr_default">既定</string>+ <string name="langmgr_filter">言語を絞り込む</string>+ <string name="langmgr_delete_shared_title">共有辞書を削除しますか?</string>+ <string name="langmgr_delete_shared_body">この辞書は %1$s と共有されています。\n削除すると、それらすべてから辞書がなくなります。</string>+ <string name="langmgr_download_size">%1$s をダウンロード</string>+ <string name="langmgr_repair_needed">一部のダウンロード済み機能はファイルが不足しており、修復するまで動作しません。</string>+ <string name="langmgr_repair_size">%1$s を修復</string>+ <string name="nolang_title">言語の設定</string>+ <string name="nolang_prompt">翻訳を始めるには言語パックをダウンロードしてください</string>+ <string name="howto_title">使い方</string>+ <!-- image capture / voice / dictionary / language selector -->+ <string name="image_no_crop_remote">リモート画像は直接切り抜きできません</string>+ <string name="image_open_failed">ファイルを開けませんでした</string>+ <string name="image_source_screen">画面</string>+ <string name="image_source_document">ドキュメント</string>+ <string name="image_source_photos">写真</string>+ <string name="image_source_gallery">ギャラリー</string>+ <string name="image_source_camera">カメラ</string>+ <string name="voice_playback_speed">再生速度</string>+ <string name="voice_label">音声</string>+ <string name="voice_default">既定の音声</string>+ <string name="langsel_auto">✨ 自動</string>+ <string name="dict_also_as">別の表記:</string>+ <!-- camera / browser / screen translate -->+ <string name="camera_permission_rationale">リアルタイム翻訳にはカメラの権限が必要です。</string>+ <string name="camera_need_ocr_models">この言語の文字認識モデルをダウンロードする必要があります</string>+ <string name="browser_no_source_language">利用できる翻訳元の言語がありません。まずメイン画面でインストールするか、設定で既定の翻訳元の言語を指定してください。</string>+ <string name="browser_reader_unavailable">このページではリーダーモードを利用できません</string>+ <string name="browser_translate_image">画像を翻訳</string>+ <string name="screen_translating_notification">画面を翻訳中</string>+ <!-- enums -->+ <string name="align_top">上</string>+ <string name="align_middle">中央</string>+ <string name="align_bottom">下</string>+ <string name="assistant_action_still_image">一度だけ翻訳</string>+ <string name="assistant_action_live_screen">リアルタイム翻訳を開始</string>+ <string name="background_mode_white_on_black">黒地に白文字</string>+ <string name="background_mode_black_on_white">白地に黒文字</string>+ <string name="background_mode_auto_detect">色を自動検出</string>+ <!-- tts / speech errors -->+ <string name="tts_nothing_to_speak">読み上げる内容がありません</string>+ <string name="tts_catalog_unavailable">カタログを利用できません</string>+ <string name="tts_no_voice">%1$s の音声がインストールされていません</string>+ <string name="tts_synthesis_failed">%1$s の音声合成に失敗しました</string>+ <string name="tts_sample_fallback">これは Offline Translator の音声読み上げのサンプルです。</string>+ <!-- translation -->+ <string name="translation_error">翻訳エラー: %1$s</string>+ <!-- download errors -->+ <string name="download_failed_core">%1$s のダウンロードに失敗しました</string>+ <string name="download_failed_ocr">%1$s の文字認識のダウンロードに失敗しました</string>+ <string name="download_failed_ocr_batch">文字認識の一括ダウンロードに失敗しました</string>+ <string name="download_failed_dictionary">%1$s の辞書ダウンロードに失敗しました</string>+ <string name="download_failed_tts">%1$s の音声のダウンロードに失敗しました</string>+ <string name="download_failed_adblock">Adblock のダウンロードに失敗しました</string>+ <string name="download_failed_repair">修復のダウンロードに失敗しました</string>+ <string name="download_catalog_unavailable">カタログを利用できません</string>+ <string name="download_catalog_save_failed">カタログを保存できませんでした</string>+ <string name="download_unknown_error">不明なエラー</string>+ <string name="download_catalog_failed">カタログのダウンロードに失敗しました: %1$s</string>+ <!-- assistant overlay status -->+ <string name="assistant_invoke_prompt">翻訳したい文字の上でこのアシスタントを起動してください</string>+ <string name="assistant_collecting_context">画面の情報を取得中…</string>+ <string name="assistant_screenshot_disabled">このアシスタントではスクリーンショットの利用が無効になっています。システムのアシスタント設定で有効にしてください。</string>+ <string name="assistant_no_screen_data">画面のデータを受信できませんでした。このアシスタントで\'スクリーンショットを使用\'を有効にしてください。</string>+ <string name="assistant_no_screenshot">このアプリはスクリーンショットを提供しませんでした。</string>+ <string name="assistant_set_source_ocr">文字認識用に既定の翻訳元の言語を指定してください。</string>+ <string name="assistant_langs_not_ready">翻訳の言語がまだ準備できていません。もう一度お試しください。</string>+ <string name="assistant_ocr_failed">文字認識に失敗しました</string>+ <string name="ocr_models_missing">文字認識モデルがありません。アプリの言語管理を開いて修復してください。</string>+ <string name="assistant_set_source_live">画面のリアルタイム翻訳を使うには、設定で既定の翻訳元の言語を指定してください。</string>+ <!-- migration gate -->+ <string name="migration_updating_speech_models">音声モデルを更新中</string>+ <string name="migration_accept_convert">同意して変換</string>+ <string name="migration_delete_all">代わりにすべて削除</string>+ <string name="migration_converting">%2$d 件中 %1$d 件を変換中</string>+ <string name="migration_optimizing">モデルを最適化中</string>+ <plurals name="migration_convert_prompt">+ <item quantity="other">新しい形式に変換する音声読み上げモデルが %1$d 件あります。およそ %2$d 秒かかります。ディスク容量を %3$.0f MB 節約できます。</item>+ </plurals>+ <!-- document translation notification + progress -->+ <string name="doc_notif_translating">ファイルを翻訳中</string>+ <string name="doc_notif_translated">ファイルを翻訳しました</string>+ <string name="doc_notif_phase_text">テキスト %1$d%%</string>+ <string name="doc_notif_phase_images">画像 %1$d/%2$d</string>+ <string name="doc_notif_phase_raster">ビットマップページ %1$d/%2$d</string>+ <string name="doc_notif_channel_name">ドキュメント翻訳</string>+ <string name="doc_notif_channel_desc">ドキュメントの翻訳中に進捗を表示します</string>+ <string name="doc_progress_preparing">ファイルを準備中</string>+ <string name="doc_progress_translating">翻訳中</string>+ <string name="doc_progress_translated">ファイルを翻訳しました</string>+ <string name="doc_progress_saving">翻訳したファイルを保存中</string>+ <string name="doc_translation_failed">ドキュメントの翻訳に失敗しました</string>+ <string name="doc_url_unsupported">ドキュメントをダウンロードして、アプリで開いてください</string>+ <!-- document configure sheet -->+ <string name="document_wrap_columns">%1$d 文字で折り返す</string>+ <string name="document_translate_pdf_images">PDF 内の画像を翻訳</string>+ <string name="layout_preserve">改行をそのまま残す</string>+ <string name="layout_reflow">段落にまとめ直す</string>+ <string name="layout_reflow_wrap">まとめ直して折り返す</string>+ <!-- common (additional) -->+ <string name="common_open">開く</string>+ <string name="common_close">閉じる</string>+ <string name="common_save">保存</string>+ <!-- translator app -->+ <string name="translator_translated_file">翻訳したファイル: %1$s</string>+ <string name="translator_document_saved">ドキュメントを保存しました</string>+ <string name="translator_document_save_failed">ドキュメントの保存に失敗しました</string>+ <string name="translator_audio_playback_failed">音声の再生に失敗しました: %1$s</string>+ <string name="translator_no_app_to_open">このファイルを開けるアプリが見つかりません</string>+ <!-- document alignment -->+ <string name="docalign_decode_failed">画像をデコードできません。</string>+ <string name="docalign_detecting">角を検出中…</string>+ <string name="docalign_redetecting">再検出中…</string>+ <string name="docalign_help">ドキュメントを正確に囲むと認識の精度が上がります。線が文字と平行になっていることが大切です。\n\nズームや移動をすると、たいてい自動でドキュメントを認識しますが、見つからない場合は手動で調整することもできます。</string>+ <!-- how to use -->+ <string name="howto_section_other_apps">他のアプリから</string>+ <string name="howto_share_title">共有して翻訳</string>+ <string name="howto_share_body">どのアプリからでも、テキスト・リンク・画像を共有して翻訳できます。</string>+ <string name="howto_copy_title">他のアプリを離れずに翻訳</string>+ <string name="howto_copy_body">どこでも文字を選択し、コピー用ツールバーの\"翻訳\"をタップすると、コンパクトなポップアップで翻訳が表示されます。</string>+ <string name="howto_section_in_app">アプリ内で</string>+ <string name="howto_docs_title">ドキュメントを翻訳</string>+ <string name="howto_docs_body">ドキュメントタブを開くと、EPUB・PDF・TXT ファイルを翻訳できます。</string>+ <string name="howto_dict_title">辞書で調べる</string>+ <string name="howto_dict_body">翻訳内の単語を長押しすると意味が表示されます。データは Wiktionary を使用しています。</string>+ <string name="howto_voice_title">音声や速度を変える</string>+ <string name="howto_voice_body">再生ボタンを長押しすると、別の音声を選んだり再生速度を調整したりできます。</string>+ <!-- feature row labels -->+ <string name="feature_translation">翻訳</string>+ <string name="feature_dictionary">辞書</string>+ <string name="feature_tts">音声</string>+ <!-- misc -->+ <string name="main_input_placeholder">テキストを入力</string>+ <string name="aidl_target_unavailable">翻訳先の言語を利用できません</string>+ <string name="voice_section_downloaded">ダウンロード済み</string>+ <string name="voice_section_available">利用可能</string>+ <string name="detected_translate_from">翻訳元</string>+ <string name="detected_missing_language">言語がありません</string>+ <string name="langmgr_ocr_upgrade_available">改良されたテキスト検出モデルが利用できます。</string>+</resources>diff --git a/OCR-translation/src/main/res/values-kn/strings.xml b/OCR-translation/src/main/res/values-kn/strings.xmlnew file mode 100644index 0000000..7512a85--- /dev/null+++ b/OCR-translation/src/main/res/values-kn/strings.xml@@ -0,0 +1,217 @@+<?xml version="1.0" encoding="utf-8"?>+<resources>+ <string name="stop">ನಿಲ್ಲಿಸಿ</string>+ <string name="pause">ತಡೆಹಿಡಿ</string>+ <string name="resume">ಮುಂದುವರಿಸಿ</string>+ <string name="region_select_menu">ಅನುವಾದ ಪ್ರದೇಶವನ್ನು ಹೊಂದಿಸಿ</string>+ <string name="screen_translate_needs_source">ಮೂಲ ಭಾಷೆಯನ್ನು ಸೂಚಿಸಿ</string>+ <string name="live_tile_label">ಪರದೆಯನ್ನು ಲೈವ್ ಆಗಿ ಅನುವಾದಿಸಿ</string>+ <string name="translate_text">ಅನುವಾದಿಸಿ</string>+ <string name="translate_link">ಲಿಂಕ್ ಅನುವಾದಿಸಿ</string>+ <string name="accessibility_service_description">ಪರದೆಯ ಮೇಲಿನ ಪಠ್ಯವನ್ನು ಅನುವಾದಿಸಲು ಈ ಸೇವೆಯನ್ನು ಆನ್ ಮಾಡಿ. ಈಗಿನ ಪರದೆಯನ್ನು ಅನುವಾದಿಸಲು ತೇಲುವ ಅನುವಾದ ಬಟನ್ ಒತ್ತಿ, ಅಥವಾ ಲೈವ್ ಪರದೆ ಅನುವಾದವನ್ನು ಪ್ರಾರಂಭಿಸಿ.</string>+ <string name="tap_to_translate_title">ತ್ವರಿತ ಅನುವಾದ ಆನ್ ಆಗಿದೆ</string>+ <string name="tap_to_translate_body">ಅನುವಾದಕ ಪಾಪ್ಅಪ್ ತೆರೆಯಲು ಟ್ಯಾಪ್ ಮಾಡಿ</string>+ <string name="tap_to_translate_channel">ತ್ವರಿತ ಅನುವಾದ</string>+ <string name="tap_to_translate_channel_description">ಅನುವಾದಕ ಪಾಪ್ಅಪ್ಗೆ ಬೇಗ ಹೋಗಲು ಇರುವ ನಿರಂತರ ಅಧಿಸೂಚನೆ</string>+ <string name="quick_tile_label">ಅನುವಾದಿಸಿ</string>+ <!-- common -->+ <string name="common_ok">ಸರಿ</string>+ <string name="common_cancel">ರದ್ದುಮಾಡಿ</string>+ <string name="common_done">ಮುಗಿಯಿತು</string>+ <string name="common_grant">ಅನುಮತಿಸಿ</string>+ <string name="common_manage">ನಿರ್ವಹಿಸಿ</string>+ <!-- settings -->+ <string name="settings_title">ಸೆಟ್ಟಿಂಗ್ಗಳು</string>+ <string name="settings_languages">ಭಾಷೆಗಳು</string>+ <string name="settings_language_packs">ಭಾಷಾ ಪ್ಯಾಕ್ಗಳು</string>+ <string name="settings_general">ಸಾಮಾನ್ಯ</string>+ <string name="settings_font_size">ಫಾಂಟ್ ಗಾತ್ರ</string>+ <string name="settings_font_sample">ಇದು ಉದಾಹರಣೆಗಾಗಿ ಒಂದಿಷ್ಟು ಪಠ್ಯ</string>+ <string name="settings_tap_notification">ತ್ವರಿತ ಅನುವಾದ ಅಧಿಸೂಚನೆ</string>+ <string name="settings_tap_notification_desc">ಪಾಪ್ಅಪ್ ತೆರೆಯುವ ನಿರಂತರ ಅಧಿಸೂಚನೆ.</string>+ <string name="settings_web_translator">ವೆಬ್ ಅನುವಾದಕ</string>+ <string name="settings_clear_browsing">ಮುಚ್ಚುವಾಗ ಬ್ರೌಸಿಂಗ್ ಡೇಟಾ ಅಳಿಸಿ</string>+ <string name="settings_clear_browsing_desc">ಕುಕೀಗಳು, ಕ್ಯಾಶ್ ಮತ್ತು ಲೋಕಲ್ ಸ್ಟೋರೇಜ್ ಅನ್ನು ಅಳಿಸುತ್ತದೆ.</string>+ <string name="settings_tts_section">ಪಠ್ಯದಿಂದ ಧ್ವನಿ</string>+ <string name="settings_tts_read_urls_hashtags">URL ಮತ್ತು ಹ್ಯಾಶ್ಟ್ಯಾಗ್ಗಳನ್ನು ಓದಿ</string>+ <string name="settings_popup_settings">ಪಾಪ್ಅಪ್</string>+ <string name="settings_popup_desc">ಪಠ್ಯ ಆಯ್ಕೆ ಮೆನುವಿನಿಂದ \'ಅನುವಾದಿಸಿ\' ಆರಿಸಿದಾಗ ಪಾಪ್ಅಪ್ ಕಾಣಿಸಿಕೊಳ್ಳುತ್ತದೆ</string>+ <string name="settings_hide_input">ಇನ್ಪುಟ್ ಮರೆಮಾಡಿ</string>+ <string name="settings_popup_position">ಪಾಪ್ಅಪ್ ಸ್ಥಾನ</string>+ <string name="settings_popup_size">ಪಾಪ್ಅಪ್ ಗಾತ್ರ: %1$d%%</string>+ <string name="settings_screen_translation">ಪರದೆ ಅನುವಾದ</string>+ <string name="settings_screen_translation_desc">ಬೇರೆ ಆ್ಯಪ್ಗಳ ಮೇಲೆ ನೇರವಾಗಿ ಪಠ್ಯವನ್ನು ಅನುವಾದಿಸಿ.</string>+ <string name="settings_floating_button">ಯಾವಾಗಲೂ ಇರುವ ಬಟನ್</string>+ <string name="settings_floating_button_desc">ಆ್ಯಕ್ಸೆಸಿಬಿಲಿಟಿ ಅನುಮತಿ ಬೇಕು</string>+ <string name="settings_shortcut">ಶಾರ್ಟ್ಕಟ್ನಲ್ಲಿ ಪರದೆ ಅನುವಾದಿಸಿ</string>+ <string name="settings_shortcut_desc">ಪ್ರಾರಂಭಿಸಲು ಹೋಮ್ ಅಥವಾ ಪವರ್ ಬಟನ್ ಒತ್ತಿ ಹಿಡಿಯಿರಿ</string>+ <string name="settings_on_shortcut">ಶಾರ್ಟ್ಕಟ್ ಬಳಸಿದಾಗ</string>+ <string name="settings_ocr">ಚಿತ್ರಗಳು</string>+ <string name="settings_background_mode">ಪಠ್ಯವನ್ನು ಇದರಿಂದ ಬದಲಿಸಿ</string>+ <string name="settings_min_confidence">ಕನಿಷ್ಠ ವಿಶ್ವಾಸಾರ್ಹತೆ: %1$d%%</string>+ <string name="settings_max_image_size">ಗರಿಷ್ಠ ಚಿತ್ರ ಗಾತ್ರ: %1$dpx</string>+ <string name="settings_advanced">ಸುಧಾರಿತ</string>+ <string name="settings_catalog_url">ಕ್ಯಾಟಲಾಗ್ URL</string>+ <string name="settings_external_storage">ಬಾಹ್ಯ ಸ್ಟೋರೇಜ್ ಬಳಸಿ</string>+ <string name="settings_disable_autodetect">ಸ್ವಯಂಚಾಲಿತ ಭಾಷಾ ಪತ್ತೆಯನ್ನು ಆಫ್ ಮಾಡಿ</string>+ <string name="settings_translit_output">ಅನುವಾದಿಸಿದ ಪಠ್ಯಕ್ಕೆ ಲಿಪ್ಯಂತರಣ ತೋರಿಸಿ</string>+ <string name="settings_translit_input">ಮೂಲ ಪಠ್ಯಕ್ಕೆ ಲಿಪ್ಯಂತರಣ ತೋರಿಸಿ</string>+ <string name="settings_translit_japanese_spaces">ಜಪಾನೀಸ್ ಲಿಪ್ಯಂತರಣಕ್ಕೆ ಸ್ಪೇಸ್ಗಳನ್ನು ಸೇರಿಸಿ</string>+ <string name="settings_translate_pdf_images">PDF ಗಳಲ್ಲಿನ ಚಿತ್ರಗಳನ್ನು ಅನುವಾದಿಸಿ</string>+ <string name="settings_camera_live_default">ಪೂರ್ವನಿಯೋಜಿತವಾಗಿ ಕ್ಯಾಮೆರಾವನ್ನು ಲೈವ್ ಆಗಿ ಅನುವಾದಿಸಿ</string>+ <string name="settings_register_browser">ಬ್ರೌಸರ್ ಆಗಿ ನೋಂದಾಯಿಸಿ</string>+ <string name="settings_register_browser_desc">ಬೇರೆ ಆ್ಯಪ್ಗಳ ಲಿಂಕ್ಗಳನ್ನು ಅನುವಾದಿಸುವ ಆಯ್ಕೆ ನೀಡಿ.</string>+ <string name="settings_external_storage_perm_title">ಬಾಹ್ಯ ಸ್ಟೋರೇಜ್ ಅನುಮತಿ</string>+ <string name="settings_about">ಕುರಿತು</string>+ <string name="settings_version">ಆವೃತ್ತಿ %1$s</string>+ <string name="settings_no_languages_available">ಯಾವುದೇ ಭಾಷೆಗಳು ಲಭ್ಯವಿಲ್ಲ</string>+ <string name="settings_default_from">ಪೂರ್ವನಿಯೋಜಿತ \'ಯಿಂದ\' ಭಾಷೆ</string>+ <string name="settings_default_to">ಪೂರ್ವನಿಯೋಜಿತ \'ಗೆ\' ಭಾಷೆ</string>+ <string name="settings_adblock_support">ಜಾಹೀರಾತು ತಡೆ</string>+ <string name="settings_about_get_help">ಸಹಾಯ ಪಡೆಯಿರಿ / ಸಮಸ್ಯೆ ತಿಳಿಸಿ</string>+ <string name="settings_logs_copied">ಆ್ಯಪ್ ಲಾಗ್ಗಳನ್ನು ಕ್ಲಿಪ್ಬೋರ್ಡ್ಗೆ ನಕಲಿಸಲಾಗಿದೆ</string>+ <string name="settings_about_support">ಅಭಿವೃದ್ಧಿಗೆ ಬೆಂಬಲ ನೀಡಿ</string>+ <string name="settings_external_storage_perm_body">ಅನುವಾದ ಫೈಲ್ಗಳನ್ನು ನಿಮ್ಮ Documents ಫೋಲ್ಡರ್ನಲ್ಲಿ ಇರಿಸಲು, ಈ ಆ್ಯಪ್ಗೆ ಎಲ್ಲಾ ಫೈಲ್ಗಳನ್ನು ನಿರ್ವಹಿಸುವ ಅನುಮತಿ ಬೇಕು.\nಸೆಟ್ಟಿಂಗ್ಗಳಿಗೆ ನಿಮ್ಮನ್ನು ಕೊಂಡೊಯ್ಯಲಾಗುತ್ತದೆ, ಅಲ್ಲಿ ನೀವು \'ಎಲ್ಲಾ ಫೈಲ್ಗಳನ್ನು ನಿರ್ವಹಿಸಲು ಪ್ರವೇಶ ಅನುಮತಿಸಿ\' ಅನುಮತಿಯನ್ನು ನೀಡಬಹುದು.</string>+ <!-- language manager / setup / how-to -->+ <string name="langmgr_voices">ಧ್ವನಿಗಳು</string>+ <string name="voice_section_downloaded">ಡೌನ್ಲೋಡ್ ಆಗಿದೆ</string>+ <string name="voice_section_available">ಲಭ್ಯವಿದೆ</string>+ <string name="langmgr_default">ಪೂರ್ವನಿಯೋಜಿತ</string>+ <string name="langmgr_filter">ಭಾಷೆಗಳನ್ನು ಫಿಲ್ಟರ್ ಮಾಡಿ</string>+ <string name="langmgr_ocr_upgrade_available">ಚಿತ್ರಗಳಲ್ಲಿನ ಪಠ್ಯ ಪತ್ತೆಗೆ ಸುಧಾರಿತ ಮಾದರಿ ಲಭ್ಯವಿದೆ.</string>+ <string name="langmgr_delete_shared_title">ಹಂಚಿಕೊಂಡ ನಿಘಂಟು ಅಳಿಸುವುದೇ?</string>+ <string name="langmgr_delete_shared_body">ಈ ನಿಘಂಟನ್ನು %1$s ಜೊತೆ ಹಂಚಿಕೊಳ್ಳಲಾಗಿದೆ.\nಇದನ್ನು ಅಳಿಸಿದರೆ ಅವರೆಲ್ಲರಿಗೂ ನಿಘಂಟು ತೆಗೆದುಹಾಕಲ್ಪಡುತ್ತದೆ.</string>+ <string name="langmgr_download_size">%1$s ಡೌನ್ಲೋಡ್ ಮಾಡಿ</string>+ <string name="langmgr_repair_needed">ಕೆಲವು ಡೌನ್ಲೋಡ್ ಮಾಡಿದ ವೈಶಿಷ್ಟ್ಯಗಳಿಗೆ ಫೈಲ್ಗಳು ಕಾಣೆಯಾಗಿವೆ ಮತ್ತು ದುರಸ್ತಿ ಮಾಡುವವರೆಗೆ ಕೆಲಸ ಮಾಡುವುದಿಲ್ಲ.</string>+ <string name="langmgr_repair_size">%1$s ದುರಸ್ತಿ ಮಾಡಿ</string>+ <string name="nolang_title">ಭಾಷಾ ಸೆಟಪ್</string>+ <string name="nolang_prompt">ಅನುವಾದ ಪ್ರಾರಂಭಿಸಲು ಭಾಷಾ ಪ್ಯಾಕ್ಗಳನ್ನು ಡೌನ್ಲೋಡ್ ಮಾಡಿ</string>+ <string name="howto_title">ಬಳಸುವುದು ಹೇಗೆ</string>+ <!-- image capture / voice / dictionary / language selector -->+ <string name="image_no_crop_remote">ರಿಮೋಟ್ ಚಿತ್ರಗಳನ್ನು ನೇರವಾಗಿ ಕ್ರಾಪ್ ಮಾಡಲಾಗದು</string>+ <string name="image_open_failed">ಫೈಲ್ ತೆರೆಯಲು ವಿಫಲವಾಯಿತು</string>+ <string name="image_source_screen">ಪರದೆ</string>+ <string name="image_source_document">ಡಾಕ್ಯುಮೆಂಟ್</string>+ <string name="image_source_photos">ಫೋಟೋಗಳು</string>+ <string name="image_source_gallery">ಗ್ಯಾಲರಿ</string>+ <string name="image_source_camera">ಕ್ಯಾಮೆರಾ</string>+ <string name="voice_playback_speed">ಪ್ಲೇಬ್ಯಾಕ್ ವೇಗ</string>+ <string name="voice_label">ಧ್ವನಿ</string>+ <string name="voice_default">ಪೂರ್ವನಿಯೋಜಿತ ಧ್ವನಿ</string>+ <string name="langsel_auto">✨ ಸ್ವಯಂ</string>+ <string name="dict_also_as">ಹೀಗೂ:</string>+ <!-- camera / browser / screen translate -->+ <string name="camera_permission_rationale">ಲೈವ್ ಅನುವಾದಕ್ಕೆ ಕ್ಯಾಮೆರಾ ಅನುಮತಿ ಬೇಕು.</string>+ <string name="camera_need_ocr_models">ಈ ಭಾಷೆಗೆ ಚಿತ್ರಗಳಲ್ಲಿನ ಪಠ್ಯ ಗುರುತಿಸುವ ಮಾದರಿಗಳನ್ನು ನೀವು ಡೌನ್ಲೋಡ್ ಮಾಡಬೇಕು</string>+ <string name="browser_no_source_language">ಯಾವುದೇ ಮೂಲ ಭಾಷೆ ಲಭ್ಯವಿಲ್ಲ. ಮೊದಲು ಮುಖ್ಯ ಪರದೆಯಿಂದ ಒಂದನ್ನು ಇನ್ಸ್ಟಾಲ್ ಮಾಡಿ, ಅಥವಾ ಸೆಟ್ಟಿಂಗ್ಗಳಲ್ಲಿ ಪೂರ್ವನಿಯೋಜಿತ ಮೂಲ ಭಾಷೆಯನ್ನು ಹೊಂದಿಸಿ.</string>+ <string name="browser_reader_unavailable">ಈ ಪುಟಕ್ಕೆ ರೀಡರ್ ಮೋಡ್ ಲಭ್ಯವಿಲ್ಲ</string>+ <string name="browser_translate_image">ಚಿತ್ರ ಅನುವಾದಿಸಿ</string>+ <string name="screen_translating_notification">ಪರದೆ ಅನುವಾದಿಸಲಾಗುತ್ತಿದೆ</string>+ <!-- enums -->+ <string name="align_top">ಮೇಲ್ಭಾಗ</string>+ <string name="align_middle">ಮಧ್ಯ</string>+ <string name="align_bottom">ಕೆಳಭಾಗ</string>+ <string name="assistant_action_still_image">ಒಮ್ಮೆ ಅನುವಾದಿಸಿ</string>+ <string name="assistant_action_live_screen">ಲೈವ್ ಅನುವಾದ ಪ್ರಾರಂಭಿಸಿ</string>+ <string name="background_mode_white_on_black">ಕಪ್ಪಿನ ಮೇಲೆ ಬಿಳಿ</string>+ <string name="background_mode_black_on_white">ಬಿಳಿಯ ಮೇಲೆ ಕಪ್ಪು</string>+ <string name="background_mode_auto_detect">ಮೂಲ ಚಿತ್ರದ ಬಣ್ಣಗಳು</string>+ <!-- tts / speech errors -->+ <string name="tts_nothing_to_speak">ಓದಲು ಏನೂ ಇಲ್ಲ</string>+ <string name="tts_catalog_unavailable">ಕ್ಯಾಟಲಾಗ್ ಲಭ್ಯವಿಲ್ಲ</string>+ <string name="tts_no_voice">%1$s ಗೆ ಯಾವುದೇ ಧ್ವನಿ ಇನ್ಸ್ಟಾಲ್ ಆಗಿಲ್ಲ</string>+ <string name="tts_synthesis_failed">%1$s ಗೆ ಧ್ವನಿ ಸಂಯೋಜನೆ ವಿಫಲವಾಯಿತು</string>+ <string name="tts_sample_fallback">ಇದು Offline Translator ನಿಂದ ಒಂದು ಧ್ವನಿ ಮಾದರಿ.</string>+ <!-- translation -->+ <string name="translation_error">ಅನುವಾದ ದೋಷ: %1$s</string>+ <!-- download errors -->+ <string name="download_failed_core">%1$s ಡೌನ್ಲೋಡ್ ವಿಫಲವಾಯಿತು</string>+ <string name="download_failed_ocr">%1$s ಚಿತ್ರ ಪಠ್ಯ ಮಾದರಿ ಡೌನ್ಲೋಡ್ ವಿಫಲವಾಯಿತು</string>+ <string name="download_failed_ocr_batch">ಚಿತ್ರ ಪಠ್ಯ ಮಾದರಿಗಳ ಬ್ಯಾಚ್ ಡೌನ್ಲೋಡ್ ವಿಫಲವಾಯಿತು</string>+ <string name="download_failed_dictionary">%1$s ನಿಘಂಟು ಡೌನ್ಲೋಡ್ ವಿಫಲವಾಯಿತು</string>+ <string name="download_failed_tts">%1$s ಧ್ವನಿ ಡೌನ್ಲೋಡ್ ವಿಫಲವಾಯಿತು</string>+ <string name="download_failed_adblock">ಜಾಹೀರಾತು ತಡೆ ಡೌನ್ಲೋಡ್ ವಿಫಲವಾಯಿತು</string>+ <string name="download_failed_repair">ದುರಸ್ತಿ ಡೌನ್ಲೋಡ್ ವಿಫಲವಾಯಿತು</string>+ <string name="download_catalog_unavailable">ಕ್ಯಾಟಲಾಗ್ ಲಭ್ಯವಿಲ್ಲ</string>+ <string name="download_catalog_save_failed">ಕ್ಯಾಟಲಾಗ್ ಉಳಿಸಲು ವಿಫಲವಾಯಿತು</string>+ <string name="download_unknown_error">ಗೊತ್ತಿಲ್ಲದ ದೋಷ</string>+ <string name="download_catalog_failed">ಕ್ಯಾಟಲಾಗ್ ಡೌನ್ಲೋಡ್ ವಿಫಲವಾಯಿತು: %1$s</string>+ <!-- assistant overlay status -->+ <string name="assistant_invoke_prompt">ಪಠ್ಯವನ್ನು ಅನುವಾದಿಸಲು ಅದರ ಮೇಲೆ ಈ ಅಸಿಸ್ಟೆಂಟ್ ಅನ್ನು ತೆರೆಯಿರಿ</string>+ <string name="assistant_collecting_context">ಪರದೆಯ ಸಂದರ್ಭ ಸಂಗ್ರಹಿಸಲಾಗುತ್ತಿದೆ…</string>+ <string name="assistant_screenshot_disabled">ಈ ಅಸಿಸ್ಟೆಂಟ್ಗೆ ಸ್ಕ್ರೀನ್ಶಾಟ್ ಪ್ರವೇಶ ಆಫ್ ಆಗಿದೆ. ಸಿಸ್ಟಂ ಅಸಿಸ್ಟೆಂಟ್ ಸೆಟ್ಟಿಂಗ್ಗಳಲ್ಲಿ ಅದನ್ನು ಆನ್ ಮಾಡಿ.</string>+ <string name="assistant_no_screen_data">ಯಾವುದೇ ಪರದೆ ಡೇಟಾ ಸಿಗಲಿಲ್ಲ. ಈ ಅಸಿಸ್ಟೆಂಟ್ಗೆ \'ಸ್ಕ್ರೀನ್ಶಾಟ್ ಬಳಸಿ\' ಆನ್ ಮಾಡಿ.</string>+ <string name="assistant_no_screenshot">ಈ ಆ್ಯಪ್ ಸ್ಕ್ರೀನ್ಶಾಟ್ ಒದಗಿಸಲಿಲ್ಲ.</string>+ <string name="assistant_set_source_ocr">ಚಿತ್ರಗಳಲ್ಲಿನ ಪಠ್ಯ ಗುರುತಿಸಲು ಪೂರ್ವನಿಯೋಜಿತ ಮೂಲ ಭಾಷೆಯನ್ನು ಹೊಂದಿಸಿ.</string>+ <string name="assistant_langs_not_ready">ಅನುವಾದ ಭಾಷೆಗಳು ಇನ್ನೂ ಸಿದ್ಧವಾಗಿಲ್ಲ. ಮತ್ತೆ ಪ್ರಯತ್ನಿಸಿ.</string>+ <string name="assistant_ocr_failed">ಚಿತ್ರದಲ್ಲಿನ ಪಠ್ಯ ಗುರುತಿಸಲು ವಿಫಲವಾಯಿತು</string>+ <string name="ocr_models_missing">ಪಠ್ಯ ಗುರುತಿಸುವಿಕೆ ಮಾದರಿಗಳು ಕಾಣೆಯಾಗಿವೆ. ದುರಸ್ತಿ ಮಾಡಲು ಆ್ಯಪ್ನಲ್ಲಿ ಭಾಷಾ ನಿರ್ವಹಣೆ ತೆರೆಯಿರಿ.</string>+ <string name="assistant_set_source_live">ಲೈವ್ ಪರದೆ ಅನುವಾದ ಬಳಸಲು ಸೆಟ್ಟಿಂಗ್ಗಳಲ್ಲಿ ಪೂರ್ವನಿಯೋಜಿತ ಮೂಲ ಭಾಷೆಯನ್ನು ಹೊಂದಿಸಿ.</string>+ <!-- migration gate -->+ <string name="migration_updating_speech_models">ಧ್ವನಿ ಮಾದರಿಗಳನ್ನು ಅಪ್ಡೇಟ್ ಮಾಡಲಾಗುತ್ತಿದೆ</string>+ <string name="migration_accept_convert">ಒಪ್ಪಿ ಪರಿವರ್ತಿಸಿ</string>+ <string name="migration_delete_all">ಬದಲಿಗೆ ಎಲ್ಲವನ್ನೂ ಅಳಿಸಿ</string>+ <string name="migration_converting">%2$d ರಲ್ಲಿ %1$d ಪರಿವರ್ತಿಸಲಾಗುತ್ತಿದೆ</string>+ <string name="migration_optimizing">ಮಾದರಿಗಳನ್ನು ಆಪ್ಟಿಮೈಸ್ ಮಾಡಲಾಗುತ್ತಿದೆ</string>+ <plurals name="migration_convert_prompt">+ <item quantity="one">ಹೊಸ ಫಾರ್ಮ್ಯಾಟ್ಗೆ ಪರಿವರ್ತಿಸಲು ನಿಮ್ಮ ಬಳಿ %1$d ಧ್ವನಿ ಮಾದರಿ ಇದೆ. ಇದಕ್ಕೆ ಸುಮಾರು %2$d ಸೆಕೆಂಡ್ಗಳು ಬೇಕಾಗುತ್ತದೆ. ನೀವು %3$.0f MB ಡಿಸ್ಕ್ ಜಾಗವನ್ನು ಉಳಿಸುತ್ತೀರಿ.</item>+ <item quantity="other">ಹೊಸ ಫಾರ್ಮ್ಯಾಟ್ಗೆ ಪರಿವರ್ತಿಸಲು ನಿಮ್ಮ ಬಳಿ %1$d ಧ್ವನಿ ಮಾದರಿಗಳು ಇವೆ. ಇದಕ್ಕೆ ಸುಮಾರು %2$d ಸೆಕೆಂಡ್ಗಳು ಬೇಕಾಗುತ್ತದೆ. ನೀವು %3$.0f MB ಡಿಸ್ಕ್ ಜಾಗವನ್ನು ಉಳಿಸುತ್ತೀರಿ.</item>+ </plurals>+ <!-- document translation notification + progress -->+ <string name="doc_notif_translating">ಫೈಲ್ ಅನುವಾದಿಸಲಾಗುತ್ತಿದೆ</string>+ <string name="doc_notif_translated">ಅನುವಾದಿಸಿದ ಫೈಲ್</string>+ <string name="doc_notif_phase_text">ಪಠ್ಯ %1$d%%</string>+ <string name="doc_notif_phase_images">ಚಿತ್ರಗಳು %1$d/%2$d</string>+ <string name="doc_notif_phase_raster">ಬಿಟ್ಮ್ಯಾಪ್ ಪುಟಗಳು %1$d/%2$d</string>+ <string name="doc_notif_channel_name">ಡಾಕ್ಯುಮೆಂಟ್ ಅನುವಾದ</string>+ <string name="doc_notif_channel_desc">ಡಾಕ್ಯುಮೆಂಟ್ಗಳನ್ನು ಅನುವಾದಿಸುವಾಗ ಪ್ರಗತಿಯನ್ನು ತೋರಿಸುತ್ತದೆ</string>+ <string name="doc_progress_preparing">ಫೈಲ್ ಸಿದ್ಧಪಡಿಸಲಾಗುತ್ತಿದೆ</string>+ <string name="doc_progress_translating">ಅನುವಾದಿಸಲಾಗುತ್ತಿದೆ</string>+ <string name="doc_progress_translated">ಅನುವಾದಿಸಿದ ಫೈಲ್</string>+ <string name="doc_progress_saving">ಅನುವಾದಿಸಿದ ಫೈಲ್ ಉಳಿಸಲಾಗುತ್ತಿದೆ</string>+ <string name="doc_translation_failed">ಡಾಕ್ಯುಮೆಂಟ್ ಅನುವಾದ ವಿಫಲವಾಯಿತು</string>+ <string name="doc_url_unsupported">ಡಾಕ್ಯುಮೆಂಟ್ ಅನ್ನು ಡೌನ್ಲೋಡ್ ಮಾಡಿ ಬದಲಿಗೆ ಆ್ಯಪ್ನಲ್ಲಿ ತೆರೆಯಿರಿ</string>+ <!-- document configure sheet -->+ <string name="document_wrap_columns">%1$d ಕಾಲಮ್ಗಳಲ್ಲಿ ಸುತ್ತಿಕೊಳ್ಳಿ</string>+ <string name="document_translate_pdf_images">PDF ನಲ್ಲಿನ ಚಿತ್ರಗಳನ್ನು ಅನುವಾದಿಸಿ</string>+ <string name="layout_preserve">ಸಾಲಿನ ವಿರಾಮಗಳನ್ನು ಉಳಿಸಿಕೊಳ್ಳಿ</string>+ <string name="layout_reflow">ಪ್ಯಾರಾಗಳಾಗಿ ಮರುಜೋಡಿಸಿ</string>+ <string name="layout_reflow_wrap">ಮರುಜೋಡಿಸಿ ಮತ್ತು ಸುತ್ತಿಕೊಳ್ಳಿ</string>+ <!-- common (additional) -->+ <string name="common_open">ತೆರೆಯಿರಿ</string>+ <string name="common_close">ಮುಚ್ಚಿ</string>+ <string name="common_save">ಉಳಿಸಿ</string>+ <!-- translator app -->+ <string name="translator_translated_file">ಅನುವಾದಿಸಿದ ಫೈಲ್: %1$s</string>+ <string name="translator_document_saved">ಡಾಕ್ಯುಮೆಂಟ್ ಉಳಿಸಲಾಗಿದೆ</string>+ <string name="translator_document_save_failed">ಡಾಕ್ಯುಮೆಂಟ್ ಉಳಿಸಲು ವಿಫಲವಾಯಿತು</string>+ <string name="translator_audio_playback_failed">ಆಡಿಯೋ ಪ್ಲೇಬ್ಯಾಕ್ ವಿಫಲವಾಯಿತು: %1$s</string>+ <string name="translator_no_app_to_open">ಈ ಫೈಲ್ ತೆರೆಯಲು ಯಾವುದೇ ಆ್ಯಪ್ ಸಿಗಲಿಲ್ಲ</string>+ <!-- document alignment -->+ <string name="docalign_decode_failed">ಚಿತ್ರವನ್ನು ಡಿಕೋಡ್ ಮಾಡಲಾಗಲಿಲ್ಲ.</string>+ <string name="docalign_detecting">ಮೂಲೆಗಳನ್ನು ಪತ್ತೆ ಮಾಡಲಾಗುತ್ತಿದೆ…</string>+ <string name="docalign_redetecting">ಮತ್ತೆ ಪತ್ತೆ ಮಾಡಲಾಗುತ್ತಿದೆ…</string>+ <string name="docalign_help">ಡಾಕ್ಯುಮೆಂಟ್ನ ಸುತ್ತ ನಿಖರವಾದ ಪರಿಧಿ ಗುರುತಿಸುವಿಕೆಯ ಗುಣಮಟ್ಟವನ್ನು ಸುಧಾರಿಸುತ್ತದೆ. ಸಾಲುಗಳು ಪಠ್ಯಕ್ಕೆ ಸಮಾನಾಂತರವಾಗಿರುವುದು ಮುಖ್ಯ.\n\nಜೂಮ್ ಮಾಡಿದಾಗ ಅಥವಾ ಸರಿಸಿದಾಗ ಸಾಮಾನ್ಯವಾಗಿ ಅಲ್ಗಾರಿದಂ ಡಾಕ್ಯುಮೆಂಟ್ ಅನ್ನು ತಾನಾಗಿಯೇ ಗುರುತಿಸುತ್ತದೆ, ಆದರೆ ಸಿಗದಿದ್ದರೆ ನೀವು ಕೈಯಾರೆ ಹೊಂದಿಸಬಹುದು.</string>+ <!-- how to use -->+ <string name="howto_section_other_apps">ಬೇರೆ ಆ್ಯಪ್ಗಳಿಂದ</string>+ <string name="howto_share_title">ಹಂಚಿ ಅನುವಾದಿಸಿ</string>+ <string name="howto_share_body">ಯಾವುದೇ ಆ್ಯಪ್ನಿಂದ ಪಠ್ಯ, ಲಿಂಕ್ಗಳು ಅಥವಾ ಚಿತ್ರಗಳನ್ನು ಹಂಚಿಕೊಂಡು ಅನುವಾದಿಸಿ.</string>+ <string name="howto_copy_title">ಬೇರೆ ಆ್ಯಪ್ಗಳಿಂದ ಹೊರಬರದೆ ಅನುವಾದಿಸಿ</string>+ <string name="howto_copy_body">ಎಲ್ಲಿಯಾದರೂ ಪಠ್ಯವನ್ನು ಆಯ್ಕೆಮಾಡಿ, ನಂತರ ನಕಲು ಟೂಲ್ಬಾರ್ನಲ್ಲಿ \"ಅನುವಾದಿಸಿ\" ಒತ್ತಿ, ಅನುವಾದವನ್ನು ಸಣ್ಣ ಪಾಪ್ಅಪ್ನಲ್ಲಿ ನೋಡಿ.</string>+ <string name="howto_section_in_app">ಆ್ಯಪ್ ಒಳಗೆ</string>+ <string name="howto_docs_title">ಡಾಕ್ಯುಮೆಂಟ್ಗಳು ಮತ್ತು ಚಿತ್ರಗಳನ್ನು ಅನುವಾದಿಸಿ</string>+ <string name="howto_docs_body">ಚಿತ್ರಗಳು ಅಥವಾ EPUB, PDF ಮತ್ತು TXT ಫೈಲ್ಗಳನ್ನು ಅನುವಾದಿಸಲು Documents ಟ್ಯಾಬ್ ತೆರೆಯಿರಿ.</string>+ <string name="howto_dict_title">ನಿಘಂಟು ಹುಡುಕಾಟ</string>+ <string name="howto_dict_body">ಅನುವಾದದಲ್ಲಿನ ಯಾವುದೇ ಪದವನ್ನು ಒತ್ತಿ ಹಿಡಿದು ಅದರ ಅರ್ಥವನ್ನು ನೋಡಿ. ಡೇಟಾ Wiktionary ನಿಂದ ಪಡೆಯಲಾಗಿದೆ.</string>+ <string name="howto_voice_title">ಧ್ವನಿ ಅಥವಾ ವೇಗ ಬದಲಿಸಿ</string>+ <string name="howto_voice_body">ಬೇರೆ ಧ್ವನಿ ಆಯ್ಕೆ ಮಾಡಲು ಅಥವಾ ಪ್ಲೇಬ್ಯಾಕ್ ವೇಗ ಹೊಂದಿಸಲು ಪ್ಲೇ ಬಟನ್ ಅನ್ನು ಒತ್ತಿ ಹಿಡಿಯಿರಿ.</string>+ <!-- feature row labels -->+ <string name="feature_translation">ಅನುವಾದ</string>+ <string name="feature_dictionary">ನಿಘಂಟು</string>+ <string name="feature_tts">ಧ್ವನಿ</string>+ <!-- misc -->+ <string name="detected_translate_from">ಇದರಿಂದ ಅನುವಾದಿಸಿ</string>+ <string name="detected_missing_language">ಭಾಷೆ ಇಲ್ಲ</string>+ <string name="main_input_placeholder">ಪಠ್ಯ ನಮೂದಿಸಿ</string>+ <string name="aidl_target_unavailable">ಗುರಿ ಭಾಷೆ ಲಭ್ಯವಿಲ್ಲ</string>+</resources>diff --git a/OCR-translation/src/main/res/values-ko/strings.xml b/OCR-translation/src/main/res/values-ko/strings.xmlnew file mode 100644index 0000000..71973de--- /dev/null+++ b/OCR-translation/src/main/res/values-ko/strings.xml@@ -0,0 +1,216 @@+<?xml version="1.0" encoding="utf-8"?>+<resources>+ <string name="stop">중지</string>+ <string name="pause">일시정지</string>+ <string name="resume">계속</string>+ <string name="region_select_menu">번역 영역 설정</string>+ <string name="screen_translate_needs_source">원본 언어를 지정해 주세요</string>+ <string name="live_tile_label">화면 실시간 번역</string>+ <string name="translate_text">번역</string>+ <string name="translate_link">링크 번역</string>+ <string name="accessibility_service_description">화면의 텍스트를 번역하려면 이 서비스를 켜세요. 떠 있는 번역 버튼을 누르면 현재 화면을 번역하거나 화면 실시간 번역을 시작할 수 있어요.</string>+ <string name="tap_to_translate_title">빠른 번역이 켜져 있어요</string>+ <string name="tap_to_translate_body">눌러서 번역 팝업을 열어 보세요</string>+ <string name="tap_to_translate_channel">빠른 번역</string>+ <string name="tap_to_translate_channel_description">번역 팝업에 빠르게 접근할 수 있는 상시 알림</string>+ <string name="quick_tile_label">번역</string>+ <!-- common -->+ <string name="common_ok">확인</string>+ <string name="common_cancel">취소</string>+ <string name="common_done">완료</string>+ <string name="common_grant">허용</string>+ <string name="common_manage">관리</string>+ <!-- settings -->+ <string name="settings_title">설정</string>+ <string name="settings_languages">언어</string>+ <string name="settings_language_packs">언어 팩</string>+ <string name="settings_general">일반</string>+ <string name="settings_font_size">글자 크기</string>+ <string name="settings_font_sample">이것은 예시 텍스트예요</string>+ <string name="settings_tap_notification">빠른 번역 알림</string>+ <string name="settings_tap_notification_desc">팝업을 여는 상시 알림이에요.</string>+ <string name="settings_web_translator">웹 번역기</string>+ <string name="settings_clear_browsing">닫을 때 인터넷 사용 기록 지우기</string>+ <string name="settings_clear_browsing_desc">쿠키, 캐시, 로컬 저장소를 삭제해요.</string>+ <string name="settings_tts_section">텍스트 음성 변환</string>+ <string name="settings_tts_read_urls_hashtags">URL 및 해시태그 읽기</string>+ <string name="settings_popup_settings">팝업</string>+ <string name="settings_popup_desc">텍스트 선택 메뉴에서 \'번역\'을 고르면 팝업이 나타나요</string>+ <string name="settings_hide_input">입력 숨기기</string>+ <string name="settings_popup_position">팝업 위치</string>+ <string name="settings_popup_size">팝업 크기: %1$d%%</string>+ <string name="settings_screen_translation">화면 번역</string>+ <string name="settings_screen_translation_desc">다른 앱 위에 바로 텍스트를 번역해요.</string>+ <string name="settings_floating_button">항상 떠 있는 버튼</string>+ <string name="settings_floating_button_desc">접근성 권한이 필요해요</string>+ <string name="settings_shortcut">단축키로 화면 번역</string>+ <string name="settings_shortcut_desc">홈 또는 전원 버튼을 길게 눌러 실행</string>+ <string name="settings_on_shortcut">단축키를 실행했을 때</string>+ <string name="settings_ocr">이미지</string>+ <string name="settings_background_mode">바꿀 텍스트 스타일</string>+ <string name="settings_min_confidence">최소 신뢰도: %1$d%%</string>+ <string name="settings_max_image_size">최대 이미지 크기: %1$dpx</string>+ <string name="settings_advanced">고급</string>+ <string name="settings_catalog_url">카탈로그 URL</string>+ <string name="settings_external_storage">외부 저장소 사용</string>+ <string name="settings_disable_autodetect">언어 자동 감지 끄기</string>+ <string name="settings_translit_output">번역된 텍스트의 음역 표시</string>+ <string name="settings_translit_input">원본 텍스트의 음역 표시</string>+ <string name="settings_translit_japanese_spaces">일본어 음역에 띄어쓰기 추가</string>+ <string name="settings_translate_pdf_images">PDF 안의 이미지 번역</string>+ <string name="settings_camera_live_default">기본적으로 카메라 실시간 번역</string>+ <string name="settings_register_browser">브라우저로 등록</string>+ <string name="settings_register_browser_desc">다른 앱의 링크를 번역하도록 제안해요.</string>+ <string name="settings_external_storage_perm_title">외부 저장소 권한</string>+ <string name="settings_about">정보</string>+ <string name="settings_version">버전 %1$s</string>+ <string name="settings_no_languages_available">사용할 수 있는 언어가 없어요</string>+ <string name="settings_default_from">기본 \'출발\' 언어</string>+ <string name="settings_default_to">기본 \'도착\' 언어</string>+ <string name="settings_adblock_support">광고 차단</string>+ <string name="settings_about_get_help">도움 받기 / 문제 신고</string>+ <string name="settings_logs_copied">앱 로그를 클립보드에 복사했어요</string>+ <string name="settings_about_support">개발 후원하기</string>+ <string name="settings_external_storage_perm_body">번역 파일을 문서 폴더에 저장하려면 이 앱이 모든 파일을 관리할 수 있는 권한이 필요해요.\n설정으로 이동하면 거기서 \'모든 파일 관리 허용\' 권한을 줄 수 있어요.</string>+ <!-- language manager / setup / how-to -->+ <string name="langmgr_voices">음성</string>+ <string name="voice_section_downloaded">다운로드됨</string>+ <string name="voice_section_available">사용 가능</string>+ <string name="langmgr_default">기본</string>+ <string name="langmgr_filter">언어 검색</string>+ <string name="langmgr_ocr_upgrade_available">개선된 텍스트 인식 모델이 나왔어요.</string>+ <string name="langmgr_delete_shared_title">공유 사전을 삭제할까요?</string>+ <string name="langmgr_delete_shared_body">이 사전은 %1$s와(과) 공유돼요.\n삭제하면 그 모두에서 사전이 사라져요.</string>+ <string name="langmgr_download_size">%1$s 다운로드</string>+ <string name="langmgr_repair_needed">일부 다운로드한 기능에 파일이 없어 복구하기 전까지 작동하지 않아요.</string>+ <string name="langmgr_repair_size">%1$s 복구</string>+ <string name="nolang_title">언어 설정</string>+ <string name="nolang_prompt">번역을 시작하려면 언어 팩을 다운로드하세요</string>+ <string name="howto_title">사용 방법</string>+ <!-- image capture / voice / dictionary / language selector -->+ <string name="image_no_crop_remote">원격 이미지는 바로 자를 수 없어요</string>+ <string name="image_open_failed">파일을 열지 못했어요</string>+ <string name="image_source_screen">화면</string>+ <string name="image_source_document">문서</string>+ <string name="image_source_photos">사진</string>+ <string name="image_source_gallery">갤러리</string>+ <string name="image_source_camera">카메라</string>+ <string name="voice_playback_speed">재생 속도</string>+ <string name="voice_label">음성</string>+ <string name="voice_default">기본 음성</string>+ <string name="langsel_auto">✨ 자동</string>+ <string name="dict_also_as">다른 표현:</string>+ <!-- camera / browser / screen translate -->+ <string name="camera_permission_rationale">실시간 번역을 하려면 카메라 권한이 필요해요.</string>+ <string name="camera_need_ocr_models">이 언어의 텍스트 인식 모델(이미지용)을 다운로드해야 해요</string>+ <string name="browser_no_source_language">사용할 수 있는 원본 언어가 없어요. 먼저 메인 화면에서 하나 설치하거나, 설정에서 기본 원본 언어를 정해 주세요.</string>+ <string name="browser_reader_unavailable">이 페이지에서는 리더 모드를 쓸 수 없어요</string>+ <string name="browser_translate_image">이미지 번역</string>+ <string name="screen_translating_notification">화면 번역 중</string>+ <!-- enums -->+ <string name="align_top">위</string>+ <string name="align_middle">가운데</string>+ <string name="align_bottom">아래</string>+ <string name="assistant_action_still_image">한 번 번역</string>+ <string name="assistant_action_live_screen">실시간 번역 시작</string>+ <string name="background_mode_white_on_black">검은 배경에 흰 글자</string>+ <string name="background_mode_black_on_white">흰 배경에 검은 글자</string>+ <string name="background_mode_auto_detect">원본 이미지 색상</string>+ <!-- tts / speech errors -->+ <string name="tts_nothing_to_speak">읽을 내용이 없어요</string>+ <string name="tts_catalog_unavailable">카탈로그를 사용할 수 없어요</string>+ <string name="tts_no_voice">%1$s 음성이 설치되어 있지 않아요</string>+ <string name="tts_synthesis_failed">%1$s 음성 합성에 실패했어요</string>+ <string name="tts_sample_fallback">이것은 Offline Translator의 음성 샘플이에요.</string>+ <!-- translation -->+ <string name="translation_error">번역 오류: %1$s</string>+ <!-- download errors -->+ <string name="download_failed_core">%1$s 다운로드에 실패했어요</string>+ <string name="download_failed_ocr">%1$s 텍스트 인식 모델 다운로드에 실패했어요</string>+ <string name="download_failed_ocr_batch">텍스트 인식 모델 일괄 다운로드에 실패했어요</string>+ <string name="download_failed_dictionary">%1$s 사전 다운로드에 실패했어요</string>+ <string name="download_failed_tts">%1$s 음성 다운로드에 실패했어요</string>+ <string name="download_failed_adblock">광고 차단 목록 다운로드에 실패했어요</string>+ <string name="download_failed_repair">복구 다운로드에 실패했어요</string>+ <string name="download_catalog_unavailable">카탈로그를 사용할 수 없어요</string>+ <string name="download_catalog_save_failed">카탈로그를 저장하지 못했어요</string>+ <string name="download_unknown_error">알 수 없는 오류</string>+ <string name="download_catalog_failed">카탈로그를 다운로드하지 못했어요: %1$s</string>+ <!-- assistant overlay status -->+ <string name="assistant_invoke_prompt">번역하려는 텍스트 위에서 이 어시스턴트를 실행하세요</string>+ <string name="assistant_collecting_context">화면 정보를 모으는 중…</string>+ <string name="assistant_screenshot_disabled">이 어시스턴트는 스크린샷 접근이 꺼져 있어요. 시스템 어시스턴트 설정에서 켜 주세요.</string>+ <string name="assistant_no_screen_data">화면 데이터를 받지 못했어요. 이 어시스턴트의 \'스크린샷 사용\'을 켜 주세요.</string>+ <string name="assistant_no_screenshot">이 앱은 스크린샷을 제공하지 않았어요.</string>+ <string name="assistant_set_source_ocr">이미지 텍스트 인식에 쓸 기본 원본 언어를 정해 주세요.</string>+ <string name="assistant_langs_not_ready">번역 언어가 아직 준비되지 않았어요. 다시 시도해 주세요.</string>+ <string name="assistant_ocr_failed">텍스트 인식에 실패했어요</string>+ <string name="ocr_models_missing">텍스트 인식 모델이 없어요. 복구하려면 앱에서 언어 관리를 열어 주세요.</string>+ <string name="assistant_set_source_live">화면 실시간 번역을 쓰려면 설정에서 기본 원본 언어를 정해 주세요.</string>+ <!-- migration gate -->+ <string name="migration_updating_speech_models">음성 모델 업데이트 중</string>+ <string name="migration_accept_convert">동의하고 변환</string>+ <string name="migration_delete_all">대신 모두 삭제</string>+ <string name="migration_converting">%2$d개 중 %1$d개 변환 중</string>+ <string name="migration_optimizing">모델 최적화 중</string>+ <plurals name="migration_convert_prompt">+ <item quantity="other">새 형식으로 변환할 음성 모델이 %1$d개 있어요. 약 %2$d초 정도 걸려요. 디스크 공간을 %3$.0f MB 절약할 수 있어요.</item>+ </plurals>+ <!-- document translation notification + progress -->+ <string name="doc_notif_translating">파일 번역 중</string>+ <string name="doc_notif_translated">번역된 파일</string>+ <string name="doc_notif_phase_text">텍스트 %1$d%%</string>+ <string name="doc_notif_phase_images">이미지 %1$d/%2$d</string>+ <string name="doc_notif_phase_raster">비트맵 페이지 %1$d/%2$d</string>+ <string name="doc_notif_channel_name">문서 번역</string>+ <string name="doc_notif_channel_desc">문서를 번역하는 동안 진행 상황을 보여줘요</string>+ <string name="doc_progress_preparing">파일 준비 중</string>+ <string name="doc_progress_translating">번역 중</string>+ <string name="doc_progress_translated">번역된 파일</string>+ <string name="doc_progress_saving">번역된 파일 저장 중</string>+ <string name="doc_translation_failed">문서 번역에 실패했어요</string>+ <string name="doc_url_unsupported">문서를 다운로드한 뒤 앱으로 열어 주세요</string>+ <!-- document configure sheet -->+ <string name="document_wrap_columns">%1$d칸에서 줄바꿈</string>+ <string name="document_translate_pdf_images">PDF 안의 이미지 번역</string>+ <string name="layout_preserve">줄바꿈 유지</string>+ <string name="layout_reflow">문단으로 재구성</string>+ <string name="layout_reflow_wrap">재구성하고 줄바꿈</string>+ <!-- common (additional) -->+ <string name="common_open">열기</string>+ <string name="common_close">닫기</string>+ <string name="common_save">저장</string>+ <!-- translator app -->+ <string name="translator_translated_file">번역된 파일: %1$s</string>+ <string name="translator_document_saved">문서를 저장했어요</string>+ <string name="translator_document_save_failed">문서를 저장하지 못했어요</string>+ <string name="translator_audio_playback_failed">오디오 재생에 실패했어요: %1$s</string>+ <string name="translator_no_app_to_open">이 파일을 열 수 있는 앱을 찾지 못했어요</string>+ <!-- document alignment -->+ <string name="docalign_decode_failed">이미지를 디코딩할 수 없어요.</string>+ <string name="docalign_detecting">모서리 감지 중…</string>+ <string name="docalign_redetecting">다시 감지 중…</string>+ <string name="docalign_help">문서 둘레를 정확하게 잡으면 인식 품질이 좋아져요. 선이 텍스트와 평행하게 맞추는 것이 중요해요.\n\n화면을 확대하거나 움직이면 보통 알고리즘이 문서를 자동으로 잡아 주지만, 잘 안 잡힐 때는 직접 조정할 수도 있어요.</string>+ <!-- how to use -->+ <string name="howto_section_other_apps">다른 앱에서</string>+ <string name="howto_share_title">공유해서 번역하기</string>+ <string name="howto_share_body">어떤 앱에서든 텍스트, 링크, 이미지를 공유하면 번역할 수 있어요.</string>+ <string name="howto_copy_title">다른 앱을 벗어나지 않고 번역하기</string>+ <string name="howto_copy_body">어디서든 텍스트를 선택한 다음 복사 도구 모음에서 \"번역\"을 누르면 작은 팝업으로 번역을 볼 수 있어요.</string>+ <string name="howto_section_in_app">앱 안에서</string>+ <string name="howto_docs_title">문서와 이미지 번역</string>+ <string name="howto_docs_body">문서 탭을 열어 이미지나 EPUB, PDF, TXT 파일을 번역하세요.</string>+ <string name="howto_dict_title">사전 찾기</string>+ <string name="howto_dict_body">번역문에서 단어를 길게 누르면 뜻을 볼 수 있어요. 데이터는 Wiktionary에서 가져와요.</string>+ <string name="howto_voice_title">음성이나 속도 바꾸기</string>+ <string name="howto_voice_body">재생 버튼을 길게 누르면 다른 음성을 고르거나 재생 속도를 조절할 수 있어요.</string>+ <!-- feature row labels -->+ <string name="feature_translation">번역</string>+ <string name="feature_dictionary">사전</string>+ <string name="feature_tts">음성</string>+ <!-- misc -->+ <string name="detected_translate_from">번역 출발 언어</string>+ <string name="detected_missing_language">언어 없음</string>+ <string name="main_input_placeholder">텍스트 입력</string>+ <string name="aidl_target_unavailable">도착 언어를 사용할 수 없어요</string>+</resources>diff --git a/OCR-translation/src/main/res/values-lo/strings.xml b/OCR-translation/src/main/res/values-lo/strings.xmlnew file mode 100644index 0000000..d6c470e--- /dev/null+++ b/OCR-translation/src/main/res/values-lo/strings.xml@@ -0,0 +1,291 @@+<?xml version="1.0" encoding="utf-8"?>+<resources>+ <string name="stop">ຢຸດ</string>+ <string name="pause">ພັກ</string>+ <string name="resume">ຕໍ່</string>+ <string name="region_select_menu">ກຳນົດພື້ນທີ່ການແປ</string>+ <string name="screen_translate_needs_source">ລະບຸພາສາຕົ້ນທາງ</string>+ <string name="live_tile_label">ແປໜ້າຈໍແບບສົດໆ</string>+ <string name="translate_text">ແປ</string>+ <string name="translate_link">ແປລິ້ງ</string>+ <string name="accessibility_service_description">ເປີດບໍລິການນີ້ເພື່ອແປຂໍ້ຄວາມເທິງໜ້າຈໍ. ແຕະປຸ່ມແປແບບລອຍເພື່ອແປໜ້າຈໍປັດຈຸບັນ, ຫຼື ເລີ່ມການແປໜ້າຈໍແບບສົດໆ.</string>+ <string name="tap_to_translate_title">ເປີດການແປດ່ວນແລ້ວ</string>+ <string name="tap_to_translate_body">ແຕະເພື່ອເປີດປ່ອງຢ້ຽມແປພາສາ</string>+ <string name="tap_to_translate_channel">ແປດ່ວນ</string>+ <string name="tap_to_translate_channel_description">ການແຈ້ງເຕືອນແບບຖາວອນເພື່ອເຂົ້າຫາປ່ອງຢ້ຽມແປພາສາໄດ້ໄວ</string>+ <string name="quick_tile_label">ແປພາສາ</string>+ <string name="common_ok">ຕົກລົງ</string>+ <string name="common_cancel">ຍົກເລີກ</string>+ <string name="common_done">ສຳເລັດ</string>+ <string name="common_grant">ອະນຸຍາດ</string>+ <string name="common_manage">ຈັດການ</string>+ <string name="settings_title">ການຕັ້ງຄ່າ</string>+ <string name="settings_languages">ພາສາ</string>+ <string name="settings_language_packs">ຊຸດພາສາ</string>+ <string name="settings_general">ທົ່ວໄປ</string>+ <string name="settings_font_size">ຂະໜາດຕົວໜັງສື</string>+ <string name="settings_font_sample">ນີ້ແມ່ນຕົວຢ່າງຂໍ້ຄວາມ</string>+ <string name="settings_tap_notification">ການແຈ້ງເຕືອນແປດ່ວນ</string>+ <string name="settings_tap_notification_desc">ການແຈ້ງເຕືອນແບບຖາວອນເພື່ອເປີດປ່ອງຢ້ຽມແປພາສາ.</string>+ <string name="settings_web_translator">ຕົວແປເວັບ</string>+ <string name="settings_clear_browsing">ລຶບຂໍ້ມູນການທ່ອງເວັບເມື່ອປິດ</string>+ <string name="settings_clear_browsing_desc">ລຶບ ຄຸກກີ້, ແຄສ ແລະ ບ່ອນເກັບຂໍ້ມູນພາຍໃນ.</string>+ <string name="settings_tts_section">ປ່ຽນຂໍ້ຄວາມເປັນສຽງ</string>+ <string name="settings_tts_read_urls_hashtags">ອ່ານ URLs ແລະ ແຮຊແທັກ</string>+ <string name="settings_popup_settings">ປ່ອງຢ້ຽມລອຍ</string>+ <string name="settings_popup_desc">ປ່ອງຢ້ຽມຈະສະແດງຂຶ້ນເມື່ອເລືອກ \'ແປ\' ຈາກເມນູເລືອກຂໍ້ຄວາມ</string>+ <string name="settings_hide_input">ເຊື່ອງຊ່ອງປ້ອນຂໍ້ມູນ</string>+ <string name="settings_popup_position">ຕຳແໜ່ງປ່ອງຢ້ຽມ</string>+ <string name="settings_popup_size">ຂະໜາດປ່ອງຢ້ຽມ: %1$d%%</string>+ <string name="settings_screen_translation">ການແປໜ້າຈໍ</string>+ <string name="settings_screen_translation_desc">ແປຂໍ້ຄວາມໂດຍກົງທັບເທິງແອັບອື່ນ.</string>+ <string name="settings_floating_button">ສະແດງປຸ່ມຕະຫຼອດ</string>+ <string name="settings_floating_button_desc">ຕ້ອງການສິດການເຂົ້າເຖິງ</string>+ <string name="settings_shortcut">ແປໜ້າຈໍດ້ວຍປຸ່ມລັດ</string>+ <string name="settings_shortcut_desc">ກົດປຸ່ມໂຮມ ຫຼື ປຸ່ມເປີດເຄື່ອງຄ້າງໄວ້ເພື່ອເລີ່ມ</string>+ <string name="settings_on_shortcut">ເມື່ອໃຊ້ປຸ່ມລັດ</string>+ <string name="settings_ocr">ຮູບພາບ</string>+ <string name="settings_background_mode">ແທນບ່ອນຂໍ້ຄວາມດ້ວຍ</string>+ <string name="settings_min_confidence">ຄວາມຖືກຕ້ອງຕ່ຳສຸດ: %1$d%%</string>+ <string name="settings_max_image_size">ຂະໜາດຮູບສູງສຸດ: %1$dpx</string>+ <string name="settings_advanced">ຂັ້ນສູງ</string>+ <string name="settings_catalog_url">URL ແຄັດຕາລັອກ</string>+ <string name="settings_external_storage">ໃຊ້ບ່ອນເກັບຂໍ້ມູນພາຍນອກ</string>+ <string name="settings_disable_autodetect">ປິດການກວດຫາພາສາອັດຕະໂນມັດ</string>+ <string name="settings_experimental_screen_translate">ແປໜ້າຈໍ (ລຸ້ນທົດລອງ)</string>+ <string name="settings_multi_target">ແປເປັນຫຼາຍພາສາພ້ອມກັນ</string>+ <string name="a11y_add_target_language">ເພີ່ມພາສາປາຍທາງ</string>+ <string name="a11y_remove_target_language">ລຶບພາສາປາຍທາງ</string>+ <string name="feature_unavailable_tts">ບໍ່ມີລະບົບສຽງ, ກະລຸນາດາວໂຫຼດຢູ່ໜ້າຈັດການພາສາ</string>+ <string name="feature_unavailable_dictionary">ບໍ່ມີວັດຈະນານຸກົມ, ກະລຸນາດາວໂຫຼດຢູ່ໜ້າຈັດການພາສາ</string>+ <string name="settings_translit_output">ສະແດງຄຳອ່ານສຳລັບຂໍ້ຄວາມທີ່ແປແລ້ວ</string>+ <string name="settings_translit_input">ສະແດງຄຳອ່ານສຳລັບຂໍ້ຄວາມຕົ້ນສະບັບ</string>+ <string name="settings_translit_japanese_spaces">ເພີ່ມຍະຫວ່າງສຳລັບຄຳອ່ານພາສາຍີ່ປຸ່ນ</string>+ <string name="settings_translate_pdf_images">ແປຮູບພາບໃນໄຟລ໌ PDF</string>+ <string name="settings_camera_live_default">ແປຈາກກ້ອງແບບສົດໆເປັນຄ່າເລີ່ມຕົ້ນ</string>+ <string name="settings_register_browser">ລົງທະບຽນເປັນບຣາວເຊີ</string>+ <string name="settings_register_browser_desc">ສະເໜີໃຫ້ແປລິ້ງຈາກແອັບອື່ນ.</string>+ <string name="settings_external_storage_perm_title">ສິດເຂົ້າເຖິງບ່ອນເກັບຂໍ້ມູນພາຍນອກ</string>+ <string name="settings_about">ກ່ຽວກັບ</string>+ <string name="settings_version">ເວີຊັນ %1$s</string>+ <string name="settings_no_languages_available">ບໍ່ມີພາສາທີ່ພ້ອມໃຊ້</string>+ <string name="settings_default_from">ພາສາຕົ້ນທາງເລີ່ມຕົ້ນ</string>+ <string name="settings_default_to">ພາສາປາຍທາງເລີ່ມຕົ້ນ</string>+ <string name="settings_adblock_support">ບລັອກໂຄສະນາ</string>+ <string name="settings_about_get_help">ຂໍຄວາມຊ່ວຍເຫຼືອ / ລາຍງານບັນຫາ</string>+ <string name="settings_logs_copied">ສຳເນົາບັນທຶກແອັບໄວ້ໃນຄລິບບອດແລ້ວ</string>+ <string name="settings_about_support">ສະໜັບສະໜູນການພັດທະນາ</string>+ <string name="settings_external_storage_perm_body">ເພື່ອເກັບໄຟລ໌ການແປໄວ້ໃນໂຟນເດີເອກະສານ, ແອັບນີ້ຕ້ອງມີສິດຈັດການໄຟລ໌ທັງໝົດ.\nລະບົບຈະພາທ່ານໄປທີ່ການຕັ້ງຄ່າເພື່ອເປີດສິດ \'ອະນຸຍາດໃຫ້ເຂົ້າເຖິງການຈັດການໄຟລ໌ທັງໝົດ\'.</string>+ <string name="langmgr_voices">ສຽງ</string>+ <string name="voice_section_downloaded">ດາວໂຫຼດແລ້ວ</string>+ <string name="voice_section_available">ທີ່ມີໃຫ້ໃຊ້</string>+ <string name="langmgr_default">ເລີ່ມຕົ້ນ</string>+ <string name="langmgr_filter">ກັ່ນຕອງພາສາ</string>+ <string name="langmgr_ocr_upgrade_available">ມີໂມເດວການກວດຈັບຂໍ້ຄວາມທີ່ດີກວ່າເກົ່າໃຫ້ອັບເດດ.</string>+ <string name="langmgr_translation_upgrade_available">ມີການປັບປຸງການແປສຳລັບ: %1$s</string>+ <string name="langmgr_delete_shared_title">ລຶບວັດຈະນານຸກົມທີ່ໃຊ້ຮ່ວມກັນບໍ່?</string>+ <string name="langmgr_delete_shared_body">ວັດຈະນານຸກົມນີ້ຖືກໃຊ້ຮ່ວມກັບ %1$s.\nການລຶບຈະເຮັດໃຫ້ວັດຈະນານຸກົມຫາຍໄປຈາກທັງໝົດນັ້ນ.</string>+ <string name="langmgr_download_size">ດາວໂຫຼດ %1$s</string>+ <string name="langmgr_repair_needed">ບາງຟີເຈີທີ່ດາວໂຫຼດມາມີໄຟລ໌ບໍ່ຄົບ ແລະ ຈະບໍ່ເຮັດວຽກຈົນກວ່າຈະມີການສ້ອມແປງ.</string>+ <string name="langmgr_repair_size">ສ້ອມແປງ %1$s</string>+ <string name="nolang_title">ຕັ້ງຄ່າພາສາ</string>+ <string name="nolang_prompt">ດາວໂຫຼດຊຸດພາສາເພື່ອເລີ່ມການແປ</string>+ <string name="howto_title">ວິທີການນຳໃຊ້</string>+ <string name="image_no_crop_remote">ຮູບພາບຈາກທາງໄກບໍ່ສາມາດຕັດຂອບໂດຍກົງໄດ້</string>+ <string name="image_crop_action">ຕັດຂອບ</string>+ <string name="image_open_failed">ເປີດໄຟລ໌ບໍ່ສຳເລັດ</string>+ <string name="image_source_screen">ໜ້າຈໍ</string>+ <string name="image_source_document">ເອກະສານ</string>+ <string name="image_source_photos">ຮູບພາບ</string>+ <string name="image_source_gallery">ຄັງຮູບພາບ</string>+ <string name="image_source_camera">ກ້ອງຖ່າຍຮູບ</string>+ <string name="voice_playback_speed">ຄວາມໄວການຫຼິ້ນສຽງ</string>+ <string name="voice_label">ສຽງ</string>+ <string name="voice_default">ສຽງເລີ່ມຕົ້ນ</string>+ <string name="langsel_auto">✨ ອັດຕະໂນມັດ</string>+ <string name="dict_also_as">ເປັນໄດ້ຄືກັນກັບ:</string>+ <string name="camera_permission_rationale">ຕ້ອງການສິດການໃຊ້ກ້ອງເພື່ອແປແບບສົດໆ.</string>+ <string name="camera_need_ocr_models">ທ່ານຕ້ອງດາວໂຫຼດໂມເດວການກວດຈັບຂໍ້ຄວາມສຳລັບພາສານີ້</string>+ <string name="browser_no_source_language">ບໍ່ມີພາສາຕົ້ນທາງ. ກະລຸນາຕິດຕັ້ງຈາກໜ້າຈໍຫຼັກກ່ອນ, ຫຼື ຕັ້ງພາສາຕົ້ນທາງເລີ່ມຕົ້ນໃນການຕັ້ງຄ່າ.</string>+ <string name="browser_reader_unavailable">ບໍ່ມີໂໝດການອ່ານສຳລັບໜ້ານີ້</string>+ <string name="browser_translate_image">ແປຮູບພາບ</string>+ <string name="screen_translating_notification">ກຳລັງແປໜ້າຈໍ</string>+ <string name="align_top">ເທິງ</string>+ <string name="align_middle">ກາງ</string>+ <string name="align_bottom">ລຸ່ມ</string>+ <string name="assistant_action_still_image">ແປຄັ້ງດຽວ</string>+ <string name="assistant_action_live_screen">ເລີ່ມການແປແບບສົດໆ</string>+ <string name="background_mode_white_on_black">ຂາວເທິງດຳ</string>+ <string name="background_mode_black_on_white">ດຳເທິງຂາວ</string>+ <string name="background_mode_auto_detect">ສີຕາມຮູບຕົ້ນສະບັບ</string>+ <string name="tts_nothing_to_speak">ບໍ່ມີຂໍ້ຄວາມໃຫ້ອ່ານ</string>+ <string name="tts_catalog_unavailable">ບໍ່ມີແຄັດຕາລັອກ</string>+ <string name="tts_no_voice">ບໍ່ໄດ້ຕິດຕັ້ງສຽງສຳລັບ %1$s</string>+ <string name="tts_synthesis_failed">ການສ້າງສຽງເວົ້າຫຼົ້ມເຫຼວສຳລັບ %1$s</string>+ <string name="tts_sample_fallback">ນີ້ແມ່ນຕົວຢ່າງສຽງອ່ານຈາກແອັບ Offline Translator.</string>+ <string name="translation_error">ການແປຜິດພາດ: %1$s</string>+ <string name="download_failed_core">ດາວໂຫຼດ %1$s ບໍ່ສຳເລັດ</string>+ <string name="download_failed_ocr">ດາວໂຫຼດການກວດຈັບຂໍ້ຄວາມ %1$s ບໍ່ສຳເລັດ</string>+ <string name="download_failed_ocr_batch">ດາວໂຫຼດຊຸດການກວດຈັບຂໍ້ຄວາມບໍ່ສຳເລັດ</string>+ <string name="download_failed_translation_batch">ດາວໂຫຼດຕົວອັບເກຣດການແປບໍ່ສຳເລັດ</string>+ <string name="download_failed_dictionary">ດາວໂຫຼດວັດຈະນານຸກົມ %1$s ບໍ່ສຳເລັດ</string>+ <string name="download_failed_tts">ດາວໂຫຼດສຽງ %1$s ບໍ່ສຳເລັດ</string>+ <string name="download_failed_adblock">ດາວໂຫຼດຕົວບລັອກໂຄສະນາບໍ່ສຳເລັດ</string>+ <string name="download_failed_repair">ດາວໂຫຼດໄຟລ໌ສ້ອມແປງບໍ່ສຳເລັດ</string>+ <string name="download_catalog_unavailable">ບໍ່ມີແຄັດຕາລັອກ</string>+ <string name="download_catalog_save_failed">ບັນທຶກແຄັດຕາລັອກບໍ່ສຳເລັດ</string>+ <string name="download_unknown_error">ເກີດຂໍ້ຜິດພາດທີ່ບໍ່ຮູ້ຈັກ</string>+ <string name="download_catalog_failed">ດາວໂຫຼດແຄັດຕາລັອກບໍ່ສຳເລັດ: %1$s</string>+ <string name="assistant_invoke_prompt">ໃຊ້ຕົວຊ່ວຍນີ້ເທິງຂໍ້ຄວາມທີ່ຕ້ອງການແປ</string>+ <string name="assistant_collecting_context">ກຳລັງເກັບກຳຂໍ້ມູນໜ້າຈໍ…</string>+ <string name="assistant_screenshot_disabled">ການເຂົ້າເຖິງການຖ່າຍພາບໜ້າຈໍຖືກປິດໄວ້. ກະລຸນາເປີດໃນການຕັ້ງຄ່າຕົວຊ່ວຍຂອງລະບົບ.</string>+ <string name="assistant_no_screen_data">ບໍ່ໄດ້ຮັບຂໍ້ມູນໜ້າຈໍ. ກະລຸນາເປີດ \'ໃຊ້ການຖ່າຍພາບໜ້າຈໍ\' ສຳລັບຕົວຊ່ວຍນີ້.</string>+ <string name="assistant_no_screenshot">ແອັບນີ້ບໍ່ໄດ້ໃຫ້ພາບຖ່າຍໜ້າຈໍ.</string>+ <string name="assistant_set_source_ocr">ຕັ້ງພາສາຕົ້ນທາງເລີ່ມຕົ້ນສຳລັບການກວດຈັບຂໍ້ຄວາມ.</string>+ <string name="assistant_langs_not_ready">ພາສາທີ່ຈະແປຍັງບໍ່ພ້ອມເທື່ອ. ກະລຸນາລອງໃໝ່.</string>+ <string name="assistant_ocr_failed">ການກວດຈັບຂໍ້ຄວາມບໍ່ສຳເລັດ</string>+ <string name="ocr_models_missing">ບໍ່ພົບໂມເດວການກວດຈັບຂໍ້ຄວາມ. ເປີດໜ້າຈັດການພາສາເພື່ອສ້ອມແປງ.</string>+ <string name="assistant_set_source_live">ຕັ້ງພາສາຕົ້ນທາງເລີ່ມຕົ້ນໃນການຕັ້ງຄ່າເພື່ອໃຊ້ການແປໜ້າຈໍແບບສົດໆ.</string>+ <string name="migration_updating_speech_models">ກຳລັງອັບເດດໂມເດວສຽງເວົ້າ</string>+ <string name="migration_accept_convert">ຍອມຮັບ ແລະ ແປງໄຟລ໌</string>+ <string name="migration_delete_all">ລຶບທັງໝົດແທນ</string>+ <string name="migration_converting">ກຳລັງແປງ %1$d ຈາກ %2$d</string>+ <string name="migration_optimizing">ກຳລັງປັບແຕ່ງໂມເດວ</string>+ <plurals name="migration_convert_prompt">+ <item quantity="other">ທ່ານມີໂມເດວສຽງເວົ້າ %1$d ທີ່ຕ້ອງແປງເປັນຮູບແບບໃໝ່. ຈະໃຊ້ເວລາປະມານ %2$d ວິນາທີ. ທ່ານຈະປະຢັດພື້ນທີ່ໄດ້ %3$.0f MB.</item>+ </plurals>+ <string name="doc_notif_translating">ກຳລັງແປໄຟລ໌</string>+ <string name="doc_notif_translated">ແປໄຟລ໌ສຳເລັດແລ້ວ</string>+ <string name="doc_notif_phase_text">ຂໍ້ຄວາມ %1$d%%</string>+ <string name="doc_notif_phase_images">ຮູບພາບ %1$d/%2$d</string>+ <string name="doc_notif_phase_raster">ໜ້າບິດແມັບ %1$d/%2$d</string>+ <string name="doc_notif_channel_name">ການແປເອກະສານ</string>+ <string name="doc_notif_channel_desc">ສະແດງຄວາມຄືບໜ້າລະຫວ່າງການແປເອກະສານ</string>+ <string name="doc_progress_preparing">ກຳລັງກຽມໄຟລ໌</string>+ <string name="doc_progress_translating">ກຳລັງແປ</string>+ <string name="doc_progress_translated">ແປໄຟລ໌ສຳເລັດແລ້ວ</string>+ <string name="doc_progress_saving">ກຳລັງບັນທຶກໄຟລ໌ທີ່ແປແລ້ວ</string>+ <string name="doc_translation_failed">ການແປເອກະສານບໍ່ສຳເລັດ</string>+ <string name="doc_url_unsupported">ໃຫ້ດາວໂຫຼດເອກະສານ ແລະ ເປີດດ້ວຍແອັບແທນ</string>+ <string name="document_wrap_columns">ຕັດແຖວທີ່ %1$d ຄໍລຳ</string>+ <string name="document_translate_pdf_images">ແປຮູບພາບໃນ PDF</string>+ <string name="layout_preserve">ຮັກສາການຂຶ້ນແຖວໃໝ່</string>+ <string name="layout_reflow">ຈັດຮຽງເປັນຫຍໍ້ໜ້າ</string>+ <string name="layout_reflow_wrap">ຈັດຮຽງ ແລະ ຕັດແຖວ</string>+ <string name="common_open">ເປີດ</string>+ <string name="common_close">ປິດ</string>+ <string name="common_save">ບັນທຶກ</string>+ <string name="translator_translated_file">ໄຟລ໌ທີ່ແປແລ້ວ: %1$s</string>+ <string name="translator_document_saved">ບັນທຶກເອກະສານແລ້ວ</string>+ <string name="translator_document_save_failed">ບັນທຶກເອກະສານບໍ່ສຳເລັດ</string>+ <string name="translator_audio_playback_failed">ຫຼິ້ນສຽງບໍ່ສຳເລັດ: %1$s</string>+ <string name="translator_no_app_to_open">ບໍ່ພົບແອັບທີ່ຈະເປີດໄຟລ໌ນີ້</string>+ <string name="docalign_decode_failed">ບໍ່ສາມາດຖອດລະຫັດຮູບພາບໄດ້.</string>+ <string name="docalign_detecting">ກຳລັງກວດຫາແຈ…</string>+ <string name="docalign_redetecting">ກຳລັງກວດຫາຄືນໃໝ່…</string>+ <string name="docalign_help">ການກຳນົດຂອບເຂດທີ່ຊັດເຈນອ້ອມຮອບເອກະສານຈະຊ່ວຍໃຫ້ການກວດຈັບດີຂຶ້ນ. ເສັ້ນຂອບຄວນຂະໜານກັບຂໍ້ຄວາມ.\n\nການຊູມ ຫຼື ການຍ້າຍຮູບ ມັກຈະຊ່ວຍໃຫ້ລະບົບກວດຫາເອກະສານເອງໂດຍອັດຕະໂນມັດ, ແຕ່ທ່ານຍັງສາມາດປັບແຕ່ງເອງໄດ້ຖ້າລະບົບກວດຫາບໍ່ພົບ.</string>+ <string name="howto_section_other_apps">ຈາກແອັບອື່ນ</string>+ <string name="howto_share_title">ແບ່ງປັນເພື່ອແປ</string>+ <string name="howto_share_body">ແບ່ງປັນຂໍ້ຄວາມ, ລິ້ງ ຫຼື ຮູບພາບຈາກແອັບໃດກໍໄດ້ເພື່ອແປ.</string>+ <string name="howto_copy_title">ແປພາສາໂດຍບໍ່ຕ້ອງອອກຈາກແອັບອື່ນ</string>+ <string name="howto_copy_body">ເລືອກຂໍ້ຄວາມໃນແອັບໃດກໍໄດ້, ແລ້ວແຕະ \"ແປ\" ໃນແຖບເຄື່ອງມືເພື່ອເບິ່ງຄຳແປໃນປ່ອງຢ້ຽມຂະໜາດນ້ອຍ.</string>+ <string name="howto_section_in_app">ພາຍໃນແອັບ</string>+ <string name="howto_docs_title">ແປເອກະສານ ແລະ ຮູບພາບ</string>+ <string name="howto_docs_body">ເປີດແທັບເອກະສານເພື່ອແປຮູບພາບ ຫຼື ໄຟລ໌ EPUB, PDF ແລະ TXT.</string>+ <string name="howto_dict_title">ຄົ້ນຫາວັດຈະນານຸກົມ</string>+ <string name="howto_dict_body">ກົດຄ້າງທີ່ຄຳສັບໃດໜຶ່ງ, ແລ້ວເລືອກ \"ວັດຈະນານຸກົມ\" ເພື່ອເບິ່ງຄວາມໝາຍ. ຫຼື ແຕະປຸ່ມວັດຈະນານຸກົມ ແລ້ວແຕະຄຳສັບທີ່ຕ້ອງການ. ຂໍ້ມູນມາຈາກ Wiktionary.</string>+ <string name="howto_alt_title">ເລືອກຄຳສັບທາງເລືອກ</string>+ <string name="howto_alt_body">ແຕະປຸ່ມທາງເລືອກ, ແລ້ວແຕະຄຳສັບໃດໜຶ່ງເພື່ອປ່ຽນ. ລະບົບອາດຈະໃຫ້ຄຳສັບອື່ນໆ ຫຼື ທ່ານສາມາດພິມເອງໄດ້. ສ່ວນທີ່ເຫຼືອຂອງປະໂຫຍກຈະຖືກແປໃໝ່ໃຫ້ເຂົ້າກັນ.</string>+ <string name="howto_voice_title">ປ່ຽນສຽງ ຫຼື ຄວາມໄວ</string>+ <string name="howto_voice_body">ກົດຄ້າງທີ່ປຸ່ມຫຼິ້ນເພື່ອເລືອກສຽງອື່ນ ຫຼື ປັບຄວາມໄວການອ່ານ.</string>+ <string name="feature_translation">ການແປ</string>+ <string name="feature_dictionary">ວັດຈະນານຸກົມ</string>+ <string name="feature_tts">ສຽງ</string>+ <string name="detected_translate_from">ແປຈາກ</string>+ <string name="detected_missing_language">ບໍ່ມີພາສານີ້</string>+ <string name="main_input_placeholder">ປ້ອນຂໍ້ຄວາມ</string>+ <string name="aidl_target_unavailable">ບໍ່ມີພາສາປາຍທາງນີ້</string>+ <string name="a11y_cancel">ຍົກເລີກ</string>+ <string name="a11y_region_reset">ຄືນຄ່າເປັນເຕັມໜ້າຈໍ</string>+ <string name="a11y_region_confirm">ຢືນຢັນພື້ນທີ່</string>+ <string name="a11y_translate_screen_live">ແປໜ້າຈໍແບບສົດໆ</string>+ <string name="a11y_refresh">ໂຫຼດໃໝ່</string>+ <string name="a11y_select_text">ເລືອກຂໍ້ຄວາມ</string>+ <string name="a11y_set_translation_area">ກຳນົດພື້ນທີ່ການແປ</string>+ <string name="a11y_show_original">ສະແດງຕົ້ນສະບັບ</string>+ <string name="a11y_pause_resume">ພັກ ຫຼື ຕໍ່</string>+ <string name="a11y_primary_input">ຊ່ອງປ້ອນຂໍ້ມູນຫຼັກ</string>+ <string name="a11y_help">ຊ່ວຍເຫຼືອ</string>+ <string name="a11y_rotate_90">ໝູນ 90 ອົງສາ</string>+ <string name="a11y_switch_rectangular_crop">ປ່ຽນເປັນການຕັດຂອບສີ່ຫຼ່ຽມ</string>+ <string name="a11y_detect_document_corners">ກວດຫາແຈເອກະສານ</string>+ <string name="a11y_cancel_download">ຍົກເລີກການດາວໂຫຼດ</string>+ <string name="a11y_delete_language">ລຶບພາສາ</string>+ <string name="a11y_retry_download">ລອງດາວໂຫຼດໃໝ່</string>+ <string name="a11y_download">ດາວໂຫຼດ</string>+ <string name="a11y_share_image">ແບ່ງປັນຮູບພາບ</string>+ <string name="a11y_close_fullscreen">ປິດການເບິ່ງແບບເຕັມໜ້າຈໍ</string>+ <string name="a11y_translation_output">ຜົນການແປ</string>+ <string name="a11y_output_textview">ບ່ອນສະແດງຂໍ້ຄວາມຜົນລັດ</string>+ <string name="a11y_copy_translation">ສຳເນົາຄຳແປ</string>+ <string name="a11y_alternatives_mode_on">ອອກຈາກໂໝດທາງເລືອກ</string>+ <string name="a11y_alternatives_mode_off">ໂໝດທາງເລືອກ: ແຕະທີ່ຄຳສັບເພື່ອເບິ່ງຄຳແປອື່ນໆ</string>+ <string name="a11y_close_alternatives">ປິດທາງເລືອກ</string>+ <string name="alt_custom_entry">ພິມເອງ…</string>+ <string name="alt_custom_label">ຄຳສັບຂອງທ່ານ</string>+ <string name="alt_custom_preview_label">ຕົວຢ່າງ</string>+ <string name="a11y_dictionary_mode_on">ອອກຈາກໂໝດວັດຈະນານຸກົມ</string>+ <string name="a11y_dictionary_mode_off">ໂໝດວັດຈະນານຸກົມ: ແຕະທີ່ຄຳສັບເພື່ອຄົ້ນຫາ</string>+ <string name="a11y_source_document">ເອກະສານ</string>+ <string name="a11y_source_photos">ຮູບພາບ</string>+ <string name="a11y_source_gallery">ຄັງຮູບພາບ</string>+ <string name="a11y_source_camera">ກ້ອງຖ່າຍຮູບ</string>+ <string name="a11y_back">ກັບຄືນ</string>+ <string name="a11y_reverse_translation_direction">ສະຫຼັບທິດທາງການແປ</string>+ <string name="a11y_settings">ການຕັ້ງຄ່າ</string>+ <string name="a11y_close">ປິດ</string>+ <string name="a11y_dictionary_status">ສະຖານະວັດຈະນານຸກົມ</string>+ <string name="a11y_dictionary_entry">ລາຍການວັດຈະນານຸກົມ</string>+ <string name="a11y_tts_status">ສະຖານະສຽງອ່ານ</string>+ <string name="a11y_main_screen">ໜ້າຈໍຫຼັກ</string>+ <string name="a11y_translate_image_or_file">ແປຮູບພາບ ຫຼື ໄຟລ໌</string>+ <string name="a11y_replace_text">ແທນບ່ອນຂໍ້ຄວາມ</string>+ <string name="a11y_clear_input">ລຶບຂໍ້ມູນທີ່ປ້ອນ</string>+ <string name="a11y_resize_split">ປັບຂະໜາດພື້ນທີ່ປ້ອນຂໍ້ມູນ ແລະ ສະແດງຜົນ</string>+ <string name="a11y_paste">ວາງ</string>+ <string name="a11y_voice_input">ປ້ອນຂໍ້ມູນດ້ວຍສຽງ</string>+ <string name="a11y_detected_language_toast">ແຈ້ງເຕືອນພາສາທີ່ກວດພົບ</string>+ <string name="a11y_switch_detected_language">ປ່ຽນເປັນພາສາທີ່ກວດພົບ</string>+ <string name="a11y_torch_on">ເປີດໄຟສາຍ</string>+ <string name="a11y_torch_off">ປິດໄຟສາຍ</string>+ <string name="a11y_live_overlay_on">ເປີດການສະແດງທັບແບບສົດໆ</string>+ <string name="a11y_live_overlay_off">ປິດການສະແດງທັບແບບສົດໆ</string>+ <string name="a11y_collapse">ຫຍໍ້ເຂົ້າ</string>+ <string name="a11y_expand">ຂະຫຍາຍອອກ</string>+ <string name="a11y_delete">ລຶບ</string>+ <string name="a11y_favorite_remove">ລຶບອອກຈາກລາຍການທີ່ມັກ</string>+ <string name="a11y_favorite_add">ເພີ່ມເຂົ້າໃນລາຍການທີ່ມັກ</string>+ <string name="a11y_download_feature">ດາວໂຫຼດຟີເຈີ</string>+ <string name="a11y_show_translated_image">ສະແດງຮູບພາບທີ່ແປແລ້ວ</string>+ <string name="a11y_show_original_image">ສະແດງຮູບພາບຕົ້ນສະບັບ</string>+ <string name="a11y_stop_audio">ຢຸດສຽງ</string>+ <string name="a11y_speak_input">ອ່ານຂໍ້ຄວາມທີ່ປ້ອນ</string>+ <string name="a11y_speak_translation">ອ່ານຄຳແປ</string>+ <string name="a11y_original_image">ຮູບພາບຕົ້ນສະບັບ</string>+ <string name="a11y_translated_image">ຮູບພາບທີ່ແປແລ້ວ</string>+ <string name="a11y_zoomable_original_image">ຮູບພາບຕົ້ນສະບັບທີ່ຊູມໄດ້</string>+ <string name="a11y_zoomable_translated_image">ຮູບພາບທີ່ແປແລ້ວທີ່ຊູມໄດ້</string>+ <string name="settings_http_server">ເປີດໃຊ້ເຊີບເວີ HTTP ທີ່ຮອງຮັບ LibreTranslate</string>+ <string name="settings_http_server_desc">ອະນຸຍາດໃຫ້ແອັບອື່ນຮ້ອງຂໍການແປຜ່ານລະບົບໄດ້</string>+ <string name="settings_http_server_port">ພອດ (Port)</string>+ <string name="settings_http_server_bind">ເຊື່ອມກັບ</string>+ <string name="settings_http_server_bind_localhost">localhost</string>+ <string name="settings_http_server_bind_all">ທຸກອິນເຕີເຟດ</string>+ <string name="settings_http_server_title">ເຊີບເວີ API</string>+ <string name="http_server_notif_channel_name">API ການແປພາສາ</string>+ <string name="http_server_notif_channel_desc">ສະແດງເມື່ອເຊີບເວີທີ່ຮອງຮັບ LibreTranslate ກຳລັງເຮັດວຽກ</string>+ <string name="http_server_notif_running">API ການແປພາສາ</string>+ <string name="http_server_notif_text">ກຳລັງລໍຖ້າການເຊື່ອມຕໍ່ທີ່ %1$s:%2$d</string>+ <string name="http_server_notif_error">ເລີ່ມຕົ້ນໃນພອດ %1$d ບໍ່ສຳເລັດ</string>+ <string name="http_server_notif_disable">ປິດການໃຊ້ງານ</string>+</resources>diff --git a/OCR-translation/src/main/res/values-ml/strings.xml b/OCR-translation/src/main/res/values-ml/strings.xmlnew file mode 100644index 0000000..876b458--- /dev/null+++ b/OCR-translation/src/main/res/values-ml/strings.xml@@ -0,0 +1,217 @@+<?xml version="1.0" encoding="utf-8"?>+<resources>+ <string name="stop">നിർത്തുക</string>+ <string name="pause">താൽക്കാലികമായി നിർത്തുക</string>+ <string name="resume">തുടരുക</string>+ <string name="region_select_menu">വിവർത്തന ഭാഗം തിരഞ്ഞെടുക്കുക</string>+ <string name="screen_translate_needs_source">ഏത് ഭാഷയിൽ നിന്നാണെന്ന് തിരഞ്ഞെടുക്കുക</string>+ <string name="live_tile_label">സ്ക്രീൻ തത്സമയം വിവർത്തനം ചെയ്യുക</string>+ <string name="translate_text">വിവർത്തനം ചെയ്യുക</string>+ <string name="translate_link">ലിങ്ക് വിവർത്തനം ചെയ്യുക</string>+ <string name="accessibility_service_description">സ്ക്രീനിലെ ടെക്സ്റ്റ് വിവർത്തനം ചെയ്യാൻ ഈ സേവനം ഓണാക്കുക. ഇപ്പോഴത്തെ സ്ക്രീൻ വിവർത്തനം ചെയ്യാൻ ഫ്ലോട്ടിംഗ് വിവർത്തന ബട്ടണിൽ ടാപ്പ് ചെയ്യുക, അല്ലെങ്കിൽ തത്സമയ സ്ക്രീൻ വിവർത്തനം ആരംഭിക്കുക.</string>+ <string name="tap_to_translate_title">ക്വിക്ക് ട്രാൻസ്ലേറ്റ് ഓണാണ്</string>+ <string name="tap_to_translate_body">വിവർത്തക പോപ്പ്അപ്പ് തുറക്കാൻ ടാപ്പ് ചെയ്യുക</string>+ <string name="tap_to_translate_channel">ക്വിക്ക് ട്രാൻസ്ലേറ്റ്</string>+ <string name="tap_to_translate_channel_description">വിവർത്തക പോപ്പ്അപ്പ് വേഗത്തിൽ തുറക്കാനുള്ള സ്ഥിരം നോട്ടിഫിക്കേഷൻ</string>+ <string name="quick_tile_label">വിവർത്തനം</string>+ <!-- common -->+ <string name="common_ok">ശരി</string>+ <string name="common_cancel">റദ്ദാക്കുക</string>+ <string name="common_done">പൂർത്തിയായി</string>+ <string name="common_grant">അനുവദിക്കുക</string>+ <string name="common_manage">കൈകാര്യം ചെയ്യുക</string>+ <!-- settings -->+ <string name="settings_title">സെറ്റിംഗ്സ്</string>+ <string name="settings_languages">ഭാഷകൾ</string>+ <string name="settings_language_packs">ഭാഷാ പാക്കുകൾ</string>+ <string name="settings_general">പൊതുവായവ</string>+ <string name="settings_font_size">ഫോണ്ട് വലുപ്പം</string>+ <string name="settings_font_sample">ഇത് ഒരു ഉദാഹരണ ടെക്സ്റ്റാണ്</string>+ <string name="settings_tap_notification">ക്വിക്ക് ട്രാൻസ്ലേറ്റ് നോട്ടിഫിക്കേഷൻ</string>+ <string name="settings_tap_notification_desc">പോപ്പ്അപ്പ് തുറക്കുന്ന സ്ഥിരം നോട്ടിഫിക്കേഷൻ.</string>+ <string name="settings_web_translator">വെബ് വിവർത്തകൻ</string>+ <string name="settings_clear_browsing">അടയ്ക്കുമ്പോൾ ബ്രൗസിംഗ് ഡാറ്റ മായ്ക്കുക</string>+ <string name="settings_clear_browsing_desc">കുക്കികൾ, കാഷെ, ലോക്കൽ സ്റ്റോറേജ് എന്നിവ ഇല്ലാതാക്കുന്നു.</string>+ <string name="settings_tts_section">ടെക്സ്റ്റ് ടു സ്പീച്ച്</string>+ <string name="settings_tts_read_urls_hashtags">URL-കളും ഹാഷ്ടാഗുകളും വായിക്കുക</string>+ <string name="settings_popup_settings">പോപ്പ്അപ്പ്</string>+ <string name="settings_popup_desc">ടെക്സ്റ്റ് സെലക്ഷൻ മെനുവിൽ നിന്ന് \'വിവർത്തനം\' തിരഞ്ഞെടുക്കുമ്പോൾ പോപ്പ്അപ്പ് വരും</string>+ <string name="settings_hide_input">ഇൻപുട്ട് മറയ്ക്കുക</string>+ <string name="settings_popup_position">പോപ്പ്അപ്പ് സ്ഥാനം</string>+ <string name="settings_popup_size">പോപ്പ്അപ്പ് വലുപ്പം: %1$d%%</string>+ <string name="settings_screen_translation">സ്ക്രീൻ വിവർത്തനം</string>+ <string name="settings_screen_translation_desc">മറ്റ് ആപ്പുകൾക്ക് മുകളിൽ നേരിട്ട് ടെക്സ്റ്റ് വിവർത്തനം ചെയ്യുക.</string>+ <string name="settings_floating_button">എപ്പോഴും കാണുന്ന ബട്ടൺ</string>+ <string name="settings_floating_button_desc">ആക്സസിബിലിറ്റി അനുമതി വേണം</string>+ <string name="settings_shortcut">ഷോർട്ട്കട്ടിൽ സ്ക്രീൻ വിവർത്തനം ചെയ്യുക</string>+ <string name="settings_shortcut_desc">സജീവമാക്കാൻ ഹോം അല്ലെങ്കിൽ പവർ ബട്ടൺ അമർത്തിപ്പിടിക്കുക</string>+ <string name="settings_on_shortcut">ഷോർട്ട്കട്ട് ഉപയോഗിക്കുമ്പോൾ</string>+ <string name="settings_ocr">ചിത്രങ്ങൾ</string>+ <string name="settings_background_mode">ടെക്സ്റ്റിന് പകരം വയ്ക്കുക</string>+ <string name="settings_min_confidence">കുറഞ്ഞ കൃത്യത: %1$d%%</string>+ <string name="settings_max_image_size">പരമാവധി ചിത്ര വലുപ്പം: %1$dpx</string>+ <string name="settings_advanced">വിപുലമായവ</string>+ <string name="settings_catalog_url">കാറ്റലോഗ് URL</string>+ <string name="settings_external_storage">എക്സ്റ്റേണൽ സ്റ്റോറേജ് ഉപയോഗിക്കുക</string>+ <string name="settings_disable_autodetect">ഭാഷ സ്വയം കണ്ടെത്തുന്നത് ഓഫാക്കുക</string>+ <string name="settings_translit_output">വിവർത്തനം ചെയ്ത ടെക്സ്റ്റിന്റെ ലിപ്യന്തരണം കാണിക്കുക</string>+ <string name="settings_translit_input">യഥാർത്ഥ ടെക്സ്റ്റിന്റെ ലിപ്യന്തരണം കാണിക്കുക</string>+ <string name="settings_translit_japanese_spaces">ജാപ്പനീസ് ലിപ്യന്തരണത്തിന് സ്പേസുകൾ ചേർക്കുക</string>+ <string name="settings_translate_pdf_images">PDF-ലെ ചിത്രങ്ങൾ വിവർത്തനം ചെയ്യുക</string>+ <string name="settings_camera_live_default">സ്ഥിരമായി ക്യാമറ തത്സമയം വിവർത്തനം ചെയ്യുക</string>+ <string name="settings_register_browser">ബ്രൗസറായി രജിസ്റ്റർ ചെയ്യുക</string>+ <string name="settings_register_browser_desc">മറ്റ് ആപ്പുകളിൽ നിന്നുള്ള ലിങ്കുകൾ വിവർത്തനം ചെയ്യാൻ വാഗ്ദാനം ചെയ്യുക.</string>+ <string name="settings_external_storage_perm_title">എക്സ്റ്റേണൽ സ്റ്റോറേജ് അനുമതി</string>+ <string name="settings_about">ഈ ആപ്പിനെപ്പറ്റി</string>+ <string name="settings_version">പതിപ്പ് %1$s</string>+ <string name="settings_no_languages_available">ഭാഷകളൊന്നും ലഭ്യമല്ല</string>+ <string name="settings_default_from">സ്ഥിരം \'ഏതിൽ നിന്ന്\' ഭാഷ</string>+ <string name="settings_default_to">സ്ഥിരം \'ഏതിലേക്ക്\' ഭാഷ</string>+ <string name="settings_adblock_support">പരസ്യങ്ങൾ തടയുക</string>+ <string name="settings_about_get_help">സഹായം നേടുക / പ്രശ്നം അറിയിക്കുക</string>+ <string name="settings_logs_copied">ആപ്പ് ലോഗുകൾ ക്ലിപ്പ്ബോർഡിലേക്ക് പകർത്തി</string>+ <string name="settings_about_support">വികസനത്തെ പിന്തുണയ്ക്കുക</string>+ <string name="settings_external_storage_perm_body">വിവർത്തന ഫയലുകൾ നിങ്ങളുടെ Documents ഫോൾഡറിൽ സൂക്ഷിക്കാൻ, എല്ലാ ഫയലുകളും കൈകാര്യം ചെയ്യാനുള്ള അനുമതി ഈ ആപ്പിന് വേണം.\nഅനുമതി നൽകാവുന്ന സെറ്റിംഗ്സിലേക്ക് നിങ്ങളെ കൊണ്ടുപോകും, അവിടെ \'എല്ലാ ഫയലുകളും കൈകാര്യം ചെയ്യാൻ അനുമതി നൽകുക\' എന്നത് അനുവദിക്കാം.</string>+ <!-- language manager / setup / how-to -->+ <string name="langmgr_voices">ശബ്ദങ്ങൾ</string>+ <string name="voice_section_downloaded">ഡൗൺലോഡ് ചെയ്തവ</string>+ <string name="voice_section_available">ലഭ്യമായവ</string>+ <string name="langmgr_default">സ്ഥിരം</string>+ <string name="langmgr_filter">ഭാഷകൾ ഫിൽട്ടർ ചെയ്യുക</string>+ <string name="langmgr_ocr_upgrade_available">ചിത്രങ്ങളിലെ ടെക്സ്റ്റ് കണ്ടെത്താൻ മെച്ചപ്പെട്ട മോഡൽ ലഭ്യമാണ്.</string>+ <string name="langmgr_delete_shared_title">പങ്കിട്ട നിഘണ്ടു ഇല്ലാതാക്കണോ?</string>+ <string name="langmgr_delete_shared_body">ഈ നിഘണ്ടു %1$s-മായി പങ്കിട്ടിരിക്കുന്നു.\nഇത് ഇല്ലാതാക്കിയാൽ അവയ്ക്കെല്ലാം നിഘണ്ടു ഇല്ലാതാകും.</string>+ <string name="langmgr_download_size">%1$s ഡൗൺലോഡ് ചെയ്യുക</string>+ <string name="langmgr_repair_needed">ചില ഡൗൺലോഡ് ചെയ്ത സവിശേഷതകൾക്ക് ഫയലുകൾ ഇല്ല, നന്നാക്കുന്നതുവരെ പ്രവർത്തിക്കില്ല.</string>+ <string name="langmgr_repair_size">%1$s നന്നാക്കുക</string>+ <string name="nolang_title">ഭാഷാ ക്രമീകരണം</string>+ <string name="nolang_prompt">വിവർത്തനം തുടങ്ങാൻ ഭാഷാ പാക്കുകൾ ഡൗൺലോഡ് ചെയ്യുക</string>+ <string name="howto_title">എങ്ങനെ ഉപയോഗിക്കാം</string>+ <!-- image capture / voice / dictionary / language selector -->+ <string name="image_no_crop_remote">റിമോട്ട് ചിത്രങ്ങൾ നേരിട്ട് ക്രോപ്പ് ചെയ്യാനാവില്ല</string>+ <string name="image_open_failed">ഫയൽ തുറക്കാനായില്ല</string>+ <string name="image_source_screen">സ്ക്രീൻ</string>+ <string name="image_source_document">ഡോക്യുമെന്റ്</string>+ <string name="image_source_photos">ഫോട്ടോകൾ</string>+ <string name="image_source_gallery">ഗാലറി</string>+ <string name="image_source_camera">ക്യാമറ</string>+ <string name="voice_playback_speed">പ്ലേബാക്ക് വേഗത</string>+ <string name="voice_label">ശബ്ദം</string>+ <string name="voice_default">സ്ഥിരം ശബ്ദം</string>+ <string name="langsel_auto">✨ ഓട്ടോ</string>+ <string name="dict_also_as">ഇങ്ങനെയും:</string>+ <!-- camera / browser / screen translate -->+ <string name="camera_permission_rationale">തത്സമയ വിവർത്തനത്തിന് ക്യാമറ അനുമതി വേണം.</string>+ <string name="camera_need_ocr_models">ഈ ഭാഷയ്ക്കായി ചിത്രങ്ങളിലെ ടെക്സ്റ്റ് വായിക്കാനുള്ള മോഡലുകൾ ഡൗൺലോഡ് ചെയ്യണം</string>+ <string name="browser_no_source_language">ഏതിൽ നിന്ന് വിവർത്തനം ചെയ്യണമെന്ന ഭാഷയൊന്നും ലഭ്യമല്ല. ആദ്യം പ്രധാന സ്ക്രീനിൽ നിന്ന് ഒന്ന് ഇൻസ്റ്റാൾ ചെയ്യുക, അല്ലെങ്കിൽ സെറ്റിംഗ്സിൽ ഒരു സ്ഥിരം ഭാഷ സജ്ജമാക്കുക.</string>+ <string name="browser_reader_unavailable">ഈ പേജിന് റീഡർ മോഡ് ലഭ്യമല്ല</string>+ <string name="browser_translate_image">ചിത്രം വിവർത്തനം ചെയ്യുക</string>+ <string name="screen_translating_notification">സ്ക്രീൻ വിവർത്തനം ചെയ്യുന്നു</string>+ <!-- enums -->+ <string name="align_top">മുകളിൽ</string>+ <string name="align_middle">നടുവിൽ</string>+ <string name="align_bottom">താഴെ</string>+ <string name="assistant_action_still_image">ഒരുവട്ടം വിവർത്തനം ചെയ്യുക</string>+ <string name="assistant_action_live_screen">തത്സമയ വിവർത്തനം ആരംഭിക്കുക</string>+ <string name="background_mode_white_on_black">കറുപ്പിൽ വെളുപ്പ്</string>+ <string name="background_mode_black_on_white">വെളുപ്പിൽ കറുപ്പ്</string>+ <string name="background_mode_auto_detect">യഥാർത്ഥ ചിത്രത്തിന്റെ നിറങ്ങൾ</string>+ <!-- tts / speech errors -->+ <string name="tts_nothing_to_speak">വായിക്കാൻ ഒന്നുമില്ല</string>+ <string name="tts_catalog_unavailable">കാറ്റലോഗ് ലഭ്യമല്ല</string>+ <string name="tts_no_voice">%1$s-ന് ശബ്ദമൊന്നും ഇൻസ്റ്റാൾ ചെയ്തിട്ടില്ല</string>+ <string name="tts_synthesis_failed">%1$s-ന്റെ ശബ്ദം സൃഷ്ടിക്കാനായില്ല</string>+ <string name="tts_sample_fallback">ഇത് Offline Translator-ൽ നിന്നുള്ള ഒരു ശബ്ദ സാമ്പിളാണ്.</string>+ <!-- translation -->+ <string name="translation_error">വിവർത്തന പിശക്: %1$s</string>+ <!-- download errors -->+ <string name="download_failed_core">%1$s ഡൗൺലോഡ് പരാജയപ്പെട്ടു</string>+ <string name="download_failed_ocr">%1$s ചിത്ര-ടെക്സ്റ്റ് ഡൗൺലോഡ് പരാജയപ്പെട്ടു</string>+ <string name="download_failed_ocr_batch">ചിത്ര-ടെക്സ്റ്റ് ബാച്ച് ഡൗൺലോഡ് പരാജയപ്പെട്ടു</string>+ <string name="download_failed_dictionary">%1$s നിഘണ്ടു ഡൗൺലോഡ് പരാജയപ്പെട്ടു</string>+ <string name="download_failed_tts">%1$s ശബ്ദം ഡൗൺലോഡ് പരാജയപ്പെട്ടു</string>+ <string name="download_failed_adblock">പരസ്യം തടയൽ ഡൗൺലോഡ് പരാജയപ്പെട്ടു</string>+ <string name="download_failed_repair">നന്നാക്കൽ ഡൗൺലോഡ് പരാജയപ്പെട്ടു</string>+ <string name="download_catalog_unavailable">കാറ്റലോഗ് ലഭ്യമല്ല</string>+ <string name="download_catalog_save_failed">കാറ്റലോഗ് സേവ് ചെയ്യാനായില്ല</string>+ <string name="download_unknown_error">അജ്ഞാത പിശക്</string>+ <string name="download_catalog_failed">കാറ്റലോഗ് ഡൗൺലോഡ് ചെയ്യാനായില്ല: %1$s</string>+ <!-- assistant overlay status -->+ <string name="assistant_invoke_prompt">വിവർത്തനം ചെയ്യാൻ ടെക്സ്റ്റിന് മുകളിൽ ഈ അസിസ്റ്റന്റ് വിളിക്കുക</string>+ <string name="assistant_collecting_context">സ്ക്രീൻ വിവരങ്ങൾ ശേഖരിക്കുന്നു…</string>+ <string name="assistant_screenshot_disabled">ഈ അസിസ്റ്റന്റിന് സ്ക്രീൻഷോട്ട് ആക്സസ് ഓഫാണ്. സിസ്റ്റം അസിസ്റ്റന്റ് സെറ്റിംഗ്സിൽ ഇത് ഓണാക്കുക.</string>+ <string name="assistant_no_screen_data">സ്ക്രീൻ ഡാറ്റയൊന്നും ലഭിച്ചില്ല. ഈ അസിസ്റ്റന്റിന് \'സ്ക്രീൻഷോട്ട് ഉപയോഗിക്കുക\' ഓണാക്കുക.</string>+ <string name="assistant_no_screenshot">ഈ ആപ്പ് സ്ക്രീൻഷോട്ട് നൽകിയില്ല.</string>+ <string name="assistant_set_source_ocr">ചിത്രങ്ങളിലെ ടെക്സ്റ്റ് വായിക്കാൻ ഒരു സ്ഥിരം ഭാഷ സജ്ജമാക്കുക.</string>+ <string name="assistant_langs_not_ready">വിവർത്തന ഭാഷകൾ ഇതുവരെ തയ്യാറായിട്ടില്ല. വീണ്ടും ശ്രമിക്കുക.</string>+ <string name="assistant_ocr_failed">ചിത്രങ്ങളിലെ ടെക്സ്റ്റ് വായിക്കാനായില്ല</string>+ <string name="ocr_models_missing">ടെക്സ്റ്റ് തിരിച്ചറിയൽ മോഡലുകൾ ഇല്ല. നന്നാക്കാൻ ആപ്പിൽ ഭാഷാ മാനേജ്മെന്റ് തുറക്കുക.</string>+ <string name="assistant_set_source_live">തത്സമയ സ്ക്രീൻ വിവർത്തനം ഉപയോഗിക്കാൻ സെറ്റിംഗ്സിൽ ഒരു സ്ഥിരം ഭാഷ സജ്ജമാക്കുക.</string>+ <!-- migration gate -->+ <string name="migration_updating_speech_models">ശബ്ദ മോഡലുകൾ അപ്ഡേറ്റ് ചെയ്യുന്നു</string>+ <string name="migration_accept_convert">സമ്മതിച്ച് മാറ്റുക</string>+ <string name="migration_delete_all">പകരം എല്ലാം ഇല്ലാതാക്കുക</string>+ <string name="migration_converting">%2$d-ൽ %1$d മാറ്റുന്നു</string>+ <string name="migration_optimizing">മോഡലുകൾ ഒപ്റ്റിമൈസ് ചെയ്യുന്നു</string>+ <plurals name="migration_convert_prompt">+ <item quantity="one">പുതിയ ഫോർമാറ്റിലേക്ക് മാറ്റാൻ %1$d ശബ്ദ മോഡൽ നിങ്ങൾക്കുണ്ട്. ഏകദേശം %2$d സെക്കൻഡ് എടുക്കും. %3$.0f MB ഡിസ്ക് സ്ഥലം ലാഭിക്കാം.</item>+ <item quantity="other">പുതിയ ഫോർമാറ്റിലേക്ക് മാറ്റാൻ %1$d ശബ്ദ മോഡലുകൾ നിങ്ങൾക്കുണ്ട്. ഏകദേശം %2$d സെക്കൻഡ് എടുക്കും. %3$.0f MB ഡിസ്ക് സ്ഥലം ലാഭിക്കാം.</item>+ </plurals>+ <!-- document translation notification + progress -->+ <string name="doc_notif_translating">ഫയൽ വിവർത്തനം ചെയ്യുന്നു</string>+ <string name="doc_notif_translated">ഫയൽ വിവർത്തനം ചെയ്തു</string>+ <string name="doc_notif_phase_text">ടെക്സ്റ്റ് %1$d%%</string>+ <string name="doc_notif_phase_images">ചിത്രങ്ങൾ %1$d/%2$d</string>+ <string name="doc_notif_phase_raster">ബിറ്റ്മാപ്പ് പേജുകൾ %1$d/%2$d</string>+ <string name="doc_notif_channel_name">ഡോക്യുമെന്റ് വിവർത്തനം</string>+ <string name="doc_notif_channel_desc">ഡോക്യുമെന്റുകൾ വിവർത്തനം ചെയ്യുമ്പോൾ പുരോഗതി കാണിക്കുന്നു</string>+ <string name="doc_progress_preparing">ഫയൽ തയ്യാറാക്കുന്നു</string>+ <string name="doc_progress_translating">വിവർത്തനം ചെയ്യുന്നു</string>+ <string name="doc_progress_translated">ഫയൽ വിവർത്തനം ചെയ്തു</string>+ <string name="doc_progress_saving">വിവർത്തനം ചെയ്ത ഫയൽ സേവ് ചെയ്യുന്നു</string>+ <string name="doc_translation_failed">ഡോക്യുമെന്റ് വിവർത്തനം പരാജയപ്പെട്ടു</string>+ <string name="doc_url_unsupported">പകരം ഡോക്യുമെന്റ് ഡൗൺലോഡ് ചെയ്ത് ആപ്പിൽ തുറക്കുക</string>+ <!-- document configure sheet -->+ <string name="document_wrap_columns">%1$d കോളങ്ങളിൽ റാപ്പ് ചെയ്യുക</string>+ <string name="document_translate_pdf_images">PDF-ലെ ചിത്രങ്ങൾ വിവർത്തനം ചെയ്യുക</string>+ <string name="layout_preserve">വരി മുറിവുകൾ നിലനിർത്തുക</string>+ <string name="layout_reflow">ഖണ്ഡികകളായി ക്രമീകരിക്കുക</string>+ <string name="layout_reflow_wrap">ക്രമീകരിച്ച് റാപ്പ് ചെയ്യുക</string>+ <!-- common (additional) -->+ <string name="common_open">തുറക്കുക</string>+ <string name="common_close">അടയ്ക്കുക</string>+ <string name="common_save">സേവ് ചെയ്യുക</string>+ <!-- translator app -->+ <string name="translator_translated_file">വിവർത്തനം ചെയ്ത ഫയൽ: %1$s</string>+ <string name="translator_document_saved">ഡോക്യുമെന്റ് സേവ് ചെയ്തു</string>+ <string name="translator_document_save_failed">ഡോക്യുമെന്റ് സേവ് ചെയ്യാനായില്ല</string>+ <string name="translator_audio_playback_failed">ഓഡിയോ പ്ലേബാക്ക് പരാജയപ്പെട്ടു: %1$s</string>+ <string name="translator_no_app_to_open">ഈ ഫയൽ തുറക്കാൻ ആപ്പൊന്നും കണ്ടെത്തിയില്ല</string>+ <!-- document alignment -->+ <string name="docalign_decode_failed">ചിത്രം ഡീകോഡ് ചെയ്യാനായില്ല.</string>+ <string name="docalign_detecting">മൂലകൾ കണ്ടെത്തുന്നു…</string>+ <string name="docalign_redetecting">വീണ്ടും കണ്ടെത്തുന്നു…</string>+ <string name="docalign_help">ഡോക്യുമെന്റിന് ചുറ്റും കൃത്യമായ ഒരു അതിര് ഉണ്ടെങ്കിൽ തിരിച്ചറിയൽ ഗുണനിലവാരം മെച്ചപ്പെടും. വരികൾ ടെക്സ്റ്റിന് സമാന്തരമായിരിക്കണം എന്നത് പ്രധാനമാണ്.\n\nസൂം ചെയ്യുമ്പോഴോ പാൻ ചെയ്യുമ്പോഴോ സാധാരണ ഡോക്യുമെന്റ് സ്വയം കണ്ടെത്തും, പക്ഷേ കണ്ടെത്തിയില്ലെങ്കിൽ നിങ്ങൾക്ക് സ്വയം ക്രമീകരിക്കാം.</string>+ <!-- how to use -->+ <string name="howto_section_other_apps">മറ്റ് ആപ്പുകളിൽ നിന്ന്</string>+ <string name="howto_share_title">ഷെയർ ചെയ്ത് വിവർത്തനം ചെയ്യുക</string>+ <string name="howto_share_body">ഏത് ആപ്പിൽ നിന്നും ടെക്സ്റ്റ്, ലിങ്കുകൾ, ചിത്രങ്ങൾ എന്നിവ ഷെയർ ചെയ്ത് വിവർത്തനം ചെയ്യുക.</string>+ <string name="howto_copy_title">മറ്റ് ആപ്പുകൾ വിടാതെ വിവർത്തനം ചെയ്യുക</string>+ <string name="howto_copy_body">എവിടെയും ടെക്സ്റ്റ് സെലക്ട് ചെയ്ത് കോപ്പി ടൂൾബാറിലെ \"വിവർത്തനം\" ടാപ്പ് ചെയ്താൽ ഒരു ചെറിയ പോപ്പ്അപ്പിൽ വിവർത്തനം കാണാം.</string>+ <string name="howto_section_in_app">ആപ്പിനുള്ളിൽ</string>+ <string name="howto_docs_title">ഡോക്യുമെന്റുകളും ചിത്രങ്ങളും വിവർത്തനം ചെയ്യുക</string>+ <string name="howto_docs_body">ചിത്രങ്ങളോ EPUB, PDF, TXT ഫയലുകളോ വിവർത്തനം ചെയ്യാൻ ഡോക്യുമെന്റ്സ് ടാബ് തുറക്കുക.</string>+ <string name="howto_dict_title">നിഘണ്ടു തിരയൽ</string>+ <string name="howto_dict_body">ഒരു വിവർത്തനത്തിലെ ഏതെങ്കിലും വാക്ക് അമർത്തിപ്പിടിച്ചാൽ അതിന്റെ അർത്ഥം കാണാം. വിവരങ്ങൾ Wiktionary-ൽ നിന്ന്.</string>+ <string name="howto_voice_title">ശബ്ദമോ വേഗതയോ മാറ്റുക</string>+ <string name="howto_voice_body">മറ്റൊരു ശബ്ദം തിരഞ്ഞെടുക്കാനോ പ്ലേബാക്ക് വേഗത ക്രമീകരിക്കാനോ പ്ലേ ബട്ടൺ അമർത്തിപ്പിടിക്കുക.</string>+ <!-- feature row labels -->+ <string name="feature_translation">വിവർത്തനം</string>+ <string name="feature_dictionary">നിഘണ്ടു</string>+ <string name="feature_tts">ശബ്ദം</string>+ <!-- misc -->+ <string name="detected_translate_from">ഏതിൽ നിന്ന് വിവർത്തനം ചെയ്യണം</string>+ <string name="detected_missing_language">ഭാഷ ലഭ്യമല്ല</string>+ <string name="main_input_placeholder">ടെക്സ്റ്റ് നൽകുക</string>+ <string name="aidl_target_unavailable">ലക്ഷ്യ ഭാഷ ലഭ്യമല്ല</string>+</resources>diff --git a/OCR-translation/src/main/res/values-mr/strings.xml b/OCR-translation/src/main/res/values-mr/strings.xmlnew file mode 100644index 0000000..cddc604--- /dev/null+++ b/OCR-translation/src/main/res/values-mr/strings.xml@@ -0,0 +1,217 @@+<?xml version="1.0" encoding="utf-8"?>+<resources>+ <string name="stop">थांबवा</string>+ <string name="pause">थांबवा</string>+ <string name="resume">पुन्हा सुरू करा</string>+ <string name="region_select_menu">भाषांतर क्षेत्र निवडा</string>+ <string name="screen_translate_needs_source">स्रोत भाषा निवडा</string>+ <string name="live_tile_label">स्क्रीन थेट भाषांतर करा</string>+ <string name="translate_text">भाषांतर करा</string>+ <string name="translate_link">दुवा भाषांतर करा</string>+ <string name="accessibility_service_description">स्क्रीनवरील मजकूर भाषांतर करण्यासाठी ही सेवा सुरू करा. सध्याची स्क्रीन भाषांतर करण्यासाठी तरंगता भाषांतर बटण दाबा, किंवा थेट स्क्रीन भाषांतर सुरू करा.</string>+ <string name="tap_to_translate_title">झटपट भाषांतर सुरू आहे</string>+ <string name="tap_to_translate_body">भाषांतर पॉपअप उघडण्यासाठी दाबा</string>+ <string name="tap_to_translate_channel">झटपट भाषांतर</string>+ <string name="tap_to_translate_channel_description">भाषांतर पॉपअप पटकन उघडण्यासाठीची कायमस्वरूपी सूचना</string>+ <string name="quick_tile_label">भाषांतर करा</string>+ <!-- common -->+ <string name="common_ok">ठीक आहे</string>+ <string name="common_cancel">रद्द करा</string>+ <string name="common_done">झाले</string>+ <string name="common_grant">परवानगी द्या</string>+ <string name="common_manage">व्यवस्थापित करा</string>+ <!-- settings -->+ <string name="settings_title">सेटिंग्ज</string>+ <string name="settings_languages">भाषा</string>+ <string name="settings_language_packs">भाषा पॅक</string>+ <string name="settings_general">सामान्य</string>+ <string name="settings_font_size">अक्षर आकार</string>+ <string name="settings_font_sample">हा काही उदाहरणादाखल मजकूर आहे</string>+ <string name="settings_tap_notification">झटपट भाषांतर सूचना</string>+ <string name="settings_tap_notification_desc">पॉपअप उघडणारी कायमस्वरूपी सूचना.</string>+ <string name="settings_web_translator">वेब भाषांतरक</string>+ <string name="settings_clear_browsing">बंद करताना ब्राउझिंग डेटा साफ करा</string>+ <string name="settings_clear_browsing_desc">कुकीज, कॅशे आणि स्थानिक संचयन हटवते.</string>+ <string name="settings_tts_section">मजकूर-ते-उच्चार</string>+ <string name="settings_tts_read_urls_hashtags">URL आणि हॅशटॅग वाचा</string>+ <string name="settings_popup_settings">पॉपअप</string>+ <string name="settings_popup_desc">मजकूर निवड मेनूमधून \'भाषांतर करा\' निवडल्यावर पॉपअप दिसतो</string>+ <string name="settings_hide_input">इनपुट लपवा</string>+ <string name="settings_popup_position">पॉपअप स्थान</string>+ <string name="settings_popup_size">पॉपअप आकार: %1$d%%</string>+ <string name="settings_screen_translation">स्क्रीन भाषांतर</string>+ <string name="settings_screen_translation_desc">इतर अॅप्सच्या वर थेट मजकूर भाषांतर करा.</string>+ <string name="settings_floating_button">कायम सुरू बटण</string>+ <string name="settings_floating_button_desc">प्रवेशयोग्यता भूमिका आवश्यक</string>+ <string name="settings_shortcut">शॉर्टकटवर स्क्रीन भाषांतर करा</string>+ <string name="settings_shortcut_desc">सुरू करण्यासाठी होम किंवा पॉवर बटण दाबून धरा</string>+ <string name="settings_on_shortcut">शॉर्टकट वापरल्यावर</string>+ <string name="settings_ocr">प्रतिमा</string>+ <string name="settings_background_mode">मजकूर बदला यासह</string>+ <string name="settings_min_confidence">किमान विश्वास: %1$d%%</string>+ <string name="settings_max_image_size">कमाल प्रतिमा आकार: %1$dpx</string>+ <string name="settings_advanced">प्रगत</string>+ <string name="settings_catalog_url">कॅटलॉग URL</string>+ <string name="settings_external_storage">बाह्य संचयन वापरा</string>+ <string name="settings_disable_autodetect">आपोआप भाषा ओळख बंद करा</string>+ <string name="settings_translit_output">भाषांतरित मजकुरासाठी लिप्यंतर दाखवा</string>+ <string name="settings_translit_input">मूळ मजकुरासाठी लिप्यंतर दाखवा</string>+ <string name="settings_translit_japanese_spaces">जपानी लिप्यंतरासाठी मोकळी जागा जोडा</string>+ <string name="settings_translate_pdf_images">PDF मधील प्रतिमा भाषांतर करा</string>+ <string name="settings_camera_live_default">डीफॉल्टनुसार कॅमेरा थेट भाषांतर करा</string>+ <string name="settings_register_browser">ब्राउझर म्हणून नोंदणी करा</string>+ <string name="settings_register_browser_desc">इतर अॅप्समधील दुवे भाषांतर करण्याची सुविधा द्या.</string>+ <string name="settings_external_storage_perm_title">बाह्य संचयन परवानगी</string>+ <string name="settings_about">माहिती</string>+ <string name="settings_version">आवृत्ती %1$s</string>+ <string name="settings_no_languages_available">कोणतीही भाषा उपलब्ध नाही</string>+ <string name="settings_default_from">डीफॉल्ट \'पासून\' भाषा</string>+ <string name="settings_default_to">डीफॉल्ट \'पर्यंत\' भाषा</string>+ <string name="settings_adblock_support">जाहिरात अडवणे</string>+ <string name="settings_about_get_help">मदत मिळवा / समस्या कळवा</string>+ <string name="settings_logs_copied">अॅप लॉग क्लिपबोर्डवर कॉपी केले</string>+ <string name="settings_about_support">विकासाला पाठिंबा द्या</string>+ <string name="settings_external_storage_perm_body">तुमच्या Documents फोल्डरमध्ये भाषांतर फायली साठवण्यासाठी, या अॅपला सर्व फायली व्यवस्थापित करण्याचा प्रवेश हवा आहे.\nतुम्हाला सेटिंग्जमध्ये नेले जाईल जिथे तुम्ही \'सर्व फायली व्यवस्थापित करण्याचा प्रवेश अनुमती द्या\' ही परवानगी देऊ शकता.</string>+ <!-- language manager / setup / how-to -->+ <string name="langmgr_voices">आवाज</string>+ <string name="langmgr_default">डीफॉल्ट</string>+ <string name="langmgr_filter">भाषा गाळा</string>+ <string name="langmgr_delete_shared_title">सामायिक शब्दकोश हटवायचा?</string>+ <string name="langmgr_delete_shared_body">हा शब्दकोश %1$s सोबत सामायिक आहे.\nतो हटवल्यास त्या सर्वांसाठीचा शब्दकोश काढून टाकला जाईल.</string>+ <string name="langmgr_download_size">%1$s डाउनलोड करा</string>+ <string name="langmgr_repair_needed">काही डाउनलोड केलेल्या वैशिष्ट्यांच्या फायली गहाळ आहेत आणि दुरुस्ती होईपर्यंत काम करणार नाहीत.</string>+ <string name="langmgr_repair_size">%1$s दुरुस्त करा</string>+ <string name="nolang_title">भाषा सेटअप</string>+ <string name="nolang_prompt">भाषांतर सुरू करण्यासाठी भाषा पॅक डाउनलोड करा</string>+ <string name="howto_title">कसे वापरावे</string>+ <!-- image capture / voice / dictionary / language selector -->+ <string name="image_no_crop_remote">दूरस्थ प्रतिमा थेट कापता येत नाहीत</string>+ <string name="image_open_failed">फाईल उघडता आली नाही</string>+ <string name="image_source_screen">स्क्रीन</string>+ <string name="image_source_document">दस्तऐवज</string>+ <string name="image_source_photos">फोटो</string>+ <string name="image_source_gallery">गॅलरी</string>+ <string name="image_source_camera">कॅमेरा</string>+ <string name="voice_playback_speed">प्लेबॅक वेग</string>+ <string name="voice_label">आवाज</string>+ <string name="voice_default">डीफॉल्ट आवाज</string>+ <string name="langsel_auto">✨ आपोआप</string>+ <string name="dict_also_as">असेही:</string>+ <!-- camera / browser / screen translate -->+ <string name="camera_permission_rationale">थेट भाषांतरासाठी कॅमेरा परवानगी आवश्यक आहे.</string>+ <string name="camera_need_ocr_models">या भाषेसाठी तुम्हाला मजकूर ओळख मॉडेल डाउनलोड करावे लागतील</string>+ <string name="browser_no_source_language">कोणतीही स्रोत भाषा उपलब्ध नाही. प्रथम मुख्य स्क्रीनवरून एक स्थापित करा, किंवा सेटिंग्जमध्ये डीफॉल्ट स्रोत भाषा निवडा.</string>+ <string name="browser_reader_unavailable">या पानासाठी वाचक मोड उपलब्ध नाही</string>+ <string name="browser_translate_image">प्रतिमा भाषांतर करा</string>+ <string name="screen_translating_notification">स्क्रीन भाषांतर होत आहे</string>+ <!-- enums -->+ <string name="align_top">वर</string>+ <string name="align_middle">मध्यभागी</string>+ <string name="align_bottom">खाली</string>+ <string name="assistant_action_still_image">एकदा भाषांतर करा</string>+ <string name="assistant_action_live_screen">थेट भाषांतर सुरू करा</string>+ <string name="background_mode_white_on_black">काळ्यावर पांढरे</string>+ <string name="background_mode_black_on_white">पांढऱ्यावर काळे</string>+ <string name="background_mode_auto_detect">रंग आपोआप ओळखा</string>+ <!-- tts / speech errors -->+ <string name="tts_nothing_to_speak">बोलण्यासाठी काही नाही</string>+ <string name="tts_catalog_unavailable">कॅटलॉग उपलब्ध नाही</string>+ <string name="tts_no_voice">%1$s साठी कोणताही आवाज स्थापित नाही</string>+ <string name="tts_synthesis_failed">%1$s साठी आवाज संश्लेषण अयशस्वी</string>+ <string name="tts_sample_fallback">हा Offline Translator कडून एक text-to-speech नमुना आहे.</string>+ <!-- translation -->+ <string name="translation_error">भाषांतर त्रुटी: %1$s</string>+ <!-- download errors -->+ <string name="download_failed_core">%1$s डाउनलोड अयशस्वी</string>+ <string name="download_failed_ocr">%1$s मजकूर ओळख डाउनलोड अयशस्वी</string>+ <string name="download_failed_ocr_batch">मजकूर ओळख बॅच डाउनलोड अयशस्वी</string>+ <string name="download_failed_dictionary">%1$s शब्दकोश डाउनलोड अयशस्वी</string>+ <string name="download_failed_tts">%1$s आवाज डाउनलोड अयशस्वी</string>+ <string name="download_failed_adblock">Adblock डाउनलोड अयशस्वी</string>+ <string name="download_failed_repair">दुरुस्ती डाउनलोड अयशस्वी</string>+ <string name="download_catalog_unavailable">कॅटलॉग उपलब्ध नाही</string>+ <string name="download_catalog_save_failed">कॅटलॉग जतन करता आला नाही</string>+ <string name="download_unknown_error">अज्ञात त्रुटी</string>+ <string name="download_catalog_failed">कॅटलॉग डाउनलोड करता आला नाही: %1$s</string>+ <!-- assistant overlay status -->+ <string name="assistant_invoke_prompt">मजकुराच्या वर हा सहाय्यक चालवून तो भाषांतर करा</string>+ <string name="assistant_collecting_context">स्क्रीन संदर्भ गोळा करत आहे…</string>+ <string name="assistant_screenshot_disabled">या सहाय्यकासाठी स्क्रीनशॉट प्रवेश बंद आहे. तो सिस्टम सहाय्यक सेटिंग्जमध्ये सुरू करा.</string>+ <string name="assistant_no_screen_data">कोणताही स्क्रीन डेटा मिळाला नाही. या सहाय्यकासाठी \'स्क्रीनशॉट वापरा\' सुरू करा.</string>+ <string name="assistant_no_screenshot">या अॅपने स्क्रीनशॉट दिला नाही.</string>+ <string name="assistant_set_source_ocr">मजकूर ओळखीसाठी डीफॉल्ट स्रोत भाषा निवडा.</string>+ <string name="assistant_langs_not_ready">भाषांतर भाषा अद्याप तयार नाहीत. पुन्हा प्रयत्न करा.</string>+ <string name="assistant_ocr_failed">मजकूर ओळख अयशस्वी</string>+ <string name="ocr_models_missing">मजकूर ओळख मॉडेल गहाळ आहेत. दुरुस्तीसाठी अॅपमध्ये भाषा व्यवस्थापन उघडा.</string>+ <string name="assistant_set_source_live">थेट स्क्रीन भाषांतर वापरण्यासाठी सेटिंग्जमध्ये डीफॉल्ट स्रोत भाषा निवडा.</string>+ <!-- migration gate -->+ <string name="migration_updating_speech_models">आवाज मॉडेल अद्यतनित होत आहेत</string>+ <string name="migration_accept_convert">स्वीकारा आणि रूपांतरित करा</string>+ <string name="migration_delete_all">त्याऐवजी सर्व हटवा</string>+ <string name="migration_converting">%2$d पैकी %1$d रूपांतरित होत आहे</string>+ <string name="migration_optimizing">मॉडेल सुधारत आहे</string>+ <plurals name="migration_convert_prompt">+ <item quantity="one">तुमच्याकडे नवीन स्वरूपात रूपांतरित करण्यासाठी %1$d text-to-speech मॉडेल आहे. यास अंदाजे %2$d सेकंद लागतील. तुम्ही %3$.0f MB डिस्क जागा वाचवाल.</item>+ <item quantity="other">तुमच्याकडे नवीन स्वरूपात रूपांतरित करण्यासाठी %1$d text-to-speech मॉडेल आहेत. यास अंदाजे %2$d सेकंद लागतील. तुम्ही %3$.0f MB डिस्क जागा वाचवाल.</item>+ </plurals>+ <!-- document translation notification + progress -->+ <string name="doc_notif_translating">फाईल भाषांतर होत आहे</string>+ <string name="doc_notif_translated">फाईल भाषांतरित झाली</string>+ <string name="doc_notif_phase_text">मजकूर %1$d%%</string>+ <string name="doc_notif_phase_images">प्रतिमा %1$d/%2$d</string>+ <string name="doc_notif_phase_raster">बिटमॅप पाने %1$d/%2$d</string>+ <string name="doc_notif_channel_name">दस्तऐवज भाषांतर</string>+ <string name="doc_notif_channel_desc">दस्तऐवज भाषांतर करताना प्रगती दाखवते</string>+ <string name="doc_progress_preparing">फाईल तयार होत आहे</string>+ <string name="doc_progress_translating">भाषांतर होत आहे</string>+ <string name="doc_progress_translated">फाईल भाषांतरित झाली</string>+ <string name="doc_progress_saving">भाषांतरित फाईल जतन होत आहे</string>+ <string name="doc_translation_failed">दस्तऐवज भाषांतर अयशस्वी</string>+ <string name="doc_url_unsupported">त्याऐवजी दस्तऐवज डाउनलोड करून अॅपने उघडा</string>+ <!-- document configure sheet -->+ <string name="document_wrap_columns">%1$d स्तंभांवर गुंडाळा</string>+ <string name="document_translate_pdf_images">PDF मधील प्रतिमा भाषांतर करा</string>+ <string name="layout_preserve">ओळींचे खंड जपा</string>+ <string name="layout_reflow">परिच्छेदांमध्ये पुनर्रचना करा</string>+ <string name="layout_reflow_wrap">पुनर्रचना करा आणि गुंडाळा</string>+ <!-- common (additional) -->+ <string name="common_open">उघडा</string>+ <string name="common_close">बंद करा</string>+ <string name="common_save">जतन करा</string>+ <!-- translator app -->+ <string name="translator_translated_file">भाषांतरित फाईल: %1$s</string>+ <string name="translator_document_saved">दस्तऐवज जतन झाला</string>+ <string name="translator_document_save_failed">दस्तऐवज जतन करता आला नाही</string>+ <string name="translator_audio_playback_failed">ऑडिओ प्लेबॅक अयशस्वी: %1$s</string>+ <string name="translator_no_app_to_open">ही फाईल उघडण्यासाठी कोणतेही अॅप सापडले नाही</string>+ <!-- document alignment -->+ <string name="docalign_decode_failed">प्रतिमा डीकोड करता आली नाही.</string>+ <string name="docalign_detecting">कोपरे शोधत आहे…</string>+ <string name="docalign_redetecting">पुन्हा शोधत आहे…</string>+ <string name="docalign_help">दस्तऐवजाभोवती अचूक परिमिती असल्यास ओळख गुणवत्ता सुधारते. ओळी मजकुराला समांतर असणे महत्त्वाचे आहे.\n\nझूम किंवा पॅन केल्यास अल्गोरिदम सहसा दस्तऐवज आपोआप ओळखतो, पण न सापडल्यास तुम्ही स्वतः जुळवणी करू शकता.</string>+ <!-- how to use -->+ <string name="howto_section_other_apps">इतर अॅप्समधून</string>+ <string name="howto_share_title">भाषांतर करण्यासाठी सामायिक करा</string>+ <string name="howto_share_body">कोणत्याही अॅपमधून मजकूर, दुवे किंवा प्रतिमा भाषांतर करण्यासाठी सामायिक करा.</string>+ <string name="howto_copy_title">इतर अॅप्स न सोडता भाषांतर करा</string>+ <string name="howto_copy_body">कुठेही मजकूर निवडा, नंतर कॉपी टूलबारमधील \"भाषांतर करा\" दाबून छोट्या पॉपअपमध्ये भाषांतर पहा.</string>+ <string name="howto_section_in_app">अॅपच्या आत</string>+ <string name="howto_docs_title">दस्तऐवज भाषांतर करा</string>+ <string name="howto_docs_body">EPUB, PDF आणि TXT फायली भाषांतर करण्यासाठी दस्तऐवज टॅब उघडा.</string>+ <string name="howto_dict_title">शब्दकोश शोध</string>+ <string name="howto_dict_body">भाषांतरातील कोणताही शब्द दाबून धरून त्याची व्याख्या पहा. डेटा Wiktionary कडून घेतलेला आहे.</string>+ <string name="howto_voice_title">आवाज किंवा वेग बदला</string>+ <string name="howto_voice_body">वेगळा आवाज निवडण्यासाठी किंवा प्लेबॅक वेग बदलण्यासाठी प्ले बटण दाबून धरा.</string>+ <!-- feature row labels -->+ <string name="feature_translation">भाषांतर</string>+ <string name="feature_dictionary">शब्दकोश</string>+ <string name="feature_tts">आवाज</string>+ <!-- misc -->+ <string name="main_input_placeholder">मजकूर टाका</string>+ <string name="aidl_target_unavailable">लक्ष्य भाषा उपलब्ध नाही</string>+ <string name="voice_section_downloaded">डाउनलोड केले</string>+ <string name="voice_section_available">उपलब्ध</string>+ <string name="detected_translate_from">यावरून भाषांतर करा</string>+ <string name="detected_missing_language">भाषा अनुपलब्ध</string>+ <string name="langmgr_ocr_upgrade_available">एक सुधारित मजकूर ओळख मॉडेल उपलब्ध आहे.</string>+</resources>diff --git a/OCR-translation/src/main/res/values-pl/strings.xml b/OCR-translation/src/main/res/values-pl/strings.xmlnew file mode 100644index 0000000..44c2283--- /dev/null+++ b/OCR-translation/src/main/res/values-pl/strings.xml@@ -0,0 +1,313 @@+<?xml version="1.0" encoding="utf-8"?>+<resources>+ <string name="stop">Zatrzymaj</string>+ <string name="pause">Wstrzymaj</string>+ <string name="resume">Wznów</string>+ <string name="region_select_menu">Ustaw obszar tłumaczenia</string>+ <string name="screen_translate_needs_source">Podaj język źródłowy</string>+ <string name="live_tile_label">Tłumacz ekran na żywo</string>+ <string name="translate_text">Przetłumacz</string>+ <string name="translate_link">Przetłumacz link</string>+ <string name="accessibility_service_description">Włącz tę usługę, aby tłumaczyć tekst na ekranie. Dotknij pływającego przycisku tłumaczenia, aby przetłumaczyć bieżący ekran, lub uruchom tłumaczenie ekranu na żywo.</string>+ <string name="tap_to_translate_title">Szybkie tłumaczenie jest włączone</string>+ <string name="tap_to_translate_body">Dotknij, aby otworzyć okienko tłumacza</string>+ <string name="tap_to_translate_channel">Szybkie tłumaczenie</string>+ <string name="tap_to_translate_channel_description">Stałe powiadomienie zapewniające szybki dostęp do okienka tłumacza</string>+ <string name="quick_tile_label">Przetłumacz</string>+ <!-- common -->+ <string name="common_ok">OK</string>+ <string name="common_cancel">Anuluj</string>+ <string name="common_done">Gotowe</string>+ <string name="common_grant">Przyznaj</string>+ <string name="common_manage">Zarządzaj</string>+ <!-- settings -->+ <string name="settings_title">Ustawienia</string>+ <string name="settings_languages">Języki</string>+ <string name="settings_language_packs">Pakiety językowe</string>+ <string name="settings_general">Ogólne</string>+ <string name="settings_font_size">Rozmiar czcionki</string>+ <string name="settings_font_sample">To jest przykładowy tekst</string>+ <string name="settings_tap_notification">Podręczne tłumaczenie</string>+ <string name="settings_tap_notification_desc">Stałe powiadomienie, które otwiera okienko tłumacza.</string>+ <string name="settings_web_translator">Tłumacz stron internetowych</string>+ <string name="settings_clear_browsing">Wyczyść dane przeglądania po zamknięciu</string>+ <string name="settings_clear_browsing_desc">Usuwa pliki cookie, pamięć podręczną i lokalną.</string>+ <string name="settings_tts_section">Zamiana tekstu na mowę</string>+ <string name="settings_tts_read_urls_hashtags">Czytaj adresy URL i hashtagi</string>+ <string name="settings_popup_settings">Okno podręczne</string>+ <string name="settings_popup_desc">Okno pojawia się po wybraniu \'Przetłumacz\' z menu zaznaczania tekstu</string>+ <string name="settings_hide_input">Ukryj tekst wejściowy</string>+ <string name="settings_popup_position">Pozycja okna</string>+ <string name="settings_popup_size">Rozmiar okienka: %1$d%%</string>+ <string name="settings_screen_translation">Tłumaczenie ekranu</string>+ <string name="settings_screen_translation_desc">Tłumacz tekst bezpośrednio z innych aplikacji.</string>+ <string name="settings_floating_button">Przycisk zawsze widoczny</string>+ <string name="settings_floating_button_desc">Wymaga uprawnień dostępności</string>+ <string name="settings_shortcut">Tłumacz ekran skrótem</string>+ <string name="settings_shortcut_desc">Przytrzymaj przycisk ekranu głównego lub zasilania, aby uruchomić</string>+ <string name="settings_on_shortcut">Przy użyciu skrótu</string>+ <string name="settings_ocr">Obrazy</string>+ <string name="settings_background_mode">Zamień tekst na</string>+ <string name="settings_min_confidence">Minimalna pewność: %1$d%%</string>+ <string name="settings_max_image_size">Maks. rozmiar obrazu: %1$dpx</string>+ <string name="settings_advanced">Zaawansowane</string>+ <string name="settings_catalog_url">URL katalogu</string>+ <string name="settings_external_storage">Użyj pamięci zewnętrznej</string>+ <string name="settings_disable_autodetect">Wyłącz automatyczne wykrywanie języka</string>+ <string name="settings_translit_output">Pokaż transliterację tłumaczenia</string>+ <string name="settings_translit_input">Pokaż transliterację oryginału</string>+ <string name="settings_translit_japanese_spaces">Dodaj spacje w transliteracji japońskiej</string>+ <string name="settings_translate_pdf_images">Tłumacz obrazy w plikach PDF</string>+ <string name="settings_camera_live_default">Domyślnie tłumacz obraz z aparatu na żywo</string>+ <string name="settings_register_browser">Zarejestruj jako przeglądarkę</string>+ <string name="settings_register_browser_desc">Oferuj tłumaczenie linków z innych aplikacji.</string>+ <string name="settings_external_storage_perm_title">Uprawnienie do pamięci zewnętrznej</string>+ <string name="settings_about">Informacje</string>+ <string name="settings_version">Wersja %1$s</string>+ <string name="settings_no_languages_available">Brak dostępnych języków</string>+ <string name="settings_default_from">Domyślny język źródłowy</string>+ <string name="settings_default_to">Domyślny język docelowy</string>+ <string name="settings_adblock_support">Blokowanie reklam</string>+ <string name="settings_about_get_help">Pomoc / zgłoś problem</string>+ <string name="settings_logs_copied">Dzienniki aplikacji skopiowano do schowka</string>+ <string name="settings_about_support">Wesprzyj rozwój</string>+ <string name="settings_external_storage_perm_body">Aby przechowywać pliki tłumaczeń w folderze Dokumenty, ta aplikacja potrzebuje dostępu do zarządzania wszystkimi plikami.\nNastąpi przejście do Ustawień, gdzie możesz przyznać uprawnienie \'Zezwól na zarządzanie wszystkimi plikami\'.</string>+ <!-- language manager / setup / how-to -->+ <string name="langmgr_voices">Głosy</string>+ <string name="langmgr_default">DOMYŚLNY</string>+ <string name="langmgr_filter">Filtruj języki</string>+ <string name="langmgr_delete_shared_title">Usunąć współdzielony słownik?</string>+ <string name="langmgr_delete_shared_body">Ten słownik jest współdzielony z %1$s.\nUsunięcie go spowoduje usunięcie słownika dla wszystkich z nich.</string>+ <string name="langmgr_download_size">Pobierz %1$s</string>+ <string name="langmgr_repair_needed">W niektórych pobranych funkcjach brakuje plików i nie będą działać do czasu naprawy.</string>+ <string name="langmgr_repair_size">Napraw %1$s</string>+ <string name="nolang_title">Konfiguracja języka</string>+ <string name="nolang_prompt">Pobierz pakiety językowe, aby rozpocząć tłumaczenie</string>+ <string name="howto_title">Jak korzystać</string>+ <!-- image capture / voice / dictionary / language selector -->+ <string name="image_no_crop_remote">Obrazów zdalnych nie można przyciąć bezpośrednio</string>+ <string name="image_open_failed">Nie udało się otworzyć pliku</string>+ <string name="image_source_screen">Ekran</string>+ <string name="image_source_document">Dokument</string>+ <string name="image_source_photos">Zdjęcia</string>+ <string name="image_source_gallery">Galeria</string>+ <string name="image_source_camera">Aparat</string>+ <string name="voice_playback_speed">Prędkość odtwarzania</string>+ <string name="voice_label">Głos</string>+ <string name="voice_default">Domyślny głos</string>+ <string name="langsel_auto">✨ Auto</string>+ <string name="dict_also_as">Również jako:</string>+ <!-- camera / browser / screen translate -->+ <string name="camera_permission_rationale">Tłumaczenie na żywo wymaga dostępu do aparatu.</string>+ <string name="camera_need_ocr_models">Musisz pobrać modele rozpoznawania tekstu dla tego języka</string>+ <string name="browser_no_source_language">Brak dostępnego języka źródłowego. Zainstaluj go najpierw na ekranie głównym lub ustaw domyślny język źródłowy w ustawieniach.</string>+ <string name="browser_reader_unavailable">Tryb czytnika niedostępny dla tej strony</string>+ <string name="browser_translate_image">Przetłumacz obraz</string>+ <string name="screen_translating_notification">Tłumaczenie ekranu</string>+ <!-- enums -->+ <string name="align_top">Góra</string>+ <string name="align_middle">Środek</string>+ <string name="align_bottom">Dół</string>+ <string name="assistant_action_still_image">Przetłumacz raz</string>+ <string name="assistant_action_live_screen">Rozpocznij tłumaczenie na żywo</string>+ <string name="background_mode_white_on_black">Biały na czarnym</string>+ <string name="background_mode_black_on_white">Czarny na białym</string>+ <string name="background_mode_auto_detect">Oryginalne kolory obrazu</string>+ <!-- tts / speech errors -->+ <string name="tts_nothing_to_speak">Brak tekstu do odczytania</string>+ <string name="tts_catalog_unavailable">Katalog niedostępny</string>+ <string name="tts_no_voice">Brak zainstalowanego głosu dla języka %1$s</string>+ <string name="tts_synthesis_failed">Synteza mowy nie powiodła się dla %1$s</string>+ <string name="tts_sample_fallback">To jest próbka mowy z Offline Translator.</string>+ <!-- translation -->+ <string name="translation_error">Błąd tłumaczenia: %1$s</string>+ <!-- download errors -->+ <string name="download_failed_core">Pobieranie %1$s nie powiodło się</string>+ <string name="download_failed_ocr">Pobieranie rozpoznawania tekstu %1$s nie powiodło się</string>+ <string name="download_failed_ocr_batch">Wsadowe pobieranie rozpoznawania tekstu nie powiodło się</string>+ <string name="download_failed_dictionary">Pobieranie słownika %1$s nie powiodło się</string>+ <string name="download_failed_tts">Pobieranie głosu %1$s nie powiodło się</string>+ <string name="download_failed_adblock">Pobieranie Adblock nie powiodło się</string>+ <string name="download_failed_repair">Pobieranie naprawy nie powiodło się</string>+ <string name="download_catalog_unavailable">Katalog niedostępny</string>+ <string name="download_catalog_save_failed">Nie udało się zapisać katalogu</string>+ <string name="download_unknown_error">Nieznany błąd</string>+ <string name="download_catalog_failed">Nie udało się pobrać katalogu: %1$s</string>+ <!-- assistant overlay status -->+ <string name="assistant_invoke_prompt">Wywołaj tego asystenta na tekście, aby go przetłumaczyć</string>+ <string name="assistant_collecting_context">Zbieranie kontekstu ekranu…</string>+ <string name="assistant_screenshot_disabled">Dostęp do zrzutu ekranu jest wyłączony dla tego asystenta. Włącz go w ustawieniach asystenta systemowego.</string>+ <string name="assistant_no_screen_data">Nie otrzymano danych z ekranu. Włącz \'Użyj zrzutu ekranu\' dla tego asystenta.</string>+ <string name="assistant_no_screenshot">Ta aplikacja nie dostarczyła zrzutu ekranu.</string>+ <string name="assistant_set_source_ocr">Ustaw domyślny język źródłowy dla rozpoznawania tekstu.</string>+ <string name="assistant_langs_not_ready">Języki tłumaczenia nie są jeszcze gotowe. Spróbuj ponownie.</string>+ <string name="assistant_ocr_failed">Rozpoznawanie tekstu nie powiodło się</string>+ <string name="ocr_models_missing">Brak modeli rozpoznawania tekstu. Otwórz Zarządzanie językami w aplikacji, aby je naprawić.</string>+ <string name="assistant_set_source_live">Ustaw domyślny język źródłowy w Ustawieniach, aby korzystać z tłumaczenia ekranu na żywo.</string>+ <!-- migration gate -->+ <string name="migration_updating_speech_models">Aktualizowanie modeli mowy</string>+ <string name="migration_accept_convert">Zaakceptuj i przekonwertuj</string>+ <string name="migration_delete_all">Zamiast tego usuń wszystko</string>+ <string name="migration_converting">Konwertowanie %1$d z %2$d</string>+ <string name="migration_optimizing">Optymalizowanie modeli</string>+ <plurals name="migration_convert_prompt">+ <item quantity="one">Masz %1$d model syntezy mowy do przekonwertowania na nowy format. Zajmie to około %2$d sekund. Zaoszczędzisz %3$.0f MB miejsca na dysku.</item>+ <item quantity="few">Masz %1$d modele syntezy mowy do przekonwertowania na nowy format. Zajmie to około %2$d sekund. Zaoszczędzisz %3$.0f MB miejsca na dysku.</item>+ <item quantity="many">Masz %1$d modeli syntezy mowy do przekonwertowania na nowy format. Zajmie to około %2$d sekund. Zaoszczędzisz %3$.0f MB miejsca na dysku.</item>+ <item quantity="other">Masz %1$d modelu syntezy mowy do przekonwertowania na nowy format. Zajmie to około %2$d sekund. Zaoszczędzisz %3$.0f MB miejsca na dysku.</item>+ </plurals>+ <!-- document translation notification + progress -->+ <string name="doc_notif_translating">Tłumaczenie pliku</string>+ <string name="doc_notif_translated">Przetłumaczono plik</string>+ <string name="doc_notif_phase_text">Tekst %1$d%%</string>+ <string name="doc_notif_phase_images">Obrazy %1$d/%2$d</string>+ <string name="doc_notif_phase_raster">Strony bitmapowe %1$d/%2$d</string>+ <string name="doc_notif_channel_name">Tłumaczenie dokumentów</string>+ <string name="doc_notif_channel_desc">Pokazuje postęp podczas tłumaczenia dokumentów</string>+ <string name="doc_progress_preparing">Przygotowywanie pliku</string>+ <string name="doc_progress_translating">Tłumaczenie</string>+ <string name="doc_progress_translated">Przetłumaczono plik</string>+ <string name="doc_progress_saving">Zapisywanie przetłumaczonego pliku</string>+ <string name="doc_translation_failed">Tłumaczenie dokumentu nie powiodło się</string>+ <string name="doc_url_unsupported">Pobierz dokument i otwórz go w aplikacji</string>+ <!-- document configure sheet -->+ <string name="document_wrap_columns">Zawijaj przy %1$d kolumnach</string>+ <string name="document_translate_pdf_images">Tłumacz obrazy w PDF</string>+ <string name="layout_preserve">Zachowaj podziały wierszy</string>+ <string name="layout_reflow">Połącz w akapity</string>+ <string name="layout_reflow_wrap">Połącz i zawijaj</string>+ <!-- common (additional) -->+ <string name="common_open">Otwórz</string>+ <string name="common_close">Zamknij</string>+ <string name="common_save">Zapisz</string>+ <!-- translator app -->+ <string name="translator_translated_file">Przetłumaczony plik: %1$s</string>+ <string name="translator_document_saved">Dokument zapisany</string>+ <string name="translator_document_save_failed">Nie udało się zapisać dokumentu</string>+ <string name="translator_audio_playback_failed">Odtwarzanie dźwięku nie powiodło się: %1$s</string>+ <string name="translator_no_app_to_open">Nie znaleziono aplikacji do otwarcia tego pliku</string>+ <!-- document alignment -->+ <string name="docalign_decode_failed">Nie można zdekodować obrazu.</string>+ <string name="docalign_detecting">Wykrywanie narożników…</string>+ <string name="docalign_redetecting">Ponowne wykrywanie…</string>+ <string name="docalign_help">Dokładne obramowanie wokół dokumentu poprawia jakość rozpoznawania. Ważne jest, aby linie były równoległe do tekstu.\n\nPrzybliżanie lub przesuwanie zwykle sprawia, że algorytm automatycznie wykrywa dokument, ale jeśli nie zostanie znaleziony, nadal możesz dostosować go ręcznie.</string>+ <!-- how to use -->+ <string name="howto_section_other_apps">Z innych aplikacji</string>+ <string name="howto_share_title">Udostępnij, aby przetłumaczyć</string>+ <string name="howto_share_body">Udostępnij tekst, linki lub obrazy z dowolnej aplikacji, aby je przetłumaczyć.</string>+ <string name="howto_copy_title">Tłumacz bez opuszczania innych aplikacji</string>+ <string name="howto_copy_body">Zaznacz tekst w dowolnej aplikacji, a następnie dotknij opcji „Przetłumacz” na pasku narzędzi kopiowania, aby wyświetlić tłumaczenie w niewielkim okienku.</string>+ <string name="howto_section_in_app">W aplikacji</string>+ <string name="howto_docs_title">Tłumacz dokumenty i obrazy</string>+ <string name="howto_docs_body">Otwórz kartę Dokumenty, aby tłumaczyć obrazy lub pliki EPUB, PDF i TXT.</string>+ <string name="howto_dict_title">Wyszukiwanie w słowniku</string>+ <string name="howto_dict_body">Przytrzymaj dowolne słowo, a następnie wybierz opcję „Słownik”, aby wyświetlić jego definicję. Możesz też najpierw przytrzymać przycisk słownika, a następnie dotknąć dowolne słowo. Źródło danych: Wikisłownik.</string>+ <string name="howto_voice_title">Zmień głos lub prędkość</string>+ <string name="howto_voice_body">Przytrzymaj przycisk odtwarzania, aby wybrać inny głos lub dostosować prędkość odtwarzania.</string>+ <!-- feature row labels -->+ <string name="feature_translation">Tłumaczenie</string>+ <string name="feature_dictionary">Słownik</string>+ <string name="feature_tts">Głos</string>+ <!-- misc -->+ <string name="main_input_placeholder">Wpisz tekst</string>+ <string name="aidl_target_unavailable">Język docelowy niedostępny</string>+ <string name="voice_section_downloaded">POBRANE</string>+ <string name="voice_section_available">DOSTĘPNE</string>+ <string name="detected_translate_from">Tłumacz z</string>+ <string name="detected_missing_language">Brak języka</string>+ <string name="langmgr_ocr_upgrade_available">Dostępny jest ulepszony model wykrywania tekstu.</string>+ <string name="settings_experimental_screen_translate">Tłumaczenie ekranu (funkcja eksperymentalna)</string>+ <string name="settings_multi_target">Wiele języków docelowych</string>+ <string name="a11y_add_target_language">Dodaj język docelowy</string>+ <string name="a11y_remove_target_language">Usuń język docelowy</string>+ <string name="feature_unavailable_tts">Funkcja zamiany tekstu na mowę nie jest dostępna – pobierz ją ze strony zarządzania językami</string>+ <string name="feature_unavailable_dictionary">Słownik jest niedostępny – pobierz go ze strony zarządzania językami</string>+ <string name="langmgr_translation_upgrade_available">Dostępne jest ulepszone tłumaczenie dla: %1$s</string>+ <string name="image_crop_action">Przytnij</string>+ <string name="download_failed_translation_batch">Pobieranie aktualizacji tłumaczenia nie powiodło się</string>+ <string name="howto_alt_title">Wybierz inne słowa</string>+ <string name="howto_alt_body">Dotknij przycisku \"inne\", a następnie dotknij dowolne słowo, aby je zastąpić. Model może zaproponować kilka opcji. W przeciwnym razie możesz wpisać własne. Pozostała część zdania zostanie ponownie przetłumaczona tak, aby pasowała do zmiany.</string>+ <string name="a11y_cancel">Anuluj</string>+ <string name="a11y_region_reset">Przełącz na tryb pełnoekranowy</string>+ <string name="a11y_region_confirm">Potwierdź region</string>+ <string name="a11y_translate_screen_live">Tłumacz ekran w czasie rzeczywistym</string>+ <string name="a11y_refresh">Odśwież</string>+ <string name="a11y_select_text">Zaznacz tekst</string>+ <string name="a11y_set_translation_area">Ustaw obszar tłumaczenia</string>+ <string name="a11y_show_original">Pokaż oryginalny</string>+ <string name="a11y_pause_resume">Zatrzymaj lub wznów</string>+ <string name="a11y_primary_input">Główne dane wejściowe</string>+ <string name="a11y_help">Pomoc</string>+ <string name="a11y_rotate_90">Obróć o 90 stopni</string>+ <string name="a11y_switch_rectangular_crop">Przełącz na prostokątne przycięcie</string>+ <string name="a11y_detect_document_corners">Wykryj rogi dokumentu</string>+ <string name="a11y_cancel_download">Anuluj pobieranie</string>+ <string name="a11y_delete_language">Usuń język</string>+ <string name="a11y_retry_download">Ponów pobieranie</string>+ <string name="a11y_download">Pobieranie</string>+ <string name="a11y_share_image">Udostępnij zdjęcie</string>+ <string name="a11y_close_fullscreen">Zamknij tryb pełnoekranowy</string>+ <string name="a11y_translation_output">Wynik tłumaczenia</string>+ <string name="a11y_output_textview">Widok tekstu wyjściowego</string>+ <string name="a11y_copy_translation">Skopiuj tłumaczenie</string>+ <string name="a11y_alternatives_mode_on">Wyjdź z trybu Inne</string>+ <string name="a11y_alternatives_mode_off">Tryb Inne: dotknij słowa, aby zobaczyć inne tłumaczenia</string>+ <string name="a11y_close_alternatives">Zamknij Inne</string>+ <string name="alt_custom_entry">Wpisz własne…</string>+ <string name="alt_custom_label">Twoje słowo</string>+ <string name="alt_custom_preview_label">Podgląd</string>+ <string name="a11y_dictionary_mode_on">Wyjdź z trybu słownika</string>+ <string name="a11y_dictionary_mode_off">Tryb słownika: dotknij słowa, aby je sprawdzić</string>+ <string name="a11y_source_document">Dokument</string>+ <string name="a11y_source_photos">Zdjęcia</string>+ <string name="a11y_source_gallery">Galeria</string>+ <string name="a11y_source_camera">Aparat</string>+ <string name="a11y_back">Wstecz</string>+ <string name="a11y_reverse_translation_direction">Zmień kierunek tłumaczenia</string>+ <string name="a11y_settings">Ustawienia</string>+ <string name="a11y_close">Zamknij</string>+ <string name="a11y_dictionary_status">Stan słownika</string>+ <string name="a11y_dictionary_entry">Wpis ze słownika</string>+ <string name="a11y_tts_status">Stan trybu zmiany tekstu na mowę</string>+ <string name="a11y_main_screen">Ekran główny</string>+ <string name="a11y_translate_image_or_file">Przetłumacz obraz lub plik</string>+ <string name="a11y_replace_text">Zamień tekst</string>+ <string name="a11y_clear_input">Wyczyść dane wejściowe</string>+ <string name="a11y_resize_split">Zmień rozmiar obszarów wejściowych i wyjściowych</string>+ <string name="a11y_paste">Wklej</string>+ <string name="a11y_voice_input">Wprowadzanie głosowe</string>+ <string name="a11y_detected_language_toast">Powiadomienie o wykryciu języka</string>+ <string name="a11y_switch_detected_language">Przełącz na wykryty język</string>+ <string name="a11y_torch_on">Latarka włączona</string>+ <string name="a11y_torch_off">Latarka wyłączona</string>+ <string name="a11y_live_overlay_on">Włączono nakładkę na żywo</string>+ <string name="a11y_live_overlay_off">Wyłączono nakładkę na żywo</string>+ <string name="a11y_collapse">Zwiń</string>+ <string name="a11y_expand">Rozwiń</string>+ <string name="a11y_delete">Usuń</string>+ <string name="a11y_favorite_remove">Usuń z ulubionych</string>+ <string name="a11y_favorite_add">Dodaj do ulubionych</string>+ <string name="a11y_download_feature">Opcje pobierania</string>+ <string name="a11y_show_translated_image">Pokazuj tłumaczony obraz</string>+ <string name="a11y_show_original_image">Pokazuj oryginalny obraz</string>+ <string name="a11y_stop_audio">Zatrzymaj dźwięk</string>+ <string name="a11y_speak_input">Głosowa treść wejściowa</string>+ <string name="a11y_speak_translation">Wypowiedziane tłumaczenie</string>+ <string name="a11y_original_image">Oryginalny obraz</string>+ <string name="a11y_translated_image">Przetłumaczony obraz</string>+ <string name="a11y_zoomable_original_image">Oryginalny obraz z możliwością powiększania</string>+ <string name="a11y_zoomable_translated_image">Przetłumaczony obraz z możliwością powiększania</string>+ <string name="settings_http_server">Włącz serwer HTTP zgodny z LibreTranslate</string>+ <string name="settings_http_server_desc">Umożliwia innym aplikacjom programowe wysyłanie żądań o przetłumaczenie</string>+ <string name="settings_http_server_port">Port</string>+ <string name="settings_http_server_bind">Włączono przypisywanie</string>+ <string name="settings_http_server_bind_localhost">localhost</string>+ <string name="settings_http_server_bind_all">Wszystkie interfejsy</string>+ <string name="settings_http_server_title">Serwer API</string>+ <string name="http_server_notif_channel_name">Tłumaczenie API</string>+ <string name="http_server_notif_channel_desc">Wyświetlane, gdy serwer zgodny z LibreTranslate jest uruchomiony</string>+ <string name="http_server_notif_running">Tłumaczenie API</string>+ <string name="http_server_notif_text">Nasłuchiwanie na %1$s:%2$d</string>+ <string name="http_server_notif_error">Nie udało się uruchomić na porcie %1$d</string>+ <string name="http_server_notif_disable">Wyłącz</string>+</resources>diff --git a/OCR-translation/src/main/res/values-pt-rPT/strings.xml b/OCR-translation/src/main/res/values-pt-rPT/strings.xmlnew file mode 100644index 0000000..0ad0282--- /dev/null+++ b/OCR-translation/src/main/res/values-pt-rPT/strings.xml@@ -0,0 +1,32 @@+<?xml version="1.0" encoding="utf-8"?>+<resources>+ <string name="align_middle">Centro</string>+ <string name="background_mode_auto_detect">Detetar cores automaticamente</string>+ <string name="common_manage">Gerir</string>+ <string name="howto_copy_body">Selecione um texto em qualquer lugar e clique em \"Traduzir\" na barra de cópia para ver a tradução por um pop-up compacto.</string>+ <string name="howto_copy_title">Traduzir sem sair de outras aplicações</string>+ <string name="howto_dict_body">Mantenha premida qualquer palavra duma tradução para ver a sua definição. Dados obtidos pelo Wiktionary.</string>+ <string name="howto_docs_body">Abra a aba Documentos para traduzir ficheiros EPUB, PDF e TXT.</string>+ <string name="howto_section_in_app">Dentro da aplicação</string>+ <string name="howto_section_other_apps">A partir de outras aplicações</string>+ <string name="howto_share_body">Partilhe texto, links ou imagens de qualquer aplicação para traduzir qualquer conteúdo .</string>+ <string name="howto_share_title">Partilhar para traduzir</string>+ <string name="howto_voice_body">Mantenha premido o botão de reprodução para escolher outra voz ou ajustar a velocidade de reprodução.</string>+ <string name="main_input_placeholder">Introduza texto aqui</string>+ <plurals name="migration_convert_prompt">+ <item quantity="one">Tem %1$d modelo de conversão de texto em fala para converter para um novo formato. Levará aproximadamente %2$d segundos. Irá economizar %3$.0f MB de espaço em disco.</item>+ <item quantity="other">Tem %1$d modelos de conversão de texto em fala para converter para um novo formato. Levará aproximadamente %2$d segundos. Irá economizar %3$.0f MB de espaço em disco.</item>+ </plurals>+ <string name="migration_delete_all">Excluir tudo</string>+ <string name="migration_updating_speech_models">A atualizar modelos de fala</string>+ <string name="settings_about_get_help">Obter ajuda / reportar problema</string>+ <string name="settings_advanced">Configurações avançadas</string>+ <string name="settings_default_from">Idioma de origem</string>+ <string name="settings_default_to">Idioma de destino</string>+ <string name="settings_disable_autodetect">Desativar deteção automática de idioma</string>+ <string name="settings_register_browser">Registar como navegador</string>+ <string name="settings_register_browser_desc">Oferecer tradução de links de outras aplicações.</string>+ <string name="settings_screen_translation_desc">Traduza texto diretamente sobre outras aplicações.</string>+ <string name="settings_shortcut">Traduzir ecrã por atalho</string>+ <string name="settings_shortcut_desc">Mantenha premido início ou ligar para acionar</string>+</resources>diff --git a/OCR-translation/src/main/res/values-pt/strings.xml b/OCR-translation/src/main/res/values-pt/strings.xmlnew file mode 100644index 0000000..b729c41--- /dev/null+++ b/OCR-translation/src/main/res/values-pt/strings.xml@@ -0,0 +1,217 @@+<?xml version="1.0" encoding="utf-8"?>+<resources>+ <string name="stop">Parar</string>+ <string name="pause">Pausar</string>+ <string name="resume">Retomar</string>+ <string name="region_select_menu">Definir área de tradução</string>+ <string name="screen_translate_needs_source">Informe o idioma de origem</string>+ <string name="live_tile_label">Traduzir tela ao vivo</string>+ <string name="translate_text">Traduzir</string>+ <string name="translate_link">Traduzir link</string>+ <string name="accessibility_service_description">Ative este serviço para traduzir texto na tela. Toque no botão flutuante de tradução para traduzir a tela atual ou inicie uma tradução de tela ao vivo.</string>+ <string name="tap_to_translate_title">Tradução Rápida ativada</string>+ <string name="tap_to_translate_body">Toque para abrir o popup do tradutor</string>+ <string name="tap_to_translate_channel">Tradução Rápida</string>+ <string name="tap_to_translate_channel_description">Notificação permanente para acesso rápido ao popup do tradutor</string>+ <string name="quick_tile_label">Traduzir</string>+ <!-- common -->+ <string name="common_ok">OK</string>+ <string name="common_cancel">Cancelar</string>+ <string name="common_done">Concluído</string>+ <string name="common_grant">Conceder</string>+ <string name="common_manage">Gerenciar</string>+ <!-- settings -->+ <string name="settings_title">Configurações</string>+ <string name="settings_languages">Idiomas</string>+ <string name="settings_language_packs">Pacotes de idiomas</string>+ <string name="settings_general">Geral</string>+ <string name="settings_font_size">Tamanho da fonte</string>+ <string name="settings_font_sample">Este é um texto de exemplo</string>+ <string name="settings_tap_notification">Notificação de Tradução Rápida</string>+ <string name="settings_tap_notification_desc">Notificação permanente que abre o popup.</string>+ <string name="settings_web_translator">Tradutor web</string>+ <string name="settings_clear_browsing">Limpar dados de navegação ao fechar</string>+ <string name="settings_clear_browsing_desc">Exclui cookies, cache e armazenamento local.</string>+ <string name="settings_tts_section">Conversão de texto em fala</string>+ <string name="settings_tts_read_urls_hashtags">Ler URLs e hashtags</string>+ <string name="settings_popup_settings">Popup</string>+ <string name="settings_popup_desc">O popup aparece ao selecionar \'Traduzir\' no menu de seleção de texto</string>+ <string name="settings_hide_input">Ocultar entrada</string>+ <string name="settings_popup_position">Posição do popup</string>+ <string name="settings_popup_size">Tamanho do popup: %1$d%%</string>+ <string name="settings_screen_translation">Tradução de tela</string>+ <string name="settings_screen_translation_desc">Traduza texto diretamente sobre outros apps.</string>+ <string name="settings_floating_button">Botão sempre ativo</string>+ <string name="settings_floating_button_desc">Requer permissão de acessibilidade</string>+ <string name="settings_shortcut">Traduzir tela por atalho</string>+ <string name="settings_shortcut_desc">Pressione e segure início ou ligar para acionar</string>+ <string name="settings_on_shortcut">Ao acionar o atalho</string>+ <string name="settings_ocr">Imagens</string>+ <string name="settings_background_mode">Substituir texto por</string>+ <string name="settings_min_confidence">Confiança mínima: %1$d%%</string>+ <string name="settings_max_image_size">Tamanho máximo da imagem: %1$dpx</string>+ <string name="settings_advanced">Avançado</string>+ <string name="settings_catalog_url">URL do catálogo</string>+ <string name="settings_external_storage">Usar armazenamento externo</string>+ <string name="settings_disable_autodetect">Desativar detecção automática de idioma</string>+ <string name="settings_translit_output">Mostrar transliteração do texto traduzido</string>+ <string name="settings_translit_input">Mostrar transliteração do texto original</string>+ <string name="settings_translit_japanese_spaces">Adicionar espaços na transliteração do japonês</string>+ <string name="settings_translate_pdf_images">Traduzir imagens em PDFs</string>+ <string name="settings_camera_live_default">Traduzir câmera ao vivo por padrão</string>+ <string name="settings_register_browser">Registrar como navegador</string>+ <string name="settings_register_browser_desc">Oferecer tradução de links de outros apps.</string>+ <string name="settings_external_storage_perm_title">Permissão de armazenamento externo</string>+ <string name="settings_about">Sobre</string>+ <string name="settings_version">Versão %1$s</string>+ <string name="settings_no_languages_available">Nenhum idioma disponível</string>+ <string name="settings_default_from">Idioma de origem padrão</string>+ <string name="settings_default_to">Idioma de destino padrão</string>+ <string name="settings_adblock_support">Bloqueio de anúncios</string>+ <string name="settings_about_get_help">Obter ajuda / relatar problema</string>+ <string name="settings_logs_copied">Registos da app copiados para a área de transferência</string>+ <string name="settings_about_support">Apoiar o desenvolvimento</string>+ <string name="settings_external_storage_perm_body">Para guardar arquivos de tradução na sua pasta Documentos, este app precisa de acesso para gerenciar todos os arquivos.\nVocê será levado às Configurações, onde poderá conceder a permissão \'Permitir acesso para gerenciar todos os arquivos\'.</string>+ <!-- language manager / setup / how-to -->+ <string name="langmgr_voices">Vozes</string>+ <string name="langmgr_default">PADRÃO</string>+ <string name="langmgr_filter">Filtrar idiomas</string>+ <string name="langmgr_delete_shared_title">Excluir dicionário compartilhado?</string>+ <string name="langmgr_delete_shared_body">Este dicionário é compartilhado com %1$s.\nExcluí-lo removerá o dicionário de todos eles.</string>+ <string name="langmgr_download_size">Baixar %1$s</string>+ <string name="langmgr_repair_needed">Alguns recursos baixados estão com arquivos ausentes e não funcionarão até serem reparados.</string>+ <string name="langmgr_repair_size">Reparar %1$s</string>+ <string name="nolang_title">Configuração de idiomas</string>+ <string name="nolang_prompt">Baixe pacotes de idiomas para começar a traduzir</string>+ <string name="howto_title">Como usar</string>+ <!-- image capture / voice / dictionary / language selector -->+ <string name="image_no_crop_remote">Imagens remotas não podem ser recortadas diretamente</string>+ <string name="image_open_failed">Falha ao abrir o arquivo</string>+ <string name="image_source_screen">Tela</string>+ <string name="image_source_document">Documento</string>+ <string name="image_source_photos">Fotos</string>+ <string name="image_source_gallery">Galeria</string>+ <string name="image_source_camera">Câmera</string>+ <string name="voice_playback_speed">Velocidade de reprodução</string>+ <string name="voice_label">Voz</string>+ <string name="voice_default">Voz padrão</string>+ <string name="langsel_auto">✨ Automático</string>+ <string name="dict_also_as">Também como:</string>+ <!-- camera / browser / screen translate -->+ <string name="camera_permission_rationale">A permissão de câmera é necessária para a tradução ao vivo.</string>+ <string name="camera_need_ocr_models">Você precisa baixar os modelos de reconhecimento de texto para este idioma</string>+ <string name="browser_no_source_language">Nenhum idioma de origem disponível. Instale um na tela principal primeiro ou defina um idioma de origem padrão nas configurações.</string>+ <string name="browser_reader_unavailable">Modo leitura indisponível para esta página</string>+ <string name="browser_translate_image">Traduzir imagem</string>+ <string name="screen_translating_notification">Traduzindo tela</string>+ <!-- enums -->+ <string name="align_top">Superior</string>+ <string name="align_middle">Meio</string>+ <string name="align_bottom">Inferior</string>+ <string name="assistant_action_still_image">Traduzir uma vez</string>+ <string name="assistant_action_live_screen">Iniciar tradução ao vivo</string>+ <string name="background_mode_white_on_black">Branco no preto</string>+ <string name="background_mode_black_on_white">Preto no branco</string>+ <string name="background_mode_auto_detect">Detectar cores automaticamente</string>+ <!-- tts / speech errors -->+ <string name="tts_nothing_to_speak">Nada para falar</string>+ <string name="tts_catalog_unavailable">Catálogo indisponível</string>+ <string name="tts_no_voice">Nenhuma voz instalada para %1$s</string>+ <string name="tts_synthesis_failed">Falha na síntese de fala para %1$s</string>+ <string name="tts_sample_fallback">Esta é uma amostra de conversão de texto em fala do Offline Translator.</string>+ <!-- translation -->+ <string name="translation_error">Erro de tradução: %1$s</string>+ <!-- download errors -->+ <string name="download_failed_core">Falha ao baixar %1$s</string>+ <string name="download_failed_ocr">Falha ao baixar o reconhecimento de texto de %1$s</string>+ <string name="download_failed_ocr_batch">Falha no download em lote de reconhecimento de texto</string>+ <string name="download_failed_dictionary">Falha ao baixar o dicionário de %1$s</string>+ <string name="download_failed_tts">Falha ao baixar a voz de %1$s</string>+ <string name="download_failed_adblock">Falha ao baixar o Adblock</string>+ <string name="download_failed_repair">Falha ao baixar o reparo</string>+ <string name="download_catalog_unavailable">Catálogo indisponível</string>+ <string name="download_catalog_save_failed">Falha ao salvar o catálogo</string>+ <string name="download_unknown_error">Erro desconhecido</string>+ <string name="download_catalog_failed">Falha ao baixar o catálogo: %1$s</string>+ <!-- assistant overlay status -->+ <string name="assistant_invoke_prompt">Acione este assistente sobre um texto para traduzi-lo</string>+ <string name="assistant_collecting_context">Coletando contexto da tela…</string>+ <string name="assistant_screenshot_disabled">O acesso a capturas de tela está desativado para este assistente. Ative-o nas configurações do assistente do sistema.</string>+ <string name="assistant_no_screen_data">Nenhum dado de tela recebido. Ative \'Usar captura de tela\' para este assistente.</string>+ <string name="assistant_no_screenshot">Este app não forneceu uma captura de tela.</string>+ <string name="assistant_set_source_ocr">Defina um idioma de origem padrão para o reconhecimento de texto.</string>+ <string name="assistant_langs_not_ready">Os idiomas de tradução ainda não estão prontos. Tente novamente.</string>+ <string name="assistant_ocr_failed">Falha no reconhecimento de texto</string>+ <string name="ocr_models_missing">Os modelos de reconhecimento de texto estão ausentes. Abra Gerenciar idiomas no app para reparar.</string>+ <string name="assistant_set_source_live">Defina um idioma de origem padrão nas Configurações para usar a tradução de tela ao vivo.</string>+ <!-- migration gate -->+ <string name="migration_updating_speech_models">Atualizando modelos de fala</string>+ <string name="migration_accept_convert">Aceitar e converter</string>+ <string name="migration_delete_all">Excluir tudo em vez disso</string>+ <string name="migration_converting">Convertendo %1$d de %2$d</string>+ <string name="migration_optimizing">Otimizando modelos</string>+ <plurals name="migration_convert_prompt">+ <item quantity="one">Você tem %1$d modelo de conversão de texto em fala para converter para um novo formato. Levará aproximadamente %2$d segundos. Você vai economizar %3$.0f MB de espaço em disco.</item>+ <item quantity="other">Você tem %1$d modelos de conversão de texto em fala para converter para um novo formato. Levará aproximadamente %2$d segundos. Você vai economizar %3$.0f MB de espaço em disco.</item>+ </plurals>+ <!-- document translation notification + progress -->+ <string name="doc_notif_translating">Traduzindo arquivo</string>+ <string name="doc_notif_translated">Arquivo traduzido</string>+ <string name="doc_notif_phase_text">Texto %1$d%%</string>+ <string name="doc_notif_phase_images">Imagens %1$d/%2$d</string>+ <string name="doc_notif_phase_raster">Páginas em bitmap %1$d/%2$d</string>+ <string name="doc_notif_channel_name">Tradução de documentos</string>+ <string name="doc_notif_channel_desc">Mostra o progresso durante a tradução de documentos</string>+ <string name="doc_progress_preparing">Preparando arquivo</string>+ <string name="doc_progress_translating">Traduzindo</string>+ <string name="doc_progress_translated">Arquivo traduzido</string>+ <string name="doc_progress_saving">Salvando arquivo traduzido</string>+ <string name="doc_translation_failed">Falha na tradução do documento</string>+ <string name="doc_url_unsupported">Baixe o documento e abra-o com o app</string>+ <!-- document configure sheet -->+ <string name="document_wrap_columns">Quebrar em %1$d colunas</string>+ <string name="document_translate_pdf_images">Traduzir imagens em PDF</string>+ <string name="layout_preserve">Preservar quebras de linha</string>+ <string name="layout_reflow">Reorganizar em parágrafos</string>+ <string name="layout_reflow_wrap">Reorganizar e quebrar</string>+ <!-- common (additional) -->+ <string name="common_open">Abrir</string>+ <string name="common_close">Fechar</string>+ <string name="common_save">Salvar</string>+ <!-- translator app -->+ <string name="translator_translated_file">Arquivo traduzido: %1$s</string>+ <string name="translator_document_saved">Documento salvo</string>+ <string name="translator_document_save_failed">Falha ao salvar o documento</string>+ <string name="translator_audio_playback_failed">Falha na reprodução de áudio: %1$s</string>+ <string name="translator_no_app_to_open">Nenhum app encontrado para abrir este arquivo</string>+ <!-- document alignment -->+ <string name="docalign_decode_failed">Não foi possível decodificar a imagem.</string>+ <string name="docalign_detecting">Detectando cantos…</string>+ <string name="docalign_redetecting">Detectando novamente…</string>+ <string name="docalign_help">Um perímetro preciso ao redor do documento melhora a qualidade do reconhecimento. É importante que as linhas fiquem paralelas ao texto.\n\nDar zoom ou mover geralmente faz o algoritmo reconhecer o documento automaticamente, mas você ainda pode ajustar manualmente se ele não for encontrado.</string>+ <!-- how to use -->+ <string name="howto_section_other_apps">A partir de outros apps</string>+ <string name="howto_share_title">Compartilhar para traduzir</string>+ <string name="howto_share_body">Compartilhe texto, links ou imagens de qualquer app para traduzi-los.</string>+ <string name="howto_copy_title">Traduzir sem sair de outros apps</string>+ <string name="howto_copy_body">Selecione um texto em qualquer lugar e toque em \"Traduzir\" na barra de cópia para ver a tradução em um popup compacto.</string>+ <string name="howto_section_in_app">Dentro do app</string>+ <string name="howto_docs_title">Traduzir documentos</string>+ <string name="howto_docs_body">Abra a aba Documentos para traduzir arquivos EPUB, PDF e TXT.</string>+ <string name="howto_dict_title">Consulta no dicionário</string>+ <string name="howto_dict_body">Pressione e segure qualquer palavra de uma tradução para ver sua definição. Dados obtidos do Wiktionary.</string>+ <string name="howto_voice_title">Alterar voz ou velocidade</string>+ <string name="howto_voice_body">Pressione e segure o botão de reprodução para escolher outra voz ou ajustar a velocidade de reprodução.</string>+ <!-- feature row labels -->+ <string name="feature_translation">Tradução</string>+ <string name="feature_dictionary">Dicionário</string>+ <string name="feature_tts">Voz</string>+ <!-- misc -->+ <string name="main_input_placeholder">Digite o texto</string>+ <string name="aidl_target_unavailable">Idioma de destino indisponível</string>+ <string name="voice_section_downloaded">BAIXADO</string>+ <string name="voice_section_available">DISPONÍVEL</string>+ <string name="detected_translate_from">Traduzir de</string>+ <string name="detected_missing_language">Idioma ausente</string>+ <string name="langmgr_ocr_upgrade_available">Há um modelo de detecção de texto aprimorado disponível.</string>+</resources>diff --git a/OCR-translation/src/main/res/values-ru/strings.xml b/OCR-translation/src/main/res/values-ru/strings.xmlnew file mode 100644index 0000000..e5a612d--- /dev/null+++ b/OCR-translation/src/main/res/values-ru/strings.xml@@ -0,0 +1,219 @@+<?xml version="1.0" encoding="utf-8"?>+<resources>+ <string name="stop">Стоп</string>+ <string name="pause">Пауза</string>+ <string name="resume">Продолжить</string>+ <string name="region_select_menu">Задайте область перевода</string>+ <string name="screen_translate_needs_source">Укажите язык оригинала</string>+ <string name="live_tile_label">Переводить экран вживую</string>+ <string name="translate_text">Перевести</string>+ <string name="translate_link">Перевести ссылку</string>+ <string name="accessibility_service_description">Включите эту службу, чтобы переводить текст на экране. Нажмите плавающую кнопку перевода, чтобы перевести текущий экран, или запустите перевод экрана вживую.</string>+ <string name="tap_to_translate_title">Быстрый перевод включён</string>+ <string name="tap_to_translate_body">Нажмите, чтобы открыть всплывающее окно переводчика</string>+ <string name="tap_to_translate_channel">Быстрый перевод</string>+ <string name="tap_to_translate_channel_description">Постоянное уведомление для быстрого доступа к всплывающему окну переводчика</string>+ <string name="quick_tile_label">Перевести</string>+ <!-- common -->+ <string name="common_ok">ОК</string>+ <string name="common_cancel">Отмена</string>+ <string name="common_done">Готово</string>+ <string name="common_grant">Разрешить</string>+ <string name="common_manage">Управление</string>+ <!-- settings -->+ <string name="settings_title">Настройки</string>+ <string name="settings_languages">Языки</string>+ <string name="settings_language_packs">Языковые пакеты</string>+ <string name="settings_general">Общие</string>+ <string name="settings_font_size">Размер шрифта</string>+ <string name="settings_font_sample">Это пример текста</string>+ <string name="settings_tap_notification">Уведомление быстрого перевода</string>+ <string name="settings_tap_notification_desc">Постоянное уведомление, открывающее всплывающее окно.</string>+ <string name="settings_web_translator">Веб-переводчик</string>+ <string name="settings_clear_browsing">Очищать данные браузера при закрытии</string>+ <string name="settings_clear_browsing_desc">Удаляет файлы cookie, кэш и локальное хранилище.</string>+ <string name="settings_tts_section">Синтез речи</string>+ <string name="settings_tts_read_urls_hashtags">Читать URL и хештеги</string>+ <string name="settings_popup_settings">Всплывающее окно</string>+ <string name="settings_popup_desc">Всплывающее окно появляется при выборе \'Перевести\' в меню выделения текста</string>+ <string name="settings_hide_input">Скрыть ввод</string>+ <string name="settings_popup_position">Положение окна</string>+ <string name="settings_popup_size">Размер окна: %1$d%%</string>+ <string name="settings_screen_translation">Перевод экрана</string>+ <string name="settings_screen_translation_desc">Переводить текст прямо поверх других приложений.</string>+ <string name="settings_floating_button">Постоянная кнопка</string>+ <string name="settings_floating_button_desc">Требует роли специальных возможностей</string>+ <string name="settings_shortcut">Переводить экран по жесту</string>+ <string name="settings_shortcut_desc">Удерживайте кнопку «Домой» или питания для запуска</string>+ <string name="settings_on_shortcut">При вызове жестом</string>+ <string name="settings_ocr">Изображения</string>+ <string name="settings_background_mode">Замена текста и фона</string>+ <string name="settings_min_confidence">Мин. уверенность: %1$d%%</string>+ <string name="settings_max_image_size">Макс. размер изображения: %1$dpx</string>+ <string name="settings_advanced">Дополнительно</string>+ <string name="settings_catalog_url">URL каталога</string>+ <string name="settings_external_storage">Использовать внешнее хранилище</string>+ <string name="settings_disable_autodetect">Отключить автоопределение языка</string>+ <string name="settings_translit_output">Показывать транслитерацию переведённого текста</string>+ <string name="settings_translit_input">Показывать транслитерацию оригинала</string>+ <string name="settings_translit_japanese_spaces">Добавлять пробелы в японской транслитерации</string>+ <string name="settings_translate_pdf_images">Переводить изображения в PDF</string>+ <string name="settings_camera_live_default">Переводить камеру вживую по умолчанию</string>+ <string name="settings_register_browser">Зарегистрировать как браузер</string>+ <string name="settings_register_browser_desc">Предлагать перевод ссылок из других приложений.</string>+ <string name="settings_external_storage_perm_title">Разрешение на внешнее хранилище</string>+ <string name="settings_about">О приложении</string>+ <string name="settings_version">Версия %1$s</string>+ <string name="settings_no_languages_available">Нет доступных языков</string>+ <string name="settings_default_from">Язык оригинала по умолчанию</string>+ <string name="settings_default_to">Язык перевода по умолчанию</string>+ <string name="settings_adblock_support">Блокировка рекламы</string>+ <string name="settings_about_get_help">Получить помощь / сообщить о проблеме</string>+ <string name="settings_logs_copied">Журналы приложения скопированы в буфер обмена</string>+ <string name="settings_about_support">Поддержать разработку</string>+ <string name="settings_external_storage_perm_body">Чтобы хранить файлы перевода в папке «Документы», приложению нужен доступ к управлению всеми файлами.\nВас перенесёт в Настройки, где Вы сможете выбрать \'Разрешить доступ к управлению всеми файлами\'.</string>+ <!-- language manager / setup / how-to -->+ <string name="langmgr_voices">Голоса</string>+ <string name="langmgr_default">ПО УМОЛЧАНИЮ</string>+ <string name="langmgr_filter">Фильтр языков</string>+ <string name="langmgr_delete_shared_title">Удалить общий словарь?</string>+ <string name="langmgr_delete_shared_body">Этот словарь совмещён с %1$s.\nУдаление словаря исключит его из остальных.</string>+ <string name="langmgr_download_size">Скачать %1$s</string>+ <string name="langmgr_repair_needed">У некоторых загруженных функций отсутствуют файлы, и они не будут работать до восстановления.</string>+ <string name="langmgr_repair_size">Восстановить %1$s</string>+ <string name="nolang_title">Настройка языков</string>+ <string name="nolang_prompt">Скачайте языковые пакеты, чтобы начать перевод</string>+ <string name="howto_title">Как пользоваться</string>+ <!-- image capture / voice / dictionary / language selector -->+ <string name="image_no_crop_remote">Удалённые изображения нельзя обрезать напрямую</string>+ <string name="image_open_failed">Не удалось открыть файл</string>+ <string name="image_source_screen">Экран</string>+ <string name="image_source_document">Документ</string>+ <string name="image_source_photos">Фотографии</string>+ <string name="image_source_gallery">Галерея</string>+ <string name="image_source_camera">Камера</string>+ <string name="voice_playback_speed">Скорость воспроизведения</string>+ <string name="voice_label">Голос</string>+ <string name="voice_default">Голос по умолчанию</string>+ <string name="langsel_auto">✨ Авто</string>+ <string name="dict_also_as">Также как:</string>+ <!-- camera / browser / screen translate -->+ <string name="camera_permission_rationale">Для перевода вживую нужно разрешение на камеру.</string>+ <string name="camera_need_ocr_models">Нужно скачать модели распознавания текста для этого языка</string>+ <string name="browser_no_source_language">Нет доступного языка оригинала. Сначала установите его на главном экране или задайте язык оригинала по умолчанию в настройках.</string>+ <string name="browser_reader_unavailable">Режим чтения недоступен для этой страницы</string>+ <string name="browser_translate_image">Перевести изображение</string>+ <string name="screen_translating_notification">Перевод экрана</string>+ <!-- enums -->+ <string name="align_top">Сверху</string>+ <string name="align_middle">По центру</string>+ <string name="align_bottom">Снизу</string>+ <string name="assistant_action_still_image">Перевести один раз</string>+ <string name="assistant_action_live_screen">Запустить перевод вживую</string>+ <string name="background_mode_white_on_black">Белым по чёрному</string>+ <string name="background_mode_black_on_white">Чёрным по белому</string>+ <string name="background_mode_auto_detect">Автоматически определять цвета</string>+ <!-- tts / speech errors -->+ <string name="tts_nothing_to_speak">Нечего озвучивать</string>+ <string name="tts_catalog_unavailable">Каталог недоступен</string>+ <string name="tts_no_voice">Нет установленного голоса для %1$s</string>+ <string name="tts_synthesis_failed">Не удалось синтезировать речь для %1$s</string>+ <string name="tts_sample_fallback">Это пример синтеза речи от Offline Translator.</string>+ <!-- translation -->+ <string name="translation_error">Ошибка перевода: %1$s</string>+ <!-- download errors -->+ <string name="download_failed_core">Не удалось скачать %1$s</string>+ <string name="download_failed_ocr">Не удалось скачать распознавание текста для %1$s</string>+ <string name="download_failed_ocr_batch">Не удалось скачать пакет распознавания текста</string>+ <string name="download_failed_dictionary">Не удалось скачать словарь %1$s</string>+ <string name="download_failed_tts">Не удалось скачать голос для %1$s</string>+ <string name="download_failed_adblock">Не удалось скачать Adblock</string>+ <string name="download_failed_repair">Не удалось скачать восстановление</string>+ <string name="download_catalog_unavailable">Каталог недоступен</string>+ <string name="download_catalog_save_failed">Не удалось сохранить каталог</string>+ <string name="download_unknown_error">Неизвестная ошибка</string>+ <string name="download_catalog_failed">Не удалось скачать каталог: %1$s</string>+ <!-- assistant overlay status -->+ <string name="assistant_invoke_prompt">Вызовите этот ассистент поверх текста, чтобы перевести его</string>+ <string name="assistant_collecting_context">Сбор контекста экрана…</string>+ <string name="assistant_screenshot_disabled">Доступ к снимку экрана отключён для этого ассистента. Включите его в системных настройках ассистента.</string>+ <string name="assistant_no_screen_data">Данные экрана не получены. Включите \'Использовать снимок экрана\' для этого ассистента.</string>+ <string name="assistant_no_screenshot">Это приложение не предоставило снимок экрана.</string>+ <string name="assistant_set_source_ocr">Задайте язык оригинала по умолчанию для распознавания текста.</string>+ <string name="assistant_langs_not_ready">Языки перевода ещё не готовы. Попробуйте снова.</string>+ <string name="assistant_ocr_failed">Ошибка распознавания текста</string>+ <string name="ocr_models_missing">Модели распознавания текста отсутствуют. Откройте управление языками в приложении, чтобы восстановить их.</string>+ <string name="assistant_set_source_live">Задайте язык оригинала по умолчанию в Настройках, чтобы использовать перевод экрана вживую.</string>+ <!-- migration gate -->+ <string name="migration_updating_speech_models">Обновление моделей речи</string>+ <string name="migration_accept_convert">Принять и преобразовать</string>+ <string name="migration_delete_all">Удалить всё вместо этого</string>+ <string name="migration_converting">Преобразование %1$d из %2$d</string>+ <string name="migration_optimizing">Оптимизация моделей</string>+ <plurals name="migration_convert_prompt">+ <item quantity="one">У вас %1$d модель синтеза речи для преобразования в новый формат. Это займёт примерно %2$d секунд. Вы освободите %3$.0f MB места на диске.</item>+ <item quantity="few">У вас %1$d модели синтеза речи для преобразования в новый формат. Это займёт примерно %2$d секунд. Вы освободите %3$.0f MB места на диске.</item>+ <item quantity="many">У вас %1$d моделей синтеза речи для преобразования в новый формат. Это займёт примерно %2$d секунд. Вы освободите %3$.0f MB места на диске.</item>+ <item quantity="other">У вас %1$d модели синтеза речи для преобразования в новый формат. Это займёт примерно %2$d секунд. Вы освободите %3$.0f MB места на диске.</item>+ </plurals>+ <!-- document translation notification + progress -->+ <string name="doc_notif_translating">Перевод файла</string>+ <string name="doc_notif_translated">Файл переведён</string>+ <string name="doc_notif_phase_text">Текст %1$d%%</string>+ <string name="doc_notif_phase_images">Изображения %1$d/%2$d</string>+ <string name="doc_notif_phase_raster">Растровые страницы %1$d/%2$d</string>+ <string name="doc_notif_channel_name">Перевод документов</string>+ <string name="doc_notif_channel_desc">Показывает ход перевода документов</string>+ <string name="doc_progress_preparing">Подготовка файла</string>+ <string name="doc_progress_translating">Перевод</string>+ <string name="doc_progress_translated">Файл переведён</string>+ <string name="doc_progress_saving">Сохранение переведённого файла</string>+ <string name="doc_translation_failed">Не удалось перевести документ</string>+ <string name="doc_url_unsupported">Скачайте документ и откройте его в приложении</string>+ <!-- document configure sheet -->+ <string name="document_wrap_columns">Переносить на %1$d столбцах</string>+ <string name="document_translate_pdf_images">Переводить изображения в PDF</string>+ <string name="layout_preserve">Сохранять переносы строк</string>+ <string name="layout_reflow">Перекомпоновать в абзацы</string>+ <string name="layout_reflow_wrap">Перекомпоновать и переносить</string>+ <!-- common (additional) -->+ <string name="common_open">Открыть</string>+ <string name="common_close">Закрыть</string>+ <string name="common_save">Сохранить</string>+ <!-- translator app -->+ <string name="translator_translated_file">Переведённый файл: %1$s</string>+ <string name="translator_document_saved">Документ сохранён</string>+ <string name="translator_document_save_failed">Не удалось сохранить документ</string>+ <string name="translator_audio_playback_failed">Ошибка воспроизведения аудио: %1$s</string>+ <string name="translator_no_app_to_open">Не найдено приложение для открытия этого файла</string>+ <!-- document alignment -->+ <string name="docalign_decode_failed">Не удалось декодировать изображение.</string>+ <string name="docalign_detecting">Поиск углов…</string>+ <string name="docalign_redetecting">Повторный поиск…</string>+ <string name="docalign_help">Точный контур вокруг документа улучшает качество распознавания. Важно, чтобы линии были параллельны тексту.\n\nМасштабирование или перемещение обычно помогает алгоритму автоматически найти документ, но при необходимости вы можете подправить вручную, если он не найден.</string>+ <!-- how to use -->+ <string name="howto_section_other_apps">Из других приложений</string>+ <string name="howto_share_title">Поделиться для перевода</string>+ <string name="howto_share_body">Поделитесь текстом, ссылками или изображениями из любого приложения, чтобы перевести их.</string>+ <string name="howto_copy_title">Перевод, не покидая других приложений</string>+ <string name="howto_copy_body">Выделите текст где угодно, затем нажмите \"Перевести\" на панели копирования, чтобы увидеть перевод в компактном окне.</string>+ <string name="howto_section_in_app">Внутри приложения</string>+ <string name="howto_docs_title">Перевод документов</string>+ <string name="howto_docs_body">Откройте вкладку «Документы», чтобы переводить файлы EPUB, PDF и TXT.</string>+ <string name="howto_dict_title">Поиск в словаре</string>+ <string name="howto_dict_body">Удерживайте любое слово в переводе, чтобы увидеть его определение. Данные из Wiktionary.</string>+ <string name="howto_voice_title">Изменить голос или скорость</string>+ <string name="howto_voice_body">Удерживайте кнопку воспроизведения, чтобы выбрать другой голос или изменить скорость воспроизведения.</string>+ <!-- feature row labels -->+ <string name="feature_translation">Перевод</string>+ <string name="feature_dictionary">Словарь</string>+ <string name="feature_tts">Голос</string>+ <!-- misc -->+ <string name="main_input_placeholder">Введите текст</string>+ <string name="aidl_target_unavailable">Язык перевода недоступен</string>+ <string name="voice_section_downloaded">ЗАГРУЖЕНО</string>+ <string name="voice_section_available">ДОСТУПНО</string>+ <string name="detected_translate_from">Перевести с</string>+ <string name="detected_missing_language">Язык отсутствует</string>+ <string name="langmgr_ocr_upgrade_available">Доступна улучшенная модель распознавания текста.</string>+</resources>diff --git a/OCR-translation/src/main/res/values-sv/strings.xml b/OCR-translation/src/main/res/values-sv/strings.xmlnew file mode 100644index 0000000..a7ecd68--- /dev/null+++ b/OCR-translation/src/main/res/values-sv/strings.xml@@ -0,0 +1,217 @@+<?xml version="1.0" encoding="utf-8"?>+<resources>+ <string name="stop">Stoppa</string>+ <string name="pause">Pausa</string>+ <string name="resume">Återuppta</string>+ <string name="region_select_menu">Ange översättningsområde</string>+ <string name="screen_translate_needs_source">Ange källspråk</string>+ <string name="live_tile_label">Översätt skärmen live</string>+ <string name="translate_text">Översätt</string>+ <string name="translate_link">Översätt länk</string>+ <string name="accessibility_service_description">Aktivera den här tjänsten för att översätta text på skärmen. Tryck på den flytande översättningsknappen för att översätta den aktuella skärmen, eller starta en live-översättning av skärmen.</string>+ <string name="tap_to_translate_title">Snabböversättning är på</string>+ <string name="tap_to_translate_body">Tryck för att öppna översättningsfönstret</string>+ <string name="tap_to_translate_channel">Snabböversättning</string>+ <string name="tap_to_translate_channel_description">Beständig avisering för snabb åtkomst till översättningsfönstret</string>+ <string name="quick_tile_label">Översätt</string>+ <!-- common -->+ <string name="common_ok">OK</string>+ <string name="common_cancel">Avbryt</string>+ <string name="common_done">Klar</string>+ <string name="common_grant">Bevilja</string>+ <string name="common_manage">Hantera</string>+ <!-- settings -->+ <string name="settings_title">Inställningar</string>+ <string name="settings_languages">Språk</string>+ <string name="settings_language_packs">Språkpaket</string>+ <string name="settings_general">Allmänt</string>+ <string name="settings_font_size">Teckenstorlek</string>+ <string name="settings_font_sample">Det här är lite exempeltext</string>+ <string name="settings_tap_notification">Avisering för snabböversättning</string>+ <string name="settings_tap_notification_desc">Beständig avisering som öppnar fönstret.</string>+ <string name="settings_web_translator">Webböversättare</string>+ <string name="settings_clear_browsing">Rensa webbdata vid stängning</string>+ <string name="settings_clear_browsing_desc">Tar bort cookies, cache och lokal lagring.</string>+ <string name="settings_tts_section">Text till tal</string>+ <string name="settings_tts_read_urls_hashtags">Läs upp URL:er och hashtaggar</string>+ <string name="settings_popup_settings">Fönster</string>+ <string name="settings_popup_desc">Fönstret visas när du väljer \'Översätt\' i textmarkeringsmenyn</string>+ <string name="settings_hide_input">Dölj inmatning</string>+ <string name="settings_popup_position">Fönsterposition</string>+ <string name="settings_popup_size">Fönsterstorlek: %1$d%%</string>+ <string name="settings_screen_translation">Skärmöversättning</string>+ <string name="settings_screen_translation_desc">Översätt text direkt ovanpå andra appar.</string>+ <string name="settings_floating_button">Alltid-på-knapp</string>+ <string name="settings_floating_button_desc">Kräver tillgänglighetsroll</string>+ <string name="settings_shortcut">Översätt skärmen via genväg</string>+ <string name="settings_shortcut_desc">Håll in hem- eller strömknappen för att utlösa</string>+ <string name="settings_on_shortcut">Vid genvägsaktivering</string>+ <string name="settings_ocr">Bilder</string>+ <string name="settings_background_mode">Ersätt text med</string>+ <string name="settings_min_confidence">Lägsta säkerhet: %1$d%%</string>+ <string name="settings_max_image_size">Max bildstorlek: %1$dpx</string>+ <string name="settings_advanced">Avancerat</string>+ <string name="settings_catalog_url">Katalog-URL</string>+ <string name="settings_external_storage">Använd extern lagring</string>+ <string name="settings_disable_autodetect">Inaktivera automatisk språkidentifiering</string>+ <string name="settings_translit_output">Visa translitterering för översatt text</string>+ <string name="settings_translit_input">Visa translitterering för originaltext</string>+ <string name="settings_translit_japanese_spaces">Lägg till mellanslag för japansk translitterering</string>+ <string name="settings_translate_pdf_images">Översätt bilder i PDF-filer</string>+ <string name="settings_camera_live_default">Översätt kameran live som standard</string>+ <string name="settings_register_browser">Registrera som webbläsare</string>+ <string name="settings_register_browser_desc">Erbjud att översätta länkar från andra appar.</string>+ <string name="settings_external_storage_perm_title">Behörighet för extern lagring</string>+ <string name="settings_about">Om</string>+ <string name="settings_version">Version %1$s</string>+ <string name="settings_no_languages_available">Inga språk tillgängliga</string>+ <string name="settings_default_from">Standardspråk att översätta \'från\'</string>+ <string name="settings_default_to">Standardspråk att översätta \'till\'</string>+ <string name="settings_adblock_support">Annonsblockering</string>+ <string name="settings_about_get_help">Få hjälp / rapportera problem</string>+ <string name="settings_logs_copied">Apploggar kopierade till urklipp</string>+ <string name="settings_about_support">Stöd utvecklingen</string>+ <string name="settings_external_storage_perm_body">För att lagra översättningsfiler i din Dokument-mapp behöver den här appen åtkomst för att hantera alla filer.\nDu kommer att tas till Inställningar där du kan bevilja behörigheten \'Tillåt åtkomst för att hantera alla filer\'.</string>+ <!-- language manager / setup / how-to -->+ <string name="langmgr_voices">Röster</string>+ <string name="langmgr_default">STANDARD</string>+ <string name="langmgr_filter">Filtrera språk</string>+ <string name="langmgr_delete_shared_title">Ta bort delad ordbok?</string>+ <string name="langmgr_delete_shared_body">Den här ordboken delas med %1$s.\nOm du tar bort den försvinner ordboken för alla.</string>+ <string name="langmgr_download_size">Ladda ner %1$s</string>+ <string name="langmgr_repair_needed">Vissa nedladdade funktioner saknar filer och fungerar inte förrän de reparerats.</string>+ <string name="langmgr_repair_size">Reparera %1$s</string>+ <string name="nolang_title">Språkinställning</string>+ <string name="nolang_prompt">Ladda ner språkpaket för att börja översätta</string>+ <string name="howto_title">Så här använder du</string>+ <!-- image capture / voice / dictionary / language selector -->+ <string name="image_no_crop_remote">Fjärrbilder kan inte beskäras direkt</string>+ <string name="image_open_failed">Det gick inte att öppna filen</string>+ <string name="image_source_screen">Skärm</string>+ <string name="image_source_document">Dokument</string>+ <string name="image_source_photos">Foton</string>+ <string name="image_source_gallery">Galleri</string>+ <string name="image_source_camera">Kamera</string>+ <string name="voice_playback_speed">Uppspelningshastighet</string>+ <string name="voice_label">Röst</string>+ <string name="voice_default">Standardröst</string>+ <string name="langsel_auto">✨ Auto</string>+ <string name="dict_also_as">Även som:</string>+ <!-- camera / browser / screen translate -->+ <string name="camera_permission_rationale">Kamerabehörighet krävs för live-översättning.</string>+ <string name="camera_need_ocr_models">Du behöver ladda ner textigenkänningsmodellerna för det här språket</string>+ <string name="browser_no_source_language">Inget källspråk tillgängligt. Installera ett från huvudskärmen först, eller ange ett standardkällspråk i inställningarna.</string>+ <string name="browser_reader_unavailable">Läsläge är inte tillgängligt för den här sidan</string>+ <string name="browser_translate_image">Översätt bild</string>+ <string name="screen_translating_notification">Översätter skärmen</string>+ <!-- enums -->+ <string name="align_top">Överst</string>+ <string name="align_middle">Mitten</string>+ <string name="align_bottom">Nederst</string>+ <string name="assistant_action_still_image">Översätt en gång</string>+ <string name="assistant_action_live_screen">Starta live-översättning</string>+ <string name="background_mode_white_on_black">Vitt på svart</string>+ <string name="background_mode_black_on_white">Svart på vitt</string>+ <string name="background_mode_auto_detect">Identifiera färger automatiskt</string>+ <!-- tts / speech errors -->+ <string name="tts_nothing_to_speak">Inget att läsa upp</string>+ <string name="tts_catalog_unavailable">Katalogen är inte tillgänglig</string>+ <string name="tts_no_voice">Ingen röst installerad för %1$s</string>+ <string name="tts_synthesis_failed">Talsyntes misslyckades för %1$s</string>+ <string name="tts_sample_fallback">Det här är ett text-till-tal-exempel från Offline Translator.</string>+ <!-- translation -->+ <string name="translation_error">Översättningsfel: %1$s</string>+ <!-- download errors -->+ <string name="download_failed_core">Nedladdningen av %1$s misslyckades</string>+ <string name="download_failed_ocr">Nedladdningen av textigenkänning för %1$s misslyckades</string>+ <string name="download_failed_ocr_batch">Batchnedladdningen av textigenkänning misslyckades</string>+ <string name="download_failed_dictionary">Ordboksnedladdningen för %1$s misslyckades</string>+ <string name="download_failed_tts">Röstnedladdningen för %1$s misslyckades</string>+ <string name="download_failed_adblock">Adblock-nedladdningen misslyckades</string>+ <string name="download_failed_repair">Nedladdning av reparation misslyckades</string>+ <string name="download_catalog_unavailable">Katalogen är inte tillgänglig</string>+ <string name="download_catalog_save_failed">Det gick inte att spara katalogen</string>+ <string name="download_unknown_error">Okänt fel</string>+ <string name="download_catalog_failed">Det gick inte att ladda ner katalogen: %1$s</string>+ <!-- assistant overlay status -->+ <string name="assistant_invoke_prompt">Aktivera den här assistenten ovanpå text för att översätta den</string>+ <string name="assistant_collecting_context">Samlar in skärmkontext…</string>+ <string name="assistant_screenshot_disabled">Skärmdumpsåtkomst är inaktiverad för den här assistenten. Aktivera den i systemets assistentinställningar.</string>+ <string name="assistant_no_screen_data">Inga skärmdata mottagna. Aktivera \'Använd skärmdump\' för den här assistenten.</string>+ <string name="assistant_no_screenshot">Den här appen tillhandahöll ingen skärmdump.</string>+ <string name="assistant_set_source_ocr">Ange ett standardkällspråk för textigenkänning.</string>+ <string name="assistant_langs_not_ready">Översättningsspråken är inte redo än. Försök igen.</string>+ <string name="assistant_ocr_failed">Textigenkänning misslyckades</string>+ <string name="ocr_models_missing">Textigenkänningsmodeller saknas. Öppna Hantera språk i appen för att reparera.</string>+ <string name="assistant_set_source_live">Ange ett standardkällspråk i Inställningar för att använda live-översättning av skärmen.</string>+ <!-- migration gate -->+ <string name="migration_updating_speech_models">Uppdaterar talmodeller</string>+ <string name="migration_accept_convert">Acceptera och konvertera</string>+ <string name="migration_delete_all">Ta bort alla i stället</string>+ <string name="migration_converting">Konverterar %1$d av %2$d</string>+ <string name="migration_optimizing">Optimerar modeller</string>+ <plurals name="migration_convert_prompt">+ <item quantity="one">Du har %1$d text-till-tal-modell att konvertera till ett nytt format. Det tar ungefär %2$d sekunder. Du sparar %3$.0f MB diskutrymme.</item>+ <item quantity="other">Du har %1$d text-till-tal-modeller att konvertera till ett nytt format. Det tar ungefär %2$d sekunder. Du sparar %3$.0f MB diskutrymme.</item>+ </plurals>+ <!-- document translation notification + progress -->+ <string name="doc_notif_translating">Översätter fil</string>+ <string name="doc_notif_translated">Översatt fil</string>+ <string name="doc_notif_phase_text">Text %1$d%%</string>+ <string name="doc_notif_phase_images">Bilder %1$d/%2$d</string>+ <string name="doc_notif_phase_raster">Bitmappssidor %1$d/%2$d</string>+ <string name="doc_notif_channel_name">Dokumentöversättning</string>+ <string name="doc_notif_channel_desc">Visar förlopp medan dokument översätts</string>+ <string name="doc_progress_preparing">Förbereder fil</string>+ <string name="doc_progress_translating">Översätter</string>+ <string name="doc_progress_translated">Översatt fil</string>+ <string name="doc_progress_saving">Sparar översatt fil</string>+ <string name="doc_translation_failed">Dokumentöversättningen misslyckades</string>+ <string name="doc_url_unsupported">Ladda ner dokumentet och öppna det med appen i stället</string>+ <!-- document configure sheet -->+ <string name="document_wrap_columns">Radbryt vid %1$d kolumner</string>+ <string name="document_translate_pdf_images">Översätt bilder i PDF</string>+ <string name="layout_preserve">Behåll radbrytningar</string>+ <string name="layout_reflow">Omforma till stycken</string>+ <string name="layout_reflow_wrap">Omforma och radbryt</string>+ <!-- common (additional) -->+ <string name="common_open">Öppna</string>+ <string name="common_close">Stäng</string>+ <string name="common_save">Spara</string>+ <!-- translator app -->+ <string name="translator_translated_file">Översatt fil: %1$s</string>+ <string name="translator_document_saved">Dokumentet sparat</string>+ <string name="translator_document_save_failed">Det gick inte att spara dokumentet</string>+ <string name="translator_audio_playback_failed">Ljuduppspelningen misslyckades: %1$s</string>+ <string name="translator_no_app_to_open">Ingen app hittades för att öppna den här filen</string>+ <!-- document alignment -->+ <string name="docalign_decode_failed">Det gick inte att avkoda bilden.</string>+ <string name="docalign_detecting">Identifierar hörn…</string>+ <string name="docalign_redetecting">Identifierar igen…</string>+ <string name="docalign_help">En exakt avgränsning runt dokumentet förbättrar igenkänningskvaliteten. Det är viktigt att linjerna är parallella med texten.\n\nGenom att zooma eller panorera plockar algoritmen oftast upp dokumentet automatiskt, men du kan fortfarande justera manuellt om det inte hittas.</string>+ <!-- how to use -->+ <string name="howto_section_other_apps">Från andra appar</string>+ <string name="howto_share_title">Dela för att översätta</string>+ <string name="howto_share_body">Dela text, länkar eller bilder från valfri app för att översätta dem.</string>+ <string name="howto_copy_title">Översätt utan att lämna andra appar</string>+ <string name="howto_copy_body">Markera text var som helst och tryck sedan på \"Översätt\" i kopieringsverktygsfältet för att se översättningen i ett kompakt fönster.</string>+ <string name="howto_section_in_app">Inuti appen</string>+ <string name="howto_docs_title">Översätt dokument</string>+ <string name="howto_docs_body">Öppna fliken Dokument för att översätta EPUB-, PDF- och TXT-filer.</string>+ <string name="howto_dict_title">Slå upp i ordbok</string>+ <string name="howto_dict_body">Håll in valfritt ord i en översättning för att se dess definition. Data hämtad från Wiktionary.</string>+ <string name="howto_voice_title">Ändra röst eller hastighet</string>+ <string name="howto_voice_body">Håll in uppspelningsknappen för att välja en annan röst eller justera uppspelningshastigheten.</string>+ <!-- feature row labels -->+ <string name="feature_translation">Översättning</string>+ <string name="feature_dictionary">Ordbok</string>+ <string name="feature_tts">Röst</string>+ <!-- misc -->+ <string name="main_input_placeholder">Skriv text</string>+ <string name="aidl_target_unavailable">Målspråket är inte tillgängligt</string>+ <string name="voice_section_downloaded">NEDLADDADE</string>+ <string name="voice_section_available">TILLGÄNGLIGA</string>+ <string name="detected_translate_from">Översätt från</string>+ <string name="detected_missing_language">Språk saknas</string>+ <string name="langmgr_ocr_upgrade_available">En förbättrad textigenkänningsmodell är tillgänglig.</string>+</resources>diff --git a/OCR-translation/src/main/res/values-ta/strings.xml b/OCR-translation/src/main/res/values-ta/strings.xmlnew file mode 100644index 0000000..3966ba1--- /dev/null+++ b/OCR-translation/src/main/res/values-ta/strings.xml@@ -0,0 +1,217 @@+<?xml version="1.0" encoding="utf-8"?>+<resources>+ <string name="stop">நிறுத்து</string>+ <string name="pause">இடைநிறுத்து</string>+ <string name="resume">தொடரவும்</string>+ <string name="region_select_menu">மொழிபெயர்ப்புப் பகுதியை அமைக்கவும்</string>+ <string name="screen_translate_needs_source">மூல மொழியைக் குறிப்பிடவும்</string>+ <string name="live_tile_label">திரையை நேரலையில் மொழிபெயர்</string>+ <string name="translate_text">மொழிபெயர்</string>+ <string name="translate_link">இணைப்பை மொழிபெயர்</string>+ <string name="accessibility_service_description">திரையில் உள்ள உரையை மொழிபெயர்க்க இந்தச் சேவையை இயக்கவும். தற்போதைய திரையை மொழிபெயர்க்க மிதக்கும் மொழிபெயர்ப்பு பட்டனைத் தட்டவும், அல்லது நேரலைத் திரை மொழிபெயர்ப்பைத் தொடங்கவும்.</string>+ <string name="tap_to_translate_title">விரைவு மொழிபெயர்ப்பு இயக்கத்தில் உள்ளது</string>+ <string name="tap_to_translate_body">மொழிபெயர்ப்பு பாப்அப்பைத் திறக்க தட்டவும்</string>+ <string name="tap_to_translate_channel">விரைவு மொழிபெயர்ப்பு</string>+ <string name="tap_to_translate_channel_description">மொழிபெயர்ப்பு பாப்அப்பை விரைவாக அணுக நிலையான அறிவிப்பு</string>+ <string name="quick_tile_label">மொழிபெயர்</string>+ <!-- common -->+ <string name="common_ok">சரி</string>+ <string name="common_cancel">ரத்து செய்</string>+ <string name="common_done">முடிந்தது</string>+ <string name="common_grant">அனுமதி</string>+ <string name="common_manage">நிர்வகி</string>+ <!-- settings -->+ <string name="settings_title">அமைப்புகள்</string>+ <string name="settings_languages">மொழிகள்</string>+ <string name="settings_language_packs">மொழித் தொகுப்புகள்</string>+ <string name="settings_general">பொது</string>+ <string name="settings_font_size">எழுத்து அளவு</string>+ <string name="settings_font_sample">இது ஒரு உதாரண உரை</string>+ <string name="settings_tap_notification">விரைவு மொழிபெயர்ப்பு அறிவிப்பு</string>+ <string name="settings_tap_notification_desc">பாப்அப்பைத் திறக்கும் நிலையான அறிவிப்பு.</string>+ <string name="settings_web_translator">வெப் மொழிபெயர்ப்பான்</string>+ <string name="settings_clear_browsing">மூடும்போது உலாவல் தரவை அழி</string>+ <string name="settings_clear_browsing_desc">குக்கீகள், கேஷ் மற்றும் லோக்கல் ஸ்டோரேஜை நீக்கும்.</string>+ <string name="settings_tts_section">உரையிலிருந்து பேச்சு</string>+ <string name="settings_tts_read_urls_hashtags">URLகளையும் ஹாஷ்டேக்குகளையும் படி</string>+ <string name="settings_popup_settings">பாப்அப்</string>+ <string name="settings_popup_desc">உரைத் தேர்வு மெனுவில் \'மொழிபெயர்\' என்பதைத் தேர்ந்தெடுக்கும்போது பாப்அப் தோன்றும்</string>+ <string name="settings_hide_input">உள்ளீட்டை மறை</string>+ <string name="settings_popup_position">பாப்அப் இடம்</string>+ <string name="settings_popup_size">பாப்அப் அளவு: %1$d%%</string>+ <string name="settings_screen_translation">திரை மொழிபெயர்ப்பு</string>+ <string name="settings_screen_translation_desc">பிற ஆப்களுக்கு மேலேயே உரையை நேரடியாக மொழிபெயர்.</string>+ <string name="settings_floating_button">எப்போதும் இருக்கும் பட்டன்</string>+ <string name="settings_floating_button_desc">அணுகல்தன்மை அனுமதி தேவை</string>+ <string name="settings_shortcut">ஷார்ட்கட் மூலம் திரையை மொழிபெயர்</string>+ <string name="settings_shortcut_desc">இயக்க, ஹோம் அல்லது பவர் பட்டனை நீண்ட நேரம் அழுத்தவும்</string>+ <string name="settings_on_shortcut">ஷார்ட்கட் இயக்கப்படும்போது</string>+ <string name="settings_ocr">படங்கள்</string>+ <string name="settings_background_mode">உரையை இதனால் மாற்று</string>+ <string name="settings_min_confidence">குறைந்தபட்ச நம்பகத்தன்மை: %1$d%%</string>+ <string name="settings_max_image_size">அதிகபட்ச பட அளவு: %1$dpx</string>+ <string name="settings_advanced">மேம்பட்டவை</string>+ <string name="settings_catalog_url">பட்டியல் URL</string>+ <string name="settings_external_storage">வெளிப்புற சேமிப்பகத்தைப் பயன்படுத்து</string>+ <string name="settings_disable_autodetect">தானியங்கி மொழிக் கண்டறிதலை முடக்கு</string>+ <string name="settings_translit_output">மொழிபெயர்த்த உரைக்கு ஒலிபெயர்ப்பைக் காட்டு</string>+ <string name="settings_translit_input">மூல உரைக்கு ஒலிபெயர்ப்பைக் காட்டு</string>+ <string name="settings_translit_japanese_spaces">ஜப்பானிய ஒலிபெயர்ப்புக்கு இடைவெளிகளைச் சேர்</string>+ <string name="settings_translate_pdf_images">PDF-களில் உள்ள படங்களை மொழிபெயர்</string>+ <string name="settings_camera_live_default">இயல்பாகவே கேமராவை நேரலையில் மொழிபெயர்</string>+ <string name="settings_register_browser">உலாவியாக பதிவு செய்</string>+ <string name="settings_register_browser_desc">பிற ஆப்களில் இருந்து இணைப்புகளை மொழிபெயர்க்க வழங்கும்.</string>+ <string name="settings_external_storage_perm_title">வெளிப்புற சேமிப்பக அனுமதி</string>+ <string name="settings_about">பற்றி</string>+ <string name="settings_version">பதிப்பு %1$s</string>+ <string name="settings_no_languages_available">மொழிகள் எதுவும் கிடைக்கவில்லை</string>+ <string name="settings_default_from">இயல்பான \'மூல\' மொழி</string>+ <string name="settings_default_to">இயல்பான \'இலக்கு\' மொழி</string>+ <string name="settings_adblock_support">விளம்பரங்களைத் தடு</string>+ <string name="settings_about_get_help">உதவி பெறு / சிக்கலைத் தெரிவி</string>+ <string name="settings_logs_copied">ஆப் லாக்குகள் கிளிப்போர்டுக்கு நகலெடுக்கப்பட்டன</string>+ <string name="settings_about_support">டெவலப்மென்ட்டுக்கு ஆதரவளி</string>+ <string name="settings_external_storage_perm_body">மொழிபெயர்ப்பு கோப்புகளை உங்கள் Documents ஃபோல்டரில் சேமிக்க, இந்த ஆப்புக்கு எல்லா கோப்புகளையும் நிர்வகிக்கும் அணுகல் தேவை.\n\'எல்லா கோப்புகளையும் நிர்வகிக்க அனுமதி\' என்ற அனுமதியை வழங்கக்கூடிய அமைப்புகளுக்கு நீங்கள் அழைத்துச் செல்லப்படுவீர்கள்.</string>+ <!-- language manager / setup / how-to -->+ <string name="langmgr_voices">குரல்கள்</string>+ <string name="voice_section_downloaded">டவுன்லோடு செய்யப்பட்டவை</string>+ <string name="voice_section_available">கிடைப்பவை</string>+ <string name="langmgr_default">இயல்பு</string>+ <string name="langmgr_filter">மொழிகளை வடிகட்டு</string>+ <string name="langmgr_ocr_upgrade_available">மேம்படுத்தப்பட்ட உரை கண்டறிதல் மாடல் கிடைக்கிறது.</string>+ <string name="langmgr_delete_shared_title">பகிரப்பட்ட அகராதியை நீக்கவா?</string>+ <string name="langmgr_delete_shared_body">இந்த அகராதி %1$s உடன் பகிரப்பட்டுள்ளது.\nஇதை நீக்கினால் அவர்கள் அனைவருக்கும் இந்த அகராதி நீக்கப்படும்.</string>+ <string name="langmgr_download_size">%1$s டவுன்லோடு செய்</string>+ <string name="langmgr_repair_needed">சில டவுன்லோடு செய்யப்பட்ட அம்சங்களுக்கான கோப்புகள் இல்லை, சரிசெய்யும் வரை அவை வேலை செய்யாது.</string>+ <string name="langmgr_repair_size">%1$s சரிசெய்</string>+ <string name="nolang_title">மொழி அமைப்பு</string>+ <string name="nolang_prompt">மொழிபெயர்க்கத் தொடங்க மொழித் தொகுப்புகளை டவுன்லோடு செய்யுங்கள்</string>+ <string name="howto_title">எப்படிப் பயன்படுத்துவது</string>+ <!-- image capture / voice / dictionary / language selector -->+ <string name="image_no_crop_remote">தொலைநிலைப் படங்களை நேரடியாக கிராப் செய்ய முடியாது</string>+ <string name="image_open_failed">கோப்பைத் திறக்க முடியவில்லை</string>+ <string name="image_source_screen">திரை</string>+ <string name="image_source_document">ஆவணம்</string>+ <string name="image_source_photos">புகைப்படங்கள்</string>+ <string name="image_source_gallery">கேலரி</string>+ <string name="image_source_camera">கேமரா</string>+ <string name="voice_playback_speed">ஒலிபரப்பு வேகம்</string>+ <string name="voice_label">குரல்</string>+ <string name="voice_default">இயல்பான குரல்</string>+ <string name="langsel_auto">✨ தானியங்கி</string>+ <string name="dict_also_as">இவ்வாறும்:</string>+ <!-- camera / browser / screen translate -->+ <string name="camera_permission_rationale">நேரலை மொழிபெயர்ப்புக்கு கேமரா அனுமதி தேவை.</string>+ <string name="camera_need_ocr_models">இந்த மொழிக்கான படத்திலிருந்து உரை அடையாளம் காணும் மாடல்களை டவுன்லோடு செய்ய வேண்டும்</string>+ <string name="browser_no_source_language">மூல மொழி எதுவும் கிடைக்கவில்லை. முதலில் முதன்மைத் திரையில் இருந்து ஒன்றை நிறுவவும், அல்லது அமைப்புகளில் இயல்பான மூல மொழியை அமைக்கவும்.</string>+ <string name="browser_reader_unavailable">இந்தப் பக்கத்திற்கு வாசிப்பு பயன்முறை கிடைக்கவில்லை</string>+ <string name="browser_translate_image">படத்தை மொழிபெயர்</string>+ <string name="screen_translating_notification">திரையை மொழிபெயர்க்கிறது</string>+ <!-- enums -->+ <string name="align_top">மேல்</string>+ <string name="align_middle">நடு</string>+ <string name="align_bottom">கீழ்</string>+ <string name="assistant_action_still_image">ஒருமுறை மொழிபெயர்</string>+ <string name="assistant_action_live_screen">நேரலை மொழிபெயர்ப்பைத் தொடங்கு</string>+ <string name="background_mode_white_on_black">கருப்பில் வெள்ளை</string>+ <string name="background_mode_black_on_white">வெள்ளையில் கருப்பு</string>+ <string name="background_mode_auto_detect">அசல் படத்தின் வண்ணங்கள்</string>+ <!-- tts / speech errors -->+ <string name="tts_nothing_to_speak">படிக்க எதுவும் இல்லை</string>+ <string name="tts_catalog_unavailable">பட்டியல் கிடைக்கவில்லை</string>+ <string name="tts_no_voice">%1$s மொழிக்கு குரல் எதுவும் நிறுவப்படவில்லை</string>+ <string name="tts_synthesis_failed">%1$s மொழிக்கு குரல் உருவாக்கம் தோல்வியடைந்தது</string>+ <string name="tts_sample_fallback">இது Offline Translator-இன் ஒரு குரல் மாதிரி.</string>+ <!-- translation -->+ <string name="translation_error">மொழிபெயர்ப்புப் பிழை: %1$s</string>+ <!-- download errors -->+ <string name="download_failed_core">%1$s டவுன்லோடு தோல்வியடைந்தது</string>+ <string name="download_failed_ocr">%1$s படத்திலிருந்து உரை அடையாளம் காணும் டவுன்லோடு தோல்வியடைந்தது</string>+ <string name="download_failed_ocr_batch">படத்திலிருந்து உரை அடையாளம் காணும் தொகுதி டவுன்லோடு தோல்வியடைந்தது</string>+ <string name="download_failed_dictionary">%1$s அகராதி டவுன்லோடு தோல்வியடைந்தது</string>+ <string name="download_failed_tts">%1$s குரல் டவுன்லோடு தோல்வியடைந்தது</string>+ <string name="download_failed_adblock">விளம்பரத் தடுப்பான் டவுன்லோடு தோல்வியடைந்தது</string>+ <string name="download_failed_repair">சரிசெய்தல் டவுன்லோடு தோல்வியடைந்தது</string>+ <string name="download_catalog_unavailable">பட்டியல் கிடைக்கவில்லை</string>+ <string name="download_catalog_save_failed">பட்டியலைச் சேமிக்க முடியவில்லை</string>+ <string name="download_unknown_error">தெரியாத பிழை</string>+ <string name="download_catalog_failed">பட்டியலை டவுன்லோடு செய்ய முடியவில்லை: %1$s</string>+ <!-- assistant overlay status -->+ <string name="assistant_invoke_prompt">உரையை மொழிபெயர்க்க அதன் மேல் இந்த அசிஸ்டண்டை இயக்கவும்</string>+ <string name="assistant_collecting_context">திரையின் சூழலைச் சேகரிக்கிறது…</string>+ <string name="assistant_screenshot_disabled">இந்த அசிஸ்டண்டுக்கு ஸ்கிரீன்ஷாட் அணுகல் முடக்கப்பட்டுள்ளது. கணினி அசிஸ்டண்ட் அமைப்புகளில் அதை இயக்கவும்.</string>+ <string name="assistant_no_screen_data">திரைத் தரவு எதுவும் கிடைக்கவில்லை. இந்த அசிஸ்டண்டுக்கு \'ஸ்கிரீன்ஷாட்டைப் பயன்படுத்து\' என்பதை இயக்கவும்.</string>+ <string name="assistant_no_screenshot">இந்த ஆப் ஸ்கிரீன்ஷாட்டை வழங்கவில்லை.</string>+ <string name="assistant_set_source_ocr">படத்திலிருந்து உரை அடையாளம் காண இயல்பான மூல மொழியை அமைக்கவும்.</string>+ <string name="assistant_langs_not_ready">மொழிபெயர்ப்பு மொழிகள் இன்னும் தயாராகவில்லை. மீண்டும் முயற்சிக்கவும்.</string>+ <string name="assistant_ocr_failed">படத்திலிருந்து உரை அடையாளம் காண்பது தோல்வியடைந்தது</string>+ <string name="ocr_models_missing">உரை அடையாளம் காணும் மாதிரிகள் இல்லை. சரிசெய்ய, ஆப்பில் மொழி மேலாண்மையைத் திற.</string>+ <string name="assistant_set_source_live">நேரலைத் திரை மொழிபெயர்ப்பைப் பயன்படுத்த அமைப்புகளில் இயல்பான மூல மொழியை அமைக்கவும்.</string>+ <!-- migration gate -->+ <string name="migration_updating_speech_models">குரல் மாடல்களைப் புதுப்பிக்கிறது</string>+ <string name="migration_accept_convert">ஏற்று மாற்று</string>+ <string name="migration_delete_all">அதற்குப் பதிலாக அனைத்தையும் நீக்கு</string>+ <string name="migration_converting">%2$d இல் %1$d மாற்றப்படுகிறது</string>+ <string name="migration_optimizing">மாடல்களை மேம்படுத்துகிறது</string>+ <plurals name="migration_convert_prompt">+ <item quantity="one">புதிய வடிவத்திற்கு மாற்ற உங்களிடம் %1$d குரல் மாடல் உள்ளது. இதற்கு சுமார் %2$d வினாடிகள் ஆகும். நீங்கள் %3$.0f MB சேமிப்பக இடத்தைச் சேமிப்பீர்கள்.</item>+ <item quantity="other">புதிய வடிவத்திற்கு மாற்ற உங்களிடம் %1$d குரல் மாடல்கள் உள்ளன. இதற்கு சுமார் %2$d வினாடிகள் ஆகும். நீங்கள் %3$.0f MB சேமிப்பக இடத்தைச் சேமிப்பீர்கள்.</item>+ </plurals>+ <!-- document translation notification + progress -->+ <string name="doc_notif_translating">கோப்பை மொழிபெயர்க்கிறது</string>+ <string name="doc_notif_translated">மொழிபெயர்த்த கோப்பு</string>+ <string name="doc_notif_phase_text">உரை %1$d%%</string>+ <string name="doc_notif_phase_images">படங்கள் %1$d/%2$d</string>+ <string name="doc_notif_phase_raster">பிட்மேப் பக்கங்கள் %1$d/%2$d</string>+ <string name="doc_notif_channel_name">ஆவண மொழிபெயர்ப்பு</string>+ <string name="doc_notif_channel_desc">ஆவணங்களை மொழிபெயர்க்கும்போது முன்னேற்றத்தைக் காட்டும்</string>+ <string name="doc_progress_preparing">கோப்பைத் தயார் செய்கிறது</string>+ <string name="doc_progress_translating">மொழிபெயர்க்கிறது</string>+ <string name="doc_progress_translated">மொழிபெயர்த்த கோப்பு</string>+ <string name="doc_progress_saving">மொழிபெயர்த்த கோப்பைச் சேமிக்கிறது</string>+ <string name="doc_translation_failed">ஆவண மொழிபெயர்ப்பு தோல்வியடைந்தது</string>+ <string name="doc_url_unsupported">அதற்குப் பதிலாக ஆவணத்தை டவுன்லோடு செய்து ஆப்பில் திறக்கவும்</string>+ <!-- document configure sheet -->+ <string name="document_wrap_columns">%1$d நெடுவரிசைகளில் அடைக்கவும்</string>+ <string name="document_translate_pdf_images">PDF-இல் உள்ள படங்களை மொழிபெயர்</string>+ <string name="layout_preserve">வரி இடைவெளிகளைத் தக்கவை</string>+ <string name="layout_reflow">பத்திகளாக மறுஅமை</string>+ <string name="layout_reflow_wrap">மறுஅமைத்து அடைக்கவும்</string>+ <!-- common (additional) -->+ <string name="common_open">திற</string>+ <string name="common_close">மூடு</string>+ <string name="common_save">சேமி</string>+ <!-- translator app -->+ <string name="translator_translated_file">மொழிபெயர்த்த கோப்பு: %1$s</string>+ <string name="translator_document_saved">ஆவணம் சேமிக்கப்பட்டது</string>+ <string name="translator_document_save_failed">ஆவணத்தைச் சேமிக்க முடியவில்லை</string>+ <string name="translator_audio_playback_failed">ஆடியோ ஒலிபரப்பு தோல்வியடைந்தது: %1$s</string>+ <string name="translator_no_app_to_open">இந்தக் கோப்பைத் திறக்க ஆப் எதுவும் கிடைக்கவில்லை</string>+ <!-- document alignment -->+ <string name="docalign_decode_failed">படத்தை டிகோடு செய்ய முடியவில்லை.</string>+ <string name="docalign_detecting">மூலைகளைக் கண்டறிகிறது…</string>+ <string name="docalign_redetecting">மீண்டும் கண்டறிகிறது…</string>+ <string name="docalign_help">ஆவணத்தைச் சுற்றி துல்லியமான விளிம்பு இருந்தால் அடையாளம் காணும் தரம் மேம்படும். வரிகள் உரைக்கு இணையாக இருப்பது முக்கியம்.\n\nஜூம் செய்வது அல்லது நகர்த்துவது பொதுவாக அல்காரிதம் தானாகவே ஆவணத்தைக் கண்டறிய உதவும், ஆனால் அது கண்டறியப்படாவிட்டால் நீங்கள் கைமுறையாகவும் சரிசெய்யலாம்.</string>+ <!-- how to use -->+ <string name="howto_section_other_apps">பிற ஆப்களில் இருந்து</string>+ <string name="howto_share_title">மொழிபெயர்க்கப் பகிரவும்</string>+ <string name="howto_share_body">எந்த ஆப்பில் இருந்தும் உரை, இணைப்புகள் அல்லது படங்களைப் பகிர்ந்து மொழிபெயர்க்கலாம்.</string>+ <string name="howto_copy_title">பிற ஆப்களை விட்டு வெளியேறாமல் மொழிபெயர்</string>+ <string name="howto_copy_body">எங்கு வேண்டுமானாலும் உரையைத் தேர்ந்தெடுத்து, காப்பி டூல்பாரில் \"மொழிபெயர்\" என்பதைத் தட்டினால் மொழிபெயர்ப்பை சிறிய பாப்அப்பில் காணலாம்.</string>+ <string name="howto_section_in_app">ஆப்புக்குள்</string>+ <string name="howto_docs_title">ஆவணங்களையும் படங்களையும் மொழிபெயர்</string>+ <string name="howto_docs_body">படங்களை அல்லது EPUB, PDF, TXT கோப்புகளை மொழிபெயர்க்க Documents டேப்பைத் திறக்கவும்.</string>+ <string name="howto_dict_title">அகராதியில் தேடு</string>+ <string name="howto_dict_body">மொழிபெயர்ப்பில் உள்ள எந்த சொல்லையும் நீண்ட நேரம் அழுத்தினால் அதன் பொருளைக் காணலாம். தரவு Wiktionary-இல் இருந்து பெறப்பட்டது.</string>+ <string name="howto_voice_title">குரல் அல்லது வேகத்தை மாற்று</string>+ <string name="howto_voice_body">வேறு குரலைத் தேர்ந்தெடுக்க அல்லது ஒலிபரப்பு வேகத்தைச் சரிசெய்ய பிளே பட்டனை நீண்ட நேரம் அழுத்தவும்.</string>+ <!-- feature row labels -->+ <string name="feature_translation">மொழிபெயர்ப்பு</string>+ <string name="feature_dictionary">அகராதி</string>+ <string name="feature_tts">குரல்</string>+ <!-- misc -->+ <string name="detected_translate_from">இதிலிருந்து மொழிபெயர்</string>+ <string name="detected_missing_language">மொழி இல்லை</string>+ <string name="main_input_placeholder">உரையை உள்ளிடவும்</string>+ <string name="aidl_target_unavailable">இலக்கு மொழி கிடைக்கவில்லை</string>+</resources>diff --git a/OCR-translation/src/main/res/values-te/strings.xml b/OCR-translation/src/main/res/values-te/strings.xmlnew file mode 100644index 0000000..ae70238--- /dev/null+++ b/OCR-translation/src/main/res/values-te/strings.xml@@ -0,0 +1,217 @@+<?xml version="1.0" encoding="utf-8"?>+<resources>+ <string name="stop">ఆపు</string>+ <string name="pause">పాజ్ చేయి</string>+ <string name="resume">కొనసాగించు</string>+ <string name="region_select_menu">అనువాద ప్రాంతాన్ని సెట్ చేయి</string>+ <string name="screen_translate_needs_source">ఏ భాష నుంచి అనువదించాలో చెప్పండి</string>+ <string name="live_tile_label">స్క్రీన్ను లైవ్గా అనువదించు</string>+ <string name="translate_text">అనువదించు</string>+ <string name="translate_link">లింక్ను అనువదించు</string>+ <string name="accessibility_service_description">స్క్రీన్పై ఉన్న టెక్స్ట్ను అనువదించడానికి ఈ సర్వీస్ను ఆన్ చేయండి. ప్రస్తుత స్క్రీన్ను అనువదించడానికి తేలియాడే అనువాద బటన్ను నొక్కండి, లేదా లైవ్ స్క్రీన్ అనువాదాన్ని ప్రారంభించండి.</string>+ <string name="tap_to_translate_title">క్విక్ ట్రాన్స్లేట్ ఆన్లో ఉంది</string>+ <string name="tap_to_translate_body">అనువాదకం పాపప్ను తెరవడానికి నొక్కండి</string>+ <string name="tap_to_translate_channel">క్విక్ ట్రాన్స్లేట్</string>+ <string name="tap_to_translate_channel_description">అనువాదకం పాపప్ను త్వరగా తెరవడానికి ఎప్పుడూ ఉండే నోటిఫికేషన్</string>+ <string name="quick_tile_label">అనువదించు</string>+ <!-- common -->+ <string name="common_ok">సరే</string>+ <string name="common_cancel">రద్దు చేయి</string>+ <string name="common_done">అయిపోయింది</string>+ <string name="common_grant">అనుమతి ఇవ్వు</string>+ <string name="common_manage">నిర్వహించు</string>+ <!-- settings -->+ <string name="settings_title">సెట్టింగ్లు</string>+ <string name="settings_languages">భాషలు</string>+ <string name="settings_language_packs">భాషా ప్యాక్లు</string>+ <string name="settings_general">సాధారణం</string>+ <string name="settings_font_size">ఫాంట్ సైజు</string>+ <string name="settings_font_sample">ఇది ఒక ఉదాహరణ టెక్స్ట్</string>+ <string name="settings_tap_notification">క్విక్ ట్రాన్స్లేట్ నోటిఫికేషన్</string>+ <string name="settings_tap_notification_desc">పాపప్ను తెరిచే, ఎప్పుడూ ఉండే నోటిఫికేషన్.</string>+ <string name="settings_web_translator">వెబ్ అనువాదకం</string>+ <string name="settings_clear_browsing">మూసేటప్పుడు బ్రౌజింగ్ డేటాను తొలగించు</string>+ <string name="settings_clear_browsing_desc">కుకీలు, క్యాష్ మరియు లోకల్ స్టోరేజ్ను తొలగిస్తుంది.</string>+ <string name="settings_tts_section">టెక్స్ట్-టు-స్పీచ్</string>+ <string name="settings_tts_read_urls_hashtags">URLలు మరియు హ్యాష్ట్యాగ్లను చదవండి</string>+ <string name="settings_popup_settings">పాపప్</string>+ <string name="settings_popup_desc">టెక్స్ట్ సెలెక్షన్ మెనూలో \'అనువదించు\' ఎంచుకున్నప్పుడు పాపప్ కనిపిస్తుంది</string>+ <string name="settings_hide_input">ఇన్పుట్ను దాచు</string>+ <string name="settings_popup_position">పాపప్ స్థానం</string>+ <string name="settings_popup_size">పాపప్ సైజు: %1$d%%</string>+ <string name="settings_screen_translation">స్క్రీన్ అనువాదం</string>+ <string name="settings_screen_translation_desc">వేరే యాప్ల పైనే నేరుగా టెక్స్ట్ను అనువదించు.</string>+ <string name="settings_floating_button">ఎప్పుడూ ఉండే బటన్</string>+ <string name="settings_floating_button_desc">యాక్సెసిబిలిటీ అనుమతి అవసరం</string>+ <string name="settings_shortcut">షార్ట్కట్తో స్క్రీన్ను అనువదించు</string>+ <string name="settings_shortcut_desc">యాక్టివేట్ చేయడానికి హోమ్ లేదా పవర్ బటన్ను నొక్కి పట్టుకోండి</string>+ <string name="settings_on_shortcut">షార్ట్కట్ నొక్కినప్పుడు</string>+ <string name="settings_ocr">చిత్రాలు</string>+ <string name="settings_background_mode">టెక్స్ట్ను దీనితో మార్చు</string>+ <string name="settings_min_confidence">కనీస కచ్చితత్వం: %1$d%%</string>+ <string name="settings_max_image_size">గరిష్ట చిత్ర సైజు: %1$dpx</string>+ <string name="settings_advanced">అడ్వాన్స్డ్</string>+ <string name="settings_catalog_url">కేటలాగ్ URL</string>+ <string name="settings_external_storage">ఎక్స్టర్నల్ స్టోరేజ్ వాడు</string>+ <string name="settings_disable_autodetect">భాషను ఆటోమేటిక్గా గుర్తించడాన్ని ఆఫ్ చేయి</string>+ <string name="settings_translit_output">అనువదించిన టెక్స్ట్కు లిప్యంతరీకరణ చూపించు</string>+ <string name="settings_translit_input">అసలు టెక్స్ట్కు లిప్యంతరీకరణ చూపించు</string>+ <string name="settings_translit_japanese_spaces">జపనీస్ లిప్యంతరీకరణకు ఖాళీలు జోడించు</string>+ <string name="settings_translate_pdf_images">PDFల్లోని చిత్రాలను అనువదించు</string>+ <string name="settings_camera_live_default">డిఫాల్ట్గా కెమెరాను లైవ్గా అనువదించు</string>+ <string name="settings_register_browser">బ్రౌజర్గా రిజిస్టర్ చేయి</string>+ <string name="settings_register_browser_desc">వేరే యాప్ల నుంచి వచ్చే లింక్లను అనువదించడానికి అందిస్తుంది.</string>+ <string name="settings_external_storage_perm_title">ఎక్స్టర్నల్ స్టోరేజ్ అనుమతి</string>+ <string name="settings_about">గురించి</string>+ <string name="settings_version">వెర్షన్ %1$s</string>+ <string name="settings_no_languages_available">భాషలు ఏవీ అందుబాటులో లేవు</string>+ <string name="settings_default_from">డిఫాల్ట్ \'నుంచి\' భాష</string>+ <string name="settings_default_to">డిఫాల్ట్ \'కి\' భాష</string>+ <string name="settings_adblock_support">ప్రకటనలను బ్లాక్ చేయి</string>+ <string name="settings_about_get_help">సహాయం పొందు / సమస్యను తెలియజేయి</string>+ <string name="settings_logs_copied">యాప్ లాగ్లు క్లిప్బోర్డ్కు కాపీ అయ్యాయి</string>+ <string name="settings_about_support">అభివృద్ధికి తోడ్పడు</string>+ <string name="settings_external_storage_perm_body">మీ Documents ఫోల్డర్లో అనువాద ఫైళ్లను సేవ్ చేయడానికి, ఈ యాప్కు అన్ని ఫైళ్లను నిర్వహించే అనుమతి అవసరం.\nమిమ్మల్ని సెట్టింగ్లకు తీసుకువెళ్తాం, అక్కడ \'అన్ని ఫైళ్లను నిర్వహించడానికి అనుమతించు\' అనుమతిని ఇవ్వవచ్చు.</string>+ <!-- language manager / setup / how-to -->+ <string name="langmgr_voices">వాయిస్లు</string>+ <string name="voice_section_downloaded">డౌన్లోడ్ చేసినవి</string>+ <string name="voice_section_available">అందుబాటులో ఉన్నవి</string>+ <string name="langmgr_default">డిఫాల్ట్</string>+ <string name="langmgr_filter">భాషలను ఫిల్టర్ చేయి</string>+ <string name="langmgr_ocr_upgrade_available">చిత్రాల్లో టెక్స్ట్ను గుర్తించే మెరుగైన మోడల్ అందుబాటులో ఉంది.</string>+ <string name="langmgr_delete_shared_title">షేర్ చేసిన నిఘంటువును తొలగించాలా?</string>+ <string name="langmgr_delete_shared_body">ఈ నిఘంటువు %1$sతో షేర్ చేయబడింది.\nదీన్ని తొలగిస్తే వారందరికీ ఈ నిఘంటువు తొలగిపోతుంది.</string>+ <string name="langmgr_download_size">%1$s డౌన్లోడ్ చేయి</string>+ <string name="langmgr_repair_needed">కొన్ని డౌన్లోడ్ చేసిన ఫీచర్లకు ఫైల్లు లేవు, మరమ్మతు చేసే వరకు పని చేయవు.</string>+ <string name="langmgr_repair_size">%1$s మరమ్మతు చేయి</string>+ <string name="nolang_title">భాషల సెటప్</string>+ <string name="nolang_prompt">అనువాదం మొదలుపెట్టడానికి భాషా ప్యాక్లను డౌన్లోడ్ చేయండి</string>+ <string name="howto_title">ఎలా వాడాలి</string>+ <!-- image capture / voice / dictionary / language selector -->+ <string name="image_no_crop_remote">రిమోట్ చిత్రాలను నేరుగా క్రాప్ చేయలేరు</string>+ <string name="image_open_failed">ఫైల్ను తెరవడం విఫలమైంది</string>+ <string name="image_source_screen">స్క్రీన్</string>+ <string name="image_source_document">డాక్యుమెంట్</string>+ <string name="image_source_photos">ఫోటోలు</string>+ <string name="image_source_gallery">గ్యాలరీ</string>+ <string name="image_source_camera">కెమెరా</string>+ <string name="voice_playback_speed">ప్లేబ్యాక్ వేగం</string>+ <string name="voice_label">వాయిస్</string>+ <string name="voice_default">డిఫాల్ట్ వాయిస్</string>+ <string name="langsel_auto">✨ ఆటో</string>+ <string name="dict_also_as">ఇలా కూడా:</string>+ <!-- camera / browser / screen translate -->+ <string name="camera_permission_rationale">లైవ్ అనువాదానికి కెమెరా అనుమతి అవసరం.</string>+ <string name="camera_need_ocr_models">ఈ భాషకు చిత్రాల్లోని టెక్స్ట్ను గుర్తించే మోడల్లను డౌన్లోడ్ చేసుకోవాలి</string>+ <string name="browser_no_source_language">మూల భాష ఏదీ అందుబాటులో లేదు. మొదట మెయిన్ స్క్రీన్ నుంచి ఒకటి ఇన్స్టాల్ చేయండి, లేదా సెట్టింగ్లలో డిఫాల్ట్ మూల భాషను సెట్ చేయండి.</string>+ <string name="browser_reader_unavailable">ఈ పేజీకి రీడర్ మోడ్ అందుబాటులో లేదు</string>+ <string name="browser_translate_image">చిత్రాన్ని అనువదించు</string>+ <string name="screen_translating_notification">స్క్రీన్ను అనువదిస్తోంది</string>+ <!-- enums -->+ <string name="align_top">పైన</string>+ <string name="align_middle">మధ్యలో</string>+ <string name="align_bottom">కింద</string>+ <string name="assistant_action_still_image">ఒకసారి అనువదించు</string>+ <string name="assistant_action_live_screen">లైవ్ అనువాదాన్ని ప్రారంభించు</string>+ <string name="background_mode_white_on_black">నలుపుపై తెలుపు</string>+ <string name="background_mode_black_on_white">తెలుపుపై నలుపు</string>+ <string name="background_mode_auto_detect">అసలు చిత్రం రంగులు</string>+ <!-- tts / speech errors -->+ <string name="tts_nothing_to_speak">చదవడానికి ఏమీ లేదు</string>+ <string name="tts_catalog_unavailable">కేటలాగ్ అందుబాటులో లేదు</string>+ <string name="tts_no_voice">%1$s కోసం ఏ వాయిస్ ఇన్స్టాల్ కాలేదు</string>+ <string name="tts_synthesis_failed">%1$s కోసం వాయిస్ తయారీ విఫలమైంది</string>+ <string name="tts_sample_fallback">ఇది Offline Translator నుంచి ఒక వాయిస్ నమూనా.</string>+ <!-- translation -->+ <string name="translation_error">అనువాద లోపం: %1$s</string>+ <!-- download errors -->+ <string name="download_failed_core">%1$s డౌన్లోడ్ విఫలమైంది</string>+ <string name="download_failed_ocr">%1$s చిత్ర టెక్స్ట్ మోడల్ డౌన్లోడ్ విఫలమైంది</string>+ <string name="download_failed_ocr_batch">చిత్ర టెక్స్ట్ మోడల్ల బ్యాచ్ డౌన్లోడ్ విఫలమైంది</string>+ <string name="download_failed_dictionary">%1$s నిఘంటువు డౌన్లోడ్ విఫలమైంది</string>+ <string name="download_failed_tts">%1$s వాయిస్ డౌన్లోడ్ విఫలమైంది</string>+ <string name="download_failed_adblock">ప్రకటనల బ్లాకర్ డౌన్లోడ్ విఫలమైంది</string>+ <string name="download_failed_repair">మరమ్మతు డౌన్లోడ్ విఫలమైంది</string>+ <string name="download_catalog_unavailable">కేటలాగ్ అందుబాటులో లేదు</string>+ <string name="download_catalog_save_failed">కేటలాగ్ను సేవ్ చేయడం విఫలమైంది</string>+ <string name="download_unknown_error">తెలియని లోపం</string>+ <string name="download_catalog_failed">కేటలాగ్ను డౌన్లోడ్ చేయడం విఫలమైంది: %1$s</string>+ <!-- assistant overlay status -->+ <string name="assistant_invoke_prompt">ఏదైనా టెక్స్ట్ను అనువదించడానికి దాని పైన ఈ అసిస్టెంట్ను తెరవండి</string>+ <string name="assistant_collecting_context">స్క్రీన్ సమాచారాన్ని సేకరిస్తోంది…</string>+ <string name="assistant_screenshot_disabled">ఈ అసిస్టెంట్కు స్క్రీన్షాట్ యాక్సెస్ ఆఫ్లో ఉంది. సిస్టమ్ అసిస్టెంట్ సెట్టింగ్లలో దాన్ని ఆన్ చేయండి.</string>+ <string name="assistant_no_screen_data">స్క్రీన్ డేటా ఏదీ అందలేదు. ఈ అసిస్టెంట్కు \'స్క్రీన్షాట్ వాడు\' ఆన్ చేయండి.</string>+ <string name="assistant_no_screenshot">ఈ యాప్ స్క్రీన్షాట్ ఇవ్వలేదు.</string>+ <string name="assistant_set_source_ocr">చిత్రాల్లోని టెక్స్ట్ను గుర్తించడానికి డిఫాల్ట్ మూల భాషను సెట్ చేయండి.</string>+ <string name="assistant_langs_not_ready">అనువాద భాషలు ఇంకా సిద్ధంగా లేవు. మళ్లీ ప్రయత్నించండి.</string>+ <string name="assistant_ocr_failed">చిత్రంలో టెక్స్ట్ను గుర్తించడం విఫలమైంది</string>+ <string name="ocr_models_missing">టెక్స్ట్ గుర్తింపు మోడల్లు లేవు. మరమ్మతు చేయడానికి యాప్లో భాషల నిర్వహణ తెరవండి.</string>+ <string name="assistant_set_source_live">లైవ్ స్క్రీన్ అనువాదాన్ని వాడటానికి సెట్టింగ్లలో డిఫాల్ట్ మూల భాషను సెట్ చేయండి.</string>+ <!-- migration gate -->+ <string name="migration_updating_speech_models">వాయిస్ మోడల్లను అప్డేట్ చేస్తోంది</string>+ <string name="migration_accept_convert">అంగీకరించి మార్చు</string>+ <string name="migration_delete_all">బదులుగా అన్నీ తొలగించు</string>+ <string name="migration_converting">%2$dలో %1$d మారుస్తోంది</string>+ <string name="migration_optimizing">మోడల్లను ఆప్టిమైజ్ చేస్తోంది</string>+ <plurals name="migration_convert_prompt">+ <item quantity="one">కొత్త ఫార్మాట్కు మార్చాల్సిన %1$d వాయిస్ మోడల్ మీ దగ్గర ఉంది. దీనికి సుమారు %2$d సెకన్లు పడుతుంది. మీరు %3$.0f MB డిస్క్ స్థలాన్ని ఆదా చేస్తారు.</item>+ <item quantity="other">కొత్త ఫార్మాట్కు మార్చాల్సిన %1$d వాయిస్ మోడల్లు మీ దగ్గర ఉన్నాయి. దీనికి సుమారు %2$d సెకన్లు పడుతుంది. మీరు %3$.0f MB డిస్క్ స్థలాన్ని ఆదా చేస్తారు.</item>+ </plurals>+ <!-- document translation notification + progress -->+ <string name="doc_notif_translating">ఫైల్ను అనువదిస్తోంది</string>+ <string name="doc_notif_translated">ఫైల్ అనువదించబడింది</string>+ <string name="doc_notif_phase_text">టెక్స్ట్ %1$d%%</string>+ <string name="doc_notif_phase_images">చిత్రాలు %1$d/%2$d</string>+ <string name="doc_notif_phase_raster">బిట్మ్యాప్ పేజీలు %1$d/%2$d</string>+ <string name="doc_notif_channel_name">డాక్యుమెంట్ అనువాదం</string>+ <string name="doc_notif_channel_desc">డాక్యుమెంట్లను అనువదిస్తున్నప్పుడు పురోగతిని చూపిస్తుంది</string>+ <string name="doc_progress_preparing">ఫైల్ను సిద్ధం చేస్తోంది</string>+ <string name="doc_progress_translating">అనువదిస్తోంది</string>+ <string name="doc_progress_translated">ఫైల్ అనువదించబడింది</string>+ <string name="doc_progress_saving">అనువదించిన ఫైల్ను సేవ్ చేస్తోంది</string>+ <string name="doc_translation_failed">డాక్యుమెంట్ అనువాదం విఫలమైంది</string>+ <string name="doc_url_unsupported">బదులుగా డాక్యుమెంట్ను డౌన్లోడ్ చేసి యాప్తో తెరవండి</string>+ <!-- document configure sheet -->+ <string name="document_wrap_columns">%1$d కాలమ్ల వద్ద చుట్టు</string>+ <string name="document_translate_pdf_images">PDFలోని చిత్రాలను అనువదించు</string>+ <string name="layout_preserve">లైన్ బ్రేక్లను అలాగే ఉంచు</string>+ <string name="layout_reflow">పేరాలుగా మార్చు</string>+ <string name="layout_reflow_wrap">పేరాలుగా మార్చి చుట్టు</string>+ <!-- common (additional) -->+ <string name="common_open">తెరువు</string>+ <string name="common_close">మూసివేయి</string>+ <string name="common_save">సేవ్ చేయి</string>+ <!-- translator app -->+ <string name="translator_translated_file">అనువదించిన ఫైల్: %1$s</string>+ <string name="translator_document_saved">డాక్యుమెంట్ సేవ్ అయింది</string>+ <string name="translator_document_save_failed">డాక్యుమెంట్ను సేవ్ చేయడం విఫలమైంది</string>+ <string name="translator_audio_playback_failed">ఆడియో ప్లేబ్యాక్ విఫలమైంది: %1$s</string>+ <string name="translator_no_app_to_open">ఈ ఫైల్ను తెరవడానికి యాప్ ఏదీ దొరకలేదు</string>+ <!-- document alignment -->+ <string name="docalign_decode_failed">చిత్రాన్ని డీకోడ్ చేయలేకపోయాం.</string>+ <string name="docalign_detecting">మూలలను గుర్తిస్తోంది…</string>+ <string name="docalign_redetecting">మళ్లీ గుర్తిస్తోంది…</string>+ <string name="docalign_help">డాక్యుమెంట్ చుట్టూ కచ్చితమైన అంచు ఉంటే గుర్తింపు నాణ్యత మెరుగుపడుతుంది. గీతలు టెక్స్ట్కు సమాంతరంగా ఉండటం ముఖ్యం.\n\nజూమ్ చేయడం లేదా పాన్ చేయడం వల్ల అల్గోరిథమ్ సాధారణంగా డాక్యుమెంట్ను దానంతటదే గుర్తిస్తుంది, కానీ దొరకకపోతే మీరు మాన్యువల్గా సర్దుబాటు చేయవచ్చు.</string>+ <!-- how to use -->+ <string name="howto_section_other_apps">వేరే యాప్ల నుంచి</string>+ <string name="howto_share_title">అనువదించడానికి షేర్ చేయి</string>+ <string name="howto_share_body">ఏ యాప్ నుంచైనా టెక్స్ట్, లింక్లు లేదా చిత్రాలను షేర్ చేసి అనువదించండి.</string>+ <string name="howto_copy_title">వేరే యాప్ల నుంచి బయటకు రాకుండా అనువదించు</string>+ <string name="howto_copy_body">ఎక్కడైనా టెక్స్ట్ను సెలెక్ట్ చేసి, కాపీ టూల్బార్లో \"అనువదించు\" నొక్కితే అనువాదం ఒక చిన్న పాపప్లో కనిపిస్తుంది.</string>+ <string name="howto_section_in_app">యాప్ లోపల</string>+ <string name="howto_docs_title">డాక్యుమెంట్లు, చిత్రాలను అనువదించు</string>+ <string name="howto_docs_body">చిత్రాలను లేదా EPUB, PDF, TXT ఫైళ్లను అనువదించడానికి Documents ట్యాబ్ను తెరవండి.</string>+ <string name="howto_dict_title">నిఘంటువులో వెతుకు</string>+ <string name="howto_dict_body">అర్థం చూడటానికి అనువాదంలోని ఏ పదాన్నైనా నొక్కి పట్టుకోండి. డేటా Wiktionary నుంచి తీసుకోబడింది.</string>+ <string name="howto_voice_title">వాయిస్ లేదా వేగాన్ని మార్చు</string>+ <string name="howto_voice_body">వేరే వాయిస్ను ఎంచుకోవడానికి లేదా ప్లేబ్యాక్ వేగాన్ని సర్దుబాటు చేయడానికి ప్లే బటన్ను నొక్కి పట్టుకోండి.</string>+ <!-- feature row labels -->+ <string name="feature_translation">అనువాదం</string>+ <string name="feature_dictionary">నిఘంటువు</string>+ <string name="feature_tts">వాయిస్</string>+ <!-- misc -->+ <string name="detected_translate_from">ఈ భాష నుంచి అనువదించు</string>+ <string name="detected_missing_language">భాష లేదు</string>+ <string name="main_input_placeholder">టెక్స్ట్ నమోదు చేయండి</string>+ <string name="aidl_target_unavailable">లక్ష్య భాష అందుబాటులో లేదు</string>+</resources>diff --git a/OCR-translation/src/main/res/values-th/strings.xml b/OCR-translation/src/main/res/values-th/strings.xmlnew file mode 100644index 0000000..dfe1446--- /dev/null+++ b/OCR-translation/src/main/res/values-th/strings.xml@@ -0,0 +1,216 @@+<?xml version="1.0" encoding="utf-8"?>+<resources>+ <string name="stop">หยุด</string>+ <string name="pause">หยุดชั่วคราว</string>+ <string name="resume">เล่นต่อ</string>+ <string name="region_select_menu">กำหนดพื้นที่การแปล</string>+ <string name="screen_translate_needs_source">ระบุภาษาต้นทาง</string>+ <string name="live_tile_label">แปลหน้าจอแบบสด</string>+ <string name="translate_text">แปล</string>+ <string name="translate_link">แปลลิงก์</string>+ <string name="accessibility_service_description">เปิดใช้บริการนี้เพื่อแปลข้อความบนหน้าจอ แตะปุ่มแปลแบบลอยเพื่อแปลหน้าจอปัจจุบัน หรือเริ่มการแปลหน้าจอแบบสด</string>+ <string name="tap_to_translate_title">เปิดแปลด่วนแล้ว</string>+ <string name="tap_to_translate_body">แตะเพื่อเปิดหน้าต่างป๊อปอัปของตัวแปล</string>+ <string name="tap_to_translate_channel">แปลด่วน</string>+ <string name="tap_to_translate_channel_description">การแจ้งเตือนแบบถาวรเพื่อเข้าถึงหน้าต่างป๊อปอัปของตัวแปลได้อย่างรวดเร็ว</string>+ <string name="quick_tile_label">แปล</string>+ <!-- common -->+ <string name="common_ok">ตกลง</string>+ <string name="common_cancel">ยกเลิก</string>+ <string name="common_done">เสร็จ</string>+ <string name="common_grant">อนุญาต</string>+ <string name="common_manage">จัดการ</string>+ <!-- settings -->+ <string name="settings_title">การตั้งค่า</string>+ <string name="settings_languages">ภาษา</string>+ <string name="settings_language_packs">แพ็กภาษา</string>+ <string name="settings_general">ทั่วไป</string>+ <string name="settings_font_size">ขนาดตัวอักษร</string>+ <string name="settings_font_sample">นี่คือข้อความตัวอย่าง</string>+ <string name="settings_tap_notification">การแจ้งเตือนแปลด่วน</string>+ <string name="settings_tap_notification_desc">การแจ้งเตือนแบบถาวรที่เปิดหน้าต่างป๊อปอัป</string>+ <string name="settings_web_translator">ตัวแปลเว็บ</string>+ <string name="settings_clear_browsing">ล้างข้อมูลการเรียกดูเมื่อปิด</string>+ <string name="settings_clear_browsing_desc">ลบคุกกี้ แคช และที่จัดเก็บข้อมูลในเครื่อง</string>+ <string name="settings_tts_section">อ่านออกเสียงข้อความ</string>+ <string name="settings_tts_read_urls_hashtags">อ่าน URL และแฮชแท็ก</string>+ <string name="settings_popup_settings">ป๊อปอัป</string>+ <string name="settings_popup_desc">ป๊อปอัปจะปรากฏขึ้นเมื่อเลือก \'แปล\' จากเมนูการเลือกข้อความ</string>+ <string name="settings_hide_input">ซ่อนข้อความที่ป้อน</string>+ <string name="settings_popup_position">ตำแหน่งป๊อปอัป</string>+ <string name="settings_popup_size">ขนาดป๊อปอัป: %1$d%%</string>+ <string name="settings_screen_translation">การแปลหน้าจอ</string>+ <string name="settings_screen_translation_desc">แปลข้อความซ้อนทับบนแอปอื่นได้โดยตรง</string>+ <string name="settings_floating_button">ปุ่มแสดงตลอด</string>+ <string name="settings_floating_button_desc">ต้องใช้สิทธิ์การช่วยเหลือพิเศษ</string>+ <string name="settings_shortcut">แปลหน้าจอด้วยทางลัด</string>+ <string name="settings_shortcut_desc">กดค้างที่ปุ่มโฮมหรือปุ่มเปิดปิดเพื่อเรียกใช้</string>+ <string name="settings_on_shortcut">เมื่อเรียกใช้ทางลัด</string>+ <string name="settings_ocr">รูปภาพ</string>+ <string name="settings_background_mode">แทนที่ข้อความด้วย</string>+ <string name="settings_min_confidence">ความเชื่อมั่นขั้นต่ำ: %1$d%%</string>+ <string name="settings_max_image_size">ขนาดรูปภาพสูงสุด: %1$dpx</string>+ <string name="settings_advanced">ขั้นสูง</string>+ <string name="settings_catalog_url">URL ของแคตตาล็อก</string>+ <string name="settings_external_storage">ใช้ที่จัดเก็บข้อมูลภายนอก</string>+ <string name="settings_disable_autodetect">ปิดการตรวจจับภาษาอัตโนมัติ</string>+ <string name="settings_translit_output">แสดงการถอดอักษรของข้อความที่แปลแล้ว</string>+ <string name="settings_translit_input">แสดงการถอดอักษรของข้อความต้นฉบับ</string>+ <string name="settings_translit_japanese_spaces">เพิ่มช่องว่างในการถอดอักษรภาษาญี่ปุ่น</string>+ <string name="settings_translate_pdf_images">แปลรูปภาพในไฟล์ PDF</string>+ <string name="settings_camera_live_default">แปลกล้องแบบสดเป็นค่าเริ่มต้น</string>+ <string name="settings_register_browser">ลงทะเบียนเป็นเบราว์เซอร์</string>+ <string name="settings_register_browser_desc">เสนอให้แปลลิงก์จากแอปอื่น</string>+ <string name="settings_external_storage_perm_title">สิทธิ์ที่จัดเก็บข้อมูลภายนอก</string>+ <string name="settings_about">เกี่ยวกับ</string>+ <string name="settings_version">เวอร์ชัน %1$s</string>+ <string name="settings_no_languages_available">ไม่มีภาษาให้ใช้งาน</string>+ <string name="settings_default_from">ภาษาต้นทางเริ่มต้น</string>+ <string name="settings_default_to">ภาษาปลายทางเริ่มต้น</string>+ <string name="settings_adblock_support">บล็อกโฆษณา</string>+ <string name="settings_about_get_help">ขอความช่วยเหลือ / รายงานปัญหา</string>+ <string name="settings_logs_copied">คัดลอกบันทึกของแอปไปยังคลิปบอร์ดแล้ว</string>+ <string name="settings_about_support">สนับสนุนการพัฒนา</string>+ <string name="settings_external_storage_perm_body">หากต้องการเก็บไฟล์การแปลไว้ในโฟลเดอร์เอกสารของคุณ แอปนี้ต้องการสิทธิ์ในการจัดการไฟล์ทั้งหมด\nระบบจะพาคุณไปที่การตั้งค่า ซึ่งคุณสามารถให้สิทธิ์ \'อนุญาตให้เข้าถึงเพื่อจัดการไฟล์ทั้งหมด\' ได้</string>+ <!-- language manager / setup / how-to -->+ <string name="langmgr_voices">เสียง</string>+ <string name="voice_section_downloaded">ดาวน์โหลดแล้ว</string>+ <string name="voice_section_available">พร้อมใช้งาน</string>+ <string name="langmgr_default">ค่าเริ่มต้น</string>+ <string name="langmgr_filter">กรองภาษา</string>+ <string name="langmgr_ocr_upgrade_available">มีโมเดลตรวจจับข้อความที่ปรับปรุงแล้วให้ใช้งาน</string>+ <string name="langmgr_delete_shared_title">ลบพจนานุกรมที่ใช้ร่วมกันหรือไม่</string>+ <string name="langmgr_delete_shared_body">พจนานุกรมนี้ใช้ร่วมกับ %1$s\nการลบจะนำพจนานุกรมออกสำหรับทั้งหมด</string>+ <string name="langmgr_download_size">ดาวน์โหลด %1$s</string>+ <string name="langmgr_repair_needed">คุณสมบัติที่ดาวน์โหลดบางอย่างมีไฟล์ขาดหายไปและจะไม่ทำงานจนกว่าจะซ่อมแซม</string>+ <string name="langmgr_repair_size">ซ่อมแซม %1$s</string>+ <string name="nolang_title">ตั้งค่าภาษา</string>+ <string name="nolang_prompt">ดาวน์โหลดแพ็กภาษาเพื่อเริ่มแปล</string>+ <string name="howto_title">วิธีใช้</string>+ <!-- image capture / voice / dictionary / language selector -->+ <string name="image_no_crop_remote">ไม่สามารถครอบตัดรูปภาพระยะไกลได้โดยตรง</string>+ <string name="image_open_failed">เปิดไฟล์ไม่สำเร็จ</string>+ <string name="image_source_screen">หน้าจอ</string>+ <string name="image_source_document">เอกสาร</string>+ <string name="image_source_photos">รูปภาพ</string>+ <string name="image_source_gallery">แกลเลอรี</string>+ <string name="image_source_camera">กล้อง</string>+ <string name="voice_playback_speed">ความเร็วในการเล่น</string>+ <string name="voice_label">เสียง</string>+ <string name="voice_default">เสียงเริ่มต้น</string>+ <string name="langsel_auto">✨ อัตโนมัติ</string>+ <string name="dict_also_as">หรือเรียกว่า:</string>+ <!-- camera / browser / screen translate -->+ <string name="camera_permission_rationale">ต้องใช้สิทธิ์กล้องเพื่อการแปลแบบสด</string>+ <string name="camera_need_ocr_models">คุณต้องดาวน์โหลดโมเดลอ่านข้อความจากรูปภาพสำหรับภาษานี้</string>+ <string name="browser_no_source_language">ไม่มีภาษาต้นทางให้ใช้งาน ติดตั้งภาษาจากหน้าจอหลักก่อน หรือกำหนดภาษาต้นทางเริ่มต้นในการตั้งค่า</string>+ <string name="browser_reader_unavailable">โหมดอ่านไม่พร้อมใช้งานสำหรับหน้านี้</string>+ <string name="browser_translate_image">แปลรูปภาพ</string>+ <string name="screen_translating_notification">กำลังแปลหน้าจอ</string>+ <!-- enums -->+ <string name="align_top">บน</string>+ <string name="align_middle">กลาง</string>+ <string name="align_bottom">ล่าง</string>+ <string name="assistant_action_still_image">แปลครั้งเดียว</string>+ <string name="assistant_action_live_screen">เริ่มการแปลแบบสด</string>+ <string name="background_mode_white_on_black">ตัวอักษรขาวบนพื้นดำ</string>+ <string name="background_mode_black_on_white">ตัวอักษรดำบนพื้นขาว</string>+ <string name="background_mode_auto_detect">สีของรูปภาพต้นฉบับ</string>+ <!-- tts / speech errors -->+ <string name="tts_nothing_to_speak">ไม่มีข้อความให้อ่านออกเสียง</string>+ <string name="tts_catalog_unavailable">แคตตาล็อกไม่พร้อมใช้งาน</string>+ <string name="tts_no_voice">ไม่ได้ติดตั้งเสียงสำหรับ %1$s</string>+ <string name="tts_synthesis_failed">สังเคราะห์เสียงสำหรับ %1$s ไม่สำเร็จ</string>+ <string name="tts_sample_fallback">นี่คือตัวอย่างเสียงพูดจาก Offline Translator</string>+ <!-- translation -->+ <string name="translation_error">ข้อผิดพลาดในการแปล: %1$s</string>+ <!-- download errors -->+ <string name="download_failed_core">ดาวน์โหลด %1$s ไม่สำเร็จ</string>+ <string name="download_failed_ocr">ดาวน์โหลดข้อมูลอ่านข้อความจากรูปภาพของ %1$s ไม่สำเร็จ</string>+ <string name="download_failed_ocr_batch">ดาวน์โหลดชุดข้อมูลอ่านข้อความจากรูปภาพไม่สำเร็จ</string>+ <string name="download_failed_dictionary">ดาวน์โหลดพจนานุกรมของ %1$s ไม่สำเร็จ</string>+ <string name="download_failed_tts">ดาวน์โหลดเสียงของ %1$s ไม่สำเร็จ</string>+ <string name="download_failed_adblock">ดาวน์โหลดข้อมูลบล็อกโฆษณาไม่สำเร็จ</string>+ <string name="download_failed_repair">ดาวน์โหลดการซ่อมแซมไม่สำเร็จ</string>+ <string name="download_catalog_unavailable">แคตตาล็อกไม่พร้อมใช้งาน</string>+ <string name="download_catalog_save_failed">บันทึกแคตตาล็อกไม่สำเร็จ</string>+ <string name="download_unknown_error">ข้อผิดพลาดที่ไม่รู้จัก</string>+ <string name="download_catalog_failed">ดาวน์โหลดแคตตาล็อกไม่สำเร็จ: %1$s</string>+ <!-- assistant overlay status -->+ <string name="assistant_invoke_prompt">เรียกใช้ผู้ช่วยนี้บนข้อความเพื่อแปล</string>+ <string name="assistant_collecting_context">กำลังรวบรวมบริบทของหน้าจอ…</string>+ <string name="assistant_screenshot_disabled">การเข้าถึงภาพหน้าจอถูกปิดสำหรับผู้ช่วยนี้ เปิดใช้งานได้ในการตั้งค่าผู้ช่วยของระบบ</string>+ <string name="assistant_no_screen_data">ไม่ได้รับข้อมูลหน้าจอ เปิดใช้ \'ใช้ภาพหน้าจอ\' สำหรับผู้ช่วยนี้</string>+ <string name="assistant_no_screenshot">แอปนี้ไม่ได้ให้ภาพหน้าจอ</string>+ <string name="assistant_set_source_ocr">กำหนดภาษาต้นทางเริ่มต้นสำหรับการอ่านข้อความจากรูปภาพ</string>+ <string name="assistant_langs_not_ready">ภาษาสำหรับการแปลยังไม่พร้อม ลองอีกครั้ง</string>+ <string name="assistant_ocr_failed">อ่านข้อความจากรูปภาพไม่สำเร็จ</string>+ <string name="ocr_models_missing">ไม่มีโมเดลการอ่านข้อความ เปิดจัดการภาษาในแอปเพื่อซ่อมแซม</string>+ <string name="assistant_set_source_live">กำหนดภาษาต้นทางเริ่มต้นในการตั้งค่าเพื่อใช้การแปลหน้าจอแบบสด</string>+ <!-- migration gate -->+ <string name="migration_updating_speech_models">กำลังอัปเดตโมเดลเสียงพูด</string>+ <string name="migration_accept_convert">ยอมรับและแปลง</string>+ <string name="migration_delete_all">ลบทั้งหมดแทน</string>+ <string name="migration_converting">กำลังแปลง %1$d จาก %2$d</string>+ <string name="migration_optimizing">กำลังปรับโมเดลให้เหมาะสม</string>+ <plurals name="migration_convert_prompt">+ <item quantity="other">คุณมีโมเดลเสียงพูด %1$d โมเดลที่ต้องแปลงเป็นรูปแบบใหม่ จะใช้เวลาประมาณ %2$d วินาที คุณจะประหยัดพื้นที่ดิสก์ได้ %3$.0f MB</item>+ </plurals>+ <!-- document translation notification + progress -->+ <string name="doc_notif_translating">กำลังแปลไฟล์</string>+ <string name="doc_notif_translated">แปลไฟล์แล้ว</string>+ <string name="doc_notif_phase_text">ข้อความ %1$d%%</string>+ <string name="doc_notif_phase_images">รูปภาพ %1$d/%2$d</string>+ <string name="doc_notif_phase_raster">หน้าบิตแมป %1$d/%2$d</string>+ <string name="doc_notif_channel_name">การแปลเอกสาร</string>+ <string name="doc_notif_channel_desc">แสดงความคืบหน้าขณะแปลเอกสาร</string>+ <string name="doc_progress_preparing">กำลังเตรียมไฟล์</string>+ <string name="doc_progress_translating">กำลังแปล</string>+ <string name="doc_progress_translated">แปลไฟล์แล้ว</string>+ <string name="doc_progress_saving">กำลังบันทึกไฟล์ที่แปลแล้ว</string>+ <string name="doc_translation_failed">แปลเอกสารไม่สำเร็จ</string>+ <string name="doc_url_unsupported">ดาวน์โหลดเอกสารและเปิดด้วยแอปแทน</string>+ <!-- document configure sheet -->+ <string name="document_wrap_columns">ตัดบรรทัดที่ %1$d คอลัมน์</string>+ <string name="document_translate_pdf_images">แปลรูปภาพใน PDF</string>+ <string name="layout_preserve">คงการขึ้นบรรทัดใหม่</string>+ <string name="layout_reflow">จัดเรียงใหม่เป็นย่อหน้า</string>+ <string name="layout_reflow_wrap">จัดเรียงใหม่และตัดบรรทัด</string>+ <!-- common (additional) -->+ <string name="common_open">เปิด</string>+ <string name="common_close">ปิด</string>+ <string name="common_save">บันทึก</string>+ <!-- translator app -->+ <string name="translator_translated_file">ไฟล์ที่แปลแล้ว: %1$s</string>+ <string name="translator_document_saved">บันทึกเอกสารแล้ว</string>+ <string name="translator_document_save_failed">บันทึกเอกสารไม่สำเร็จ</string>+ <string name="translator_audio_playback_failed">เล่นเสียงไม่สำเร็จ: %1$s</string>+ <string name="translator_no_app_to_open">ไม่พบแอปสำหรับเปิดไฟล์นี้</string>+ <!-- document alignment -->+ <string name="docalign_decode_failed">ไม่สามารถถอดรหัสรูปภาพได้</string>+ <string name="docalign_detecting">กำลังตรวจหามุม…</string>+ <string name="docalign_redetecting">กำลังตรวจหาอีกครั้ง…</string>+ <string name="docalign_help">ขอบเขตที่แม่นยำรอบเอกสารช่วยเพิ่มคุณภาพการอ่านข้อความ สิ่งสำคัญคือเส้นต้องขนานกับข้อความ\n\nการซูมหรือเลื่อนภาพมักทำให้อัลกอริทึมตรวจจับเอกสารได้โดยอัตโนมัติ แต่คุณยังปรับเองได้หากตรวจไม่พบ</string>+ <!-- how to use -->+ <string name="howto_section_other_apps">จากแอปอื่น</string>+ <string name="howto_share_title">แชร์เพื่อแปล</string>+ <string name="howto_share_body">แชร์ข้อความ ลิงก์ หรือรูปภาพจากแอปใดก็ได้เพื่อแปล</string>+ <string name="howto_copy_title">แปลโดยไม่ต้องออกจากแอปอื่น</string>+ <string name="howto_copy_body">เลือกข้อความที่ใดก็ได้ แล้วแตะ \"แปล\" ในแถบเครื่องมือคัดลอกเพื่อดูคำแปลในป๊อปอัปขนาดกะทัดรัด</string>+ <string name="howto_section_in_app">ภายในแอป</string>+ <string name="howto_docs_title">แปลเอกสารและรูปภาพ</string>+ <string name="howto_docs_body">เปิดแท็บเอกสารเพื่อแปลรูปภาพหรือไฟล์ EPUB, PDF และ TXT</string>+ <string name="howto_dict_title">ค้นหาในพจนานุกรม</string>+ <string name="howto_dict_body">กดค้างที่คำใดก็ได้ในคำแปลเพื่อดูความหมาย ข้อมูลจาก Wiktionary</string>+ <string name="howto_voice_title">เปลี่ยนเสียงหรือความเร็ว</string>+ <string name="howto_voice_body">กดค้างที่ปุ่มเล่นเพื่อเลือกเสียงอื่นหรือปรับความเร็วในการเล่น</string>+ <!-- feature row labels -->+ <string name="feature_translation">การแปล</string>+ <string name="feature_dictionary">พจนานุกรม</string>+ <string name="feature_tts">เสียง</string>+ <!-- misc -->+ <string name="detected_translate_from">แปลจาก</string>+ <string name="detected_missing_language">ไม่มีภาษา</string>+ <string name="main_input_placeholder">ป้อนข้อความ</string>+ <string name="aidl_target_unavailable">ไม่มีภาษาปลายทางให้ใช้งาน</string>+</resources>diff --git a/OCR-translation/src/main/res/values-tr/strings.xml b/OCR-translation/src/main/res/values-tr/strings.xmlnew file mode 100644index 0000000..fcbab0f--- /dev/null+++ b/OCR-translation/src/main/res/values-tr/strings.xml@@ -0,0 +1,217 @@+<?xml version="1.0" encoding="utf-8"?>+<resources>+ <string name="stop">Durdur</string>+ <string name="pause">Duraklat</string>+ <string name="resume">Devam et</string>+ <string name="region_select_menu">Çeviri alanını belirle</string>+ <string name="screen_translate_needs_source">Kaynak dili belirt</string>+ <string name="live_tile_label">Ekranı canlı çevir</string>+ <string name="translate_text">Çevir</string>+ <string name="translate_link">Bağlantıyı çevir</string>+ <string name="accessibility_service_description">Ekrandaki metni çevirmek için bu hizmeti etkinleştir. Mevcut ekranı çevirmek için kayan çeviri düğmesine dokun ya da canlı ekran çevirisi başlat.</string>+ <string name="tap_to_translate_title">Hızlı Çeviri açık</string>+ <string name="tap_to_translate_body">Çevirmen penceresini açmak için dokun</string>+ <string name="tap_to_translate_channel">Hızlı Çeviri</string>+ <string name="tap_to_translate_channel_description">Çevirmen penceresine hızlı erişim için kalıcı bildirim</string>+ <string name="quick_tile_label">Çevir</string>+ <!-- common -->+ <string name="common_ok">Tamam</string>+ <string name="common_cancel">İptal</string>+ <string name="common_done">Bitti</string>+ <string name="common_grant">İzin ver</string>+ <string name="common_manage">Yönet</string>+ <!-- settings -->+ <string name="settings_title">Ayarlar</string>+ <string name="settings_languages">Diller</string>+ <string name="settings_language_packs">Dil paketleri</string>+ <string name="settings_general">Genel</string>+ <string name="settings_font_size">Yazı tipi boyutu</string>+ <string name="settings_font_sample">Bu bir örnek metindir</string>+ <string name="settings_tap_notification">Hızlı Çeviri bildirimi</string>+ <string name="settings_tap_notification_desc">Pencereyi açan kalıcı bildirim.</string>+ <string name="settings_web_translator">Web çevirmeni</string>+ <string name="settings_clear_browsing">Kapatınca tarama verilerini sil</string>+ <string name="settings_clear_browsing_desc">Çerezleri, önbelleği ve yerel depolamayı siler.</string>+ <string name="settings_tts_section">Metin okuma</string>+ <string name="settings_tts_read_urls_hashtags">URL\'leri ve etiketleri oku</string>+ <string name="settings_popup_settings">Açılır pencere</string>+ <string name="settings_popup_desc">Metin seçim menüsünden \'Çevir\' seçildiğinde açılır pencere görünür</string>+ <string name="settings_hide_input">Girişi gizle</string>+ <string name="settings_popup_position">Açılır pencere konumu</string>+ <string name="settings_popup_size">Pencere boyutu: %1$d%%</string>+ <string name="settings_screen_translation">Ekran çevirisi</string>+ <string name="settings_screen_translation_desc">Metni doğrudan diğer uygulamaların üzerinde çevir.</string>+ <string name="settings_floating_button">Her zaman açık düğme</string>+ <string name="settings_floating_button_desc">Erişilebilirlik izni gerektirir</string>+ <string name="settings_shortcut">Kısayolla ekranı çevir</string>+ <string name="settings_shortcut_desc">Tetiklemek için ana ekran ya da güç tuşuna basılı tut</string>+ <string name="settings_on_shortcut">Kısayol çağrıldığında</string>+ <string name="settings_ocr">Görseller</string>+ <string name="settings_background_mode">Metnin yerine şunu koy</string>+ <string name="settings_min_confidence">Min. güven: %1$d%%</string>+ <string name="settings_max_image_size">Maks. görsel boyutu: %1$dpx</string>+ <string name="settings_advanced">Gelişmiş</string>+ <string name="settings_catalog_url">Katalog URL\'si</string>+ <string name="settings_external_storage">Harici depolamayı kullan</string>+ <string name="settings_disable_autodetect">Otomatik dil algılamayı kapat</string>+ <string name="settings_translit_output">Çevrilen metin için harf çevirisini göster</string>+ <string name="settings_translit_input">Özgün metin için harf çevirisini göster</string>+ <string name="settings_translit_japanese_spaces">Japonca harf çevirisine boşluk ekle</string>+ <string name="settings_translate_pdf_images">PDF\'lerdeki görselleri çevir</string>+ <string name="settings_camera_live_default">Varsayılan olarak kamerayı canlı çevir</string>+ <string name="settings_register_browser">Tarayıcı olarak kaydet</string>+ <string name="settings_register_browser_desc">Diğer uygulamalardan gelen bağlantıları çevirmeyi öner.</string>+ <string name="settings_external_storage_perm_title">Harici depolama izni</string>+ <string name="settings_about">Hakkında</string>+ <string name="settings_version">Sürüm %1$s</string>+ <string name="settings_no_languages_available">Kullanılabilir dil yok</string>+ <string name="settings_default_from">Varsayılan \'kaynak\' dil</string>+ <string name="settings_default_to">Varsayılan \'hedef\' dil</string>+ <string name="settings_adblock_support">Reklam engelleme</string>+ <string name="settings_about_get_help">Yardım al / sorun bildir</string>+ <string name="settings_logs_copied">Uygulama günlükleri panoya kopyalandı</string>+ <string name="settings_about_support">Geliştirmeyi destekle</string>+ <string name="settings_external_storage_perm_body">Çeviri dosyalarını Belgeler klasörüne kaydetmek için bu uygulamanın tüm dosyaları yönetme erişimine ihtiyacı var.\n\'Tüm dosyaları yönetme erişimine izin ver\' iznini verebileceğin Ayarlar\'a yönlendirileceksin.</string>+ <!-- language manager / setup / how-to -->+ <string name="langmgr_voices">Sesler</string>+ <string name="voice_section_downloaded">İNDİRİLENLER</string>+ <string name="voice_section_available">KULLANILABİLİR</string>+ <string name="langmgr_default">VARSAYILAN</string>+ <string name="langmgr_filter">Dilleri filtrele</string>+ <string name="langmgr_ocr_upgrade_available">Geliştirilmiş bir metin algılama modeli mevcut.</string>+ <string name="langmgr_delete_shared_title">Paylaşılan sözlük silinsin mi?</string>+ <string name="langmgr_delete_shared_body">Bu sözlük %1$s ile paylaşılıyor.\nSilersen sözlük hepsi için kaldırılır.</string>+ <string name="langmgr_download_size">%1$s indir</string>+ <string name="langmgr_repair_needed">İndirilen bazı özelliklerin dosyaları eksik ve onarılana kadar çalışmayacak.</string>+ <string name="langmgr_repair_size">%1$s onar</string>+ <string name="nolang_title">Dil kurulumu</string>+ <string name="nolang_prompt">Çevirmeye başlamak için dil paketleri indir</string>+ <string name="howto_title">Nasıl kullanılır</string>+ <!-- image capture / voice / dictionary / language selector -->+ <string name="image_no_crop_remote">Uzaktaki görseller doğrudan kırpılamaz</string>+ <string name="image_open_failed">Dosya açılamadı</string>+ <string name="image_source_screen">Ekran</string>+ <string name="image_source_document">Belge</string>+ <string name="image_source_photos">Fotoğraflar</string>+ <string name="image_source_gallery">Galeri</string>+ <string name="image_source_camera">Kamera</string>+ <string name="voice_playback_speed">Oynatma hızı</string>+ <string name="voice_label">Ses</string>+ <string name="voice_default">Varsayılan ses</string>+ <string name="langsel_auto">✨ Otomatik</string>+ <string name="dict_also_as">Şöyle de:</string>+ <!-- camera / browser / screen translate -->+ <string name="camera_permission_rationale">Canlı çeviri için kamera izni gerekiyor.</string>+ <string name="camera_need_ocr_models">Bu dil için görsellerdeki metni tanıma modellerini indirmen gerekiyor</string>+ <string name="browser_no_source_language">Kullanılabilir kaynak dil yok. Önce ana ekrandan birini yükle ya da ayarlardan varsayılan bir kaynak dil belirle.</string>+ <string name="browser_reader_unavailable">Bu sayfa için okuyucu modu kullanılamıyor</string>+ <string name="browser_translate_image">Görseli çevir</string>+ <string name="screen_translating_notification">Ekran çevriliyor</string>+ <!-- enums -->+ <string name="align_top">Üst</string>+ <string name="align_middle">Orta</string>+ <string name="align_bottom">Alt</string>+ <string name="assistant_action_still_image">Bir kez çevir</string>+ <string name="assistant_action_live_screen">Canlı çeviriyi başlat</string>+ <string name="background_mode_white_on_black">Siyah üzerine beyaz</string>+ <string name="background_mode_black_on_white">Beyaz üzerine siyah</string>+ <string name="background_mode_auto_detect">Özgün görsel renkleri</string>+ <!-- tts / speech errors -->+ <string name="tts_nothing_to_speak">Seslendirilecek bir şey yok</string>+ <string name="tts_catalog_unavailable">Katalog kullanılamıyor</string>+ <string name="tts_no_voice">%1$s için yüklü ses yok</string>+ <string name="tts_synthesis_failed">%1$s için ses sentezi başarısız oldu</string>+ <string name="tts_sample_fallback">Bu, Offline Translator\'dan bir seslendirme örneğidir.</string>+ <!-- translation -->+ <string name="translation_error">Çeviri hatası: %1$s</string>+ <!-- download errors -->+ <string name="download_failed_core">%1$s indirilemedi</string>+ <string name="download_failed_ocr">%1$s görsel metin tanıma indirmesi başarısız oldu</string>+ <string name="download_failed_ocr_batch">Görsel metin tanıma toplu indirmesi başarısız oldu</string>+ <string name="download_failed_dictionary">%1$s sözlük indirmesi başarısız oldu</string>+ <string name="download_failed_tts">%1$s ses indirmesi başarısız oldu</string>+ <string name="download_failed_adblock">Reklam engelleyici indirmesi başarısız oldu</string>+ <string name="download_failed_repair">Onarım indirmesi başarısız oldu</string>+ <string name="download_catalog_unavailable">Katalog kullanılamıyor</string>+ <string name="download_catalog_save_failed">Katalog kaydedilemedi</string>+ <string name="download_unknown_error">Bilinmeyen hata</string>+ <string name="download_catalog_failed">Katalog indirilemedi: %1$s</string>+ <!-- assistant overlay status -->+ <string name="assistant_invoke_prompt">Bir metni çevirmek için bu asistanı metnin üzerinde çağır</string>+ <string name="assistant_collecting_context">Ekran içeriği toplanıyor…</string>+ <string name="assistant_screenshot_disabled">Bu asistan için ekran görüntüsü erişimi kapalı. Sistem asistanı ayarlarından etkinleştir.</string>+ <string name="assistant_no_screen_data">Ekran verisi alınmadı. Bu asistan için \'Ekran görüntüsü kullan\' seçeneğini etkinleştir.</string>+ <string name="assistant_no_screenshot">Bu uygulama bir ekran görüntüsü sağlamadı.</string>+ <string name="assistant_set_source_ocr">Görsellerdeki metni tanıma için varsayılan bir kaynak dil belirle.</string>+ <string name="assistant_langs_not_ready">Çeviri dilleri henüz hazır değil. Tekrar dene.</string>+ <string name="assistant_ocr_failed">Görseldeki metin tanınamadı</string>+ <string name="ocr_models_missing">Metin tanıma modelleri eksik. Onarmak için uygulamada Dilleri yönet\'i açın.</string>+ <string name="assistant_set_source_live">Canlı ekran çevirisini kullanmak için Ayarlar\'dan varsayılan bir kaynak dil belirle.</string>+ <!-- migration gate -->+ <string name="migration_updating_speech_models">Konuşma modelleri güncelleniyor</string>+ <string name="migration_accept_convert">Kabul et ve dönüştür</string>+ <string name="migration_delete_all">Bunun yerine hepsini sil</string>+ <string name="migration_converting">%2$d modelden %1$d. dönüştürülüyor</string>+ <string name="migration_optimizing">Modeller iyileştiriliyor</string>+ <plurals name="migration_convert_prompt">+ <item quantity="one">Yeni bir biçime dönüştürülecek %1$d seslendirme modelin var. Yaklaşık %2$d saniye sürecek. %3$.0f MB disk alanı kazanacaksın.</item>+ <item quantity="other">Yeni bir biçime dönüştürülecek %1$d seslendirme modelin var. Yaklaşık %2$d saniye sürecek. %3$.0f MB disk alanı kazanacaksın.</item>+ </plurals>+ <!-- document translation notification + progress -->+ <string name="doc_notif_translating">Dosya çevriliyor</string>+ <string name="doc_notif_translated">Dosya çevrildi</string>+ <string name="doc_notif_phase_text">Metin %1$d%%</string>+ <string name="doc_notif_phase_images">Görseller %1$d/%2$d</string>+ <string name="doc_notif_phase_raster">Bit eşlem sayfaları %1$d/%2$d</string>+ <string name="doc_notif_channel_name">Belge çevirisi</string>+ <string name="doc_notif_channel_desc">Belgeler çevrilirken ilerlemeyi gösterir</string>+ <string name="doc_progress_preparing">Dosya hazırlanıyor</string>+ <string name="doc_progress_translating">Çevriliyor</string>+ <string name="doc_progress_translated">Dosya çevrildi</string>+ <string name="doc_progress_saving">Çevrilen dosya kaydediliyor</string>+ <string name="doc_translation_failed">Belge çevirisi başarısız oldu</string>+ <string name="doc_url_unsupported">Bunun yerine belgeyi indirip uygulamayla aç</string>+ <!-- document configure sheet -->+ <string name="document_wrap_columns">%1$d sütunda kaydır</string>+ <string name="document_translate_pdf_images">PDF\'deki görselleri çevir</string>+ <string name="layout_preserve">Satır sonlarını koru</string>+ <string name="layout_reflow">Paragraflara dönüştür</string>+ <string name="layout_reflow_wrap">Paragraflara dönüştür ve kaydır</string>+ <!-- common (additional) -->+ <string name="common_open">Aç</string>+ <string name="common_close">Kapat</string>+ <string name="common_save">Kaydet</string>+ <!-- translator app -->+ <string name="translator_translated_file">Çevrilen dosya: %1$s</string>+ <string name="translator_document_saved">Belge kaydedildi</string>+ <string name="translator_document_save_failed">Belge kaydedilemedi</string>+ <string name="translator_audio_playback_failed">Ses oynatma başarısız oldu: %1$s</string>+ <string name="translator_no_app_to_open">Bu dosyayı açacak bir uygulama bulunamadı</string>+ <!-- document alignment -->+ <string name="docalign_decode_failed">Görsel çözümlenemedi.</string>+ <string name="docalign_detecting">Köşeler algılanıyor…</string>+ <string name="docalign_redetecting">Yeniden algılanıyor…</string>+ <string name="docalign_help">Belgenin çevresindeki kesin bir sınır, tanıma kalitesini artırır. Çizgilerin metne paralel olması önemlidir.\n\nYakınlaştırmak ya da kaydırmak genellikle algoritmanın belgeyi otomatik olarak yakalamasını sağlar, ancak bulunamazsa yine de elle ayarlayabilirsin.</string>+ <!-- how to use -->+ <string name="howto_section_other_apps">Diğer uygulamalardan</string>+ <string name="howto_share_title">Paylaşarak çevir</string>+ <string name="howto_share_body">Çevirmek için herhangi bir uygulamadan metin, bağlantı ya da görsel paylaş.</string>+ <string name="howto_copy_title">Diğer uygulamalardan çıkmadan çevir</string>+ <string name="howto_copy_body">Herhangi bir yerde metni seç, ardından kopyalama araç çubuğundaki \"Çevir\"e dokunarak çeviriyi kompakt bir pencerede gör.</string>+ <string name="howto_section_in_app">Uygulama içinde</string>+ <string name="howto_docs_title">Belgeleri ve görselleri çevir</string>+ <string name="howto_docs_body">Görselleri ya da EPUB, PDF ve TXT dosyalarını çevirmek için Belgeler sekmesini aç.</string>+ <string name="howto_dict_title">Sözlükte arama</string>+ <string name="howto_dict_body">Tanımını görmek için bir çevirideki herhangi bir kelimeye basılı tut. Veriler Wiktionary\'den alınmıştır.</string>+ <string name="howto_voice_title">Sesi ya da hızı değiştir</string>+ <string name="howto_voice_body">Farklı bir ses seçmek ya da oynatma hızını ayarlamak için oynat düğmesine basılı tut.</string>+ <!-- feature row labels -->+ <string name="feature_translation">Çeviri</string>+ <string name="feature_dictionary">Sözlük</string>+ <string name="feature_tts">Ses</string>+ <!-- misc -->+ <string name="detected_translate_from">Şu dilden çevir</string>+ <string name="detected_missing_language">Eksik dil</string>+ <string name="main_input_placeholder">Metin gir</string>+ <string name="aidl_target_unavailable">Hedef dil kullanılamıyor</string>+</resources>diff --git a/OCR-translation/src/main/res/values-uk/strings.xml b/OCR-translation/src/main/res/values-uk/strings.xmlnew file mode 100644index 0000000..eaabf5e--- /dev/null+++ b/OCR-translation/src/main/res/values-uk/strings.xml@@ -0,0 +1,219 @@+<?xml version="1.0" encoding="utf-8"?>+<resources>+ <string name="stop">Зупинити</string>+ <string name="pause">Пауза</string>+ <string name="resume">Відновити</string>+ <string name="region_select_menu">Задати область перекладу</string>+ <string name="screen_translate_needs_source">Вкажи мову оригіналу</string>+ <string name="live_tile_label">Перекладати екран наживо</string>+ <string name="translate_text">Перекласти</string>+ <string name="translate_link">Перекласти посилання</string>+ <string name="accessibility_service_description">Увімкни цю службу, щоб перекладати текст на екрані. Торкнися плаваючої кнопки перекладу, щоб перекласти поточний екран, або запусти переклад екрана наживо.</string>+ <string name="tap_to_translate_title">Швидкий переклад увімкнено</string>+ <string name="tap_to_translate_body">Торкнися, щоб відкрити вікно перекладача</string>+ <string name="tap_to_translate_channel">Швидкий переклад</string>+ <string name="tap_to_translate_channel_description">Постійне сповіщення для швидкого доступу до вікна перекладача</string>+ <string name="quick_tile_label">Перекласти</string>+ <!-- common -->+ <string name="common_ok">Гаразд</string>+ <string name="common_cancel">Скасувати</string>+ <string name="common_done">Готово</string>+ <string name="common_grant">Надати</string>+ <string name="common_manage">Керувати</string>+ <!-- settings -->+ <string name="settings_title">Налаштування</string>+ <string name="settings_languages">Мови</string>+ <string name="settings_language_packs">Мовні пакети</string>+ <string name="settings_general">Загальні</string>+ <string name="settings_font_size">Розмір шрифту</string>+ <string name="settings_font_sample">Це приклад тексту</string>+ <string name="settings_tap_notification">Сповіщення швидкого перекладу</string>+ <string name="settings_tap_notification_desc">Постійне сповіщення, що відкриває спливаюче вікно.</string>+ <string name="settings_web_translator">Веб-перекладач</string>+ <string name="settings_clear_browsing">Очищати дані перегляду при закритті</string>+ <string name="settings_clear_browsing_desc">Видаляє файли cookie, кеш і локальне сховище.</string>+ <string name="settings_tts_section">Синтез мовлення</string>+ <string name="settings_tts_read_urls_hashtags">Читати URL і хештеги</string>+ <string name="settings_popup_settings">Спливаюче вікно</string>+ <string name="settings_popup_desc">Спливаюче вікно з\'являється, коли ти вибираєш \'Перекласти\' в меню виділення тексту</string>+ <string name="settings_hide_input">Приховати ввід</string>+ <string name="settings_popup_position">Положення спливаючого вікна</string>+ <string name="settings_popup_size">Розмір вікна: %1$d%%</string>+ <string name="settings_screen_translation">Переклад екрана</string>+ <string name="settings_screen_translation_desc">Перекладай текст прямо поверх інших застосунків.</string>+ <string name="settings_floating_button">Постійна кнопка</string>+ <string name="settings_floating_button_desc">Потребує доступу до спеціальних можливостей</string>+ <string name="settings_shortcut">Перекладати екран за ярликом</string>+ <string name="settings_shortcut_desc">Утримуй кнопку «Додому» або живлення, щоб активувати</string>+ <string name="settings_on_shortcut">При виклику ярлика</string>+ <string name="settings_ocr">Зображення</string>+ <string name="settings_background_mode">Замінювати текст на</string>+ <string name="settings_min_confidence">Мін. впевненість: %1$d%%</string>+ <string name="settings_max_image_size">Макс. розмір зображення: %1$dpx</string>+ <string name="settings_advanced">Розширені</string>+ <string name="settings_catalog_url">URL каталогу</string>+ <string name="settings_external_storage">Використовувати зовнішнє сховище</string>+ <string name="settings_disable_autodetect">Вимкнути автоматичне визначення мови</string>+ <string name="settings_translit_output">Показувати транслітерацію перекладеного тексту</string>+ <string name="settings_translit_input">Показувати транслітерацію оригінального тексту</string>+ <string name="settings_translit_japanese_spaces">Додавати пробіли в транслітерації японської</string>+ <string name="settings_translate_pdf_images">Перекладати зображення в PDF</string>+ <string name="settings_camera_live_default">Перекладати камеру наживо за замовчуванням</string>+ <string name="settings_register_browser">Зареєструвати як браузер</string>+ <string name="settings_register_browser_desc">Пропонувати переклад посилань з інших застосунків.</string>+ <string name="settings_external_storage_perm_title">Дозвіл на зовнішнє сховище</string>+ <string name="settings_about">Про застосунок</string>+ <string name="settings_version">Версія %1$s</string>+ <string name="settings_no_languages_available">Немає доступних мов</string>+ <string name="settings_default_from">Мова оригіналу за замовчуванням</string>+ <string name="settings_default_to">Мова перекладу за замовчуванням</string>+ <string name="settings_adblock_support">Блокування реклами</string>+ <string name="settings_about_get_help">Отримати допомогу / повідомити про проблему</string>+ <string name="settings_logs_copied">Журнали застосунку скопійовано в буфер обміну</string>+ <string name="settings_about_support">Підтримати розробку</string>+ <string name="settings_external_storage_perm_body">Щоб зберігати файли перекладу в твоїй папці «Документи», цьому застосунку потрібен доступ для керування всіма файлами.\nТебе буде перенаправлено в Налаштування, де ти зможеш надати дозвіл \'Дозволити доступ для керування всіма файлами\'.</string>+ <!-- language manager / setup / how-to -->+ <string name="langmgr_voices">Голоси</string>+ <string name="voice_section_downloaded">ЗАВАНТАЖЕНІ</string>+ <string name="voice_section_available">ДОСТУПНІ</string>+ <string name="langmgr_default">ЗА ЗАМОВЧ.</string>+ <string name="langmgr_filter">Фільтрувати мови</string>+ <string name="langmgr_ocr_upgrade_available">Доступна покращена модель розпізнавання тексту.</string>+ <string name="langmgr_delete_shared_title">Видалити спільний словник?</string>+ <string name="langmgr_delete_shared_body">Цей словник спільний з %1$s.\nЯкщо його видалити, словник зникне для всіх них.</string>+ <string name="langmgr_download_size">Завантажити %1$s</string>+ <string name="langmgr_repair_needed">У деяких завантажених функцій відсутні файли, і вони не працюватимуть до відновлення.</string>+ <string name="langmgr_repair_size">Відновити %1$s</string>+ <string name="nolang_title">Налаштування мов</string>+ <string name="nolang_prompt">Завантаж мовні пакети, щоб почати перекладати</string>+ <string name="howto_title">Як користуватися</string>+ <!-- image capture / voice / dictionary / language selector -->+ <string name="image_no_crop_remote">Віддалені зображення не можна обрізати напряму</string>+ <string name="image_open_failed">Не вдалося відкрити файл</string>+ <string name="image_source_screen">Екран</string>+ <string name="image_source_document">Документ</string>+ <string name="image_source_photos">Фото</string>+ <string name="image_source_gallery">Галерея</string>+ <string name="image_source_camera">Камера</string>+ <string name="voice_playback_speed">Швидкість відтворення</string>+ <string name="voice_label">Голос</string>+ <string name="voice_default">Голос за замовчуванням</string>+ <string name="langsel_auto">✨ Авто</string>+ <string name="dict_also_as">Також як:</string>+ <!-- camera / browser / screen translate -->+ <string name="camera_permission_rationale">Для перекладу наживо потрібен дозвіл на камеру.</string>+ <string name="camera_need_ocr_models">Потрібно завантажити моделі розпізнавання тексту для цієї мови</string>+ <string name="browser_no_source_language">Немає доступної мови оригіналу. Спочатку встанови одну з головного екрана або задай мову оригіналу за замовчуванням у налаштуваннях.</string>+ <string name="browser_reader_unavailable">Режим читання недоступний для цієї сторінки</string>+ <string name="browser_translate_image">Перекласти зображення</string>+ <string name="screen_translating_notification">Переклад екрана</string>+ <!-- enums -->+ <string name="align_top">Зверху</string>+ <string name="align_middle">По центру</string>+ <string name="align_bottom">Знизу</string>+ <string name="assistant_action_still_image">Перекласти один раз</string>+ <string name="assistant_action_live_screen">Запустити переклад наживо</string>+ <string name="background_mode_white_on_black">Білий на чорному</string>+ <string name="background_mode_black_on_white">Чорний на білому</string>+ <string name="background_mode_auto_detect">Кольори оригінального зображення</string>+ <!-- tts / speech errors -->+ <string name="tts_nothing_to_speak">Нема чого озвучувати</string>+ <string name="tts_catalog_unavailable">Каталог недоступний</string>+ <string name="tts_no_voice">Немає встановленого голосу для %1$s</string>+ <string name="tts_synthesis_failed">Не вдалося синтезувати мовлення для %1$s</string>+ <string name="tts_sample_fallback">Це зразок озвучення від Offline Translator.</string>+ <!-- translation -->+ <string name="translation_error">Помилка перекладу: %1$s</string>+ <!-- download errors -->+ <string name="download_failed_core">Не вдалося завантажити %1$s</string>+ <string name="download_failed_ocr">Не вдалося завантажити модель розпізнавання тексту для %1$s</string>+ <string name="download_failed_ocr_batch">Не вдалося завантажити пакет моделей розпізнавання тексту</string>+ <string name="download_failed_dictionary">Не вдалося завантажити словник %1$s</string>+ <string name="download_failed_tts">Не вдалося завантажити голос %1$s</string>+ <string name="download_failed_adblock">Не вдалося завантажити блокувальник реклами</string>+ <string name="download_failed_repair">Не вдалося завантажити відновлення</string>+ <string name="download_catalog_unavailable">Каталог недоступний</string>+ <string name="download_catalog_save_failed">Не вдалося зберегти каталог</string>+ <string name="download_unknown_error">Невідома помилка</string>+ <string name="download_catalog_failed">Не вдалося завантажити каталог: %1$s</string>+ <!-- assistant overlay status -->+ <string name="assistant_invoke_prompt">Виклич цього помічника поверх тексту, щоб перекласти його</string>+ <string name="assistant_collecting_context">Збираю контекст екрана…</string>+ <string name="assistant_screenshot_disabled">Доступ до знімків екрана вимкнено для цього помічника. Увімкни його в системних налаштуваннях помічника.</string>+ <string name="assistant_no_screen_data">Не отримано даних екрана. Увімкни \'Використовувати знімок екрана\' для цього помічника.</string>+ <string name="assistant_no_screenshot">Цей застосунок не надав знімок екрана.</string>+ <string name="assistant_set_source_ocr">Задай мову оригіналу за замовчуванням для розпізнавання тексту.</string>+ <string name="assistant_langs_not_ready">Мови перекладу ще не готові. Спробуй ще раз.</string>+ <string name="assistant_ocr_failed">Не вдалося розпізнати текст</string>+ <string name="ocr_models_missing">Моделі розпізнавання тексту відсутні. Відкрийте керування мовами в застосунку, щоб відновити їх.</string>+ <string name="assistant_set_source_live">Задай мову оригіналу за замовчуванням у Налаштуваннях, щоб користуватися перекладом екрана наживо.</string>+ <!-- migration gate -->+ <string name="migration_updating_speech_models">Оновлення голосових моделей</string>+ <string name="migration_accept_convert">Прийняти й конвертувати</string>+ <string name="migration_delete_all">Натомість видалити все</string>+ <string name="migration_converting">Конвертування %1$d з %2$d</string>+ <string name="migration_optimizing">Оптимізація моделей</string>+ <plurals name="migration_convert_prompt">+ <item quantity="one">У тебе є %1$d голосова модель, яку потрібно конвертувати в новий формат. Це займе приблизно %2$d секунд. Ти звільниш %3$.0f MB місця на диску.</item>+ <item quantity="few">У тебе є %1$d голосові моделі, які потрібно конвертувати в новий формат. Це займе приблизно %2$d секунд. Ти звільниш %3$.0f MB місця на диску.</item>+ <item quantity="many">У тебе є %1$d голосових моделей, які потрібно конвертувати в новий формат. Це займе приблизно %2$d секунд. Ти звільниш %3$.0f MB місця на диску.</item>+ <item quantity="other">У тебе є %1$d голосової моделі, яку потрібно конвертувати в новий формат. Це займе приблизно %2$d секунд. Ти звільниш %3$.0f MB місця на диску.</item>+ </plurals>+ <!-- document translation notification + progress -->+ <string name="doc_notif_translating">Переклад файлу</string>+ <string name="doc_notif_translated">Файл перекладено</string>+ <string name="doc_notif_phase_text">Текст %1$d%%</string>+ <string name="doc_notif_phase_images">Зображення %1$d/%2$d</string>+ <string name="doc_notif_phase_raster">Растрові сторінки %1$d/%2$d</string>+ <string name="doc_notif_channel_name">Переклад документів</string>+ <string name="doc_notif_channel_desc">Показує прогрес під час перекладу документів</string>+ <string name="doc_progress_preparing">Підготовка файлу</string>+ <string name="doc_progress_translating">Переклад</string>+ <string name="doc_progress_translated">Файл перекладено</string>+ <string name="doc_progress_saving">Збереження перекладеного файлу</string>+ <string name="doc_translation_failed">Не вдалося перекласти документ</string>+ <string name="doc_url_unsupported">Завантаж документ і відкрий його в застосунку</string>+ <!-- document configure sheet -->+ <string name="document_wrap_columns">Переносити за %1$d стовпцями</string>+ <string name="document_translate_pdf_images">Перекладати зображення в PDF</string>+ <string name="layout_preserve">Зберігати розриви рядків</string>+ <string name="layout_reflow">Перекомпонувати в абзаци</string>+ <string name="layout_reflow_wrap">Перекомпонувати й переносити</string>+ <!-- common (additional) -->+ <string name="common_open">Відкрити</string>+ <string name="common_close">Закрити</string>+ <string name="common_save">Зберегти</string>+ <!-- translator app -->+ <string name="translator_translated_file">Перекладений файл: %1$s</string>+ <string name="translator_document_saved">Документ збережено</string>+ <string name="translator_document_save_failed">Не вдалося зберегти документ</string>+ <string name="translator_audio_playback_failed">Не вдалося відтворити аудіо: %1$s</string>+ <string name="translator_no_app_to_open">Не знайдено застосунку для відкриття цього файлу</string>+ <!-- document alignment -->+ <string name="docalign_decode_failed">Не вдалося декодувати зображення.</string>+ <string name="docalign_detecting">Виявлення кутів…</string>+ <string name="docalign_redetecting">Повторне виявлення…</string>+ <string name="docalign_help">Точний периметр навколо документа покращує якість розпізнавання. Важливо, щоб лінії були паралельні тексту.\n\nЗазвичай масштабування або переміщення допомагає алгоритму автоматично знайти документ, але ти все одно можеш налаштувати вручну, якщо його не знайдено.</string>+ <!-- how to use -->+ <string name="howto_section_other_apps">З інших застосунків</string>+ <string name="howto_share_title">Поділися, щоб перекласти</string>+ <string name="howto_share_body">Поділися текстом, посиланнями або зображеннями з будь-якого застосунку, щоб перекласти їх.</string>+ <string name="howto_copy_title">Перекладай, не виходячи з інших застосунків</string>+ <string name="howto_copy_body">Виділи текст будь-де, а потім торкнися \"Перекласти\" на панелі копіювання, щоб побачити переклад у компактному вікні.</string>+ <string name="howto_section_in_app">Усередині застосунку</string>+ <string name="howto_docs_title">Перекладай документи та зображення</string>+ <string name="howto_docs_body">Відкрий вкладку «Документи», щоб перекладати зображення або файли EPUB, PDF і TXT.</string>+ <string name="howto_dict_title">Пошук у словнику</string>+ <string name="howto_dict_body">Утримуй будь-яке слово в перекладі, щоб побачити його визначення. Дані з Wiktionary.</string>+ <string name="howto_voice_title">Зміни голос або швидкість</string>+ <string name="howto_voice_body">Утримуй кнопку відтворення, щоб вибрати інший голос або змінити швидкість відтворення.</string>+ <!-- feature row labels -->+ <string name="feature_translation">Переклад</string>+ <string name="feature_dictionary">Словник</string>+ <string name="feature_tts">Голос</string>+ <!-- misc -->+ <string name="detected_translate_from">Перекласти з</string>+ <string name="detected_missing_language">Мова відсутня</string>+ <string name="main_input_placeholder">Введи текст</string>+ <string name="aidl_target_unavailable">Мова перекладу недоступна</string>+</resources>diff --git a/OCR-translation/src/main/res/values-ur/strings.xml b/OCR-translation/src/main/res/values-ur/strings.xmlnew file mode 100644index 0000000..614b384--- /dev/null+++ b/OCR-translation/src/main/res/values-ur/strings.xml@@ -0,0 +1,217 @@+<?xml version="1.0" encoding="utf-8"?>+<resources>+ <string name="stop">روکیں</string>+ <string name="pause">وقفہ</string>+ <string name="resume">دوبارہ شروع کریں</string>+ <string name="region_select_menu">ترجمے کا علاقہ مقرر کریں</string>+ <string name="screen_translate_needs_source">ماخذ زبان منتخب کریں</string>+ <string name="live_tile_label">اسکرین کا براہِ راست ترجمہ کریں</string>+ <string name="translate_text">ترجمہ کریں</string>+ <string name="translate_link">لنک کا ترجمہ کریں</string>+ <string name="accessibility_service_description">اسکرین پر موجود متن کا ترجمہ کرنے کے لیے یہ سروس فعال کریں۔ موجودہ اسکرین کا ترجمہ کرنے کے لیے ترجمے کا تیرتا بٹن دبائیں، یا براہِ راست اسکرین کا ترجمہ شروع کریں۔</string>+ <string name="tap_to_translate_title">فوری ترجمہ آن ہے</string>+ <string name="tap_to_translate_body">ترجمے کی پاپ اپ کھولنے کے لیے دبائیں</string>+ <string name="tap_to_translate_channel">فوری ترجمہ</string>+ <string name="tap_to_translate_channel_description">ترجمے کی پاپ اپ تک فوری رسائی کے لیے مستقل اطلاع</string>+ <string name="quick_tile_label">ترجمہ کریں</string>+ <!-- common -->+ <string name="common_ok">ٹھیک ہے</string>+ <string name="common_cancel">منسوخ کریں</string>+ <string name="common_done">ہو گیا</string>+ <string name="common_grant">اجازت دیں</string>+ <string name="common_manage">نظم کریں</string>+ <!-- settings -->+ <string name="settings_title">ترتیبات</string>+ <string name="settings_languages">زبانیں</string>+ <string name="settings_language_packs">زبان کے پیکجز</string>+ <string name="settings_general">عمومی</string>+ <string name="settings_font_size">فونٹ کا سائز</string>+ <string name="settings_font_sample">یہ ایک نمونہ متن ہے</string>+ <string name="settings_tap_notification">فوری ترجمے کی اطلاع</string>+ <string name="settings_tap_notification_desc">مستقل اطلاع جو پاپ اپ کھولتی ہے۔</string>+ <string name="settings_web_translator">ویب ٹرانسلیٹر</string>+ <string name="settings_clear_browsing">بند کرتے وقت براؤزنگ ڈیٹا صاف کریں</string>+ <string name="settings_clear_browsing_desc">کوکیز، کیشے اور لوکل اسٹوریج حذف کرتا ہے۔</string>+ <string name="settings_tts_section">متن سے تقریر</string>+ <string name="settings_tts_read_urls_hashtags">یو آر ایل اور ہیش ٹیگ پڑھیں</string>+ <string name="settings_popup_settings">پاپ اپ</string>+ <string name="settings_popup_desc">پاپ اپ اس وقت ظاہر ہوتی ہے جب آپ متن کے انتخاب کے مینو سے \'ترجمہ کریں\' منتخب کرتے ہیں</string>+ <string name="settings_hide_input">ان پٹ چھپائیں</string>+ <string name="settings_popup_position">پاپ اپ کی جگہ</string>+ <string name="settings_popup_size">پاپ اپ کا سائز: %1$d%%</string>+ <string name="settings_screen_translation">اسکرین کا ترجمہ</string>+ <string name="settings_screen_translation_desc">دوسری ایپس کے اوپر براہِ راست متن کا ترجمہ کریں۔</string>+ <string name="settings_floating_button">ہمیشہ موجود بٹن</string>+ <string name="settings_floating_button_desc">رسائی (ایکسیسبیلٹی) کی اجازت درکار ہے</string>+ <string name="settings_shortcut">شارٹ کٹ پر اسکرین کا ترجمہ کریں</string>+ <string name="settings_shortcut_desc">چلانے کے لیے ہوم یا پاور بٹن کو دبائے رکھیں</string>+ <string name="settings_on_shortcut">شارٹ کٹ چلانے پر</string>+ <string name="settings_ocr">تصاویر</string>+ <string name="settings_background_mode">متن کی جگہ رکھیں</string>+ <string name="settings_min_confidence">کم از کم اعتماد: %1$d%%</string>+ <string name="settings_max_image_size">تصویر کا زیادہ سے زیادہ سائز: %1$dpx</string>+ <string name="settings_advanced">اعلیٰ</string>+ <string name="settings_catalog_url">کیٹلاگ کا URL</string>+ <string name="settings_external_storage">بیرونی اسٹوریج استعمال کریں</string>+ <string name="settings_disable_autodetect">زبان کی خودکار شناخت بند کریں</string>+ <string name="settings_translit_output">ترجمہ شدہ متن کے لیے نقلِ حرفی دکھائیں</string>+ <string name="settings_translit_input">اصل متن کے لیے نقلِ حرفی دکھائیں</string>+ <string name="settings_translit_japanese_spaces">جاپانی نقلِ حرفی کے لیے خالی جگہیں شامل کریں</string>+ <string name="settings_translate_pdf_images">PDF میں تصاویر کا ترجمہ کریں</string>+ <string name="settings_camera_live_default">بطورِ ڈیفالٹ کیمرے کا براہِ راست ترجمہ کریں</string>+ <string name="settings_register_browser">براؤزر کے طور پر رجسٹر کریں</string>+ <string name="settings_register_browser_desc">دوسری ایپس کے لنکس کا ترجمہ کرنے کی پیشکش کریں۔</string>+ <string name="settings_external_storage_perm_title">بیرونی اسٹوریج کی اجازت</string>+ <string name="settings_about">بارے میں</string>+ <string name="settings_version">ورژن %1$s</string>+ <string name="settings_no_languages_available">کوئی زبان دستیاب نہیں</string>+ <string name="settings_default_from">ڈیفالٹ \'سے\' زبان</string>+ <string name="settings_default_to">ڈیفالٹ \'تک\' زبان</string>+ <string name="settings_adblock_support">اشتہارات روکنا</string>+ <string name="settings_about_get_help">مدد حاصل کریں / مسئلہ رپورٹ کریں</string>+ <string name="settings_logs_copied">ایپ کے لاگز کلپ بورڈ پر کاپی ہو گئے</string>+ <string name="settings_about_support">ترقی میں معاونت کریں</string>+ <string name="settings_external_storage_perm_body">ترجمے کی فائلیں آپ کے دستاویزات فولڈر میں محفوظ کرنے کے لیے، اس ایپ کو تمام فائلوں کے انتظام تک رسائی درکار ہے۔\nآپ کو ترتیبات میں لے جایا جائے گا جہاں آپ \'تمام فائلوں کے انتظام تک رسائی کی اجازت دیں\' دے سکتے ہیں۔</string>+ <!-- language manager / setup / how-to -->+ <string name="langmgr_voices">آوازیں</string>+ <string name="langmgr_default">ڈیفالٹ</string>+ <string name="langmgr_filter">زبانیں چھانٹیں</string>+ <string name="langmgr_delete_shared_title">مشترکہ لغت حذف کریں؟</string>+ <string name="langmgr_delete_shared_body">یہ لغت %1$s کے ساتھ مشترک ہے۔\nاسے حذف کرنے سے یہ لغت ان سب کے لیے ہٹ جائے گی۔</string>+ <string name="langmgr_download_size">%1$s ڈاؤن لوڈ کریں</string>+ <string name="langmgr_repair_needed">کچھ ڈاؤن لوڈ کردہ خصوصیات کی فائلیں غائب ہیں اور مرمت ہونے تک کام نہیں کریں گی۔</string>+ <string name="langmgr_repair_size">%1$s کی مرمت کریں</string>+ <string name="nolang_title">زبان کی ترتیب</string>+ <string name="nolang_prompt">ترجمہ شروع کرنے کے لیے زبان کے پیکجز ڈاؤن لوڈ کریں</string>+ <string name="howto_title">استعمال کا طریقہ</string>+ <!-- image capture / voice / dictionary / language selector -->+ <string name="image_no_crop_remote">دور دراز کی تصاویر کو براہِ راست کراپ نہیں کیا جا سکتا</string>+ <string name="image_open_failed">فائل کھولنے میں ناکامی</string>+ <string name="image_source_screen">اسکرین</string>+ <string name="image_source_document">دستاویز</string>+ <string name="image_source_photos">تصاویر</string>+ <string name="image_source_gallery">گیلری</string>+ <string name="image_source_camera">کیمرہ</string>+ <string name="voice_playback_speed">پلے بیک کی رفتار</string>+ <string name="voice_label">آواز</string>+ <string name="voice_default">ڈیفالٹ آواز</string>+ <string name="langsel_auto">✨ خودکار</string>+ <string name="dict_also_as">یوں بھی:</string>+ <!-- camera / browser / screen translate -->+ <string name="camera_permission_rationale">براہِ راست ترجمے کے لیے کیمرے کی اجازت درکار ہے۔</string>+ <string name="camera_need_ocr_models">اس زبان کے لیے آپ کو تصاویر سے متن پہچاننے والے ماڈلز ڈاؤن لوڈ کرنے ہوں گے</string>+ <string name="browser_no_source_language">کوئی ماخذ زبان دستیاب نہیں۔ پہلے مرکزی اسکرین سے کوئی زبان انسٹال کریں، یا ترتیبات میں ڈیفالٹ ماخذ زبان مقرر کریں۔</string>+ <string name="browser_reader_unavailable">اس صفحے کے لیے ریڈر موڈ دستیاب نہیں</string>+ <string name="browser_translate_image">تصویر کا ترجمہ کریں</string>+ <string name="screen_translating_notification">اسکرین کا ترجمہ ہو رہا ہے</string>+ <!-- enums -->+ <string name="align_top">اوپر</string>+ <string name="align_middle">درمیان</string>+ <string name="align_bottom">نیچے</string>+ <string name="assistant_action_still_image">ایک بار ترجمہ کریں</string>+ <string name="assistant_action_live_screen">براہِ راست ترجمہ شروع کریں</string>+ <string name="background_mode_white_on_black">سیاہ پر سفید</string>+ <string name="background_mode_black_on_white">سفید پر سیاہ</string>+ <string name="background_mode_auto_detect">اصل تصویر کے رنگ</string>+ <!-- tts / speech errors -->+ <string name="tts_nothing_to_speak">بولنے کے لیے کچھ نہیں</string>+ <string name="tts_catalog_unavailable">کیٹلاگ دستیاب نہیں</string>+ <string name="tts_no_voice">%1$s کے لیے کوئی آواز انسٹال نہیں ہے</string>+ <string name="tts_synthesis_failed">%1$s کے لیے آواز بنانے میں ناکامی</string>+ <string name="tts_sample_fallback">یہ Offline Translator کی جانب سے ایک آواز کا نمونہ ہے۔</string>+ <!-- translation -->+ <string name="translation_error">ترجمے کی خرابی: %1$s</string>+ <!-- download errors -->+ <string name="download_failed_core">%1$s ڈاؤن لوڈ ناکام</string>+ <string name="download_failed_ocr">%1$s کے لیے تصاویر سے متن پہچاننے والی ڈاؤن لوڈ ناکام</string>+ <string name="download_failed_ocr_batch">تصاویر سے متن پہچاننے والی بیچ ڈاؤن لوڈ ناکام</string>+ <string name="download_failed_dictionary">%1$s لغت ڈاؤن لوڈ ناکام</string>+ <string name="download_failed_tts">%1$s آواز ڈاؤن لوڈ ناکام</string>+ <string name="download_failed_adblock">اشتہار روکنے والی ڈاؤن لوڈ ناکام</string>+ <string name="download_failed_repair">مرمت ڈاؤن لوڈ ناکام</string>+ <string name="download_catalog_unavailable">کیٹلاگ دستیاب نہیں</string>+ <string name="download_catalog_save_failed">کیٹلاگ محفوظ کرنے میں ناکامی</string>+ <string name="download_unknown_error">نامعلوم خرابی</string>+ <string name="download_catalog_failed">کیٹلاگ ڈاؤن لوڈ کرنے میں ناکامی: %1$s</string>+ <!-- assistant overlay status -->+ <string name="assistant_invoke_prompt">کسی متن کا ترجمہ کرنے کے لیے اس کے اوپر یہ اسسٹنٹ چلائیں</string>+ <string name="assistant_collecting_context">اسکرین کا سیاق و سباق جمع ہو رہا ہے…</string>+ <string name="assistant_screenshot_disabled">اس اسسٹنٹ کے لیے اسکرین شاٹ تک رسائی بند ہے۔ اسے سسٹم اسسٹنٹ کی ترتیبات میں فعال کریں۔</string>+ <string name="assistant_no_screen_data">اسکرین کا کوئی ڈیٹا موصول نہیں ہوا۔ اس اسسٹنٹ کے لیے \'اسکرین شاٹ استعمال کریں\' فعال کریں۔</string>+ <string name="assistant_no_screenshot">اس ایپ نے کوئی اسکرین شاٹ فراہم نہیں کیا۔</string>+ <string name="assistant_set_source_ocr">تصاویر سے متن پہچاننے کے لیے ڈیفالٹ ماخذ زبان مقرر کریں۔</string>+ <string name="assistant_langs_not_ready">ترجمے کی زبانیں ابھی تیار نہیں ہیں۔ دوبارہ کوشش کریں۔</string>+ <string name="assistant_ocr_failed">تصاویر سے متن پہچاننے میں ناکامی</string>+ <string name="ocr_models_missing">متن پہچاننے والے ماڈل غائب ہیں۔ مرمت کے لیے ایپ میں زبان کا انتظام کھولیں۔</string>+ <string name="assistant_set_source_live">براہِ راست اسکرین ترجمہ استعمال کرنے کے لیے ترتیبات میں ڈیفالٹ ماخذ زبان مقرر کریں۔</string>+ <!-- migration gate -->+ <string name="migration_updating_speech_models">آواز کے ماڈلز اپ ڈیٹ ہو رہے ہیں</string>+ <string name="migration_accept_convert">قبول کریں اور تبدیل کریں</string>+ <string name="migration_delete_all">اس کے بجائے سب حذف کریں</string>+ <string name="migration_converting">%2$d میں سے %1$d تبدیل ہو رہا ہے</string>+ <string name="migration_optimizing">ماڈلز بہتر بنائے جا رہے ہیں</string>+ <plurals name="migration_convert_prompt">+ <item quantity="one">آپ کے پاس %1$d آواز کا ماڈل ہے جسے نئے فارمیٹ میں تبدیل کرنا ہے۔ اس میں تقریباً %2$d سیکنڈ لگیں گے۔ آپ ڈسک کی %3$.0f MB جگہ بچائیں گے۔</item>+ <item quantity="other">آپ کے پاس %1$d آواز کے ماڈلز ہیں جنہیں نئے فارمیٹ میں تبدیل کرنا ہے۔ اس میں تقریباً %2$d سیکنڈ لگیں گے۔ آپ ڈسک کی %3$.0f MB جگہ بچائیں گے۔</item>+ </plurals>+ <!-- document translation notification + progress -->+ <string name="doc_notif_translating">فائل کا ترجمہ ہو رہا ہے</string>+ <string name="doc_notif_translated">فائل کا ترجمہ ہو گیا</string>+ <string name="doc_notif_phase_text">متن %1$d%%</string>+ <string name="doc_notif_phase_images">تصاویر %1$d/%2$d</string>+ <string name="doc_notif_phase_raster">بٹ میپ صفحات %1$d/%2$d</string>+ <string name="doc_notif_channel_name">دستاویز کا ترجمہ</string>+ <string name="doc_notif_channel_desc">دستاویزات کے ترجمے کے دوران پیش رفت دکھاتا ہے</string>+ <string name="doc_progress_preparing">فائل تیار ہو رہی ہے</string>+ <string name="doc_progress_translating">ترجمہ ہو رہا ہے</string>+ <string name="doc_progress_translated">فائل کا ترجمہ ہو گیا</string>+ <string name="doc_progress_saving">ترجمہ شدہ فائل محفوظ ہو رہی ہے</string>+ <string name="doc_translation_failed">دستاویز کا ترجمہ ناکام</string>+ <string name="doc_url_unsupported">دستاویز ڈاؤن لوڈ کریں اور اس کے بجائے اسے ایپ میں کھولیں</string>+ <!-- document configure sheet -->+ <string name="document_wrap_columns">%1$d کالم پر لپیٹیں</string>+ <string name="document_translate_pdf_images">PDF میں تصاویر کا ترجمہ کریں</string>+ <string name="layout_preserve">سطر کے وقفے برقرار رکھیں</string>+ <string name="layout_reflow">پیراگراف میں دوبارہ ترتیب دیں</string>+ <string name="layout_reflow_wrap">دوبارہ ترتیب دیں اور لپیٹیں</string>+ <!-- common (additional) -->+ <string name="common_open">کھولیں</string>+ <string name="common_close">بند کریں</string>+ <string name="common_save">محفوظ کریں</string>+ <!-- translator app -->+ <string name="translator_translated_file">ترجمہ شدہ فائل: %1$s</string>+ <string name="translator_document_saved">دستاویز محفوظ ہو گئی</string>+ <string name="translator_document_save_failed">دستاویز محفوظ کرنے میں ناکامی</string>+ <string name="translator_audio_playback_failed">آڈیو پلے بیک ناکام: %1$s</string>+ <string name="translator_no_app_to_open">اس فائل کو کھولنے کے لیے کوئی ایپ نہیں ملی</string>+ <!-- document alignment -->+ <string name="docalign_decode_failed">تصویر ڈی کوڈ نہیں ہو سکی۔</string>+ <string name="docalign_detecting">کونے پہچانے جا رہے ہیں…</string>+ <string name="docalign_redetecting">دوبارہ پہچانا جا رہا ہے…</string>+ <string name="docalign_help">دستاویز کے گرد ایک درست حد متن کی پہچان کا معیار بہتر بناتی ہے۔ یہ ضروری ہے کہ لکیریں متن کے متوازی ہوں۔\n\nزوم یا پین کرنے سے الگورتھم عموماً دستاویز کو خودکار طور پر پہچان لیتا ہے، لیکن اگر یہ نہ ملے تو آپ پھر بھی دستی طور پر ایڈجسٹ کر سکتے ہیں۔</string>+ <!-- how to use -->+ <string name="howto_section_other_apps">دوسری ایپس سے</string>+ <string name="howto_share_title">ترجمے کے لیے شیئر کریں</string>+ <string name="howto_share_body">ترجمہ کرنے کے لیے کسی بھی ایپ سے متن، لنکس یا تصاویر شیئر کریں۔</string>+ <string name="howto_copy_title">دوسری ایپس چھوڑے بغیر ترجمہ کریں</string>+ <string name="howto_copy_body">کہیں بھی متن منتخب کریں، پھر ایک مختصر پاپ اپ میں ترجمہ دیکھنے کے لیے کاپی ٹول بار میں \"ترجمہ کریں\" دبائیں۔</string>+ <string name="howto_section_in_app">ایپ کے اندر</string>+ <string name="howto_docs_title">دستاویزات اور تصاویر کا ترجمہ کریں</string>+ <string name="howto_docs_body">تصاویر یا EPUB، PDF اور TXT فائلوں کا ترجمہ کرنے کے لیے دستاویزات کا ٹیب کھولیں۔</string>+ <string name="howto_dict_title">لغت میں تلاش</string>+ <string name="howto_dict_body">کسی ترجمے میں کسی بھی لفظ کی تعریف دیکھنے کے لیے اسے دبائے رکھیں۔ ڈیٹا Wiktionary سے لیا گیا ہے۔</string>+ <string name="howto_voice_title">آواز یا رفتار بدلیں</string>+ <string name="howto_voice_body">مختلف آواز چننے یا پلے بیک کی رفتار ایڈجسٹ کرنے کے لیے پلے بٹن کو دبائے رکھیں۔</string>+ <!-- feature row labels -->+ <string name="feature_translation">ترجمہ</string>+ <string name="feature_dictionary">لغت</string>+ <string name="feature_tts">آواز</string>+ <!-- misc -->+ <string name="main_input_placeholder">متن درج کریں</string>+ <string name="aidl_target_unavailable">ہدف زبان دستیاب نہیں</string>+ <string name="voice_section_downloaded">ڈاؤن لوڈ شدہ</string>+ <string name="voice_section_available">دستیاب</string>+ <string name="detected_translate_from">سے ترجمہ کریں</string>+ <string name="detected_missing_language">زبان موجود نہیں</string>+ <string name="langmgr_ocr_upgrade_available">متن کی پہچان کا ایک بہتر ماڈل دستیاب ہے۔</string>+</resources>diff --git a/OCR-translation/src/main/res/values-v30/bools.xml b/OCR-translation/src/main/res/values-v30/bools.xmlnew file mode 100644index 0000000..4938ce0--- /dev/null+++ b/OCR-translation/src/main/res/values-v30/bools.xml@@ -0,0 +1,4 @@+<?xml version="1.0" encoding="utf-8"?>+<resources>+ <bool name="accessibility_service_enabled">true</bool>+</resources>diff --git a/OCR-translation/src/main/res/values-vi/strings.xml b/OCR-translation/src/main/res/values-vi/strings.xmlnew file mode 100644index 0000000..5d1d782--- /dev/null+++ b/OCR-translation/src/main/res/values-vi/strings.xml@@ -0,0 +1,216 @@+<?xml version="1.0" encoding="utf-8"?>+<resources>+ <string name="stop">Dừng</string>+ <string name="pause">Tạm dừng</string>+ <string name="resume">Tiếp tục</string>+ <string name="region_select_menu">Đặt vùng dịch</string>+ <string name="screen_translate_needs_source">Hãy chọn ngôn ngữ nguồn</string>+ <string name="live_tile_label">Dịch màn hình trực tiếp</string>+ <string name="translate_text">Dịch</string>+ <string name="translate_link">Dịch liên kết</string>+ <string name="accessibility_service_description">Bật dịch vụ này để dịch văn bản trên màn hình. Chạm vào nút dịch nổi để dịch màn hình hiện tại, hoặc bắt đầu dịch màn hình trực tiếp.</string>+ <string name="tap_to_translate_title">Dịch nhanh đang bật</string>+ <string name="tap_to_translate_body">Chạm để mở cửa sổ dịch</string>+ <string name="tap_to_translate_channel">Dịch nhanh</string>+ <string name="tap_to_translate_channel_description">Thông báo cố định để truy cập nhanh cửa sổ dịch</string>+ <string name="quick_tile_label">Dịch</string>+ <!-- common -->+ <string name="common_ok">OK</string>+ <string name="common_cancel">Hủy</string>+ <string name="common_done">Xong</string>+ <string name="common_grant">Cấp quyền</string>+ <string name="common_manage">Quản lý</string>+ <!-- settings -->+ <string name="settings_title">Cài đặt</string>+ <string name="settings_languages">Ngôn ngữ</string>+ <string name="settings_language_packs">Gói ngôn ngữ</string>+ <string name="settings_general">Chung</string>+ <string name="settings_font_size">Cỡ chữ</string>+ <string name="settings_font_sample">Đây là một đoạn văn bản ví dụ</string>+ <string name="settings_tap_notification">Thông báo Dịch nhanh</string>+ <string name="settings_tap_notification_desc">Thông báo cố định giúp mở cửa sổ dịch.</string>+ <string name="settings_web_translator">Trình dịch web</string>+ <string name="settings_clear_browsing">Xóa dữ liệu duyệt web khi đóng</string>+ <string name="settings_clear_browsing_desc">Xóa cookie, bộ nhớ đệm và bộ nhớ cục bộ.</string>+ <string name="settings_tts_section">Chuyển văn bản thành giọng nói</string>+ <string name="settings_tts_read_urls_hashtags">Đọc URL và hashtag</string>+ <string name="settings_popup_settings">Cửa sổ dịch</string>+ <string name="settings_popup_desc">Cửa sổ dịch hiện ra khi chọn \'Dịch\' trong menu chọn văn bản</string>+ <string name="settings_hide_input">Ẩn phần nhập</string>+ <string name="settings_popup_position">Vị trí cửa sổ dịch</string>+ <string name="settings_popup_size">Kích thước cửa sổ: %1$d%%</string>+ <string name="settings_screen_translation">Dịch màn hình</string>+ <string name="settings_screen_translation_desc">Dịch văn bản trực tiếp lên trên các ứng dụng khác.</string>+ <string name="settings_floating_button">Nút luôn hiển thị</string>+ <string name="settings_floating_button_desc">Cần quyền trợ năng</string>+ <string name="settings_shortcut">Dịch màn hình bằng phím tắt</string>+ <string name="settings_shortcut_desc">Nhấn giữ nút home hoặc nguồn để kích hoạt</string>+ <string name="settings_on_shortcut">Khi gọi bằng phím tắt</string>+ <string name="settings_ocr">Hình ảnh</string>+ <string name="settings_background_mode">Thay văn bản bằng</string>+ <string name="settings_min_confidence">Độ tin cậy tối thiểu: %1$d%%</string>+ <string name="settings_max_image_size">Kích thước ảnh tối đa: %1$dpx</string>+ <string name="settings_advanced">Nâng cao</string>+ <string name="settings_catalog_url">URL danh mục</string>+ <string name="settings_external_storage">Dùng bộ nhớ ngoài</string>+ <string name="settings_disable_autodetect">Tắt nhận diện ngôn ngữ tự động</string>+ <string name="settings_translit_output">Hiện phiên âm cho văn bản đã dịch</string>+ <string name="settings_translit_input">Hiện phiên âm cho văn bản gốc</string>+ <string name="settings_translit_japanese_spaces">Thêm khoảng trắng cho phiên âm tiếng Nhật</string>+ <string name="settings_translate_pdf_images">Dịch hình ảnh trong PDF</string>+ <string name="settings_camera_live_default">Mặc định dịch camera trực tiếp</string>+ <string name="settings_register_browser">Đăng ký làm trình duyệt</string>+ <string name="settings_register_browser_desc">Đề nghị dịch liên kết từ ứng dụng khác.</string>+ <string name="settings_external_storage_perm_title">Quyền bộ nhớ ngoài</string>+ <string name="settings_about">Giới thiệu</string>+ <string name="settings_version">Phiên bản %1$s</string>+ <string name="settings_no_languages_available">Không có ngôn ngữ nào</string>+ <string name="settings_default_from">Ngôn ngữ nguồn mặc định</string>+ <string name="settings_default_to">Ngôn ngữ đích mặc định</string>+ <string name="settings_adblock_support">Chặn quảng cáo</string>+ <string name="settings_about_get_help">Trợ giúp / báo lỗi</string>+ <string name="settings_logs_copied">Đã sao chép nhật ký ứng dụng vào bộ nhớ tạm</string>+ <string name="settings_about_support">Ủng hộ phát triển</string>+ <string name="settings_external_storage_perm_body">Để lưu các tệp dịch vào thư mục Tài liệu của bạn, ứng dụng cần quyền quản lý mọi tệp.\nBạn sẽ được đưa đến phần Cài đặt, nơi bạn có thể cấp quyền \'Cho phép truy cập để quản lý mọi tệp\'.</string>+ <!-- language manager / setup / how-to -->+ <string name="langmgr_voices">Giọng nói</string>+ <string name="voice_section_downloaded">ĐÃ TẢI</string>+ <string name="voice_section_available">CÓ SẴN</string>+ <string name="langmgr_default">MẶC ĐỊNH</string>+ <string name="langmgr_filter">Lọc ngôn ngữ</string>+ <string name="langmgr_ocr_upgrade_available">Đã có mô hình nhận diện văn bản tốt hơn.</string>+ <string name="langmgr_delete_shared_title">Xóa từ điển dùng chung?</string>+ <string name="langmgr_delete_shared_body">Từ điển này được dùng chung với %1$s.\nXóa nó sẽ gỡ từ điển cho tất cả.</string>+ <string name="langmgr_download_size">Tải %1$s</string>+ <string name="langmgr_repair_needed">Một số tính năng đã tải thiếu tệp và sẽ không hoạt động cho đến khi được sửa.</string>+ <string name="langmgr_repair_size">Sửa %1$s</string>+ <string name="nolang_title">Thiết lập ngôn ngữ</string>+ <string name="nolang_prompt">Tải gói ngôn ngữ để bắt đầu dịch</string>+ <string name="howto_title">Cách sử dụng</string>+ <!-- image capture / voice / dictionary / language selector -->+ <string name="image_no_crop_remote">Không thể cắt trực tiếp ảnh từ xa</string>+ <string name="image_open_failed">Không mở được tệp</string>+ <string name="image_source_screen">Màn hình</string>+ <string name="image_source_document">Tài liệu</string>+ <string name="image_source_photos">Ảnh</string>+ <string name="image_source_gallery">Thư viện</string>+ <string name="image_source_camera">Máy ảnh</string>+ <string name="voice_playback_speed">Tốc độ phát</string>+ <string name="voice_label">Giọng nói</string>+ <string name="voice_default">Giọng mặc định</string>+ <string name="langsel_auto">✨ Tự động</string>+ <string name="dict_also_as">Cũng là:</string>+ <!-- camera / browser / screen translate -->+ <string name="camera_permission_rationale">Cần quyền máy ảnh để dịch trực tiếp.</string>+ <string name="camera_need_ocr_models">Bạn cần tải các mô hình nhận diện văn bản (cho hình ảnh) cho ngôn ngữ này</string>+ <string name="browser_no_source_language">Không có ngôn ngữ nguồn nào. Hãy cài một ngôn ngữ từ màn hình chính trước, hoặc đặt ngôn ngữ nguồn mặc định trong phần cài đặt.</string>+ <string name="browser_reader_unavailable">Chế độ đọc không khả dụng cho trang này</string>+ <string name="browser_translate_image">Dịch hình ảnh</string>+ <string name="screen_translating_notification">Đang dịch màn hình</string>+ <!-- enums -->+ <string name="align_top">Trên</string>+ <string name="align_middle">Giữa</string>+ <string name="align_bottom">Dưới</string>+ <string name="assistant_action_still_image">Dịch một lần</string>+ <string name="assistant_action_live_screen">Bắt đầu dịch trực tiếp</string>+ <string name="background_mode_white_on_black">Chữ trắng nền đen</string>+ <string name="background_mode_black_on_white">Chữ đen nền trắng</string>+ <string name="background_mode_auto_detect">Màu của ảnh gốc</string>+ <!-- tts / speech errors -->+ <string name="tts_nothing_to_speak">Không có gì để đọc</string>+ <string name="tts_catalog_unavailable">Danh mục không khả dụng</string>+ <string name="tts_no_voice">Chưa cài giọng nói cho %1$s</string>+ <string name="tts_synthesis_failed">Tổng hợp giọng nói thất bại cho %1$s</string>+ <string name="tts_sample_fallback">Đây là mẫu giọng nói từ Offline Translator.</string>+ <!-- translation -->+ <string name="translation_error">Lỗi dịch: %1$s</string>+ <!-- download errors -->+ <string name="download_failed_core">Tải %1$s thất bại</string>+ <string name="download_failed_ocr">Tải nhận diện văn bản %1$s thất bại</string>+ <string name="download_failed_ocr_batch">Tải hàng loạt nhận diện văn bản thất bại</string>+ <string name="download_failed_dictionary">Tải từ điển %1$s thất bại</string>+ <string name="download_failed_tts">Tải giọng nói %1$s thất bại</string>+ <string name="download_failed_adblock">Tải chặn quảng cáo thất bại</string>+ <string name="download_failed_repair">Tải bản sửa thất bại</string>+ <string name="download_catalog_unavailable">Danh mục không khả dụng</string>+ <string name="download_catalog_save_failed">Không lưu được danh mục</string>+ <string name="download_unknown_error">Lỗi không xác định</string>+ <string name="download_catalog_failed">Không tải được danh mục: %1$s</string>+ <!-- assistant overlay status -->+ <string name="assistant_invoke_prompt">Gọi trợ lý này lên trên một đoạn văn bản để dịch</string>+ <string name="assistant_collecting_context">Đang thu thập nội dung màn hình…</string>+ <string name="assistant_screenshot_disabled">Quyền chụp màn hình đang bị tắt cho trợ lý này. Hãy bật trong phần cài đặt trợ lý của hệ thống.</string>+ <string name="assistant_no_screen_data">Không nhận được dữ liệu màn hình. Hãy bật \'Dùng ảnh chụp màn hình\' cho trợ lý này.</string>+ <string name="assistant_no_screenshot">Ứng dụng này không cung cấp ảnh chụp màn hình.</string>+ <string name="assistant_set_source_ocr">Hãy đặt ngôn ngữ nguồn mặc định để nhận diện văn bản.</string>+ <string name="assistant_langs_not_ready">Các ngôn ngữ dịch chưa sẵn sàng. Hãy thử lại.</string>+ <string name="assistant_ocr_failed">Nhận diện văn bản thất bại</string>+ <string name="ocr_models_missing">Thiếu mô hình nhận diện văn bản. Mở Quản lý ngôn ngữ trong ứng dụng để sửa.</string>+ <string name="assistant_set_source_live">Hãy đặt ngôn ngữ nguồn mặc định trong phần Cài đặt để dùng dịch màn hình trực tiếp.</string>+ <!-- migration gate -->+ <string name="migration_updating_speech_models">Đang cập nhật mô hình giọng nói</string>+ <string name="migration_accept_convert">Chấp nhận và chuyển đổi</string>+ <string name="migration_delete_all">Xóa tất cả</string>+ <string name="migration_converting">Đang chuyển đổi %1$d trên %2$d</string>+ <string name="migration_optimizing">Đang tối ưu mô hình</string>+ <plurals name="migration_convert_prompt">+ <item quantity="other">Bạn có %1$d mô hình giọng nói cần chuyển sang định dạng mới. Quá trình này mất khoảng %2$d giây. Bạn sẽ tiết kiệm được %3$.0f MB dung lượng đĩa.</item>+ </plurals>+ <!-- document translation notification + progress -->+ <string name="doc_notif_translating">Đang dịch tệp</string>+ <string name="doc_notif_translated">Đã dịch tệp</string>+ <string name="doc_notif_phase_text">Văn bản %1$d%%</string>+ <string name="doc_notif_phase_images">Hình ảnh %1$d/%2$d</string>+ <string name="doc_notif_phase_raster">Trang bitmap %1$d/%2$d</string>+ <string name="doc_notif_channel_name">Dịch tài liệu</string>+ <string name="doc_notif_channel_desc">Hiển thị tiến trình khi dịch tài liệu</string>+ <string name="doc_progress_preparing">Đang chuẩn bị tệp</string>+ <string name="doc_progress_translating">Đang dịch</string>+ <string name="doc_progress_translated">Đã dịch tệp</string>+ <string name="doc_progress_saving">Đang lưu tệp đã dịch</string>+ <string name="doc_translation_failed">Dịch tài liệu thất bại</string>+ <string name="doc_url_unsupported">Hãy tải tài liệu về và mở bằng ứng dụng</string>+ <!-- document configure sheet -->+ <string name="document_wrap_columns">Ngắt dòng ở %1$d cột</string>+ <string name="document_translate_pdf_images">Dịch hình ảnh trong PDF</string>+ <string name="layout_preserve">Giữ nguyên ngắt dòng</string>+ <string name="layout_reflow">Sắp xếp lại thành đoạn văn</string>+ <string name="layout_reflow_wrap">Sắp xếp lại và ngắt dòng</string>+ <!-- common (additional) -->+ <string name="common_open">Mở</string>+ <string name="common_close">Đóng</string>+ <string name="common_save">Lưu</string>+ <!-- translator app -->+ <string name="translator_translated_file">Tệp đã dịch: %1$s</string>+ <string name="translator_document_saved">Đã lưu tài liệu</string>+ <string name="translator_document_save_failed">Không lưu được tài liệu</string>+ <string name="translator_audio_playback_failed">Phát âm thanh thất bại: %1$s</string>+ <string name="translator_no_app_to_open">Không tìm thấy ứng dụng nào để mở tệp này</string>+ <!-- document alignment -->+ <string name="docalign_decode_failed">Không giải mã được hình ảnh.</string>+ <string name="docalign_detecting">Đang phát hiện các góc…</string>+ <string name="docalign_redetecting">Đang phát hiện lại…</string>+ <string name="docalign_help">Một đường viền chính xác quanh tài liệu giúp cải thiện chất lượng nhận diện. Quan trọng là các đường viền phải song song với văn bản.\n\nViệc phóng to hoặc di chuyển thường giúp thuật toán tự nhận ra tài liệu, nhưng bạn vẫn có thể chỉnh thủ công nếu không tìm thấy.</string>+ <!-- how to use -->+ <string name="howto_section_other_apps">Từ ứng dụng khác</string>+ <string name="howto_share_title">Chia sẻ để dịch</string>+ <string name="howto_share_body">Chia sẻ văn bản, liên kết hoặc hình ảnh từ bất kỳ ứng dụng nào để dịch.</string>+ <string name="howto_copy_title">Dịch mà không cần rời ứng dụng khác</string>+ <string name="howto_copy_body">Chọn văn bản ở bất cứ đâu, rồi chạm \"Dịch\" trên thanh công cụ sao chép để xem bản dịch trong một cửa sổ nhỏ gọn.</string>+ <string name="howto_section_in_app">Trong ứng dụng</string>+ <string name="howto_docs_title">Dịch tài liệu và hình ảnh</string>+ <string name="howto_docs_body">Mở tab Tài liệu để dịch hình ảnh hoặc các tệp EPUB, PDF và TXT.</string>+ <string name="howto_dict_title">Tra từ điển</string>+ <string name="howto_dict_body">Nhấn giữ bất kỳ từ nào trong bản dịch để xem định nghĩa. Dữ liệu lấy từ Wiktionary.</string>+ <string name="howto_voice_title">Đổi giọng nói hoặc tốc độ</string>+ <string name="howto_voice_body">Nhấn giữ nút phát để chọn giọng nói khác hoặc điều chỉnh tốc độ phát.</string>+ <!-- feature row labels -->+ <string name="feature_translation">Dịch</string>+ <string name="feature_dictionary">Từ điển</string>+ <string name="feature_tts">Giọng nói</string>+ <!-- misc -->+ <string name="detected_translate_from">Dịch từ</string>+ <string name="detected_missing_language">Thiếu ngôn ngữ</string>+ <string name="main_input_placeholder">Nhập văn bản</string>+ <string name="aidl_target_unavailable">Ngôn ngữ đích không khả dụng</string>+</resources>diff --git a/OCR-translation/src/main/res/values-zh-rCN/strings.xml b/OCR-translation/src/main/res/values-zh-rCN/strings.xmlnew file mode 100644index 0000000..f1ce8c8--- /dev/null+++ b/OCR-translation/src/main/res/values-zh-rCN/strings.xml@@ -0,0 +1,222 @@+<?xml version="1.0" encoding="utf-8"?>+<resources>+ <string name="stop">停止</string>+ <string name="pause">暂停</string>+ <string name="resume">继续</string>+ <string name="region_select_menu">设置翻译区域</string>+ <string name="screen_translate_needs_source">请指定源语言</string>+ <string name="live_tile_label">实时翻译屏幕</string>+ <string name="translate_text">翻译</string>+ <string name="translate_link">翻译链接</string>+ <string name="accessibility_service_description">开启此服务以翻译屏幕上的文字。点按悬浮的翻译按钮即可翻译当前屏幕,或开始实时屏幕翻译。</string>+ <string name="tap_to_translate_title">快速翻译已开启</string>+ <string name="tap_to_translate_body">点按打开翻译弹窗</string>+ <string name="tap_to_translate_channel">快速翻译</string>+ <string name="tap_to_translate_channel_description">用于快速打开翻译弹窗的常驻通知</string>+ <string name="quick_tile_label">翻译</string>+ <!-- common -->+ <string name="common_ok">确定</string>+ <string name="common_cancel">取消</string>+ <string name="common_done">完成</string>+ <string name="common_grant">授权</string>+ <string name="common_manage">管理</string>+ <!-- settings -->+ <string name="settings_title">设置</string>+ <string name="settings_languages">语言</string>+ <string name="settings_language_packs">语言包</string>+ <string name="settings_general">通用</string>+ <string name="settings_font_size">字体大小</string>+ <string name="settings_font_sample">这是一段示例文字</string>+ <string name="settings_tap_notification">快速翻译通知</string>+ <string name="settings_tap_notification_desc">用于打开弹窗的常驻通知。</string>+ <string name="settings_web_translator">网页翻译</string>+ <string name="settings_clear_browsing">关闭时清除浏览数据</string>+ <string name="settings_clear_browsing_desc">删除 Cookie、缓存和本地存储。</string>+ <string name="settings_tts_section">文字转语音</string>+ <string name="settings_tts_read_urls_hashtags">朗读网址和话题标签</string>+ <string name="settings_popup_settings">弹窗</string>+ <string name="settings_popup_desc">从文字选择菜单中选择\'翻译\'时会显示弹窗</string>+ <string name="settings_hide_input">隐藏输入框</string>+ <string name="settings_popup_position">弹窗位置</string>+ <string name="settings_popup_size">弹窗大小:%1$d%%</string>+ <string name="settings_screen_translation">屏幕翻译</string>+ <string name="settings_screen_translation_desc">直接在其他应用之上翻译文字。</string>+ <string name="settings_floating_button">常驻按钮</string>+ <string name="settings_floating_button_desc">需要无障碍权限</string>+ <string name="settings_shortcut">通过快捷方式翻译屏幕</string>+ <string name="settings_shortcut_desc">长按主屏幕键或电源键触发</string>+ <string name="settings_on_shortcut">快捷方式触发时</string>+ <string name="settings_ocr">图片</string>+ <string name="settings_background_mode">文字替换为</string>+ <string name="settings_min_confidence">最低置信度:%1$d%%</string>+ <string name="settings_max_image_size">最大图片尺寸:%1$dpx</string>+ <string name="settings_advanced">高级</string>+ <string name="settings_catalog_url">目录 URL</string>+ <string name="settings_external_storage">使用外部存储</string>+ <string name="settings_disable_autodetect">关闭自动语言检测</string>+ <string name="settings_translit_output">为译文显示音译</string>+ <string name="settings_translit_input">为原文显示音译</string>+ <string name="settings_translit_japanese_spaces">为日语音译添加空格</string>+ <string name="settings_translate_pdf_images">翻译 PDF 中的图片</string>+ <string name="settings_camera_live_default">默认使用相机实时翻译</string>+ <string name="settings_register_browser">注册为浏览器</string>+ <string name="settings_register_browser_desc">提供翻译来自其他应用的链接。</string>+ <string name="settings_external_storage_perm_title">外部存储权限</string>+ <string name="settings_about">关于</string>+ <string name="settings_version">版本 %1$s</string>+ <string name="settings_no_languages_available">没有可用的语言</string>+ <string name="settings_default_from">默认\'源\'语言</string>+ <string name="settings_default_to">默认\'目标\'语言</string>+ <string name="settings_adblock_support">广告拦截</string>+ <string name="settings_about_get_help">获取帮助 / 反馈问题</string>+ <string name="settings_logs_copied">应用日志已复制到剪贴板</string>+ <string name="settings_about_support">支持开发</string>+ <string name="settings_external_storage_perm_body">为了将翻译文件存储到你的“文档”文件夹,此应用需要管理所有文件的权限。\n你将被带到“设置”页面,在那里授予\'允许管理所有文件\'权限。</string>+ <!-- language manager / setup / how-to -->+ <string name="langmgr_voices">语音</string>+ <string name="langmgr_default">默认</string>+ <string name="langmgr_filter">筛选语言</string>+ <string name="langmgr_delete_shared_title">删除共享词典?</string>+ <string name="langmgr_delete_shared_body">此词典与 %1$s 共享。\n删除后将为它们全部移除该词典。</string>+ <string name="langmgr_download_size">下载 %1$s</string>+ <string name="langmgr_repair_needed">部分已下载的功能缺少文件,修复后才能使用。</string>+ <string name="langmgr_repair_size">修复 %1$s</string>+ <string name="nolang_title">语言设置</string>+ <string name="nolang_prompt">下载语言包即可开始翻译</string>+ <string name="howto_title">使用方法</string>+ <!-- image capture / voice / dictionary / language selector -->+ <string name="image_no_crop_remote">远程图片无法直接裁剪</string>+ <string name="image_open_failed">打开文件失败</string>+ <string name="image_source_screen">屏幕</string>+ <string name="image_source_document">文档</string>+ <string name="image_source_photos">照片</string>+ <string name="image_source_gallery">相册</string>+ <string name="image_source_camera">相机</string>+ <string name="voice_playback_speed">播放速度</string>+ <string name="voice_label">语音</string>+ <string name="voice_default">默认语音</string>+ <string name="langsel_auto">✨ 自动</string>+ <string name="dict_also_as">也作:</string>+ <!-- camera / browser / screen translate -->+ <string name="camera_permission_rationale">实时翻译需要相机权限。</string>+ <string name="camera_need_ocr_models">你需要下载此语言的文字识别模型</string>+ <string name="browser_no_source_language">没有可用的源语言。请先在主界面安装一种,或在设置中设定默认源语言。</string>+ <string name="browser_reader_unavailable">此页面不支持阅读模式</string>+ <string name="browser_translate_image">翻译图片</string>+ <string name="screen_translating_notification">正在翻译屏幕</string>+ <!-- enums -->+ <string name="align_top">顶部</string>+ <string name="align_middle">居中</string>+ <string name="align_bottom">底部</string>+ <string name="assistant_action_still_image">翻译一次</string>+ <string name="assistant_action_live_screen">开始实时翻译</string>+ <string name="background_mode_white_on_black">黑底白字</string>+ <string name="background_mode_black_on_white">白底黑字</string>+ <string name="background_mode_auto_detect">自动检测颜色</string>+ <!-- tts / speech errors -->+ <string name="tts_nothing_to_speak">没有可朗读的内容</string>+ <string name="tts_catalog_unavailable">目录不可用</string>+ <string name="tts_no_voice">未安装 %1$s 的语音</string>+ <string name="tts_synthesis_failed">%1$s 的语音合成失败</string>+ <string name="tts_sample_fallback">这是来自 Offline Translator 的语音合成示例。</string>+ <!-- translation -->+ <string name="translation_error">翻译错误:%1$s</string>+ <!-- download errors -->+ <string name="download_failed_core">%1$s 下载失败</string>+ <string name="download_failed_ocr">%1$s 文字识别下载失败</string>+ <string name="download_failed_ocr_batch">文字识别批量下载失败</string>+ <string name="download_failed_dictionary">%1$s 词典下载失败</string>+ <string name="download_failed_tts">%1$s 语音下载失败</string>+ <string name="download_failed_adblock">Adblock 下载失败</string>+ <string name="download_failed_repair">修复下载失败</string>+ <string name="download_catalog_unavailable">目录不可用</string>+ <string name="download_catalog_save_failed">保存目录失败</string>+ <string name="download_unknown_error">未知错误</string>+ <string name="download_catalog_failed">下载目录失败:%1$s</string>+ <!-- assistant overlay status -->+ <string name="assistant_invoke_prompt">在文字上方调用此助手即可翻译</string>+ <string name="assistant_collecting_context">正在收集屏幕内容…</string>+ <string name="assistant_screenshot_disabled">此助手的截屏权限已关闭。请在系统助手设置中开启。</string>+ <string name="assistant_no_screen_data">未收到屏幕数据。请为此助手开启\'使用截屏\'。</string>+ <string name="assistant_no_screenshot">此应用未提供截屏。</string>+ <string name="assistant_set_source_ocr">请为文字识别设置默认源语言。</string>+ <string name="assistant_langs_not_ready">翻译语言尚未就绪。请重试。</string>+ <string name="assistant_ocr_failed">文字识别失败</string>+ <string name="ocr_models_missing">缺少文字识别模型。请在应用中打开语言管理进行修复。</string>+ <string name="assistant_set_source_live">在设置中设定默认源语言即可使用实时屏幕翻译。</string>+ <!-- migration gate -->+ <string name="migration_updating_speech_models">正在更新语音模型</string>+ <string name="migration_accept_convert">接受并转换</string>+ <string name="migration_delete_all">改为全部删除</string>+ <string name="migration_converting">正在转换 %2$d 个中的第 %1$d 个</string>+ <string name="migration_optimizing">正在优化模型</string>+ <plurals name="migration_convert_prompt">+ <item quantity="other">你有 %1$d 个语音合成模型需要转换为新格式。大约需要 %2$d 秒。你将节省 %3$.0f MB 的磁盘空间。</item>+ </plurals>+ <!-- document translation notification + progress -->+ <string name="doc_notif_translating">正在翻译文件</string>+ <string name="doc_notif_translated">已翻译文件</string>+ <string name="doc_notif_phase_text">文字 %1$d%%</string>+ <string name="doc_notif_phase_images">图片 %1$d/%2$d</string>+ <string name="doc_notif_phase_raster">位图页面 %1$d/%2$d</string>+ <string name="doc_notif_channel_name">文档翻译</string>+ <string name="doc_notif_channel_desc">翻译文档时显示进度</string>+ <string name="doc_progress_preparing">正在准备文件</string>+ <string name="doc_progress_translating">正在翻译</string>+ <string name="doc_progress_translated">已翻译文件</string>+ <string name="doc_progress_saving">正在保存翻译后的文件</string>+ <string name="doc_translation_failed">文档翻译失败</string>+ <string name="doc_url_unsupported">请改为下载该文档并用本应用打开</string>+ <!-- document configure sheet -->+ <string name="document_wrap_columns">在 %1$d 列处换行</string>+ <string name="document_translate_pdf_images">翻译 PDF 中的图片</string>+ <string name="layout_preserve">保留换行</string>+ <string name="layout_reflow">重排为段落</string>+ <string name="layout_reflow_wrap">重排并换行</string>+ <!-- common (additional) -->+ <string name="common_open">打开</string>+ <string name="common_close">关闭</string>+ <string name="common_save">保存</string>+ <!-- translator app -->+ <string name="translator_translated_file">已翻译文件:%1$s</string>+ <string name="translator_document_saved">文档已保存</string>+ <string name="translator_document_save_failed">保存文档失败</string>+ <string name="translator_audio_playback_failed">音频播放失败:%1$s</string>+ <string name="translator_no_app_to_open">未找到可打开此文件的应用</string>+ <!-- document alignment -->+ <string name="docalign_decode_failed">无法解码图片。</string>+ <string name="docalign_detecting">正在检测边角…</string>+ <string name="docalign_redetecting">正在重新检测…</string>+ <string name="docalign_help">在文档周围画出精确的边框可以提高识别质量。重要的是边线要与文字平行。\n\n缩放或平移通常会让算法自动识别到文档,但如果未能找到,你仍然可以手动调整。</string>+ <!-- how to use -->+ <string name="howto_section_other_apps">从其他应用</string>+ <string name="howto_share_title">分享以翻译</string>+ <string name="howto_share_body">从任意应用分享文字、链接或图片即可翻译。</string>+ <string name="howto_copy_title">无需离开其他应用即可翻译</string>+ <string name="howto_copy_body">在任意位置选中文字,然后点按复制工具栏中的\"翻译\",即可在紧凑的弹窗中查看译文。</string>+ <string name="howto_section_in_app">在应用内</string>+ <string name="howto_docs_title">翻译文档</string>+ <string name="howto_docs_body">打开“文档”标签页即可翻译 EPUB、PDF 和 TXT 文件。</string>+ <string name="howto_dict_title">词典查询</string>+ <string name="howto_dict_body">长按译文中的任意词语即可查看释义。数据来自 Wiktionary。</string>+ <string name="howto_voice_title">更改语音或速度</string>+ <string name="howto_voice_body">长按播放按钮即可选择不同的语音或调整播放速度。</string>+ <!-- feature row labels -->+ <string name="feature_translation">翻译</string>+ <string name="feature_dictionary">词典</string>+ <string name="feature_tts">语音</string>+ <!-- misc -->+ <string name="main_input_placeholder">输入文字</string>+ <string name="aidl_target_unavailable">目标语言不可用</string>+ <string name="voice_section_downloaded">已下载</string>+ <string name="voice_section_available">可用</string>+ <string name="detected_translate_from">翻译自</string>+ <string name="detected_missing_language">缺少语言</string>+ <string name="langmgr_ocr_upgrade_available">有改进的文本检测模型可用。</string>+ <string name="settings_experimental_screen_translate">屏幕翻译(实验性功能)</string>+ <string name="a11y_add_target_language">添加目标翻译语言</string>+ <string name="a11y_remove_target_language">删除目标翻译语言</string>+ <string name="feature_unavailable_tts">文字转语音资源缺失,请从管理语言界面下载</string>+ <string name="feature_unavailable_dictionary">字典缺失,请从管理语言界面下载</string>+ <string name="image_crop_action">裁剪</string>+</resources>diff --git a/OCR-translation/src/main/res/values-zh-rTW/strings.xml b/OCR-translation/src/main/res/values-zh-rTW/strings.xmlnew file mode 100644index 0000000..2aec739--- /dev/null+++ b/OCR-translation/src/main/res/values-zh-rTW/strings.xml@@ -0,0 +1,216 @@+<?xml version="1.0" encoding="utf-8"?>+<resources>+ <string name="stop">停止</string>+ <string name="pause">暫停</string>+ <string name="resume">繼續</string>+ <string name="region_select_menu">設定翻譯區域</string>+ <string name="screen_translate_needs_source">請指定來源語言</string>+ <string name="live_tile_label">即時翻譯螢幕</string>+ <string name="translate_text">翻譯</string>+ <string name="translate_link">翻譯連結</string>+ <string name="accessibility_service_description">開啟此服務即可翻譯螢幕上的文字。點按浮動的翻譯按鈕可翻譯目前螢幕,或開始即時螢幕翻譯。</string>+ <string name="tap_to_translate_title">快速翻譯已開啟</string>+ <string name="tap_to_translate_body">點按以開啟翻譯彈出視窗</string>+ <string name="tap_to_translate_channel">快速翻譯</string>+ <string name="tap_to_translate_channel_description">用於快速開啟翻譯彈出視窗的常駐通知</string>+ <string name="quick_tile_label">翻譯</string>+ <!-- common -->+ <string name="common_ok">確定</string>+ <string name="common_cancel">取消</string>+ <string name="common_done">完成</string>+ <string name="common_grant">授予</string>+ <string name="common_manage">管理</string>+ <!-- settings -->+ <string name="settings_title">設定</string>+ <string name="settings_languages">語言</string>+ <string name="settings_language_packs">語言包</string>+ <string name="settings_general">一般</string>+ <string name="settings_font_size">字型大小</string>+ <string name="settings_font_sample">這是一段範例文字</string>+ <string name="settings_tap_notification">快速翻譯通知</string>+ <string name="settings_tap_notification_desc">用於開啟彈出視窗的常駐通知。</string>+ <string name="settings_web_translator">網頁翻譯</string>+ <string name="settings_clear_browsing">關閉時清除瀏覽資料</string>+ <string name="settings_clear_browsing_desc">刪除 Cookie、快取與本機儲存空間。</string>+ <string name="settings_tts_section">文字轉語音</string>+ <string name="settings_tts_read_urls_hashtags">朗讀網址和主題標籤</string>+ <string name="settings_popup_settings">彈出視窗</string>+ <string name="settings_popup_desc">從文字選取選單中選擇「翻譯」時會顯示彈出視窗</string>+ <string name="settings_hide_input">隱藏輸入框</string>+ <string name="settings_popup_position">彈出視窗位置</string>+ <string name="settings_popup_size">彈出視窗大小:%1$d%%</string>+ <string name="settings_screen_translation">螢幕翻譯</string>+ <string name="settings_screen_translation_desc">直接在其他應用程式上方翻譯文字。</string>+ <string name="settings_floating_button">常駐按鈕</string>+ <string name="settings_floating_button_desc">需要無障礙權限</string>+ <string name="settings_shortcut">透過捷徑翻譯螢幕</string>+ <string name="settings_shortcut_desc">長按主畫面鍵或電源鍵以觸發</string>+ <string name="settings_on_shortcut">觸發捷徑時</string>+ <string name="settings_ocr">圖片</string>+ <string name="settings_background_mode">文字替換為</string>+ <string name="settings_min_confidence">最低可信度:%1$d%%</string>+ <string name="settings_max_image_size">最大圖片尺寸:%1$dpx</string>+ <string name="settings_advanced">進階</string>+ <string name="settings_catalog_url">目錄 URL</string>+ <string name="settings_external_storage">使用外部儲存空間</string>+ <string name="settings_disable_autodetect">停用自動語言偵測</string>+ <string name="settings_translit_output">為譯文顯示音譯</string>+ <string name="settings_translit_input">為原文顯示音譯</string>+ <string name="settings_translit_japanese_spaces">為日文音譯加上空格</string>+ <string name="settings_translate_pdf_images">翻譯 PDF 中的圖片</string>+ <string name="settings_camera_live_default">預設以相機即時翻譯</string>+ <string name="settings_register_browser">註冊為瀏覽器</string>+ <string name="settings_register_browser_desc">提供翻譯其他應用程式的連結。</string>+ <string name="settings_external_storage_perm_title">外部儲存空間權限</string>+ <string name="settings_about">關於</string>+ <string name="settings_version">版本 %1$s</string>+ <string name="settings_no_languages_available">沒有可用的語言</string>+ <string name="settings_default_from">預設「來源」語言</string>+ <string name="settings_default_to">預設「目標」語言</string>+ <string name="settings_adblock_support">封鎖廣告</string>+ <string name="settings_about_get_help">取得協助 / 回報問題</string>+ <string name="settings_logs_copied">應用程式記錄已複製到剪貼簿</string>+ <string name="settings_about_support">支持開發</string>+ <string name="settings_external_storage_perm_body">為了將翻譯檔案儲存到你的「文件」資料夾,此應用程式需要管理所有檔案的權限。\n系統會帶你前往「設定」,你可以在那裡授予「允許存取以管理所有檔案」權限。</string>+ <!-- language manager / setup / how-to -->+ <string name="langmgr_voices">語音</string>+ <string name="voice_section_downloaded">已下載</string>+ <string name="voice_section_available">可用</string>+ <string name="langmgr_default">預設</string>+ <string name="langmgr_filter">篩選語言</string>+ <string name="langmgr_ocr_upgrade_available">已有改進的文字偵測模型可用。</string>+ <string name="langmgr_delete_shared_title">要刪除共用詞典嗎?</string>+ <string name="langmgr_delete_shared_body">此詞典與 %1$s 共用。\n刪除後將為它們全部移除此詞典。</string>+ <string name="langmgr_download_size">下載 %1$s</string>+ <string name="langmgr_repair_needed">部分已下載的功能缺少檔案,修復後才能使用。</string>+ <string name="langmgr_repair_size">修復 %1$s</string>+ <string name="nolang_title">語言設定</string>+ <string name="nolang_prompt">下載語言包即可開始翻譯</string>+ <string name="howto_title">使用方法</string>+ <!-- image capture / voice / dictionary / language selector -->+ <string name="image_no_crop_remote">遠端圖片無法直接裁切</string>+ <string name="image_open_failed">開啟檔案失敗</string>+ <string name="image_source_screen">螢幕</string>+ <string name="image_source_document">文件</string>+ <string name="image_source_photos">相片</string>+ <string name="image_source_gallery">相簿</string>+ <string name="image_source_camera">相機</string>+ <string name="voice_playback_speed">播放速度</string>+ <string name="voice_label">語音</string>+ <string name="voice_default">預設語音</string>+ <string name="langsel_auto">✨ 自動</string>+ <string name="dict_also_as">也作:</string>+ <!-- camera / browser / screen translate -->+ <string name="camera_permission_rationale">即時翻譯需要相機權限。</string>+ <string name="camera_need_ocr_models">你需要下載此語言的文字辨識模型(用於圖片)</string>+ <string name="browser_no_source_language">沒有可用的來源語言。請先從主畫面安裝一種,或在設定中設定預設來源語言。</string>+ <string name="browser_reader_unavailable">此頁面不支援閱讀模式</string>+ <string name="browser_translate_image">翻譯圖片</string>+ <string name="screen_translating_notification">正在翻譯螢幕</string>+ <!-- enums -->+ <string name="align_top">頂端</string>+ <string name="align_middle">置中</string>+ <string name="align_bottom">底部</string>+ <string name="assistant_action_still_image">翻譯一次</string>+ <string name="assistant_action_live_screen">開始即時翻譯</string>+ <string name="background_mode_white_on_black">黑底白字</string>+ <string name="background_mode_black_on_white">白底黑字</string>+ <string name="background_mode_auto_detect">原始圖片顏色</string>+ <!-- tts / speech errors -->+ <string name="tts_nothing_to_speak">沒有可朗讀的內容</string>+ <string name="tts_catalog_unavailable">目錄無法使用</string>+ <string name="tts_no_voice">尚未為 %1$s 安裝語音</string>+ <string name="tts_synthesis_failed">%1$s 的語音合成失敗</string>+ <string name="tts_sample_fallback">這是來自 Offline Translator 的語音範例。</string>+ <!-- translation -->+ <string name="translation_error">翻譯錯誤:%1$s</string>+ <!-- download errors -->+ <string name="download_failed_core">%1$s 下載失敗</string>+ <string name="download_failed_ocr">%1$s 圖片文字辨識下載失敗</string>+ <string name="download_failed_ocr_batch">圖片文字辨識批次下載失敗</string>+ <string name="download_failed_dictionary">%1$s 詞典下載失敗</string>+ <string name="download_failed_tts">%1$s 語音下載失敗</string>+ <string name="download_failed_adblock">廣告封鎖下載失敗</string>+ <string name="download_failed_repair">修復下載失敗</string>+ <string name="download_catalog_unavailable">目錄無法使用</string>+ <string name="download_catalog_save_failed">儲存目錄失敗</string>+ <string name="download_unknown_error">未知錯誤</string>+ <string name="download_catalog_failed">下載目錄失敗:%1$s</string>+ <!-- assistant overlay status -->+ <string name="assistant_invoke_prompt">在文字上方喚起此助理即可翻譯</string>+ <string name="assistant_collecting_context">正在收集螢幕內容…</string>+ <string name="assistant_screenshot_disabled">此助理的螢幕截圖存取權已停用。請在系統助理設定中啟用。</string>+ <string name="assistant_no_screen_data">未收到螢幕資料。請為此助理啟用「使用螢幕截圖」。</string>+ <string name="assistant_no_screenshot">此應用程式未提供螢幕截圖。</string>+ <string name="assistant_set_source_ocr">請為圖片文字辨識設定預設來源語言。</string>+ <string name="assistant_langs_not_ready">翻譯語言尚未就緒。請再試一次。</string>+ <string name="assistant_ocr_failed">文字辨識失敗</string>+ <string name="ocr_models_missing">缺少文字辨識模型。請在應用程式中開啟語言管理進行修復。</string>+ <string name="assistant_set_source_live">在設定中設定預設來源語言即可使用即時螢幕翻譯。</string>+ <!-- migration gate -->+ <string name="migration_updating_speech_models">正在更新語音模型</string>+ <string name="migration_accept_convert">接受並轉換</string>+ <string name="migration_delete_all">改為全部刪除</string>+ <string name="migration_converting">正在轉換第 %1$d / %2$d 個</string>+ <string name="migration_optimizing">正在最佳化模型</string>+ <plurals name="migration_convert_prompt">+ <item quantity="other">你有 %1$d 個語音合成模型需要轉換為新格式。大約需要 %2$d 秒。你將節省 %3$.0f MB 的磁碟空間。</item>+ </plurals>+ <!-- document translation notification + progress -->+ <string name="doc_notif_translating">正在翻譯檔案</string>+ <string name="doc_notif_translated">已翻譯檔案</string>+ <string name="doc_notif_phase_text">文字 %1$d%%</string>+ <string name="doc_notif_phase_images">圖片 %1$d/%2$d</string>+ <string name="doc_notif_phase_raster">點陣圖頁面 %1$d/%2$d</string>+ <string name="doc_notif_channel_name">文件翻譯</string>+ <string name="doc_notif_channel_desc">翻譯文件時顯示進度</string>+ <string name="doc_progress_preparing">正在準備檔案</string>+ <string name="doc_progress_translating">正在翻譯</string>+ <string name="doc_progress_translated">已翻譯檔案</string>+ <string name="doc_progress_saving">正在儲存翻譯後的檔案</string>+ <string name="doc_translation_failed">文件翻譯失敗</string>+ <string name="doc_url_unsupported">請改為下載文件並用本應用程式開啟</string>+ <!-- document configure sheet -->+ <string name="document_wrap_columns">在第 %1$d 欄換行</string>+ <string name="document_translate_pdf_images">翻譯 PDF 中的圖片</string>+ <string name="layout_preserve">保留換行</string>+ <string name="layout_reflow">重排為段落</string>+ <string name="layout_reflow_wrap">重排並換行</string>+ <!-- common (additional) -->+ <string name="common_open">開啟</string>+ <string name="common_close">關閉</string>+ <string name="common_save">儲存</string>+ <!-- translator app -->+ <string name="translator_translated_file">已翻譯檔案:%1$s</string>+ <string name="translator_document_saved">文件已儲存</string>+ <string name="translator_document_save_failed">儲存文件失敗</string>+ <string name="translator_audio_playback_failed">音訊播放失敗:%1$s</string>+ <string name="translator_no_app_to_open">找不到可開啟此檔案的應用程式</string>+ <!-- document alignment -->+ <string name="docalign_decode_failed">無法解碼圖片。</string>+ <string name="docalign_detecting">正在偵測邊角…</string>+ <string name="docalign_redetecting">正在重新偵測…</string>+ <string name="docalign_help">在文件周圍畫出精確的邊框可提升辨識品質。重要的是邊線要與文字平行。\n\n縮放或平移通常會讓演算法自動辨識到文件,但若未能找到,你仍可手動調整。</string>+ <!-- how to use -->+ <string name="howto_section_other_apps">從其他應用程式</string>+ <string name="howto_share_title">分享以翻譯</string>+ <string name="howto_share_body">從任何應用程式分享文字、連結或圖片即可翻譯。</string>+ <string name="howto_copy_title">無需離開其他應用程式即可翻譯</string>+ <string name="howto_copy_body">在任何地方選取文字,然後點按複製工具列中的「翻譯」,即可在精簡的彈出視窗中查看譯文。</string>+ <string name="howto_section_in_app">在應用程式內</string>+ <string name="howto_docs_title">翻譯文件與圖片</string>+ <string name="howto_docs_body">開啟「文件」分頁即可翻譯圖片或 EPUB、PDF 與 TXT 檔案。</string>+ <string name="howto_dict_title">詞典查詢</string>+ <string name="howto_dict_body">長按譯文中的任何字詞即可查看釋義。資料來自 Wiktionary。</string>+ <string name="howto_voice_title">變更語音或速度</string>+ <string name="howto_voice_body">長按播放按鈕即可選擇不同的語音或調整播放速度。</string>+ <!-- feature row labels -->+ <string name="feature_translation">翻譯</string>+ <string name="feature_dictionary">詞典</string>+ <string name="feature_tts">語音</string>+ <!-- misc -->+ <string name="detected_translate_from">翻譯自</string>+ <string name="detected_missing_language">缺少語言</string>+ <string name="main_input_placeholder">輸入文字</string>+ <string name="aidl_target_unavailable">目標語言無法使用</string>+</resources>diff --git a/OCR-translation/src/main/res/values/bools.xml b/OCR-translation/src/main/res/values/bools.xmlnew file mode 100644index 0000000..7c2c68b--- /dev/null+++ b/OCR-translation/src/main/res/values/bools.xml@@ -0,0 +1,4 @@+<?xml version="1.0" encoding="utf-8"?>+<resources>+ <bool name="accessibility_service_enabled">false</bool>+</resources>diff --git a/OCR-translation/src/main/res/values/colors.xml b/OCR-translation/src/main/res/values/colors.xmlnew file mode 100644index 0000000..f8c6127--- /dev/null+++ b/OCR-translation/src/main/res/values/colors.xml@@ -0,0 +1,10 @@+<?xml version="1.0" encoding="utf-8"?>+<resources>+ <color name="purple_200">#FFBB86FC</color>+ <color name="purple_500">#FF6200EE</color>+ <color name="purple_700">#FF3700B3</color>+ <color name="teal_200">#FF03DAC5</color>+ <color name="teal_700">#FF018786</color>+ <color name="black">#FF000000</color>+ <color name="white">#FFFFFFFF</color>+</resources>\ No newline at end of filediff --git a/OCR-translation/src/main/res/values/colors_ucrop_overrides.xml b/OCR-translation/src/main/res/values/colors_ucrop_overrides.xmlnew file mode 100644index 0000000..cfe4f0c--- /dev/null+++ b/OCR-translation/src/main/res/values/colors_ucrop_overrides.xml@@ -0,0 +1,5 @@+<?xml version="1.0" encoding="utf-8"?>+<resources xmlns:tools="http://schemas.android.com/tools">+ <color name="ucrop_color_progress_wheel_line" tools:override="true">#B3FFFFFF</color>+ <color name="ucrop_color_widget_rotate_angle" tools:override="true">#B3FFFFFF</color>+</resources>diff --git a/OCR-translation/src/main/res/values/dimens.xml b/OCR-translation/src/main/res/values/dimens.xmlnew file mode 100644index 0000000..d687960--- /dev/null+++ b/OCR-translation/src/main/res/values/dimens.xml@@ -0,0 +1,4 @@+<?xml version="1.0" encoding="utf-8"?>+<resources>+ <dimen name="ucrop_padding_crop_frame" tools:override="true" xmlns:tools="http://schemas.android.com/tools">36dp</dimen>+</resources>diff --git a/OCR-translation/src/main/res/values/strings.xml b/OCR-translation/src/main/res/values/strings.xmlnew file mode 100644index 0000000..e9b05bc--- /dev/null+++ b/OCR-translation/src/main/res/values/strings.xml@@ -0,0 +1,335 @@+<resources>+ <string name="app_name" translatable="false">Translator</string>+ <string name="stop">Stop</string>+ <string name="pause">Pause</string>+ <string name="resume">Resume</string>+ <string name="region_select_menu">Set translation area</string>+ <string name="screen_translate_needs_source">Specify source language</string>+ <string name="live_tile_label">Translate screen live</string>+ <string name="translate_text">Translate</string>+ <string name="translate_link">Translate link</string>+ <string name="accessibility_service_description">Enable this service to translate text on screen. Tap the floating translate button to translate the current screen, or start a live screen translation.</string>+ <string name="tap_to_translate_title">Quick Translate is on</string>+ <string name="tap_to_translate_body">Tap to open the translator popup</string>+ <string name="tap_to_translate_channel">Quick Translate</string>+ <string name="tap_to_translate_channel_description">Persistent notification for quick access to the translator popup</string>+ <string name="quick_tile_label">Translate</string>++ <!-- common -->+ <string name="common_ok">OK</string>+ <string name="common_cancel">Cancel</string>+ <string name="common_done">Done</string>+ <string name="common_grant">Grant</string>+ <string name="common_manage">Manage</string>++ <!-- settings -->+ <string name="settings_title">Settings</string>+ <string name="settings_languages">Languages</string>+ <string name="settings_language_packs">Language Packs</string>+ <string name="settings_general">General</string>+ <string name="settings_font_size">Font Size</string>+ <string name="settings_font_sample">This is some example text</string>+ <string name="settings_tap_notification">Quick Translate notification</string>+ <string name="settings_tap_notification_desc">Persistent notification that opens the popup.</string>+ <string name="settings_web_translator">Web Translator</string>+ <string name="settings_clear_browsing">Clear browsing data on close</string>+ <string name="settings_clear_browsing_desc">Deletes cookies, cache and local storage.</string>+ <string name="settings_tts_section">Text to speech</string>+ <string name="settings_tts_read_urls_hashtags">Read URLs and hashtags</string>+ <string name="settings_popup_settings">Popup</string>+ <string name="settings_popup_desc">Popup shows up when selecting \'Translate\' from the text selection menu</string>+ <string name="settings_hide_input">Hide input</string>+ <string name="settings_popup_position">Popup position</string>+ <string name="settings_popup_size">Popup size: %1$d%%</string>+ <string name="settings_screen_translation">Screen translation</string>+ <string name="settings_screen_translation_desc">Translate text directly on top of other apps.</string>+ <string name="settings_floating_button">Always-on button</string>+ <string name="settings_floating_button_desc">Requires accessibility role</string>+ <string name="settings_shortcut">Translate screen on shortcut</string>+ <string name="settings_shortcut_desc">Long-press home or power to trigger</string>+ <string name="settings_on_shortcut">On shortcut invocation</string>+ <string name="settings_ocr">Images</string>+ <string name="settings_background_mode">Replace text with</string>+ <string name="settings_min_confidence">Min Confidence: %1$d%%</string>+ <string name="settings_max_image_size">Max Image Size: %1$dpx</string>+ <string name="settings_advanced">Advanced</string>+ <string name="settings_catalog_url">Catalog URL</string>+ <string name="settings_external_storage">Use external storage</string>+ <string name="settings_disable_autodetect">Disable automatic language detection</string>+ <string name="settings_experimental_screen_translate">Screen translate (experimental)</string>+ <string name="settings_multi_target">Multiple target languages</string>+ <string name="a11y_add_target_language">Add target language</string>+ <string name="a11y_remove_target_language">Remove target language</string>+ <string name="feature_unavailable_tts">Text-to-speech is not available, download it from the manage languages page</string>+ <string name="feature_unavailable_dictionary">Dictionary is not available, download it from the manage languages page</string>+ <string name="settings_translit_output">Show transliteration for translated text</string>+ <string name="settings_translit_input">Show transliteration for original text</string>+ <string name="settings_translit_japanese_spaces">Add spaces for Japanese transliteration</string>+ <string name="settings_translate_pdf_images">Translate images in PDFs</string>+ <string name="settings_camera_live_default">Translate camera live by default</string>+ <string name="settings_register_browser">Register as browser</string>+ <string name="settings_register_browser_desc">Offer to translate links from other apps.</string>+ <string name="settings_external_storage_perm_title">External Storage Permission</string>+ <string name="settings_about">About</string>+ <string name="settings_version">Version %1$s</string>+ <string name="settings_no_languages_available">No languages available</string>+ <string name="settings_default_from">Default \'from\' language</string>+ <string name="settings_default_to">Default \'to\' language</string>+ <string name="settings_adblock_support">Ad blocking</string>+ <string name="settings_about_get_help">Get help / report issue</string>+ <string name="settings_logs_copied">App logs copied to clipboard</string>+ <string name="settings_about_support">Support development</string>+ <string name="settings_external_storage_perm_body">To store translation files in your Documents folder, this app needs access to manage all files.\nYou\'ll be taken to Settings where you can grant \'Allow access to manage all files\' permission.</string>++ <!-- language manager / setup / how-to -->+ <string name="langmgr_voices">Voices</string>+ <string name="voice_section_downloaded">DOWNLOADED</string>+ <string name="voice_section_available">AVAILABLE</string>+ <string name="langmgr_default">DEFAULT</string>+ <string name="langmgr_filter">Filter languages</string>+ <string name="langmgr_ocr_upgrade_available">An improved text detection model is available.</string>+ <string name="langmgr_translation_upgrade_available">Improved translation available for: %1$s</string>+ <string name="langmgr_delete_shared_title">Delete shared dictionary?</string>+ <string name="langmgr_delete_shared_body">This dictionary is shared with %1$s.\nDeleting it will remove the dictionary for all of them.</string>+ <string name="langmgr_download_size">Download %1$s</string>+ <string name="langmgr_repair_needed">Some downloaded features are missing files and won\'t work until repaired.</string>+ <string name="langmgr_repair_size">Repair %1$s</string>+ <string name="nolang_title">Language Setup</string>+ <string name="nolang_prompt">Download language packs to start translating</string>+ <string name="howto_title">How to use</string>++ <!-- image capture / voice / dictionary / language selector -->+ <string name="image_no_crop_remote">Remote images cannot be cropped directly</string>+ <string name="image_crop_action">Crop</string>+ <string name="image_open_failed">Failed to open file</string>+ <string name="image_source_screen">Screen</string>+ <string name="image_source_document">Document</string>+ <string name="image_source_photos">Photos</string>+ <string name="image_source_gallery">Gallery</string>+ <string name="image_source_camera">Camera</string>+ <string name="voice_playback_speed">Playback speed</string>+ <string name="voice_label">Voice</string>+ <string name="voice_default">Default voice</string>+ <string name="langsel_auto">✨ Auto</string>+ <string name="dict_also_as">Also as:</string>++ <!-- camera / browser / screen translate -->+ <string name="camera_permission_rationale">Camera permission is needed for live translate.</string>+ <string name="camera_need_ocr_models">You need to download the text-recognition models for this language</string>+ <string name="browser_no_source_language">No source language available. Install one from the main screen first, or set a default source language in settings.</string>+ <string name="browser_reader_unavailable">Reader mode unavailable for this page</string>+ <string name="browser_translate_image">Translate image</string>+ <string name="screen_translating_notification">Translating screen</string>++ <!-- enums -->+ <string name="align_top">Top</string>+ <string name="align_middle">Middle</string>+ <string name="align_bottom">Bottom</string>+ <string name="assistant_action_still_image">Translate once</string>+ <string name="assistant_action_live_screen">Start live translation</string>+ <string name="background_mode_white_on_black">White on Black</string>+ <string name="background_mode_black_on_white">Black on White</string>+ <string name="background_mode_auto_detect">Original Image Colors</string>++ <!-- tts / speech errors -->+ <string name="tts_nothing_to_speak">Nothing to speak</string>+ <string name="tts_catalog_unavailable">Catalog unavailable</string>+ <string name="tts_no_voice">No voice installed for %1$s</string>+ <string name="tts_synthesis_failed">Speech synthesis failed for %1$s</string>+ <string name="tts_synthesis_error">Speech synthesis failed for %1$s: %2$s</string>+ <string name="tts_sample_fallback">This is a text-to-speech sample from Offline Translator.</string>++ <!-- translation -->+ <string name="translation_error">Translation error: %1$s</string>++ <!-- download errors -->+ <string name="download_failed_core">%1$s download failed</string>+ <string name="download_failed_ocr">%1$s text recognition download failed</string>+ <string name="download_failed_ocr_batch">Text recognition batch download failed</string>+ <string name="download_failed_translation_batch">Translation upgrade download failed</string>+ <string name="download_failed_dictionary">%1$s dictionary download failed</string>+ <string name="download_failed_tts">%1$s voice download failed</string>+ <string name="download_failed_adblock">Adblock download failed</string>+ <string name="download_failed_repair">Repair download failed</string>+ <string name="download_catalog_unavailable">Catalog unavailable</string>+ <string name="download_catalog_save_failed">Failed to save catalog</string>+ <string name="download_unknown_error">Unknown error</string>+ <string name="download_catalog_failed">Failed to download catalog: %1$s</string>++ <!-- assistant overlay status -->+ <string name="assistant_invoke_prompt">Invoke this assistant on top of text to translate it</string>+ <string name="assistant_collecting_context">Collecting screen context…</string>+ <string name="assistant_screenshot_disabled">Screenshot access is disabled for this assistant. Enable it in the system assistant settings.</string>+ <string name="assistant_no_screen_data">No screen data received. Enable \'Use screenshot\' for this assistant.</string>+ <string name="assistant_no_screenshot">This app did not provide a screenshot.</string>+ <string name="assistant_set_source_ocr">Set a default source language for text recognition.</string>+ <string name="assistant_langs_not_ready">Translation languages aren\'t ready yet. Try again.</string>+ <string name="assistant_ocr_failed">Text recognition failed</string>+ <string name="ocr_models_missing">Text recognition models are missing. Open Manage languages in the app to repair.</string>+ <string name="assistant_set_source_live">Set a default source language in Settings to use live screen translation.</string>++ <!-- migration gate -->+ <string name="migration_updating_speech_models">Updating speech models</string>+ <string name="migration_accept_convert">Accept and convert</string>+ <string name="migration_delete_all">Delete all instead</string>+ <string name="migration_converting">Converting %1$d of %2$d</string>+ <string name="migration_optimizing">Optimizing models</string>+ <plurals name="migration_convert_prompt">+ <item quantity="one">You have %1$d text-to-speech model to convert to a new format. It will take approximately %2$d seconds. You will save %3$.0f MB of disk space.</item>+ <item quantity="other">You have %1$d text-to-speech models to convert to a new format. It will take approximately %2$d seconds. You will save %3$.0f MB of disk space.</item>+ </plurals>++ <!-- document translation notification + progress -->+ <string name="doc_notif_translating">Translating file</string>+ <string name="doc_notif_translated">Translated file</string>+ <string name="doc_notif_phase_text">Text %1$d%%</string>+ <string name="doc_notif_phase_images">Images %1$d/%2$d</string>+ <string name="doc_notif_phase_raster">Bitmap pages %1$d/%2$d</string>+ <string name="doc_notif_progress_percent" translatable="false">%1$d%%</string>+ <string name="doc_notif_channel_name">Document translation</string>+ <string name="doc_notif_channel_desc">Shows progress while translating documents</string>+ <string name="doc_progress_preparing">Preparing file</string>+ <string name="doc_progress_translating">Translating</string>+ <string name="doc_progress_translated">Translated file</string>+ <string name="doc_progress_saving">Saving translated file</string>+ <string name="doc_translation_failed">Document translation failed</string>+ <string name="doc_url_unsupported">Download the document and open it with the app instead</string>++ <!-- document configure sheet -->+ <string name="document_wrap_columns">Wrap at %1$d columns</string>+ <string name="document_translate_pdf_images">Translate images in PDF</string>+ <string name="layout_preserve">Preserve line breaks</string>+ <string name="layout_reflow">Reflow into paragraphs</string>+ <string name="layout_reflow_wrap">Reflow and wrap</string>++ <!-- common (additional) -->+ <string name="common_open">Open</string>+ <string name="common_close">Close</string>+ <string name="common_save">Save</string>++ <!-- translator app -->+ <string name="translator_percent" translatable="false">%1$d%%</string>+ <string name="translator_translated_file">Translated file: %1$s</string>+ <string name="translator_document_saved">Document saved</string>+ <string name="translator_document_save_failed">Failed to save document</string>+ <string name="translator_audio_playback_failed">Audio playback failed: %1$s</string>+ <string name="translator_no_app_to_open">No app found to open this file</string>++ <!-- document alignment -->+ <string name="docalign_decode_failed">Unable to decode image.</string>+ <string name="docalign_detecting">Detecting corners…</string>+ <string name="docalign_redetecting">Re-detecting…</string>+ <string name="docalign_help">A precise perimeter around the document improves recognition quality. It is important that the lines are parallel to the text.\n\nZooming or panning usually makes the algorithm automatically pick up the document, but you can still manually adjust if it\'s not found.</string>++ <!-- how to use -->+ <string name="howto_section_other_apps">From other apps</string>+ <string name="howto_share_title">Share to translate</string>+ <string name="howto_share_body">Share text, links, or images from any app to translate them.</string>+ <string name="howto_copy_title">Translate without leaving other apps</string>+ <string name="howto_copy_body">Select text on any app, then tap \"Translate\" in the copy toolbar to see the translation in a compact popup.</string>+ <string name="howto_section_in_app">Inside the app</string>+ <string name="howto_docs_title">Translate documents and images</string>+ <string name="howto_docs_body">Open the Documents tab to translate images or EPUB, PDF, and TXT files.</string>+ <string name="howto_dict_title">Dictionary lookup</string>+ <string name="howto_dict_body">Long-press any word, then hit \"Dictionary\" to see its definition. Alternatively, tap the dictionary button, then tap any word. Data sourced from Wiktionary.</string>+ <string name="howto_alt_title">Choose alternative words</string>+ <string name="howto_alt_body">Tap the alternatives button, then tap on any word to replace it. The model may provide some alternatives, otherwise, you can fill in your own. The rest of the sentence re-translates to match.</string>+ <string name="howto_voice_title">Change voice or speed</string>+ <string name="howto_voice_body">Long-press the play button to pick a different voice or adjust playback speed.</string>++ <!-- feature row labels -->+ <string name="feature_translation">Translation</string>+ <string name="feature_dictionary">Dictionary</string>+ <string name="feature_tts">Voice</string>++ <!-- misc -->+ <string name="detected_translate_from">Translate from</string>+ <string name="detected_missing_language">Missing language</string>+ <string name="main_input_placeholder">Enter text</string>+ <string name="aidl_target_unavailable">Target language not available</string>++ <!-- accessibility / content descriptions -->+ <string name="a11y_cancel">Cancel</string>+ <string name="a11y_region_reset">Reset to full screen</string>+ <string name="a11y_region_confirm">Confirm region</string>+ <string name="a11y_translate_screen_live">Translate screen live</string>+ <string name="a11y_refresh">Refresh</string>+ <string name="a11y_select_text">Select text</string>+ <string name="a11y_set_translation_area">Set translation area</string>+ <string name="a11y_show_original">Show original</string>+ <string name="a11y_pause_resume">Pause or resume</string>+ <string name="a11y_primary_input">Primary input</string>+ <string name="a11y_help">Help</string>+ <string name="a11y_rotate_90">Rotate 90 degrees</string>+ <string name="a11y_switch_rectangular_crop">Switch to rectangular crop</string>+ <string name="a11y_detect_document_corners">Detect document corners</string>+ <string name="a11y_cancel_download">Cancel Download</string>+ <string name="a11y_delete_language">Delete Language</string>+ <string name="a11y_retry_download">Retry Download</string>+ <string name="a11y_download">Download</string>+ <string name="a11y_share_image">Share image</string>+ <string name="a11y_close_fullscreen">Close full screen view</string>+ <string name="a11y_translation_output">Translation output</string>+ <string name="a11y_output_textview">Output textview</string>+ <string name="a11y_copy_translation">Copy translation</string>+ <string name="a11y_alternatives_mode_on">Exit alternatives mode</string>+ <string name="a11y_alternatives_mode_off">Alternatives mode: tap a word to see other translations</string>+ <string name="a11y_close_alternatives">Close alternatives</string>+ <string name="alt_custom_entry">Type your own…</string>+ <string name="alt_custom_label">Your word</string>+ <string name="alt_custom_preview_label">Preview</string>+ <string name="a11y_dictionary_mode_on">Exit dictionary mode</string>+ <string name="a11y_dictionary_mode_off">Dictionary mode: tap a word to look it up</string>+ <string name="a11y_source_document">Document</string>+ <string name="a11y_source_photos">Photos</string>+ <string name="a11y_source_gallery">Gallery</string>+ <string name="a11y_source_camera">Camera</string>+ <string name="a11y_back">Back</string>+ <string name="a11y_reverse_translation_direction">Reverse translation direction</string>+ <string name="a11y_settings">Settings</string>+ <string name="a11y_close">Close</string>+ <string name="a11y_dictionary_status">Dictionary Status</string>+ <string name="a11y_dictionary_entry">Dictionary Entry</string>+ <string name="a11y_tts_status">Text-to-speech Status</string>+ <string name="a11y_main_screen">Main screen</string>+ <string name="a11y_translate_image_or_file">Translate image or file</string>+ <string name="a11y_replace_text">Replace text</string>+ <string name="a11y_clear_input">Clear input</string>+ <string name="a11y_resize_split">Resize input and output areas</string>+ <string name="a11y_paste">Paste</string>+ <string name="a11y_voice_input">Voice input</string>+ <string name="a11y_detected_language_toast">Detected language toast</string>+ <string name="a11y_switch_detected_language">Switch to detected language</string>+ <string name="a11y_torch_on">Torch on</string>+ <string name="a11y_torch_off">Torch off</string>+ <string name="a11y_live_overlay_on">Live overlay on</string>+ <string name="a11y_live_overlay_off">Live overlay off</string>+ <string name="a11y_collapse">Collapse</string>+ <string name="a11y_expand">Expand</string>+ <string name="a11y_delete">Delete</string>+ <string name="a11y_favorite_remove">Remove from favorites</string>+ <string name="a11y_favorite_add">Add to favorites</string>+ <string name="a11y_download_feature">Download Feature</string>+ <string name="a11y_show_translated_image">Show translated image</string>+ <string name="a11y_show_original_image">Show original image</string>+ <string name="a11y_stop_audio">Stop audio</string>+ <string name="a11y_speak_input">Speak input</string>+ <string name="a11y_speak_translation">Speak translation</string>+ <string name="a11y_original_image">Original image</string>+ <string name="a11y_translated_image">Translated image</string>+ <string name="a11y_zoomable_original_image">Zoomable original image</string>+ <string name="a11y_zoomable_translated_image">Zoomable translated image</string>+ <string name="settings_http_server">Enable LibreTranslate compatible HTTP server</string>+ <string name="settings_http_server_desc">Allows other apps to programmatically request translations</string>+ <string name="settings_http_server_port">Port</string>+ <string name="settings_http_server_bind">Bind on</string>+ <string name="settings_http_server_bind_localhost">localhost</string>+ <string name="settings_http_server_bind_all">all interfaces</string>+ <string name="settings_http_server_title">API Server</string>+ <string name="http_server_notif_channel_name">Translation API</string>+ <string name="http_server_notif_channel_desc">Shown while the LibreTranslate compatible server is running</string>+ <string name="http_server_notif_running">Translation API</string>+ <string name="http_server_notif_text">Listening on %1$s:%2$d</string>+ <string name="http_server_notif_error">Failed to start on port %1$d</string>+ <string name="http_server_notif_disable">Disable</string>+</resources>diff --git a/OCR-translation/src/main/res/values/styles.xml b/OCR-translation/src/main/res/values/styles.xmlnew file mode 100644index 0000000..513b4eb--- /dev/null+++ b/OCR-translation/src/main/res/values/styles.xml@@ -0,0 +1,12 @@+<?xml version="1.0" encoding="utf-8"?>+<resources>++ <style name="WideDialogTheme" parent="Theme.Translator">+ <item name="android:windowBackground">@android:color/transparent</item>+ <item name="android:windowIsTranslucent">true</item>+ <item name="android:windowNoTitle">true</item>+ <item name="android:windowContentOverlay">@null</item>+ <item name="android:windowIsFloating">false</item>+ <item name="android:backgroundDimEnabled">false</item>+ </style>+</resources>diff --git a/OCR-translation/src/main/res/values/themes.xml b/OCR-translation/src/main/res/values/themes.xmlnew file mode 100644index 0000000..e7e725e--- /dev/null+++ b/OCR-translation/src/main/res/values/themes.xml@@ -0,0 +1,30 @@+<?xml version="1.0" encoding="utf-8"?>+<resources>++ <style name="Theme.Translator" parent="android:Theme.Material.Light.NoActionBar">+ <!-- Disable window enter/exit animations -->+ <item name="android:windowAnimationStyle">@null</item>+ <!-- Set window background to match Material3 surface color -->+ <item name="android:windowBackground">?attr/colorSurface</item>+ <!-- Ensure no window enter/exit transitions -->+ <item name="android:windowEnterTransition">@null</item>+ <item name="android:windowExitTransition">@null</item>+ <item name="android:windowSharedElementEnterTransition">@null</item>+ <item name="android:windowSharedElementExitTransition">@null</item>+ </style>++ <style name="Theme.Translator.CropImage" parent="Theme.AppCompat.NoActionBar">+ <item name="colorPrimary">@android:color/black</item>+ <item name="colorPrimaryDark">@android:color/black</item>+ <item name="android:windowBackground">@android:color/black</item>+ <item name="android:windowAnimationStyle">@null</item>+ </style>++ <style name="Theme.Translator.WebView.Light" parent="android:Theme.Material.Light.NoActionBar">+ <item name="android:isLightTheme">true</item>+ </style>++ <style name="Theme.Translator.WebView.Dark" parent="android:Theme.Material.NoActionBar">+ <item name="android:isLightTheme">false</item>+ </style>+</resources>diff --git a/OCR-translation/src/main/res/xml/accessibility_service_config.xml b/OCR-translation/src/main/res/xml/accessibility_service_config.xmlnew file mode 100644index 0000000..3002a66--- /dev/null+++ b/OCR-translation/src/main/res/xml/accessibility_service_config.xml@@ -0,0 +1,8 @@+<?xml version="1.0" encoding="utf-8"?>+<accessibility-service xmlns:android="http://schemas.android.com/apk/res/android"+ android:accessibilityEventTypes="typeViewScrolled"+ android:accessibilityFeedbackType="feedbackGeneric"+ android:accessibilityFlags="flagDefault"+ android:canTakeScreenshot="true"+ android:notificationTimeout="500"+ android:description="@string/accessibility_service_description" />diff --git a/OCR-translation/src/main/res/xml/backup_rules.xml b/OCR-translation/src/main/res/xml/backup_rules.xmlnew file mode 100644index 0000000..fa0f996--- /dev/null+++ b/OCR-translation/src/main/res/xml/backup_rules.xml@@ -0,0 +1,13 @@+<?xml version="1.0" encoding="utf-8"?><!--+ Sample backup rules file; uncomment and customize as necessary.+ See https://developer.android.com/guide/topics/data/autobackup+ for details.+ Note: This file is ignored for devices older that API 31+ See https://developer.android.com/about/versions/12/backup-restore+-->+<full-backup-content>+ <!--+ <include domain="sharedpref" path="."/>+ <exclude domain="sharedpref" path="device.xml"/>+-->+</full-backup-content>\ No newline at end of filediff --git a/OCR-translation/src/main/res/xml/data_extraction_rules.xml b/OCR-translation/src/main/res/xml/data_extraction_rules.xmlnew file mode 100644index 0000000..9ee9997--- /dev/null+++ b/OCR-translation/src/main/res/xml/data_extraction_rules.xml@@ -0,0 +1,19 @@+<?xml version="1.0" encoding="utf-8"?><!--+ Sample data extraction rules file; uncomment and customize as necessary.+ See https://developer.android.com/about/versions/12/backup-restore#xml-changes+ for details.+-->+<data-extraction-rules>+ <cloud-backup>+ <!-- TODO: Use <include> and <exclude> to control what is backed up.+ <include .../>+ <exclude .../>+ -->+ </cloud-backup>+ <!--+ <device-transfer>+ <include .../>+ <exclude .../>+ </device-transfer>+ -->+</data-extraction-rules>\ No newline at end of filediff --git a/OCR-translation/src/main/res/xml/file_paths.xml b/OCR-translation/src/main/res/xml/file_paths.xmlnew file mode 100644index 0000000..997edfa--- /dev/null+++ b/OCR-translation/src/main/res/xml/file_paths.xml@@ -0,0 +1,5 @@+<?xml version="1.0" encoding="utf-8"?>+<paths>+ <external-cache-path name="camera_images" path="." />+ <cache-path name="camera_images_internal" path="." />+</paths>\ No newline at end of filediff --git a/OCR-translation/src/main/res/xml/tts_engine.xml b/OCR-translation/src/main/res/xml/tts_engine.xmlnew file mode 100644index 0000000..f40dc2f--- /dev/null+++ b/OCR-translation/src/main/res/xml/tts_engine.xml@@ -0,0 +1,3 @@+<?xml version="1.0" encoding="utf-8"?>+<tts-engine xmlns:android="http://schemas.android.com/apk/res/android"+ android:settingsActivity="dev.davidv.translator.TranslatorTtsSettingsRelayActivity" />diff --git a/OCR-translation/src/main/res/xml/voice_interaction_service.xml b/OCR-translation/src/main/res/xml/voice_interaction_service.xmlnew file mode 100644index 0000000..97b804a--- /dev/null+++ b/OCR-translation/src/main/res/xml/voice_interaction_service.xml@@ -0,0 +1,7 @@+<?xml version="1.0" encoding="utf-8"?>+<voice-interaction-service xmlns:android="http://schemas.android.com/apk/res/android"+ android:recognitionService="dev.davidv.translator.assistantOverlay.TranslatorRecognitionService"+ android:sessionService="dev.davidv.translator.assistantOverlay.TranslatorVoiceInteractionSessionService"+ android:settingsActivity="dev.davidv.translator.MainActivity"+ android:supportsAssist="true"+ android:supportsLaunchVoiceAssistFromKeyguard="false" />diff --git a/OCR-translation/src/test/java/com/akslabs/ocr_translation/ExampleUnitTest.kt b/OCR-translation/src/test/java/com/akslabs/ocr_translation/ExampleUnitTest.ktnew file mode 100644index 0000000..283c1bd--- /dev/null+++ b/OCR-translation/src/test/java/com/akslabs/ocr_translation/ExampleUnitTest.kt@@ -0,0 +1,17 @@+package com.akslabs.ocr_translation++import org.junit.Test++import org.junit.Assert.*++/**+ * Example local unit test, which will execute on the development machine (host).+ *+ * See [testing documentation](http://d.android.com/tools/testing).+ */+class ExampleUnitTest {+ @Test+ fun addition_isCorrect() {+ assertEquals(4, 2 + 2)+ }+}\ No newline at end of filediff --git a/app/build.gradle.kts b/app/build.gradle.ktsindex 48c888d..0c0ef7a 100644--- a/app/build.gradle.kts+++ b/app/build.gradle.kts@@ -124,6 +124,7 @@ androidComponents {}dependencies {+ implementation(project(":OCR-translation"))implementation(libs.androidx.core.ktx)implementation(libs.androidx.lifecycle.runtime.ktx)implementation(libs.androidx.activity.compose)@@ -143,6 +144,6 @@ dependencies {implementation("androidx.swiperefreshlayout:swiperefreshlayout:1.1.0")implementation("androidx.webkit:webkit:1.9.0")implementation("com.google.code.gson:gson:2.10.1")- implementation("com.github.adaptech-cz.Tesseract4Android:tesseract4android:4.7.0")+ implementation("com.github.adaptech-cz.Tesseract4Android:tesseract4android:4.8.0")implementation("com.google.zxing:core:3.5.4")}diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xmlindex d4182f6..30e43c4 100644--- a/app/src/main/AndroidManifest.xml+++ b/app/src/main/AndroidManifest.xml@@ -38,6 +38,7 @@android:theme="@style/Theme.CircleToSearch"android:enableOnBackInvokedCallback="true"android:extractNativeLibs="true"+ tools:replace="android:theme,android:allowBackup"tools:targetApi="31"><activityandroid:name=".MainActivity"diff --git a/app/src/main/java/com/akslabs/circletosearch/MainActivity.kt b/app/src/main/java/com/akslabs/circletosearch/MainActivity.ktindex b220c5b..a637f1b 100644--- a/app/src/main/java/com/akslabs/circletosearch/MainActivity.kt+++ b/app/src/main/java/com/akslabs/circletosearch/MainActivity.kt@@ -31,6 +31,7 @@ import androidx.compose.animation.animateContentSizeimport androidx.compose.foundation.backgroundimport androidx.compose.foundation.clickableimport androidx.compose.foundation.layout.*+import androidx.compose.foundation.shape.CircleShapeimport androidx.compose.foundation.rememberScrollStateimport androidx.compose.foundation.verticalScrollimport androidx.compose.material.icons.Icons@@ -43,6 +44,7 @@ import androidx.compose.ui.Modifierimport androidx.compose.ui.draw.clipimport androidx.compose.ui.graphics.Colorimport androidx.compose.ui.platform.LocalContext+import androidx.compose.ui.platform.testTagimport androidx.compose.ui.res.painterResourceimport androidx.compose.ui.res.stringResourceimport androidx.compose.ui.text.SpanStyle@@ -56,7 +58,10 @@ import androidx.compose.ui.window.DialogPropertiesimport com.akslabs.circletosearch.onboarding.PixelCircleSearchOnboardingScreenimport com.akslabs.circletosearch.ui.components.PrivacyDialogimport com.akslabs.circletosearch.ui.theme.CircleToSearchTheme+import com.akslabs.circletosearch.ui.theme.M3ExpressiveShapes+import com.akslabs.circletosearch.ui.theme.m3ExpressivePressimport com.akslabs.circletosearch.utils.PrivacyPreferences+import dev.davidv.translator.MainActivity as TranslatorMainActivityimport com.akslabs.circletosearch.ui.components.DonateBottomSheetimport com.akslabs.circletosearch.ui.components.AccessibilityDisclosureDialogimport com.akslabs.circletosearch.ui.components.UnifiedSearchMethodSelector@@ -171,61 +176,98 @@ fun SetupScreen(onSettingsClick: () -> Unit, onOcrSettingsClick: () -> Unit) {horizontalAlignment = Alignment.CenterHorizontally) {Spacer(modifier = Modifier.height(32.dp))-- // 1. Header- Box(- modifier = Modifier.fillMaxWidth()++ Row(+ modifier = Modifier.fillMaxWidth(),+ verticalAlignment = Alignment.CenterVertically,+ horizontalArrangement = Arrangement.spacedBy(14.dp)) {- Text(- text = stringResource(R.string.header_title),- style = MaterialTheme.typography.displaySmall.copy(fontWeight = FontWeight.Bold),- color = MaterialTheme.colorScheme.primary,- modifier = Modifier.align(Alignment.Center)- )- IconButton(- onClick = onSettingsClick,- modifier = Modifier.align(Alignment.CenterEnd)+ Surface(+ shape = M3ExpressiveShapes.Clover4,+ color = MaterialTheme.colorScheme.primaryContainer,+ modifier = Modifier.size(56.dp)) {- Icon(Icons.Default.Settings, contentDescription = stringResource(R.string.cd_overlay_settings), tint = MaterialTheme.colorScheme.primary)+ Box(contentAlignment = Alignment.Center) {+ Icon(+ imageVector = Icons.Default.Search,+ contentDescription = null,+ tint = MaterialTheme.colorScheme.onPrimaryContainer,+ modifier = Modifier.size(28.dp)+ )+ }+ }+ Column(modifier = Modifier.weight(1f)) {+ Text(+ text = stringResource(R.string.header_title),+ style = MaterialTheme.typography.headlineSmall.copy(fontWeight = FontWeight.Bold),+ color = MaterialTheme.colorScheme.onBackground+ )+ Text(+ text = stringResource(R.string.subtitle_main),+ style = MaterialTheme.typography.bodyMedium,+ color = MaterialTheme.colorScheme.onSurfaceVariant+ )+ }+ Surface(+ shape = CircleShape,+ color = MaterialTheme.colorScheme.surfaceVariant.copy(alpha = 0.85f),+ modifier = Modifier+ .size(48.dp)+ .m3ExpressivePress(onClick = onSettingsClick)+ ) {+ Box(contentAlignment = Alignment.Center) {+ Icon(+ Icons.Default.Settings,+ contentDescription = stringResource(R.string.cd_overlay_settings),+ tint = MaterialTheme.colorScheme.onSurfaceVariant,+ modifier = Modifier.size(22.dp)+ )+ }}}- Spacer(modifier = Modifier.height(16.dp))- Text(- text = stringResource(R.string.subtitle_main),- style = MaterialTheme.typography.bodyLarge,- color = MaterialTheme.colorScheme.onSurfaceVariant,- textAlign = TextAlign.Start- )-- Spacer(modifier = Modifier.height(32.dp))- // 2. REQUIRED: Accessibility Service- Text(- text = stringResource(R.string.label_required),- style = MaterialTheme.typography.labelSmall,- color = if (isAccessibilityEnabled) MaterialTheme.colorScheme.primary else MaterialTheme.colorScheme.error,- modifier = Modifier.align(Alignment.Start).padding(bottom = 8.dp)- )+ Spacer(modifier = Modifier.height(28.dp))++ Surface(+ shape = M3ExpressiveShapes.SlantedPill,+ color = (if (isAccessibilityEnabled) MaterialTheme.colorScheme.primary else MaterialTheme.colorScheme.error).copy(alpha = 0.12f),+ modifier = Modifier.align(Alignment.Start)+ ) {+ Text(+ text = stringResource(R.string.label_required),+ style = MaterialTheme.typography.labelMedium.copy(fontWeight = FontWeight.SemiBold),+ color = if (isAccessibilityEnabled) MaterialTheme.colorScheme.primary else MaterialTheme.colorScheme.error,+ modifier = Modifier.padding(horizontal = 14.dp, vertical = 7.dp)+ )+ }+ Spacer(modifier = Modifier.height(10.dp))if (isAccessibilityEnabled) {- // Granted StateCard(colors = CardDefaults.cardColors(containerColor = MaterialTheme.colorScheme.primaryContainer.copy(alpha = 0.6f)),- shape = androidx.compose.foundation.shape.RoundedCornerShape(24.dp),+ shape = M3ExpressiveShapes.AsymmetricCard,modifier = Modifier.fillMaxWidth()) {Row(modifier = Modifier.padding(16.dp),verticalAlignment = Alignment.CenterVertically) {- Icon(- imageVector = Icons.Default.CheckCircle,- contentDescription = stringResource(R.string.cd_granted),- tint = MaterialTheme.colorScheme.primary,- modifier = Modifier.size(24.dp)- )+ Surface(+ shape = M3ExpressiveShapes.Clover4,+ color = MaterialTheme.colorScheme.primary,+ modifier = Modifier.size(48.dp)+ ) {+ Box(contentAlignment = Alignment.Center) {+ Icon(+ imageVector = Icons.Default.CheckCircle,+ contentDescription = stringResource(R.string.cd_granted),+ tint = MaterialTheme.colorScheme.onPrimary,+ modifier = Modifier.size(24.dp)+ )+ }+ }Spacer(modifier = Modifier.width(16.dp))Column {Text(@@ -242,7 +284,6 @@ fun SetupScreen(onSettingsClick: () -> Unit, onOcrSettingsClick: () -> Unit) {}}} else {- // Action Needed StateCard(onClick = {showAccessibilityDisclosure = true@@ -250,19 +291,29 @@ fun SetupScreen(onSettingsClick: () -> Unit, onOcrSettingsClick: () -> Unit) {colors = CardDefaults.cardColors(containerColor = MaterialTheme.colorScheme.errorContainer),- shape = androidx.compose.foundation.shape.RoundedCornerShape(24.dp),- modifier = Modifier.fillMaxWidth()+ shape = M3ExpressiveShapes.AsymmetricCard,+ modifier = Modifier+ .fillMaxWidth()+ .m3ExpressivePress()) {Row(modifier = Modifier.padding(16.dp),verticalAlignment = Alignment.CenterVertically) {- Icon(- imageVector = Icons.Default.Accessibility,- contentDescription = null,- modifier = Modifier.size(24.dp),- tint = MaterialTheme.colorScheme.onErrorContainer- )+ Surface(+ shape = M3ExpressiveShapes.Clover4,+ color = MaterialTheme.colorScheme.error,+ modifier = Modifier.size(48.dp)+ ) {+ Box(contentAlignment = Alignment.Center) {+ Icon(+ imageVector = Icons.Default.Accessibility,+ contentDescription = null,+ modifier = Modifier.size(24.dp),+ tint = MaterialTheme.colorScheme.onError+ )+ }+ }Spacer(modifier = Modifier.width(16.dp))Column {Text(@@ -282,33 +333,46 @@ fun SetupScreen(onSettingsClick: () -> Unit, onOcrSettingsClick: () -> Unit) {Spacer(modifier = Modifier.height(24.dp))- // 3. OPTIONAL: Default Assistant- Text(- text = stringResource(R.string.label_optional_assistant),- style = MaterialTheme.typography.labelSmall,- color = MaterialTheme.colorScheme.secondary,- modifier = Modifier.align(Alignment.Start).padding(bottom = 8.dp)- )+ Surface(+ shape = M3ExpressiveShapes.SlantedPill,+ color = MaterialTheme.colorScheme.secondary.copy(alpha = 0.12f),+ modifier = Modifier.align(Alignment.Start)+ ) {+ Text(+ text = stringResource(R.string.label_optional_assistant),+ style = MaterialTheme.typography.labelMedium.copy(fontWeight = FontWeight.SemiBold),+ color = MaterialTheme.colorScheme.secondary,+ modifier = Modifier.padding(horizontal = 14.dp, vertical = 7.dp)+ )+ }+ Spacer(modifier = Modifier.height(10.dp))if (isDefaultAssistant) {- // Granted StateCard(colors = CardDefaults.cardColors(containerColor = MaterialTheme.colorScheme.secondaryContainer.copy(alpha = 0.6f)),- shape = androidx.compose.foundation.shape.RoundedCornerShape(24.dp),+ shape = M3ExpressiveShapes.AsymmetricCard,modifier = Modifier.fillMaxWidth()) {Row(modifier = Modifier.padding(16.dp),verticalAlignment = Alignment.CenterVertically) {- Icon(- imageVector = Icons.Default.CheckCircle,- contentDescription = stringResource(R.string.cd_active),- tint = MaterialTheme.colorScheme.secondary,- modifier = Modifier.size(24.dp)- )+ Surface(+ shape = M3ExpressiveShapes.Clover4,+ color = MaterialTheme.colorScheme.secondary,+ modifier = Modifier.size(48.dp)+ ) {+ Box(contentAlignment = Alignment.Center) {+ Icon(+ imageVector = Icons.Default.CheckCircle,+ contentDescription = stringResource(R.string.cd_active),+ tint = MaterialTheme.colorScheme.onSecondary,+ modifier = Modifier.size(24.dp)+ )+ }+ }Spacer(modifier = Modifier.width(16.dp))Text(text = stringResource(R.string.label_default_assistant_set),@@ -318,7 +382,6 @@ fun SetupScreen(onSettingsClick: () -> Unit, onOcrSettingsClick: () -> Unit) {}}} else {- // Action StateCard(onClick = {val intent = Intent(Settings.ACTION_VOICE_INPUT_SETTINGS)@@ -327,19 +390,29 @@ fun SetupScreen(onSettingsClick: () -> Unit, onOcrSettingsClick: () -> Unit) {colors = CardDefaults.cardColors(containerColor = MaterialTheme.colorScheme.primaryContainer),- shape = androidx.compose.foundation.shape.RoundedCornerShape(24.dp),- modifier = Modifier.fillMaxWidth()+ shape = M3ExpressiveShapes.AsymmetricCard,+ modifier = Modifier+ .fillMaxWidth()+ .m3ExpressivePress()) {Row(modifier = Modifier.padding(16.dp),verticalAlignment = Alignment.CenterVertically) {- Icon(- imageVector = Icons.Default.TouchApp,- contentDescription = null,- modifier = Modifier.size(24.dp),- tint = MaterialTheme.colorScheme.onPrimaryContainer- )+ Surface(+ shape = M3ExpressiveShapes.Clover4,+ color = MaterialTheme.colorScheme.primary,+ modifier = Modifier.size(48.dp)+ ) {+ Box(contentAlignment = Alignment.Center) {+ Icon(+ imageVector = Icons.Default.TouchApp,+ contentDescription = null,+ modifier = Modifier.size(24.dp),+ tint = MaterialTheme.colorScheme.onPrimary+ )+ }+ }Spacer(modifier = Modifier.width(16.dp))Column(modifier = Modifier.weight(1f)) {Text(@@ -359,25 +432,33 @@ fun SetupScreen(onSettingsClick: () -> Unit, onOcrSettingsClick: () -> Unit) {Spacer(modifier = Modifier.height(24.dp))- // 4. Settings (Bubble)- Text(- text = stringResource(R.string.section_customization),- style = MaterialTheme.typography.labelSmall,- color = MaterialTheme.colorScheme.secondary,+ Surface(+ shape = M3ExpressiveShapes.SlantedPill,+ color = MaterialTheme.colorScheme.secondary.copy(alpha = 0.12f),modifier = Modifier.align(Alignment.Start)- )+ ) {+ Text(+ text = stringResource(R.string.section_customization),+ style = MaterialTheme.typography.labelMedium.copy(fontWeight = FontWeight.SemiBold),+ color = MaterialTheme.colorScheme.secondary,+ modifier = Modifier.padding(horizontal = 14.dp, vertical = 7.dp)+ )+ }+ Spacer(modifier = Modifier.height(10.dp))BubbleSwitch(context)-+val uiPreferences = remember { com.akslabs.circletosearch.utils.UIPreferences(context) }- Column(+ Card(+ shape = M3ExpressiveShapes.AsymmetricCard,+ colors = CardDefaults.cardColors(+ containerColor = MaterialTheme.colorScheme.surfaceVariant.copy(alpha = 0.55f)+ ),modifier = Modifier.fillMaxWidth().padding(top = 16.dp)- .clip(androidx.compose.foundation.shape.RoundedCornerShape(20.dp))- .background(MaterialTheme.colorScheme.surfaceVariant.copy(alpha = 0.3f))- .padding(16.dp)) {+ Column(modifier = Modifier.padding(16.dp)) {UnifiedSearchMethodSelector(uiPreferences = uiPreferences)@@ -400,15 +481,107 @@ fun SetupScreen(onSettingsClick: () -> Unit, onOcrSettingsClick: () -> Unit) {color = MaterialTheme.colorScheme.onSurfaceVariant)}+ }+ }++ Spacer(modifier = Modifier.height(12.dp))++ Card(+ onClick = onOcrSettingsClick,+ shape = M3ExpressiveShapes.AsymmetricCard,+ colors = CardDefaults.cardColors(+ containerColor = MaterialTheme.colorScheme.surfaceVariant.copy(alpha = 0.55f)+ ),+ modifier = Modifier+ .fillMaxWidth()+ .m3ExpressivePress()+ ) {+ Row(+ modifier = Modifier.padding(16.dp),+ verticalAlignment = Alignment.CenterVertically+ ) {+ Surface(+ shape = M3ExpressiveShapes.Clover4,+ color = MaterialTheme.colorScheme.tertiaryContainer,+ modifier = Modifier.size(48.dp)+ ) {+ Box(contentAlignment = Alignment.Center) {+ Icon(+ Icons.Default.Settings,+ contentDescription = null,+ tint = MaterialTheme.colorScheme.onTertiaryContainer,+ modifier = Modifier.size(24.dp)+ )+ }+ }+ Spacer(modifier = Modifier.width(16.dp))+ Column(modifier = Modifier.weight(1f)) {+ Text(+ text = stringResource(R.string.label_ocr_settings),+ style = MaterialTheme.typography.titleMedium,+ color = MaterialTheme.colorScheme.onSurface+ )+ Text(+ text = stringResource(R.string.label_ocr_settings_subtitle),+ style = MaterialTheme.typography.bodySmall,+ color = MaterialTheme.colorScheme.onSurfaceVariant+ )+ }+ }+ }++ Spacer(modifier = Modifier.height(12.dp))++ Card(+ onClick = {+ try {+ context.startActivity(Intent(context, TranslatorMainActivity::class.java))+ } catch (e: Exception) {+ android.widget.Toast.makeText(context, "Could not launch translator: ${e.message}", android.widget.Toast.LENGTH_LONG).show()+ }+ },+ shape = M3ExpressiveShapes.AsymmetricCard,+ colors = CardDefaults.cardColors(+ containerColor = MaterialTheme.colorScheme.tertiaryContainer.copy(alpha = 0.6f)+ ),+ modifier = Modifier+ .fillMaxWidth()+ .m3ExpressivePress()+ .testTag("test_translator_button")+ ) {+ Row(+ modifier = Modifier.padding(16.dp),+ verticalAlignment = Alignment.CenterVertically+ ) {+ Surface(+ shape = M3ExpressiveShapes.Clover4,+ color = MaterialTheme.colorScheme.tertiary,+ modifier = Modifier.size(48.dp)+ ) {+ Box(contentAlignment = Alignment.Center) {+ Icon(+ Icons.Default.Translate,+ contentDescription = null,+ tint = MaterialTheme.colorScheme.onTertiary,+ modifier = Modifier.size(24.dp)+ )+ }+ }+ Spacer(modifier = Modifier.width(16.dp))+ Column(modifier = Modifier.weight(1f)) {+ Text(+ text = "Offline Translator (Test)",+ style = MaterialTheme.typography.titleMedium.copy(fontWeight = FontWeight.Bold),+ color = MaterialTheme.colorScheme.onTertiaryContainer+ )+ Text(+ text = "Open the translator home screen",+ style = MaterialTheme.typography.bodySmall,+ color = MaterialTheme.colorScheme.onTertiaryContainer.copy(alpha = 0.8f)+ )+ }+ }}-- ListItem(- headlineContent = { Text(stringResource(R.string.label_ocr_settings)) },- supportingContent = { Text(stringResource(R.string.label_ocr_settings_subtitle)) },- trailingContent = { Icon(Icons.Default.Settings, contentDescription = null, modifier = Modifier.size(16.dp)) },- modifier = Modifier.clickable(onClick = onOcrSettingsClick),- colors = ListItemDefaults.colors(containerColor = Color.Transparent)- )// Spacer(modifier = Modifier.height(25.dp))//// // Privacy Note@@ -428,22 +601,21 @@ fun SetupScreen(onSettingsClick: () -> Unit, onOcrSettingsClick: () -> Unit) {onDonateClick = { showDonateSheet = true })Spacer(modifier = Modifier.height(20.dp))- Box(- modifier = Modifier- .clip(androidx.compose.foundation.shape.RoundedCornerShape(8.dp))- .clickable {- val intent = Intent(Intent.ACTION_VIEW, Uri.parse("https://github.com/aks-labs"))- context.startActivity(intent)- }- .padding(8.dp),- contentAlignment = Alignment.Center+ Surface(+ shape = M3ExpressiveShapes.SlantedPill,+ color = MaterialTheme.colorScheme.primary.copy(alpha = 0.12f),+ modifier = Modifier.m3ExpressivePress(onClick = {+ val intent = Intent(Intent.ACTION_VIEW, Uri.parse("https://github.com/aks-labs"))+ context.startActivity(intent)+ })) {Text(text = stringResource(R.string.label_from_akslabs),style = MaterialTheme.typography.labelMedium,color = MaterialTheme.colorScheme.primary.copy(alpha = 0.8f),textAlign = TextAlign.Center,- fontWeight = FontWeight.Bold+ fontWeight = FontWeight.Bold,+ modifier = Modifier.padding(horizontal = 18.dp, vertical = 10.dp))}Spacer(modifier = Modifier.height(2.dp))@@ -785,10 +957,44 @@ fun BubbleSwitch(context: android.content.Context) {val prefs = context.getSharedPreferences("app_prefs", android.content.Context.MODE_PRIVATE)val isBubbleEnabled = remember { mutableStateOf(prefs.getBoolean("bubble_enabled", false)) }- ListItem(- headlineContent = { Text(stringResource(R.string.label_floating_bubble)) },- supportingContent = { Text(stringResource(R.string.label_floating_bubble_subtitle)) },- trailingContent = {+ Card(+ shape = M3ExpressiveShapes.AsymmetricCard,+ colors = CardDefaults.cardColors(+ containerColor = MaterialTheme.colorScheme.surfaceVariant.copy(alpha = 0.55f)+ ),+ modifier = Modifier.fillMaxWidth()+ ) {+ Row(+ modifier = Modifier.padding(16.dp),+ verticalAlignment = Alignment.CenterVertically+ ) {+ Surface(+ shape = M3ExpressiveShapes.Clover4,+ color = MaterialTheme.colorScheme.tertiaryContainer,+ modifier = Modifier.size(48.dp)+ ) {+ Box(contentAlignment = Alignment.Center) {+ Icon(+ imageVector = Icons.Default.TouchApp,+ contentDescription = null,+ tint = MaterialTheme.colorScheme.onTertiaryContainer,+ modifier = Modifier.size(24.dp)+ )+ }+ }+ Spacer(modifier = Modifier.width(16.dp))+ Column(modifier = Modifier.weight(1f)) {+ Text(+ text = stringResource(R.string.label_floating_bubble),+ style = MaterialTheme.typography.titleMedium,+ color = MaterialTheme.colorScheme.onSurface+ )+ Text(+ text = stringResource(R.string.label_floating_bubble_subtitle),+ style = MaterialTheme.typography.bodySmall,+ color = MaterialTheme.colorScheme.onSurfaceVariant+ )+ }Switch(checked = isBubbleEnabled.value,onCheckedChange = { enabled ->@@ -796,10 +1002,7 @@ fun BubbleSwitch(context: android.content.Context) {prefs.edit().putBoolean("bubble_enabled", enabled).apply()})- },- colors = ListItemDefaults.colors(- containerColor = Color.Transparent- )- )+ }+ }}diff --git a/build.gradle.kts b/build.gradle.ktsindex 7668c1e..ba3f020 100644--- a/build.gradle.kts+++ b/build.gradle.kts@@ -22,4 +22,5 @@ plugins {alias(libs.plugins.android.application) apply falsealias(libs.plugins.kotlin.android) apply falsealias(libs.plugins.kotlin.compose) apply false+ alias(libs.plugins.android.library) apply false}\ No newline at end of filediff --git a/gradle/libs.versions.toml b/gradle/libs.versions.tomlindex ca34d06..7725abd 100644--- a/gradle/libs.versions.toml+++ b/gradle/libs.versions.toml@@ -10,6 +10,19 @@ activityCompose = "1.12.0"composeBom = "2024.09.00"material3 = "1.4.0-alpha04"+appcompat = "1.6.1"+material = "1.10.0"+lifecycleViewmodelCompose = "2.8.7"+navigationCompose = "2.7.7"+exifinterface = "1.3.7"+uiautomator = "2.3.0"+coroutines = "1.9.0"+datastorePreferences = "1.1.7"+graphicsPath = "1.1.0"+kotlinxSerialization = "1.7.3"+camera = "1.5.3"+ucrop = "2.2.11"+jna = "5.19.1"[libraries]androidx-core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "coreKtx" }@@ -26,8 +39,27 @@ androidx-compose-ui-tooling-preview = { group = "androidx.compose.ui", name = "uandroidx-compose-ui-test-manifest = { group = "androidx.compose.ui", name = "ui-test-manifest" }androidx-compose-ui-test-junit4 = { group = "androidx.compose.ui", name = "ui-test-junit4" }androidx-compose-material3 = { group = "androidx.compose.material3", name = "material3", version.ref = "material3" }+androidx-appcompat = { group = "androidx.appcompat", name = "appcompat", version.ref = "appcompat" }+material = { group = "com.google.android.material", name = "material", version.ref = "material" }+androidx-lifecycle-viewmodel-compose = { group = "androidx.lifecycle", name = "lifecycle-viewmodel-compose", version.ref = "lifecycleViewmodelCompose" }+androidx-navigation-compose = { group = "androidx.navigation", name = "navigation-compose", version.ref = "navigationCompose" }+androidx-exifinterface = { group = "androidx.exifinterface", name = "exifinterface", version.ref = "exifinterface" }+androidx-uiautomator = { group = "androidx.test.uiautomator", name = "uiautomator", version.ref = "uiautomator" }+kotlinx-coroutines-android = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-android", version.ref = "coroutines" }+kotlinx-coroutines-core = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-core", version.ref = "coroutines" }+androidx-datastore-preferences = { group = "androidx.datastore", name = "datastore-preferences", version.ref = "datastorePreferences" }+androidx-graphics-path = { group = "androidx.graphics", name = "graphics-path", version.ref = "graphicsPath" }+kotlinx-serialization-json = { group = "org.jetbrains.kotlinx", name = "kotlinx-serialization-json", version.ref = "kotlinxSerialization" }+ucrop = { group = "com.github.yalantis", name = "ucrop", version.ref = "ucrop" }+jna = { group = "net.java.dev.jna", name = "jna", version.ref = "jna" }+androidx-camera-core = { group = "androidx.camera", name = "camera-core", version.ref = "camera" }+androidx-camera-camera2 = { group = "androidx.camera", name = "camera-camera2", version.ref = "camera" }+androidx-camera-lifecycle = { group = "androidx.camera", name = "camera-lifecycle", version.ref = "camera" }+androidx-camera-view = { group = "androidx.camera", name = "camera-view", version.ref = "camera" }[plugins]android-application = { id = "com.android.application", version.ref = "agp" }kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }kotlin-compose = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" }+kotlin-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" }+android-library = { id = "com.android.library", version.ref = "agp" }diff --git a/settings.gradle.kts b/settings.gradle.ktsindex 00d35e4..8c4b247 100644--- a/settings.gradle.kts+++ b/settings.gradle.kts@@ -44,3 +44,4 @@ dependencyResolutionManagement {rootProject.name = "CircleToSearch"include(":app")+include(":OCR-translation")