summaryrefslogtreecommitdiffhomepage
path: root/android
diff options
context:
space:
mode:
authorJanito Vaqueiro Ferreira Filho <janito@mullvad.net>2020-12-10 18:28:38 +0000
committerJanito Vaqueiro Ferreira Filho <janito@mullvad.net>2020-12-10 18:30:28 +0000
commit82932ef2a930889adf761ccc2d7f37017d81025f (patch)
tree2776977b8437fd72464fe0cfcbe329b7396b8a70 /android
parenta01974f9065ab5d5d1d6ce67553745ab89df6f4c (diff)
downloadmullvadvpn-82932ef2a930889adf761ccc2d7f37017d81025f.tar.xz
mullvadvpn-82932ef2a930889adf761ccc2d7f37017d81025f.zip
Add a mini-example translation file to the doc.
Diffstat (limited to 'android')
-rw-r--r--android/translations-converter/src/gettext.rs20
1 files changed, 20 insertions, 0 deletions
diff --git a/android/translations-converter/src/gettext.rs b/android/translations-converter/src/gettext.rs
index f14e2e857d..b4962ab834 100644
--- a/android/translations-converter/src/gettext.rs
+++ b/android/translations-converter/src/gettext.rs
@@ -72,6 +72,26 @@ impl Translation {
/// The only metadata that is parsed from the file is the "Plural-Form" header. It is assumed
/// that the header value is one of some hard-coded values, so if new languages that have new
/// plurals are added, the code will have to be updated.
+ ///
+ /// An gettext translation file has the format in the example below:
+ ///
+ /// ```
+ /// # The start of the file can contain empty entries to include some header with meta
+ /// # information. Below is the header indicating the plural format.
+ /// msgid ""
+ /// msgstr ""
+ /// "Plural-Forms: nplurals=2; plural=(n != 1);"
+ ///
+ /// # Simple translated messages
+ /// msgid "Message in original language"
+ /// msgstr "Mesaĝo en tradukita lingvo"
+ ///
+ /// # Plural translated messages (with two forms)
+ /// msgid "One translated message"
+ /// msgid_plural "%d translated messages"
+ /// msgstr[0] "Unu tradukita mesaĝo"
+ /// msgstr[1] "%d tradukitaj mesaĝoj"
+ /// ```
pub fn from_file(file_path: impl AsRef<Path>) -> Self {
let mut parsing_header = false;
let mut entries = Vec::new();