WIP: feat: Gettext support (*.po
, *.pot
) #584
8 changed files with 58 additions and 0 deletions
11
Cargo.lock
generated
11
Cargo.lock
generated
|
@ -569,6 +569,7 @@ dependencies = [
|
|||
"tree-sitter-nix",
|
||||
"tree-sitter-ocaml",
|
||||
"tree-sitter-php",
|
||||
"tree-sitter-po-orchard",
|
||||
"tree-sitter-properties",
|
||||
"tree-sitter-python-orchard",
|
||||
"tree-sitter-ruby",
|
||||
|
@ -1243,6 +1244,16 @@ dependencies = [
|
|||
"tree-sitter-language",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tree-sitter-po-orchard"
|
||||
version = "0.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f4be5cb95a9a7d3e4ed0691545e7b78a0426becd99261249abd3444627df8d38"
|
||||
dependencies = [
|
||||
"cc",
|
||||
"tree-sitter-language",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tree-sitter-properties"
|
||||
version = "0.3.0"
|
||||
|
|
|
@ -41,6 +41,7 @@ tree-sitter-cpp = "0.23"
|
|||
tree-sitter-c-sharp = "0.23"
|
||||
tree-sitter-xml = "0.7.0"
|
||||
tree-sitter-go = "0.25.0"
|
||||
tree-sitter-po-orchard = "0.1"
|
||||
tree-sitter-gomod-orchard = "0.4"
|
||||
tree-sitter-gosum-orchard = "0.2"
|
||||
tree-sitter-dart-orchard = "0.1"
|
||||
|
|
|
@ -36,6 +36,7 @@ and the following declarative file formats:
|
|||
* Java properties files (*.properties)
|
||||
* HCL (*.hcl, *.tf, *.tfvars)
|
||||
* `go.mod` and `go.sum` files
|
||||
* Gettext (*.po, *.pot)
|
||||
|
||||
This list can also be obtained with the `mergiraf languages` command.
|
||||
|
||||
|
|
4
examples/po/working/messages/Base.po
Normal file
4
examples/po/working/messages/Base.po
Normal file
|
@ -0,0 +1,4 @@
|
|||
#: src/main.c:22
|
||||
msgid "Hello"
|
||||
msgstr "Hallo"
|
||||
|
11
examples/po/working/messages/Expected.po
Normal file
11
examples/po/working/messages/Expected.po
Normal file
|
@ -0,0 +1,11 @@
|
|||
#: src/main.c:22
|
||||
msgid "Hello"
|
||||
msgstr "Hallo"
|
||||
|
||||
#: src/main.c:38
|
||||
msgid "OK"
|
||||
msgstr "Bestätigen"
|
||||
|
||||
#: src/main.c:39
|
||||
msgid "Cancel"
|
||||
msgstr "Abbrechen"
|
7
examples/po/working/messages/Left.po
Normal file
7
examples/po/working/messages/Left.po
Normal file
|
@ -0,0 +1,7 @@
|
|||
#: src/main.c:22
|
||||
msgid "Hello"
|
||||
msgstr "Hallo"
|
||||
|
||||
#: src/main.c:38
|
||||
msgid "OK"
|
||||
msgstr "Bestätigen"
|
7
examples/po/working/messages/Right.po
Normal file
7
examples/po/working/messages/Right.po
Normal file
|
@ -0,0 +1,7 @@
|
|||
#: src/main.c:22
|
||||
msgid "Hello"
|
||||
msgstr "Hallo"
|
||||
|
||||
#: src/main.c:39
|
||||
msgid "Cancel"
|
||||
msgstr "Abbrechen"
|
|
@ -552,6 +552,22 @@ pub static SUPPORTED_LANGUAGES: LazyLock<Vec<LangProfile>> = LazyLock::new(|| {
|
|||
flattened_nodes: &[],
|
||||
comment_nodes: &[],
|
||||
},
|
||||
LangProfile {
|
||||
name: "PO",
|
||||
alternate_names: &["Gettext"],
|
||||
extensions: vec!["po", "pot"],
|
||||
file_names: vec![],
|
||||
language: tree_sitter_po_orchard::LANGUAGE.into(),
|
||||
atomic_nodes: vec!["string"],
|
||||
commutative_parents: vec![
|
||||
CommutativeParent::without_delimiters("source_file", "\n\n")
|
||||
.restricted_to_groups(&[&["message"]]),
|
||||
],
|
||||
signatures: vec![signature("message", vec![vec![ChildKind("msgid")]])],
|
||||
injections: None,
|
||||
flattened_nodes: &[],
|
||||
comment_nodes: &["comment"],
|
||||
},
|
||||
LangProfile {
|
||||
name: "Javascript",
|
||||
alternate_names: &[],
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue