{
+ include_str!(concat!(env!("OUT_DIR"), "/", $fname))
+ };
+}
+
+#[cfg(not(feature = "translations"))]
+macro_rules! ftl_path {
+ ( "template.ftl" ) => {
+ include_str!(concat!(env!("OUT_DIR"), "/template.ftl"))
+ };
+ ( $fname: expr ) => {
+ "" // translations not included
+ };
+}
+
/// Get the template/English resource text for the given group.
/// These are embedded in the binary.
fn ftl_template_text() -> &'static str {
- include_str!("ftl/template.ftl")
+ ftl_path!("template.ftl")
}
fn ftl_localized_text(lang: &LanguageIdentifier) -> Option<&'static str> {
Some(match lang.language() {
"en" => {
match lang.region() {
- Some("GB") | Some("AU") => include_str!("ftl/en-GB.ftl"),
+ Some("GB") | Some("AU") => ftl_path!("en-GB.ftl"),
// use fallback language instead
_ => return None,
}
}
"zh" => match lang.region() {
- Some("TW") | Some("HK") => include_str!("ftl/zh-TW.ftl"),
- _ => include_str!("ftl/zh-CN.ftl"),
+ Some("TW") | Some("HK") => ftl_path!("zh-TW.ftl"),
+ _ => ftl_path!("zh-CN.ftl"),
},
"pt" => {
if let Some("PT") = lang.region() {
- include_str!("ftl/pt-PT.ftl")
+ ftl_path!("pt-PT.ftl")
} else {
- include_str!("ftl/pt-BR.ftl")
+ ftl_path!("pt-BR.ftl")
}
}
- "ga" => include_str!("ftl/ga-IE.ftl"),
- "hy" => include_str!("ftl/hy-AM.ftl"),
- "nb" => include_str!("ftl/nb-NO.ftl"),
- "sv" => include_str!("ftl/sv-SE.ftl"),
- "jbo" => include_str!("ftl/jbo.ftl"),
- "kab" => include_str!("ftl/kab.ftl"),
- "af" => include_str!("ftl/af.ftl"),
- "ar" => include_str!("ftl/ar.ftl"),
- "bg" => include_str!("ftl/bg.ftl"),
- "ca" => include_str!("ftl/ca.ftl"),
- "cs" => include_str!("ftl/cs.ftl"),
- "da" => include_str!("ftl/da.ftl"),
- "de" => include_str!("ftl/de.ftl"),
- "el" => include_str!("ftl/el.ftl"),
- "eo" => include_str!("ftl/eo.ftl"),
- "es" => include_str!("ftl/es.ftl"),
- "et" => include_str!("ftl/et.ftl"),
- "eu" => include_str!("ftl/eu.ftl"),
- "fa" => include_str!("ftl/fa.ftl"),
- "fi" => include_str!("ftl/fi.ftl"),
- "fr" => include_str!("ftl/fr.ftl"),
- "gl" => include_str!("ftl/gl.ftl"),
- "he" => include_str!("ftl/he.ftl"),
- "hr" => include_str!("ftl/hr.ftl"),
- "hu" => include_str!("ftl/hu.ftl"),
- "it" => include_str!("ftl/it.ftl"),
- "ja" => include_str!("ftl/ja.ftl"),
- "ko" => include_str!("ftl/ko.ftl"),
- "la" => include_str!("ftl/la.ftl"),
- "mn" => include_str!("ftl/mn.ftl"),
- "mr" => include_str!("ftl/mr.ftl"),
- "ms" => include_str!("ftl/ms.ftl"),
- "nl" => include_str!("ftl/nl.ftl"),
- "oc" => include_str!("ftl/oc.ftl"),
- "pl" => include_str!("ftl/pl.ftl"),
- "ro" => include_str!("ftl/ro.ftl"),
- "ru" => include_str!("ftl/ru.ftl"),
- "sk" => include_str!("ftl/sk.ftl"),
- "sl" => include_str!("ftl/sl.ftl"),
- "sr" => include_str!("ftl/sr.ftl"),
- "th" => include_str!("ftl/th.ftl"),
- "tr" => include_str!("ftl/tr.ftl"),
- "uk" => include_str!("ftl/uk.ftl"),
- "vi" => include_str!("ftl/vi.ftl"),
+ "ga" => ftl_path!("ga-IE.ftl"),
+ "hy" => ftl_path!("hy-AM.ftl"),
+ "nb" => ftl_path!("nb-NO.ftl"),
+ "sv" => ftl_path!("sv-SE.ftl"),
+ "jbo" => ftl_path!("jbo.ftl"),
+ "kab" => ftl_path!("kab.ftl"),
+ "af" => ftl_path!("af.ftl"),
+ "ar" => ftl_path!("ar.ftl"),
+ "bg" => ftl_path!("bg.ftl"),
+ "ca" => ftl_path!("ca.ftl"),
+ "cs" => ftl_path!("cs.ftl"),
+ "da" => ftl_path!("da.ftl"),
+ "de" => ftl_path!("de.ftl"),
+ "el" => ftl_path!("el.ftl"),
+ "eo" => ftl_path!("eo.ftl"),
+ "es" => ftl_path!("es.ftl"),
+ "et" => ftl_path!("et.ftl"),
+ "eu" => ftl_path!("eu.ftl"),
+ "fa" => ftl_path!("fa.ftl"),
+ "fi" => ftl_path!("fi.ftl"),
+ "fr" => ftl_path!("fr.ftl"),
+ "gl" => ftl_path!("gl.ftl"),
+ "he" => ftl_path!("he.ftl"),
+ "hr" => ftl_path!("hr.ftl"),
+ "hu" => ftl_path!("hu.ftl"),
+ "it" => ftl_path!("it.ftl"),
+ "ja" => ftl_path!("ja.ftl"),
+ "ko" => ftl_path!("ko.ftl"),
+ "la" => ftl_path!("la.ftl"),
+ "mn" => ftl_path!("mn.ftl"),
+ "mr" => ftl_path!("mr.ftl"),
+ "ms" => ftl_path!("ms.ftl"),
+ "nl" => ftl_path!("nl.ftl"),
+ "oc" => ftl_path!("oc.ftl"),
+ "pl" => ftl_path!("pl.ftl"),
+ "ro" => ftl_path!("ro.ftl"),
+ "ru" => ftl_path!("ru.ftl"),
+ "sk" => ftl_path!("sk.ftl"),
+ "sl" => ftl_path!("sl.ftl"),
+ "sr" => ftl_path!("sr.ftl"),
+ "th" => ftl_path!("th.ftl"),
+ "tr" => ftl_path!("tr.ftl"),
+ "uk" => ftl_path!("uk.ftl"),
+ "vi" => ftl_path!("vi.ftl"),
_ => return None,
})
}
@@ -155,6 +171,26 @@ fn ftl_external_text(folder: &Path) -> Result