@@ -56,7 +56,18 @@ static BUNDLE_CN: Lazy<FluentBundle<FluentResource, intl_memoizer::concurrent::I
5656 let mut source = String :: new ( ) ;
5757 reader. read_to_string ( & mut source) . expect ( "Failed to read CN translation file" ) ;
5858 let res = FluentResource :: try_new ( source) . expect ( "Could not parse the FTL file." ) ;
59- let mut bundle = FluentBundle :: new_concurrent ( vec ! [ langid!( "fr" ) ] ) ;
59+ let mut bundle = FluentBundle :: new_concurrent ( vec ! [ langid!( "cn" ) ] ) ;
60+ bundle. add_resource ( res) . expect ( "Failed to add FTL resources to the bundle." ) ;
61+ bundle
62+ } ) ;
63+
64+ static BUNDLE_NL : Lazy < FluentBundle < FluentResource , intl_memoizer:: concurrent:: IntlLangMemoizer > > = Lazy :: new ( || {
65+ let file = std:: fs:: File :: open ( TRANSLATIONS_DIRECTORY . to_owned ( ) + "nl/ocp.ftl" ) . unwrap ( ) ;
66+ let mut reader = std:: io:: BufReader :: new ( file) ;
67+ let mut source = String :: new ( ) ;
68+ reader. read_to_string ( & mut source) . expect ( "Failed to read NL translation file" ) ;
69+ let res = FluentResource :: try_new ( source) . expect ( "Could not parse the FTL file." ) ;
70+ let mut bundle = FluentBundle :: new_concurrent ( vec ! [ langid!( "nl" ) ] ) ;
6071 bundle. add_resource ( res) . expect ( "Failed to add FTL resources to the bundle." ) ;
6172 bundle
6273} ) ;
@@ -68,6 +79,7 @@ pub fn tr(lang: &Language, key: &str) -> String {
6879 Language :: Spanish => & BUNDLE_ES ,
6980 Language :: French => & BUNDLE_FR ,
7081 Language :: Chinese => & BUNDLE_CN ,
82+ Language :: Dutch => & BUNDLE_NL ,
7183 } ;
7284 let msg = bundle. get_message ( key) . expect ( & ( "Missing translation key " . to_owned ( ) + key) ) ;
7385 let mut errors = vec ! [ ] ;
@@ -77,12 +89,12 @@ pub fn tr(lang: &Language, key: &str) -> String {
7789
7890#[ derive( Debug , Serialize , Deserialize , Clone , Copy , PartialEq , Eq ) ]
7991pub enum Language {
80- English , Portuguese , Spanish , French , Chinese
92+ English , Portuguese , Spanish , French , Chinese , Dutch
8193}
8294
8395impl Language {
84- pub const ALL : [ Language ; 5 ] = [
85- Language :: English , Language :: Portuguese , Language :: Spanish , Language :: French , Language :: Chinese
96+ pub const ALL : [ Language ; 6 ] = [
97+ Language :: English , Language :: Portuguese , Language :: Spanish , Language :: French , Language :: Chinese , Language :: Dutch
8698 ] ;
8799}
88100
@@ -94,6 +106,7 @@ impl DisplayTranslated for Language {
94106 Language :: Spanish => "spanish" ,
95107 Language :: French => "french" ,
96108 Language :: Chinese => "chinese" ,
109+ Language :: Dutch => "dutch" ,
97110 }
98111 }
99112}
0 commit comments