Created
March 15, 2016 10:10
-
-
Save justinas/ff7089e91ca2035c7199 to your computer and use it in GitHub Desktop.
Running xgettext on a Rust file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ cat a.rs; xgettext a.rs -o - | |
fn main() { | |
catalog.gettext("Cucumber"); | |
catalog.ngettext("Cucumber", "Cucumbers", 42); | |
catalog.pgettext("a vegetable", "Cucumber"); | |
catalog.npgettext("a vegetable", "Cucumber", "Cucumbers", 42); | |
gettext!("Hi"); | |
} | |
xgettext: warning: file 'a.rs' extension 'rs' is unknown; will try C | |
# 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: 2016-03-15 12:09+0200\n" | |
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" | |
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" | |
"Language-Team: LANGUAGE <[email protected]>\n" | |
"Language: \n" | |
"MIME-Version: 1.0\n" | |
"Content-Type: text/plain; charset=CHARSET\n" | |
"Content-Transfer-Encoding: 8bit\n" | |
"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n" | |
#: a.rs:2 a.rs:3 | |
msgid "Cucumber" | |
msgid_plural "Cucumbers" | |
msgstr[0] "" | |
msgstr[1] "" | |
#: a.rs:4 a.rs:5 | |
msgctxt "a vegetable" | |
msgid "Cucumber" | |
msgid_plural "Cucumbers" | |
msgstr[0] "" | |
msgstr[1] "" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I'm highjacking this gist to advertise the xtr crate https://github.com/woboq/tr
Using the same a.rs as in the original: