move to fluent translation system (#57)

use fluent translatation system instead of gettext

fluent makes translations more readable and easy to maintain
translation. fluent provides better handling of plural, genders cases.

ref: https://github.com/projectfluent/fluent/wiki/Fluent-vs-gettext
ref: https://projectfluent.org/
This commit is contained in:
Vladislav Nepogodin 2023-03-19 00:47:51 +00:00 committed by GitHub
parent 5ce2634718
commit 837f8a5f4b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
29 changed files with 843 additions and 718 deletions

View File

@ -1,8 +0,0 @@
[main]
host = https://www.transifex.com
[manjaro-hello.manjaro-hellopot]
file_filter = po/<lang>.po
source_file = po/pamac-hello.pot
source_lang = en
type = PO

511
Cargo.lock generated
View File

@ -42,9 +42,15 @@ dependencies = [
[[package]]
name = "anyhow"
version = "1.0.69"
version = "1.0.70"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "224afbd727c3d6e4b90103ece64b8d1b67fbb1973b1046c2281eed3f3803f800"
checksum = "7de8ce5e0f9f8d88245311066a578d72b7af3e7088f32783804676302df237e4"
[[package]]
name = "arc-swap"
version = "1.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bddcadddf5e9015d310179a59bb28c4d4b9920ad0f11e8e14dbadf654890c9a6"
[[package]]
name = "atk"
@ -94,6 +100,25 @@ version = "0.1.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0d8c1fef690941d3e7788d328517591fecc684c084084702d6ff1641e993699a"
[[package]]
name = "block-buffer"
version = "0.10.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71"
dependencies = [
"generic-array",
]
[[package]]
name = "bstr"
version = "1.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c3d4260bcc2e8fc9df1eac4919a720effeb63a3f0952f5bf4944adfa18897f09"
dependencies = [
"memchr",
"serde",
]
[[package]]
name = "bumpalo"
version = "3.12.0"
@ -114,16 +139,19 @@ dependencies = [
"alpm-utils",
"gdk",
"gdk-pixbuf",
"gettext-rs",
"gio",
"glib",
"gtk",
"i18n-embed",
"i18n-embed-fl",
"once_cell",
"pacmanconf",
"reqwest",
"rust-embed",
"serde",
"serde_json",
"subprocess",
"unic-langid",
]
[[package]]
@ -194,6 +222,59 @@ version = "0.8.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5827cebf4670468b8772dd191856768aedcb1b0278a04f989f7766351917b9dc"
[[package]]
name = "cpufeatures"
version = "0.2.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "28d997bd5e24a5928dd43e46dc529867e207907fe0b239c3477d924f7f2ca320"
dependencies = [
"libc",
]
[[package]]
name = "crypto-common"
version = "0.1.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3"
dependencies = [
"generic-array",
"typenum",
]
[[package]]
name = "dashmap"
version = "5.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "907076dfda823b0b36d2a1bb5f90c96660a5bbcd7729e10727f07858f22c4edc"
dependencies = [
"cfg-if",
"hashbrown",
"lock_api",
"once_cell",
"parking_lot_core",
]
[[package]]
name = "digest"
version = "0.10.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8168378f4e5023e7218c89c891c0fd8ecdb5e5e4f18cb78f38cf245dd021e76f"
dependencies = [
"block-buffer",
"crypto-common",
]
[[package]]
name = "displaydoc"
version = "0.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3bf95dc3f046b9da4f2d51833c0d3547d8564ef6910f5c1ed130306a75b92886"
dependencies = [
"proc-macro2",
"quote",
"syn 1.0.109",
]
[[package]]
name = "encoding_rs"
version = "0.8.32"
@ -243,6 +324,59 @@ dependencies = [
"rustc_version",
]
[[package]]
name = "find-crate"
version = "0.6.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "59a98bbaacea1c0eb6a0876280051b892eb73594fd90cf3b20e9c817029c57d2"
dependencies = [
"toml",
]
[[package]]
name = "fluent"
version = "0.16.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "61f69378194459db76abd2ce3952b790db103ceb003008d3d50d97c41ff847a7"
dependencies = [
"fluent-bundle",
"unic-langid",
]
[[package]]
name = "fluent-bundle"
version = "0.15.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e242c601dec9711505f6d5bbff5bedd4b61b2469f2e8bb8e57ee7c9747a87ffd"
dependencies = [
"fluent-langneg",
"fluent-syntax",
"intl-memoizer",
"intl_pluralrules",
"rustc-hash",
"self_cell",
"smallvec",
"unic-langid",
]
[[package]]
name = "fluent-langneg"
version = "0.13.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2c4ad0989667548f06ccd0e306ed56b61bd4d35458d54df5ec7587c0e8ed5e94"
dependencies = [
"unic-langid",
]
[[package]]
name = "fluent-syntax"
version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c0abed97648395c902868fee9026de96483933faa54ea3b40d652f7dfe61ca78"
dependencies = [
"thiserror",
]
[[package]]
name = "fnv"
version = "1.0.7"
@ -313,7 +447,7 @@ checksum = "3eb14ed937631bd8b8b8977f2c198443447a8355b6e3ca599f38c975e5a963b6"
dependencies = [
"proc-macro2",
"quote",
"syn",
"syn 1.0.109",
]
[[package]]
@ -405,23 +539,13 @@ dependencies = [
]
[[package]]
name = "gettext-rs"
version = "0.7.0"
name = "generic-array"
version = "0.14.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e49ea8a8fad198aaa1f9655a2524b64b70eb06b2f3ff37da407566c93054f364"
checksum = "bff49e947297f3312447abdca79f45f4738097cc82b06e72054d2223f601f1b9"
dependencies = [
"gettext-sys",
"locale_config",
]
[[package]]
name = "gettext-sys"
version = "0.21.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c63ce2e00f56a206778276704bbe38564c8695249fdc8f354b4ef71c57c3839d"
dependencies = [
"cc",
"temp-dir",
"typenum",
"version_check",
]
[[package]]
@ -492,7 +616,7 @@ dependencies = [
"proc-macro-error",
"proc-macro2",
"quote",
"syn",
"syn 1.0.109",
]
[[package]]
@ -505,6 +629,19 @@ dependencies = [
"system-deps",
]
[[package]]
name = "globset"
version = "0.4.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "029d74589adefde59de1a0c4f4732695c32805624aec7b68d91503d4dba79afc"
dependencies = [
"aho-corasick",
"bstr",
"fnv",
"log",
"regex",
]
[[package]]
name = "gobject-sys"
version = "0.17.4"
@ -568,7 +705,7 @@ dependencies = [
"proc-macro-error",
"proc-macro2",
"quote",
"syn",
"syn 1.0.109",
]
[[package]]
@ -688,6 +825,76 @@ dependencies = [
"tokio-native-tls",
]
[[package]]
name = "i18n-config"
version = "0.4.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3d9f93ceee6543011739bc81699b5e0cf1f23f3a80364649b6d80de8636bc8df"
dependencies = [
"log",
"serde",
"serde_derive",
"thiserror",
"toml",
"unic-langid",
]
[[package]]
name = "i18n-embed"
version = "0.13.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2653dd1a8be0726315603f1c180b29f90e5b2a58f8b943d949d5170d9ad81101"
dependencies = [
"arc-swap",
"fluent",
"fluent-langneg",
"fluent-syntax",
"i18n-embed-impl",
"intl-memoizer",
"lazy_static",
"locale_config",
"log",
"parking_lot",
"rust-embed",
"thiserror",
"unic-langid",
"walkdir",
]
[[package]]
name = "i18n-embed-fl"
version = "0.6.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4b5809e2295beeb55013705c3b947cbbe83b8cadf3c73a1e6dca06381927212a"
dependencies = [
"dashmap",
"find-crate",
"fluent",
"fluent-syntax",
"i18n-config",
"i18n-embed",
"lazy_static",
"proc-macro-error",
"proc-macro2",
"quote",
"strsim",
"syn 1.0.109",
"unic-langid",
]
[[package]]
name = "i18n-embed-impl"
version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0db2330e035808eb064afb67e6743ddce353763af3e0f2bdfc2476e00ce76136"
dependencies = [
"find-crate",
"i18n-config",
"proc-macro2",
"quote",
"syn 1.0.109",
]
[[package]]
name = "idna"
version = "0.3.0"
@ -718,10 +925,29 @@ dependencies = [
]
[[package]]
name = "io-lifetimes"
version = "1.0.7"
name = "intl-memoizer"
version = "0.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "76e86b86ae312accbf05ade23ce76b625e0e47a255712b7414037385a1c05380"
checksum = "c310433e4a310918d6ed9243542a6b83ec1183df95dff8f23f87bb88a264a66f"
dependencies = [
"type-map",
"unic-langid",
]
[[package]]
name = "intl_pluralrules"
version = "7.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "078ea7b7c29a2b4df841a7f6ac8775ff6074020c6776d48491ce2268e068f972"
dependencies = [
"unic-langid",
]
[[package]]
name = "io-lifetimes"
version = "1.0.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0dd6da19f25979c7270e70fa95ab371ec3b701cd0eefc47667a09785b3c59155"
dependencies = [
"hermit-abi 0.3.1",
"libc",
@ -780,6 +1006,16 @@ dependencies = [
"winapi",
]
[[package]]
name = "lock_api"
version = "0.4.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "435011366fe56583b16cf956f9df0095b405b82d76425bc8981c0e22e60ec4df"
dependencies = [
"autocfg",
"scopeguard",
]
[[package]]
name = "log"
version = "0.4.17"
@ -917,7 +1153,7 @@ checksum = "b501e44f11665960c7e7fcf062c7d96a14ade4aa98116c004b2e37b5be7d736c"
dependencies = [
"proc-macro2",
"quote",
"syn",
"syn 1.0.109",
]
[[package]]
@ -974,6 +1210,29 @@ dependencies = [
"system-deps",
]
[[package]]
name = "parking_lot"
version = "0.12.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f"
dependencies = [
"lock_api",
"parking_lot_core",
]
[[package]]
name = "parking_lot_core"
version = "0.9.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9069cbb9f99e3a5083476ccb29ceb1de18b9118cafa53e90c9551235de2b9521"
dependencies = [
"cfg-if",
"libc",
"redox_syscall",
"smallvec",
"windows-sys 0.45.0",
]
[[package]]
name = "percent-encoding"
version = "2.2.0"
@ -1017,7 +1276,7 @@ dependencies = [
"proc-macro-error-attr",
"proc-macro2",
"quote",
"syn",
"syn 1.0.109",
"version_check",
]
@ -1113,6 +1372,47 @@ dependencies = [
"winreg",
]
[[package]]
name = "rust-embed"
version = "6.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cb133b9a38b5543fad3807fb2028ea47c5f2b566f4f5e28a11902f1a358348b6"
dependencies = [
"rust-embed-impl",
"rust-embed-utils",
"walkdir",
]
[[package]]
name = "rust-embed-impl"
version = "6.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4d4e0f0ced47ded9a68374ac145edd65a6c1fa13a96447b873660b2a568a0fd7"
dependencies = [
"proc-macro2",
"quote",
"rust-embed-utils",
"syn 1.0.109",
"walkdir",
]
[[package]]
name = "rust-embed-utils"
version = "7.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "512b0ab6853f7e14e3c8754acb43d6f748bb9ced66aa5915a6553ac8213f7731"
dependencies = [
"globset",
"sha2",
"walkdir",
]
[[package]]
name = "rustc-hash"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2"
[[package]]
name = "rustc_version"
version = "0.4.0"
@ -1124,9 +1424,9 @@ dependencies = [
[[package]]
name = "rustix"
version = "0.36.9"
version = "0.36.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fd5c6ff11fecd55b40746d1995a02f2eb375bf8c00d192d521ee09f42bef37bc"
checksum = "2fe885c3a125aa45213b68cc1472a49880cb5923dc23f522ad2791b882228778"
dependencies = [
"bitflags",
"errno",
@ -1142,6 +1442,15 @@ version = "1.0.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f91339c0467de62360649f8d3e185ca8de4224ff281f66000de5eb2a77a79041"
[[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 = "schannel"
version = "0.1.21"
@ -1151,6 +1460,12 @@ dependencies = [
"windows-sys 0.42.0",
]
[[package]]
name = "scopeguard"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd"
[[package]]
name = "security-framework"
version = "2.8.2"
@ -1174,6 +1489,12 @@ dependencies = [
"libc",
]
[[package]]
name = "self_cell"
version = "0.10.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1ef965a420fe14fdac7dd018862966a4c14094f900e1650bbc71ddd7d580c8af"
[[package]]
name = "semver"
version = "1.0.17"
@ -1182,9 +1503,23 @@ checksum = "bebd363326d05ec3e2f532ab7660680f3b02130d780c299bca73469d521bc0ed"
[[package]]
name = "serde"
version = "1.0.156"
version = "1.0.157"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "314b5b092c0ade17c00142951e50ced110ec27cea304b1037c6969246c2469a4"
checksum = "707de5fcf5df2b5788fca98dd7eab490bc2fd9b7ef1404defc462833b83f25ca"
dependencies = [
"serde_derive",
]
[[package]]
name = "serde_derive"
version = "1.0.157"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "78997f4555c22a7971214540c4a661291970619afd56de19f77e0de86296e1e5"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.2",
]
[[package]]
name = "serde_json"
@ -1209,6 +1544,17 @@ dependencies = [
"serde",
]
[[package]]
name = "sha2"
version = "0.10.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "82e6b795fe2e3b1e845bafcb27aa35405c4d47cdfc92af5fc8d3002f76cebdc0"
dependencies = [
"cfg-if",
"cpufeatures",
"digest",
]
[[package]]
name = "slab"
version = "0.4.8"
@ -1234,6 +1580,12 @@ dependencies = [
"winapi",
]
[[package]]
name = "strsim"
version = "0.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623"
[[package]]
name = "subprocess"
version = "0.2.9"
@ -1255,6 +1607,17 @@ dependencies = [
"unicode-ident",
]
[[package]]
name = "syn"
version = "2.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "59d3276aee1fa0c33612917969b5172b5be2db051232a6e4826f1a1a9191b045"
dependencies = [
"proc-macro2",
"quote",
"unicode-ident",
]
[[package]]
name = "system-deps"
version = "6.0.3"
@ -1268,12 +1631,6 @@ dependencies = [
"version-compare",
]
[[package]]
name = "temp-dir"
version = "0.1.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "af547b166dd1ea4b472165569fc456cfb6818116f854690b0ff205e636523dab"
[[package]]
name = "tempfile"
version = "3.4.0"
@ -1289,22 +1646,31 @@ dependencies = [
[[package]]
name = "thiserror"
version = "1.0.39"
version = "1.0.40"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a5ab016db510546d856297882807df8da66a16fb8c4101cb8b30054b0d5b2d9c"
checksum = "978c9a314bd8dc99be594bc3c175faaa9794be04a5a5e153caba6915336cebac"
dependencies = [
"thiserror-impl",
]
[[package]]
name = "thiserror-impl"
version = "1.0.39"
version = "1.0.40"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5420d42e90af0c38c3290abcca25b9b3bdf379fc9f55c528f53a269d9c9a267e"
checksum = "f9456a42c5b0d803c8cd86e73dd7cc9edd429499f37a3550d286d5e86720569f"
dependencies = [
"proc-macro2",
"quote",
"syn",
"syn 2.0.2",
]
[[package]]
name = "tinystr"
version = "0.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7ac3f5b6856e931e15e07b478e98c8045239829a65f9156d4fa7e7788197a5ef"
dependencies = [
"displaydoc",
]
[[package]]
@ -1422,10 +1788,44 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3528ecfd12c466c6f163363caf2d02a71161dd5e1cc6ae7b34207ea2d42d81ed"
[[package]]
name = "unicode-bidi"
version = "0.3.11"
name = "type-map"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "524b68aca1d05e03fdf03fcdce2c6c94b6daf6d16861ddaa7e4f2b6638a9052c"
checksum = "b6d3364c5e96cb2ad1603037ab253ddd34d7fb72a58bdddf4b7350760fc69a46"
dependencies = [
"rustc-hash",
]
[[package]]
name = "typenum"
version = "1.16.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "497961ef93d974e23eb6f433eb5fe1b7930b659f06d12dec6fc44a8f554c0bba"
[[package]]
name = "unic-langid"
version = "0.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "398f9ad7239db44fd0f80fe068d12ff22d78354080332a5077dc6f52f14dcf2f"
dependencies = [
"unic-langid-impl",
]
[[package]]
name = "unic-langid-impl"
version = "0.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e35bfd2f2b8796545b55d7d3fd3e89a0613f68a0d1c8bc28cb7ff96b411a35ff"
dependencies = [
"serde",
"tinystr",
]
[[package]]
name = "unicode-bidi"
version = "0.3.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7d502c968c6a838ead8e69b2ee18ec708802f99db92a0d156705ec9ef801993b"
[[package]]
name = "unicode-ident"
@ -1471,6 +1871,16 @@ version = "0.9.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f"
[[package]]
name = "walkdir"
version = "2.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "36df944cda56c7d8d8b7496af378e6b16de9284591917d307c9b4d313c44e698"
dependencies = [
"same-file",
"winapi-util",
]
[[package]]
name = "want"
version = "0.3.0"
@ -1508,7 +1918,7 @@ dependencies = [
"once_cell",
"proc-macro2",
"quote",
"syn",
"syn 1.0.109",
"wasm-bindgen-shared",
]
@ -1542,7 +1952,7 @@ checksum = "2aff81306fcac3c7515ad4e177f521b5c9a15f2b08f4e32d823066102f35a5f6"
dependencies = [
"proc-macro2",
"quote",
"syn",
"syn 1.0.109",
"wasm-bindgen-backend",
"wasm-bindgen-shared",
]
@ -1579,6 +1989,15 @@ version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
[[package]]
name = "winapi-util"
version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178"
dependencies = [
"winapi",
]
[[package]]
name = "winapi-x86_64-pc-windows-gnu"
version = "0.4.0"

View File

@ -12,7 +12,9 @@ pacmanconf = "2.0.0"
subprocess = "0.2.9"
once_cell = { default-features = false, version = "1.17.1" }
gettext-rs = { version = "0.7", default-features = false }
i18n-embed = { version = "0.13.4", features = ["fluent-system", "desktop-requester"] }
i18n-embed-fl = "0.6.4"
rust-embed = { version = "6.4.1", features = ["debug-embed", "include-exclude"] }
gtk = { version = "0.17.0", default-features = false }
gio = { version = "0.17.4", default-features = false }
gdk = "0.17.0"
@ -21,6 +23,7 @@ glib = { default-features = false, version = "0.17.5" }
serde = { version = "1.0.156", default-features = false }
serde_json = "1.0.94"
reqwest = { version = "0.11.14", features = ["blocking"] }
unic-langid = "0.9.1"
[profile.release]
strip = "symbols"

View File

@ -14,7 +14,6 @@
"forum": "https://forum.cachyos.org",
"telegram": "https://t.me/+oR-kWT47vRdmMDli",
"discord": "https://discord.gg/qJqj94uFwE",
"mailling": "https://lists.cachyos.org/cgi-bin/mailman/listinfo",
"reddit": "https://www.reddit.com/r/cachyos",
"twitter": "https://twitter.com/cachyos",
"wiki": "https://wiki.cachyos.org"

9
i18n.toml Normal file
View File

@ -0,0 +1,9 @@
# The language identifier of the language used in the
# source code for gettext system, and the primary fallback language
# (for which all strings must be present) when using the fluent
# system.
fallback_language = "en"
[fluent]
# The path to the assets directory.
assets_dir = "i18n"

30
i18n/de/cachyos_hello.ftl Normal file
View File

@ -0,0 +1,30 @@
# About dialog
about-dialog-title = CachyOS Hello
about-dialog-comments = Willkommensdialog für CachyOS
# Main Page (buttons)
button-about-tooltip = Über
button-web-resource-tooltip = Web-Ressource
button-development-label = Entwicklung
button-software-label = Software
button-donate-label = Spenden
button-forum-label = Forum
button-installer-label = Installer starten
button-involved-label = Mitmachen
button-readme-label = Lies mich
button-release-info-label = Versionshinweise
button-wiki-label = Wiki
# Main Page (sections)
section-docs = DOKUMENTATION
section-installer = INSTALLATION
section-support = UNTERSTÜTZUNG
section-project = PROJEKT
# Main Page (body)
launch-start-label = Beim Systemstart ausführen
welcome-title = Willkommen bei CachyOS!
welcome-body =
Danke, dass Sie sich unserer Community anschließen!
Wir, die CachyOS-Entwickler, hoffen, dass Sie es genauso sehr genießen werden CachyOS zu benutzen, wie wir es genießen, es zu entwickeln. Die Links unten werden Ihnen helfen sich in Ihrem neuen Betriebssystem zurechtzufinden. Genießen Sie diese Erfahrung und zögern Sie nicht Ihr Feedback an uns zu senden.

30
i18n/en/cachyos_hello.ftl Normal file
View File

@ -0,0 +1,30 @@
# About dialog
about-dialog-title = CachyOS Hello
about-dialog-comments = Welcome screen for CachyOS
# Main Page (buttons)
button-about-tooltip = About
button-web-resource-tooltip = Web resource
button-development-label = Development
button-software-label = Software
button-donate-label = Donate
button-forum-label = Forum
button-installer-label = Launch installer
button-involved-label = Get involved
button-readme-label = Read me
button-release-info-label = Release info
button-wiki-label = Wiki
# Main Page (sections)
section-docs = DOCUMENTATION
section-installer = INSTALLATION
section-support = SUPPORT
section-project = PROJECT
# Main Page (body)
launch-start-label = Launch at start
welcome-title = Welcome to CachyOS!
welcome-body =
Thank you for joining our community!
We, the CachyOS Developers, hope that you will enjoy using CachyOS as much as we enjoy building it. The links below will help you get started with your new operating system. So enjoy the experience, and don't hesitate to send us your feedback.

30
i18n/pl/cachyos_hello.ftl Normal file
View File

@ -0,0 +1,30 @@
# About dialog
about-dialog-title = CachyOS Hello
about-dialog-comments = Ekran powitalny CachyOS
# Main Page (buttons)
button-about-tooltip = O programie
button-web-resource-tooltip = Zasób sieciowy
button-development-label = Rozwój oprogramowania
button-software-label = Software
button-donate-label = Wesprzyj
button-forum-label = Forum
button-installer-label = Uruchom instalator
button-involved-label = Zaangażuj się
button-readme-label = Czytaj to
button-release-info-label = Informacje o wydaniu
button-wiki-label = Wiki
# Main Page (sections)
section-docs = DOKUMENTACJA
section-installer = INSTALACJA
section-support = WSPARCIE
section-project = PROJEKT
# Main Page (body)
launch-start-label = Uruchamiaj przy starcie
welcome-title = Witaj w CachyOS!
welcome-body =
Dziękujemy za dołączenie do naszej społeczności!
My, programiści CachyOS, mamy nadzieję, że używanie CachyOS przyniesie Ci tyle radości ile nam jego tworzenie. Poniższe odnośniki pomogą Ci w rozpoczęciu używania nowego systemu operacyjnego. Życzymy miłych wrażeń, nie wahaj się podzielić się z nami swoją opinią.

30
i18n/ru/cachyos_hello.ftl Normal file
View File

@ -0,0 +1,30 @@
# About dialog
about-dialog-title = CachyOS Hello
about-dialog-comments = Приветственный экран CachyOS
# Main Page (buttons)
button-about-tooltip = О программе
button-web-resource-tooltip = Веб-ресурс
button-development-label = Разработка
button-software-label = ПО
button-donate-label = Пожертвовать
button-forum-label = Форум
button-installer-label = Запустить установщик
button-involved-label = Принять участие
button-readme-label = Прочитай меня
button-release-info-label = Сведения о выпуске
button-wiki-label = Вики
# Main Page (sections)
section-docs = ДОКУМЕНТАЦИЯ
section-installer = УСТАНОВКА
section-support = ПОДДЕРЖКА
section-project = ПРОЕКТ
# Main Page (body)
launch-start-label = Запускать при старте
welcome-title = Добро пожаловать в CachyOS!
welcome-body =
Благодарим Вас за то, что Вы присоединились к нашему сообществу!
Мы, разработчики CachyOS, надеемся, что пользуясь этой системой, Вы будете испытывать такое же удовольствие, какое мы испытывали, создавая ее. Представленные ниже ссылки помогут Вам начать работу. Наслаждайтесь функционалом CachyOS и оставляйте свои отзывы.

View File

@ -36,16 +36,13 @@ localedir = prefix / get_option('localedir')
datadir = prefix / get_option('datadir')
pkgdatadir = datadir / meson.project_name()
iconsdir = datadir / 'icons'
podir = meson.project_source_root() / 'po'
gettext_package = meson.project_name()
resources = gnome.compile_resources(
'cachyos-welcome',
'cachyos-welcome.gresource.xml',
gresource_bundle: true,
source_dir: meson.current_build_dir(),
install: true,
install_dir: pkgdatadir,
install: false,
)
if get_option('profile') == 'development'

View File

@ -1,3 +0,0 @@
de
pl
ru

View File

@ -1,130 +0,0 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-12-02 11:35+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: 8bit\n"
#: ../ui/cachyos-hello.glade:56
msgid "Welcome to CachyOS!"
msgstr ""
#: ../ui/cachyos-hello.glade:72
msgid ""
"Thank you for joining our community!\n"
"\n"
"We, the CachyOS Developers, hope that you will enjoy using CachyOS as much "
"as we enjoy building it. The links below will help you get started with your "
"new operating system. So enjoy the experience, and don't hesitate to send us "
"your feedback."
msgstr ""
#: ../ui/cachyos-hello.glade:90
msgid "DOCUMENTATION"
msgstr ""
#: ../ui/cachyos-hello.glade:104
msgid "SUPPORT"
msgstr ""
#: ../ui/cachyos-hello.glade:118
msgid "PROJECT"
msgstr ""
#: ../ui/cachyos-hello.glade:130
msgid "Read me"
msgstr ""
#: ../ui/cachyos-hello.glade:144
msgid "Release info"
msgstr ""
#: ../ui/cachyos-hello.glade:159
msgid "Wiki"
msgstr ""
#: ../ui/cachyos-hello.glade:164 ../ui/cachyos-hello.glade:195
#: ../ui/cachyos-hello.glade:212 ../ui/cachyos-hello.glade:229
#: ../ui/cachyos-hello.glade:246 ../ui/cachyos-hello.glade:263
msgid "Web resource"
msgstr ""
#: ../ui/cachyos-hello.glade:176
msgid "Get involved"
msgstr ""
#: ../ui/cachyos-hello.glade:190
msgid "Forums"
msgstr ""
#: ../ui/cachyos-hello.glade:207
msgid "Discover software"
msgstr ""
#: ../ui/cachyos-hello.glade:224
msgid "Mailing lists"
msgstr ""
#: ../ui/cachyos-hello.glade:241
msgid "Development"
msgstr ""
#: ../ui/cachyos-hello.glade:258
msgid "Donate"
msgstr ""
#: ../ui/cachyos-hello.glade:377
msgid "Launch at start"
msgstr ""
#: ../ui/cachyos-hello.glade:408
msgid "INSTALLATION"
msgstr ""
#: ../ui/cachyos-hello.glade:420
msgid "Launch installer"
msgstr ""
#: ../ui/cachyos-hello.glade:439
msgid "Applications"
msgstr ""
#: ../ui/cachyos-hello.glade:443
msgid "Common application selection"
msgstr ""
#: ../ui/cachyos-hello.glade:456
msgid "Gnome Layouts Manager"
msgstr ""
#: ../ui/cachyos-hello.glade:460
msgid "CachyOS Gnome config tool"
msgstr ""
#: ../ui/cachyos-hello.glade:504
msgid "Home"
msgstr ""
#: ../ui/cachyos-hello.glade:515 ../ui/cachyos-hello.glade:586
msgid "About"
msgstr ""
#: ../ui/cachyos-hello.glade:591
msgid "Welcome screen for CachyOS"
msgstr ""
#: ../src/manjaro_hello.py:306
msgid "Can't load page."
msgstr ""

119
po/de.po
View File

@ -1,119 +0,0 @@
# Translation of CachyOS-Hello.
# Copyright (C) 2016-2017 CachyOS Developers <manjaro-dev@cachyos.org>
# This file is distributed under the same license as the CachyOS-Hello package.
# Hugo Posnic <huluti@cachyos.org>, 2016-2017.
#
# Translators:
# philm <philm@cachyos.org>, 2016
# Jan Jansen, 2016
# Bernhard Landauer <bernhard@oberon.at>, 2017
# Christian G <geblerc@gmail.com>, 2018
msgid ""
msgstr ""
"Project-Id-Version: CachyOS-Hello\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-03-04 10:28+0100\n"
"PO-Revision-Date: 2017-10-07 19:09+0100\n"
"Last-Translator: Christian G <geblerc@gmail.com>, 2018\n"
"Language-Team: German (https://www.transifex.com/manjarolinux/teams/70274/de/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: de\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#: ui/cachyos-hello.glade:55
msgid "Welcome to CachyOS!"
msgstr "Willkommen bei CachyOS!"
#: ui/cachyos-hello.glade:71
msgid ""
"Thank you for joining our community!\n"
"\n"
"We, the CachyOS Developers, hope that you will enjoy using CachyOS as much as we enjoy building it. The links below will help you get started with your new operating system. So enjoy the experience, and don't hesitate to send us your feedback."
msgstr ""
"Danke, dass Sie sich unserer Community anschließen!\n"
"\n"
"Wir, die CachyOS-Entwickler, hoffen, dass Sie es genauso sehr genießen werden CachyOS zu benutzen, wie wir es genießen, es zu entwickeln. Die Links unten werden Ihnen helfen sich in Ihrem neuen Betriebssystem zurechtzufinden. Genießen Sie diese Erfahrung und zögern Sie nicht Ihr Feedback an uns zu senden."
#: ui/cachyos-hello.glade:89
msgid "DOCUMENTATION"
msgstr "DOKUMENTATION"
#: ui/cachyos-hello.glade:103
msgid "SUPPORT"
msgstr "UNTERSTÜTZUNG"
#: ui/cachyos-hello.glade:117
msgid "PROJECT"
msgstr "PROJEKT"
#: ui/cachyos-hello.glade:129
msgid "Read me"
msgstr "Lies mich"
#: ui/cachyos-hello.glade:143
msgid "Release info"
msgstr "Versionshinweise"
#: ui/cachyos-hello.glade:158
msgid "Wiki"
msgstr "Wiki"
#: ui/cachyos-hello.glade:163 ui/cachyos-hello.glade:194
#: ui/cachyos-hello.glade:211 ui/cachyos-hello.glade:228
#: ui/cachyos-hello.glade:245 ui/cachyos-hello.glade:262
msgid "Web resource"
msgstr "Web-Ressource"
#: ui/cachyos-hello.glade:175
msgid "Get involved"
msgstr "Mitmachen"
#: ui/cachyos-hello.glade:189
msgid "Forums"
msgstr "Forum"
#: ui/cachyos-hello.glade:206
msgid "Chat room"
msgstr "Chatroom"
#: ui/cachyos-hello.glade:223
msgid "Mailing lists"
msgstr "Mailingliste"
#: ui/cachyos-hello.glade:240
msgid "Development"
msgstr "Entwicklung"
#: ui/cachyos-hello.glade:257
msgid "Donate"
msgstr "Spenden"
#: ui/cachyos-hello.glade:376
msgid "Launch at start"
msgstr "Beim Systemstart ausführen"
#: ui/cachyos-hello.glade:407
msgid "INSTALLATION"
msgstr "INSTALLATION"
#: ui/cachyos-hello.glade:419
msgid "Launch installer"
msgstr "Installer starten"
#: ui/cachyos-hello.glade:462
msgid "Home"
msgstr "Hauptseite"
#: ui/cachyos-hello.glade:530 ui/cachyos-hello.glade:544
msgid "About"
msgstr "Über"
#: ui/cachyos-hello.glade:549
msgid "Welcome screen for CachyOS"
msgstr "Willkommensdialog für CachyOS"
#: src/manjaro_hello.py:212
msgid "Can't load page."
msgstr "Seite kann nicht geladen werden."

View File

@ -1 +0,0 @@
i18n.gettext(gettext_package, preset: 'glib')

118
po/pl.po
View File

@ -1,118 +0,0 @@
# Translation of CachyOS-Hello.
# Copyright (C) 2016-2017 CachyOS Developers <manjaro-dev@cachyos.org>
# This file is distributed under the same license as the CachyOS-Hello package.
# Hugo Posnic <huluti@cachyos.org>, 2016-2017.
#
# Translators:
# philm <philm@cachyos.org>, 2016
# Piotr Strębski <strebski@gmail.com>, 2016
# m4sk1n <m4sk1n@vivaldi.net>, 2017
msgid ""
msgstr ""
"Project-Id-Version: CachyOS-Hello\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-03-04 10:28+0100\n"
"PO-Revision-Date: 2017-10-07 19:09+0100\n"
"Last-Translator: m4sk1n <m4sk1n@vivaldi.net>, 2017\n"
"Language-Team: Polish (https://www.transifex.com/manjarolinux/teams/70274/pl/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: pl\n"
"Plural-Forms: nplurals=4; plural=(n==1 ? 0 : (n%10>=2 && n%10<=4) && (n%100<12 || n%100>14) ? 1 : n!=1 && (n%10>=0 && n%10<=1) || (n%10>=5 && n%10<=9) || (n%100>=12 && n%100<=14) ? 2 : 3);\n"
#: ui/cachyos-hello.glade:55
msgid "Welcome to CachyOS!"
msgstr "Witaj w CachyOS!"
#: ui/cachyos-hello.glade:71
msgid ""
"Thank you for joining our community!\n"
"\n"
"We, the CachyOS Developers, hope that you will enjoy using CachyOS as much as we enjoy building it. The links below will help you get started with your new operating system. So enjoy the experience, and don't hesitate to send us your feedback."
msgstr ""
"Dziękujemy za dołączenie do naszej społeczności!\n"
"\n"
"My, programiści CachyOS, mamy nadzieję, że używanie CachyOS przyniesie Ci tyle radości ile nam jego tworzenie. Poniższe odnośniki pomogą Ci w rozpoczęciu używania nowego systemu operacyjnego. Życzymy miłych wrażeń, nie wahaj się podzielić się z nami swoją opinią."
#: ui/cachyos-hello.glade:89
msgid "DOCUMENTATION"
msgstr "DOKUMENTACJA"
#: ui/cachyos-hello.glade:103
msgid "SUPPORT"
msgstr "WSPARCIE"
#: ui/cachyos-hello.glade:117
msgid "PROJECT"
msgstr "PROJEKT"
#: ui/cachyos-hello.glade:129
msgid "Read me"
msgstr "Czytaj to"
#: ui/cachyos-hello.glade:143
msgid "Release info"
msgstr "Informacje o wydaniu"
#: ui/cachyos-hello.glade:158
msgid "Wiki"
msgstr "Wiki"
#: ui/cachyos-hello.glade:163 ui/cachyos-hello.glade:194
#: ui/cachyos-hello.glade:211 ui/cachyos-hello.glade:228
#: ui/cachyos-hello.glade:245 ui/cachyos-hello.glade:262
msgid "Web resource"
msgstr "Zasób sieciowy"
#: ui/cachyos-hello.glade:175
msgid "Get involved"
msgstr "Zaangażuj się"
#: ui/cachyos-hello.glade:189
msgid "Forums"
msgstr "Forum"
#: ui/cachyos-hello.glade:206
msgid "Chat room"
msgstr "Pokój rozmów"
#: ui/cachyos-hello.glade:223
msgid "Mailing lists"
msgstr "Listy mailingowe"
#: ui/cachyos-hello.glade:240
msgid "Development"
msgstr "Rozwój oprogramowania"
#: ui/cachyos-hello.glade:257
msgid "Donate"
msgstr "Wesprzyj"
#: ui/cachyos-hello.glade:376
msgid "Launch at start"
msgstr "Uruchamiaj przy starcie"
#: ui/cachyos-hello.glade:407
msgid "INSTALLATION"
msgstr "INSTALACJA"
#: ui/cachyos-hello.glade:419
msgid "Launch installer"
msgstr "Uruchom instalator"
#: ui/cachyos-hello.glade:462
msgid "Home"
msgstr "Start"
#: ui/cachyos-hello.glade:530 ui/cachyos-hello.glade:544
msgid "About"
msgstr "O programie"
#: ui/cachyos-hello.glade:549
msgid "Welcome screen for CachyOS"
msgstr "Ekran powitalny CachyOS"
#: src/manjaro_hello.py:212
msgid "Can't load page."
msgstr "Nie można wczytać strony."

117
po/ru.po
View File

@ -1,117 +0,0 @@
# Translation of CachyOS-Hello.
# Copyright (C) 2016-2017 CachyOS Developers <manjaro-dev@cachyos.org>
# This file is distributed under the same license as the CachyOS-Hello package.
# Hugo Posnic <huluti@cachyos.org>, 2016-2017.
#
# Translators:
# philm <philm@cachyos.org>, 2016
# Ilya Ostapenko (Jacobtey) <jacobtey@gmail.com>, 2016
msgid ""
msgstr ""
"Project-Id-Version: CachyOS-Hello\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-03-04 10:28+0100\n"
"PO-Revision-Date: 2017-10-07 19:09+0100\n"
"Last-Translator: Ilya Ostapenko (Jacobtey) <jacobtey@gmail.com>, 2016\n"
"Language-Team: Russian (https://www.transifex.com/manjarolinux/teams/70274/ru/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: ru\n"
"Plural-Forms: nplurals=4; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<12 || n%100>14) ? 1 : n%10==0 || (n%10>=5 && n%10<=9) || (n%100>=11 && n%100<=14)? 2 : 3);\n"
#: ui/cachyos-hello.glade:55
msgid "Welcome to CachyOS!"
msgstr "Добро пожаловать в CachyOS!"
#: ui/cachyos-hello.glade:71
msgid ""
"Thank you for joining our community!\n"
"\n"
"We, the CachyOS Developers, hope that you will enjoy using CachyOS as much as we enjoy building it. The links below will help you get started with your new operating system. So enjoy the experience, and don't hesitate to send us your feedback."
msgstr ""
"Благодарим Вас за то, что Вы присоединились к нашему сообществу!\n"
"\n"
"Мы, разработчики CachyOS, надеемся, что пользуясь этой системой, Вы будете испытывать такое же удовольствие, какое мы испытывали, создавая ее. Представленные ниже ссылки помогут Вам начать работу. Наслаждайтесь функционалом CachyOS и оставляйте свои отзывы."
#: ui/cachyos-hello.glade:89
msgid "DOCUMENTATION"
msgstr "ДОКУМЕНТАЦИЯ"
#: ui/cachyos-hello.glade:103
msgid "SUPPORT"
msgstr "ПОДДЕРЖКА"
#: ui/cachyos-hello.glade:117
msgid "PROJECT"
msgstr "ПРОЕКТ"
#: ui/cachyos-hello.glade:129
msgid "Read me"
msgstr "Читать"
#: ui/cachyos-hello.glade:143
msgid "Release info"
msgstr "Информация о выпуске"
#: ui/cachyos-hello.glade:158
msgid "Wiki"
msgstr "Вики"
#: ui/cachyos-hello.glade:163 ui/cachyos-hello.glade:194
#: ui/cachyos-hello.glade:211 ui/cachyos-hello.glade:228
#: ui/cachyos-hello.glade:245 ui/cachyos-hello.glade:262
msgid "Web resource"
msgstr "Веб-ресурс"
#: ui/cachyos-hello.glade:175
msgid "Get involved"
msgstr "Принять участие"
#: ui/cachyos-hello.glade:189
msgid "Forums"
msgstr "Форумы"
#: ui/cachyos-hello.glade:206
msgid "Chat room"
msgstr "Чат"
#: ui/cachyos-hello.glade:223
msgid "Mailing lists"
msgstr "Списки рассылок"
#: ui/cachyos-hello.glade:240
msgid "Development"
msgstr "Разработка"
#: ui/cachyos-hello.glade:257
msgid "Donate"
msgstr "Пожертвовать"
#: ui/cachyos-hello.glade:376
msgid "Launch at start"
msgstr "Запускать при старте"
#: ui/cachyos-hello.glade:407
msgid "INSTALLATION"
msgstr "УСТАНОВКА"
#: ui/cachyos-hello.glade:419
msgid "Launch installer"
msgstr "Запустить"
#: ui/cachyos-hello.glade:462
msgid "Home"
msgstr "В начало"
#: ui/cachyos-hello.glade:530 ui/cachyos-hello.glade:544
msgid "About"
msgstr "О программе "
#: ui/cachyos-hello.glade:549
msgid "Welcome screen for CachyOS"
msgstr "Приветственный экран CachyOS"
#: src/manjaro_hello.py:212
msgid "Can't load page."
msgstr "Невозможно загрузить страницу."

View File

@ -2,14 +2,3 @@
mkdir -p "${DESTDIR}/${MESON_INSTALL_PREFIX}/share/cachyos-hello/"
cp -r "${MESON_SOURCE_ROOT}/src/scripts" "${DESTDIR}/${MESON_INSTALL_PREFIX}/share/cachyos-hello/"
cp -r "${MESON_SOURCE_ROOT}/data" "${DESTDIR}/${MESON_INSTALL_PREFIX}/share/cachyos-hello/"
rm -rf "${DESTDIR}/${MESON_INSTALL_PREFIX}/share/cachyos-hello/data/img"
rm -f "${DESTDIR}/${MESON_INSTALL_PREFIX}/share/cachyos-hello/data/pages/copy-release-trans.py"
cd "${MESON_SOURCE_ROOT}/po"
for lang in $(ls *.po); do
lang=${lang::-3}
mkdir -p ${DESTDIR}/usr/share/locale/${lang//_/-}/LC_MESSAGES
msgfmt -c -o ${DESTDIR}/usr/share/locale/${lang//_/-}/LC_MESSAGES/cachyos-hello.mo $lang.po
done

View File

@ -1,4 +1,4 @@
use gettextrs::gettext;
//use gettextrs::gettext;
use gtk::gio;
use gtk::glib::{self, clone, WeakRef};
use gtk::prelude::*;
@ -9,7 +9,7 @@ use std::path::Path;
use crate::config::{APP_ID, PKGDATADIR, VERSION};
use crate::widgets::MainWindow;
/*
mod imp {
use super::*;
@ -109,4 +109,4 @@ impl Default for Application {
fn default() -> Self {
gio::Application::default().unwrap().downcast().unwrap()
}
}
}*/

View File

@ -1,5 +1,4 @@
use crate::alpm_helper::*;
use crate::config::PKGDATADIR;
use crate::utils;
use gio::prelude::*;
@ -10,8 +9,6 @@ use gtk::prelude::{
};
use once_cell::sync::Lazy;
use std::fs;
use std::sync::Mutex;
#[derive(Debug)]
@ -86,10 +83,11 @@ impl ApplicationBrowser {
update_system_btn.set_sensitive(false);
// Group filter
let data =
fs::read_to_string(format!("{PKGDATADIR}/data/application_utility/default.json"))
.expect("Unable to read file");
let groups: serde_json::Value = serde_json::from_str(&data).expect("Unable to parse");
let app_util_manifest_file =
crate::embed_data::get("application_utility/default.json").unwrap();
let app_util_manifest = std::str::from_utf8(app_util_manifest_file.data.as_ref()).unwrap();
let groups: serde_json::Value =
serde_json::from_str(&app_util_manifest).expect("Unable to parse");
let group_store = load_groups_data(&groups);
let group_combo = utils::create_combo_with_model(&group_store);
group_combo.connect_changed(on_group_filter_changed);

View File

@ -1,7 +1,3 @@
pub const APP_ID: &str = @APP_ID@;
pub const GETTEXT_PACKAGE: &str = @GETTEXT_PACKAGE@;
pub const LOCALEDIR: &str = @LOCALEDIR@;
pub const PKGDATADIR: &str = @PKGDATADIR@;
pub const PROFILE: &str = @PROFILE@;
pub const RESOURCES_FILE: &str = concat!(@PKGDATADIR@, "/cachyos-welcome.gresource");
pub const VERSION: &str = @VERSION@;

12
src/embed_data.rs Normal file
View File

@ -0,0 +1,12 @@
use rust_embed::{EmbeddedFile, RustEmbed};
#[derive(RustEmbed)]
#[folder = "data/"]
#[exclude = "pages/copy-release-trans.py"]
#[exclude = "img/*"]
pub struct HelloData;
// Get the `EmbeddedFile` for the given path.
pub fn get(file_path: &str) -> Option<EmbeddedFile> {
HelloData::get(file_path)
}

7
src/gresource.rs Normal file
View File

@ -0,0 +1,7 @@
pub fn init() -> Result<(), glib::Error> {
const GRESOURCE: &[u8] = include_bytes!(concat!(env!("OUT_DIR"), "/cachyos-welcome.gresource"));
gio::resources_register(&gio::Resource::from_data(&glib::Bytes::from_static(GRESOURCE))?);
Ok(())
}

51
src/localization.rs Normal file
View File

@ -0,0 +1,51 @@
use i18n_embed::fluent::{fluent_language_loader, FluentLanguageLoader};
use i18n_embed::{DefaultLocalizer, I18nEmbedError, LanguageLoader, Localizer};
use once_cell::sync::Lazy;
use rust_embed::RustEmbed;
#[derive(RustEmbed)]
#[folder = "i18n"] // path to the compiled localization resources
struct Localizations;
pub static LANGUAGE_LOADER: Lazy<FluentLanguageLoader> = Lazy::new(|| {
let loader: FluentLanguageLoader = fluent_language_loader!();
loader.load_fallback_language(&Localizations).expect("Error while loading fallback language");
loader
});
#[macro_export]
macro_rules! fl {
($message_id:literal) => {{
i18n_embed_fl::fl!($crate::localization::LANGUAGE_LOADER, $message_id)
}};
($message_id:literal, $($args:expr),*) => {{
i18n_embed_fl::fl!($crate::localization::LANGUAGE_LOADER, $message_id, $($args), *)
}};
}
// Get the `Localizer` to be used for localizing this library.
pub fn localizer() -> Box<dyn Localizer> {
Box::from(DefaultLocalizer::new(&*LANGUAGE_LOADER, &Localizations))
}
// Get translated text
pub fn get_locale_text(message_id: &str) -> String {
LANGUAGE_LOADER.get(message_id)
}
// Get available languages
pub fn get_available_languages() -> Result<Vec<unic_langid::LanguageIdentifier>, I18nEmbedError> {
LANGUAGE_LOADER.available_languages(&Localizations)
}
// Check if language is available
pub fn check_language_valid(requested_language: &str) -> bool {
let available_languages = get_available_languages().unwrap();
available_languages.iter().any(|x| {
let lang = x.language.to_string();
lang == requested_language
})
}

View File

@ -6,17 +6,22 @@ mod alpm_helper;
mod application_browser;
mod config;
mod data_types;
mod embed_data;
mod gresource;
mod localization;
mod pages;
mod utils;
use config::{APP_ID, GETTEXT_PACKAGE, LOCALEDIR, PKGDATADIR, PROFILE, RESOURCES_FILE, VERSION};
use config::{APP_ID, PROFILE, VERSION};
use data_types::*;
use gettextrs::LocaleCategory;
use glib::GString;
use gtk::{gio, glib, Builder, HeaderBar, Window};
use i18n_embed::DesktopLanguageRequester;
use once_cell::sync::Lazy;
use std::collections::HashMap;
use std::path::Path;
use std::sync::{Arc, Mutex};
use unic_langid::LanguageIdentifier;
use utils::*;
use gio::prelude::*;
@ -30,7 +35,10 @@ use subprocess::Exec;
const RESPREFIX: &str = "/org/cachyos/hello";
static G_SAVE_JSON: Lazy<Mutex<serde_json::Value>> = Lazy::new(|| Mutex::new(json!(null)));
static G_SAVE_JSON: Lazy<Mutex<serde_json::Value>> = Lazy::new(|| {
let saved_json = get_saved_json();
Mutex::new(saved_json)
});
static mut G_HELLO_WINDOW: Option<Arc<HelloWindow>> = None;
fn quick_message(message: &'static str) {
@ -94,15 +102,15 @@ fn show_about_dialog() {
let dialog = gtk::AboutDialog::builder()
.transient_for(main_window)
.modal(true)
.program_name(gettextrs::gettext("CachyOS Hello"))
.comments(gettextrs::gettext("Welcome screen for CachyOS"))
.program_name(GString::from_string_unchecked(crate::fl!("about-dialog-title")))
.comments(GString::from_string_unchecked(crate::fl!("about-dialog-comments")))
.version(VERSION)
.logo(&logo)
.authors(vec![
"Vladislav Nepogodin".to_owned(),
])
// Translators: Replace "translator-credits" with your names. Put a comma between.
.translator_credits(gettextrs::gettext("translator-credits"))
.translator_credits("translator-credits")
.copyright("2021-2023 CachyOS team")
.license_type(gtk::License::Gpl30)
.website("https://github.com/cachyos/cachyos-welcome")
@ -113,17 +121,50 @@ fn show_about_dialog() {
dialog.hide();
}
fn get_preferences() -> serde_json::Value {
let page_file = crate::embed_data::get("preferences.json").unwrap();
let page = std::str::from_utf8(page_file.data.as_ref());
serde_json::from_str(&page.unwrap()).expect("Unable to parse")
}
fn get_saved_locale() -> Option<String> {
let saved_json = &*G_SAVE_JSON.lock().unwrap();
Some(saved_json["locale"].as_str()?.to_owned())
}
fn get_saved_json() -> serde_json::Value {
let preferences = get_preferences();
let save_path = fix_path(preferences["save_path"].as_str().unwrap());
if !Path::new(&save_path).exists() {
json!({"locale": ""})
} else {
read_json(save_path.as_str())
}
}
fn main() {
gettextrs::setlocale(LocaleCategory::LcAll, "");
gettextrs::bindtextdomain(GETTEXT_PACKAGE, LOCALEDIR).expect("Unable to bind the text domain.");
gettextrs::textdomain(GETTEXT_PACKAGE).expect("Unable to switch to the text domain.");
// Setup localization.
let saved_locale = get_saved_locale().unwrap();
let requested_languages = if !saved_locale.is_empty() {
let lang_id: LanguageIdentifier = saved_locale.parse().unwrap();
vec![lang_id]
} else {
DesktopLanguageRequester::requested_languages()
};
glib::set_application_name("CachyOSHello");
let localizer = crate::localization::localizer();
if let Err(error) = localizer.select(&requested_languages) {
eprintln!("Error while loading languages for library_fluent {}", error);
}
// Register UI.
gtk::init().expect("Unable to start GTK3.");
let res = gio::Resource::load(RESOURCES_FILE).expect("Could not load gresource file.");
gio::resources_register(&res);
gresource::init().expect("Could not load gresource file.");
// Set program name.
glib::set_program_name("CachyOSHello".into());
glib::set_application_name("CachyOSHello");
let application = gtk::Application::new(
Some(APP_ID), // Application id
@ -139,20 +180,11 @@ fn main() {
}
fn build_ui(application: &gtk::Application) {
let data = fs::read_to_string(format!("{PKGDATADIR}/data/preferences.json"))
.expect("Unable to read file");
let preferences: serde_json::Value = serde_json::from_str(&data).expect("Unable to parse");
let preferences = get_preferences();
// Get saved infos
let save_path = fix_path(preferences["save_path"].as_str().unwrap());
let save: serde_json::Value = if !Path::new(&save_path).exists() {
json!({"locale": ""})
} else {
read_json(save_path.as_str())
};
let best_locale = get_best_locale(&preferences, &save);
std::env::set_var("LANGUAGE", best_locale.as_str());
let saved_locale = get_saved_locale().unwrap();
let best_locale = get_best_locale(&preferences, &saved_locale).unwrap();
// Import Css
let provider = gtk::CssProvider::new();
@ -181,7 +213,6 @@ fn build_ui(application: &gtk::Application) {
let main_window: Window = builder.object("window").expect("Could not get the object window");
main_window.set_application(Some(application));
*G_SAVE_JSON.lock().unwrap() = save;
unsafe {
G_HELLO_WINDOW = Some(Arc::new(HelloWindow {
window: main_window.clone(),
@ -229,10 +260,13 @@ fn build_ui(application: &gtk::Application) {
}
// Create pages
let pages =
format!("{}/data/pages/{}", PKGDATADIR, preferences["default_locale"].as_str().unwrap());
let file_pages_path = crate::embed_data::HelloData::iter()
.filter(|pkg| pkg.starts_with(&format!("pages/{}", &best_locale)))
.collect::<Vec<_>>();
for page in fs::read_dir(pages).unwrap() {
for file_path in file_pages_path {
// let page_file = HelloData::get(&file_path).unwrap();
// let page = std::str::from_utf8(page_file.data.as_ref());
let scrolled_window =
gtk::ScrolledWindow::new(gtk::Adjustment::NONE, gtk::Adjustment::NONE);
@ -252,8 +286,10 @@ fn build_ui(application: &gtk::Application) {
stack.set_visible_child_name(&format!("{name}page"));
}));
let child_name =
format!("{}page", page.unwrap().path().file_name().unwrap().to_str().unwrap());
let child_name = format!(
"{}page",
Path::new(&file_path.as_ref()).file_name().unwrap().to_str().unwrap()
);
let grid = gtk::Grid::new();
grid.set_widget_name(&child_name);
@ -268,11 +304,6 @@ fn build_ui(application: &gtk::Application) {
}
// Init translation
gettextrs::bindtextdomain(GETTEXT_PACKAGE, LOCALEDIR)
.expect("Unable to switch to the text domain.");
gettextrs::bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8")
.expect("Unable to set domain encoding.");
gettextrs::textdomain(GETTEXT_PACKAGE).expect("Unable to switch to the text domain.");
let languages: gtk::ComboBoxText = builder.object("languages").unwrap();
languages.set_active_id(Some(best_locale.as_str()));
@ -309,37 +340,34 @@ fn build_ui(application: &gtk::Application) {
}
/// Returns the best locale, based on user's preferences.
pub fn get_best_locale(preferences: &serde_json::Value, save: &serde_json::Value) -> String {
let saved_locale =
format!("{}/{}/LC_MESSAGES/cachyos-hello.mo", LOCALEDIR, save["locale"].as_str().unwrap());
if check_regular_file(saved_locale.as_str()) {
return String::from(save["locale"].as_str().unwrap());
} else if save["locale"].as_str().unwrap() == preferences["default_locale"].as_str().unwrap() {
return String::from(preferences["default_locale"].as_str().unwrap());
pub fn get_best_locale(
preferences: &serde_json::Value,
saved_locale: &str,
) -> Result<String, str::Utf8Error> {
if crate::localization::check_language_valid(saved_locale) {
return Ok(saved_locale.to_owned());
} else if saved_locale == preferences["default_locale"].as_str().unwrap() {
return Ok(preferences["default_locale"].as_str().unwrap().to_owned());
}
let locale_name = std::env::var("LC_ALL").unwrap_or_else(|_| String::from("en_US.UTF-8"));
let locale_name = std::env::var("LC_MESSAGES").unwrap_or_else(|_| String::from("en_US.UTF-8"));
let sys_locale =
string_substr(locale_name.as_str(), 0, locale_name.find('.').unwrap_or(usize::MAX))
.unwrap();
let user_locale = format!("{LOCALEDIR}/{sys_locale}/LC_MESSAGES/cachyos-hello.mo");
let two_letters = string_substr(sys_locale, 0, 2).unwrap();
string_substr(locale_name.as_str(), 0, locale_name.find('.').unwrap_or(usize::MAX))?;
let two_letters = string_substr(sys_locale, 0, 2)?;
// If user's locale is supported
if check_regular_file(user_locale.as_str()) {
if crate::localization::check_language_valid(sys_locale) {
if sys_locale.contains('_') {
return sys_locale.replace('_', "-");
return Ok(sys_locale.replace('_', "-"));
}
return String::from(sys_locale);
return Ok(sys_locale.to_owned());
}
// If two first letters of user's locale is supported (ex: en_US -> en)
else if check_regular_file(
format!("{LOCALEDIR}/{two_letters}/LC_MESSAGES/cachyos-hello.mo").as_str(),
) {
return String::from(two_letters);
else if crate::localization::check_language_valid(two_letters) {
return Ok(two_letters.to_owned());
}
String::from(preferences["default_locale"].as_str().unwrap())
Ok(preferences["default_locale"].as_str().unwrap().to_owned())
}
/// Sets locale of ui and pages.
@ -352,53 +380,68 @@ fn set_locale(use_locale: &str) {
);
}
gettextrs::textdomain(GETTEXT_PACKAGE).expect("Unable to switch to the text domain.");
glib::setenv("LANGUAGE", use_locale, true).expect("Unable to change env variable.");
let localizer = crate::localization::localizer();
let req_locale: LanguageIdentifier = use_locale.parse().unwrap();
if let Err(error) = localizer.select(&[req_locale]) {
eprintln!("Error while loading languages for library_fluent {}", error);
}
G_SAVE_JSON.lock().unwrap()["locale"] = json!(use_locale);
// Real-time locale changing
let elts: HashMap<String, serde_json::Value> = serde_json::from_str(&serde_json::to_string(&json!({
"label": ["autostartlabel", "development", "software", "donate", "firstcategory", "forum", "install", "installlabel", "involved", "mailling", "readme", "release", "secondcategory", "thirdcategory", "welcomelabel", "welcometitle", "wiki"],
"tooltip_text": ["about", "development", "software", "donate", "forum", "mailling", "wiki"],
})).unwrap()).unwrap();
// Run-time locale changing
let elts: HashMap<&str, Vec<_>> = HashMap::from([
("label", vec![
"autostartlabel",
"development",
"software",
"donate",
"firstcategory",
"forum",
"install",
"installlabel",
"involved",
"readme",
"release",
"secondcategory",
"thirdcategory",
"welcomelabel",
"welcometitle",
"wiki",
]),
("tooltip_text", vec!["about", "development", "software", "donate", "forum", "wiki"]),
]);
let builder_ref = unsafe { &G_HELLO_WINDOW.as_ref().unwrap().builder };
let mut default_texts = json!(null);
for method in elts.iter() {
if default_texts.get(method.0).is_none() {
default_texts[method.0] = json![null];
}
for elt in elts[method.0].as_array().unwrap() {
let elt_value = elt.as_str().unwrap();
let item: &gtk::Widget = &builder_ref.object(elt_value).unwrap();
if default_texts[method.0].get(elt_value).is_none() {
let item_buf = item.property::<String>(method.0.as_str());
default_texts[method.0][elt_value] = json!(item_buf);
}
if method.0 == "tooltip_text" {
item.set_property(
method.0,
&gettextrs::gettext(default_texts[method.0][elt_value].as_str().unwrap()),
);
for (method, objnames) in &elts {
for objname in objnames {
let item: &gtk::Widget = &builder_ref.object(objname).unwrap();
if method == &"label" {
let translated_text =
crate::localization::get_locale_text(utils::get_translation_msgid(&objname));
item.set_property(method, &translated_text);
} else if method == &"tooltip_text" {
let translated_text = if objname == &"about" {
crate::fl!("button-about-tooltip")
} else {
crate::fl!("button-web-resource-tooltip")
};
item.set_property(method, &translated_text);
}
}
}
let save = &*G_SAVE_JSON.lock().unwrap();
let preferences = unsafe { &G_HELLO_WINDOW.as_ref().unwrap().preferences };
// Change content of pages
let pages =
format!("{}/data/pages/{}", PKGDATADIR, preferences["default_locale"].as_str().unwrap());
for page in fs::read_dir(pages).unwrap() {
let file_pages_path = crate::embed_data::HelloData::iter()
.filter(|pkg| pkg.starts_with(&format!("pages/{}", &use_locale)))
.collect::<Vec<_>>();
for file_path in file_pages_path {
let page_file_name = Path::new(file_path.as_ref()).file_name().unwrap().to_str().unwrap();
let stack: &gtk::Stack = &builder_ref.object("stack").unwrap();
let child = stack.child_by_name(&format!(
"{}page",
page.as_ref().unwrap().path().file_name().unwrap().to_str().unwrap()
));
let child = stack.child_by_name(&format!("{}page", &page_file_name));
if child.is_none() {
eprintln!("child not found");
continue;
@ -408,24 +451,14 @@ fn set_locale(use_locale: &str) {
let third_child = &second_child[0].clone().downcast::<gtk::Container>().unwrap().children();
let label = &third_child[0].clone().downcast::<gtk::Label>().unwrap();
label.set_markup(
get_page(
page.unwrap().path().file_name().unwrap().to_str().unwrap(),
preferences,
save,
)
.as_str(),
);
label.set_markup(get_page(file_path.as_ref()).as_str());
}
}
fn set_autostart(autostart: bool) {
let autostart_path = unsafe {
fix_path(G_HELLO_WINDOW.as_ref().unwrap().preferences["autostart_path"].as_str().unwrap())
};
let desktop_path = unsafe {
G_HELLO_WINDOW.as_ref().unwrap().preferences["desktop_path"].as_str().unwrap().to_owned()
};
let preferences = unsafe { &G_HELLO_WINDOW.as_ref().unwrap().preferences };
let autostart_path = fix_path(preferences["autostart_path"].as_str().unwrap());
let desktop_path = preferences["desktop_path"].as_str().unwrap().to_owned();
let config_dir = Path::new(&autostart_path).parent().unwrap();
if !config_dir.exists() {
fs::create_dir_all(config_dir).unwrap();
@ -438,19 +471,10 @@ fn set_autostart(autostart: bool) {
}
#[inline]
fn get_page(name: &str, preferences: &serde_json::Value, save: &serde_json::Value) -> String {
let mut filename =
format!("{}/data/pages/{}/{}", PKGDATADIR, save["locale"].as_str().unwrap(), name);
if !check_regular_file(filename.as_str()) {
filename = format!(
"{}/data/pages/{}/{}",
PKGDATADIR,
preferences["default_locale"].as_str().unwrap(),
name
);
}
fs::read_to_string(filename).unwrap()
fn get_page(file_path: &str) -> String {
let page_file = crate::embed_data::get(&file_path).unwrap();
let page = std::str::from_utf8(page_file.data.as_ref());
page.unwrap().to_owned()
}
/// Handlers
@ -520,9 +544,9 @@ fn on_link1_clicked(param: &[glib::Value]) -> Option<glib::Value> {
}
fn on_delete_window(_param: &[glib::Value]) -> Option<glib::Value> {
let save = &*G_SAVE_JSON.lock().unwrap();
let saved_json = &*G_SAVE_JSON.lock().unwrap();
let preferences = unsafe { &G_HELLO_WINDOW.as_ref().unwrap().preferences["save_path"] };
write_json(preferences.as_str().unwrap(), save);
write_json(preferences.as_str().unwrap(), saved_json);
Some(false.to_value())
}

View File

@ -1,10 +1,7 @@
global_conf = configuration_data()
global_conf.set_quoted('APP_ID', application_id)
global_conf.set_quoted('PKGDATADIR', pkgdatadir)
global_conf.set_quoted('PROFILE', profile)
global_conf.set_quoted('VERSION', version + version_suffix)
global_conf.set_quoted('GETTEXT_PACKAGE', gettext_package)
global_conf.set_quoted('LOCALEDIR', localedir)
config = configure_file(
input: 'config.rs.in',
output: 'config.rs',

View File

@ -76,6 +76,28 @@ pub fn create_combo_with_model(group_store: &gtk::ListStore) -> gtk::ComboBox {
group_combo
}
pub fn get_translation_msgid(objname: &str) -> &'static str {
match objname {
"autostartlabel" => "launch-start-label",
"development" => "button-development-label",
"software" => "button-software-label",
"donate" => "button-donate-label",
"forum" => "button-forum-label",
"firstcategory" => "section-docs",
"secondcategory" => "section-support",
"thirdcategory" => "section-project",
"install" => "button-installer-label",
"installlabel" => "section-installer",
"involved" => "button-involved-label",
"readme" => "button-readme-label",
"release" => "button-release-info-label",
"welcomelabel" => "welcome-body",
"welcometitle" => "welcome-title",
"wiki" => "button-wiki-label",
_ => panic!("unknown objname '{objname}'!"),
}
}
pub fn run_cmd_terminal(cmd: String, escalate: bool) -> bool {
let cmd_formated = format!("{cmd}; read -p 'Press enter to exit'");
let mut args: Vec<&str> = vec![];

View File

@ -237,23 +237,6 @@ We, the CachyOS Developers, hope that you will enjoy using CachyOS as much as we
<property name="top-attach">6</property>
</packing>
</child>
<child>
<object class="GtkButton" id="mailling">
<property name="label" translatable="yes">Mailing lists</property>
<property name="name">mailling</property>
<property name="visible">False</property>
<property name="can-focus">False</property>
<property name="receives-default">True</property>
<property name="tooltip-text" translatable="yes">Web resource</property>
<property name="image-position">right</property>
<property name="always-show-image">True</property>
<signal name="clicked" handler="on_link_clicked" swapped="no"/>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">7</property>
</packing>
</child>
<child>
<object class="GtkButton" id="development">
<property name="label" translatable="yes">Development</property>
@ -300,8 +283,8 @@ We, the CachyOS Developers, hope that you will enjoy using CachyOS as much as we
<property name="visible">True</property>
<property name="can-focus">False</property>
<items>
<item id="de">German</item>
<item id="en">English</item>
<item id="de">German</item>
<item id="pl">Polish</item>
<item id="ru">Russian</item>
</items>

View File

@ -1,3 +0,0 @@
#!/bin/sh
# Script to generate pot file
xgettext --from-code=UTF-8 --files-from=./files_to_translate --keyword=translatable --keyword=_ --output=../po/cachyos-hello.pot

View File

@ -1,2 +0,0 @@
../ui/cachyos-hello.glade
../src/manjaro_hello.py