@@ -18,16 +18,30 @@ type Locale = String;
18
18
type Value = String ;
19
19
type Translations = HashMap < Key , HashMap < Locale , Value > > ;
20
20
21
+ macro_rules! build_debug {
22
+ ( $( $tokens: tt) * ) => {
23
+ println!( "cargo:warning={}" , format!( $( $tokens) * ) )
24
+ }
25
+ }
26
+
21
27
fn read_locales ( ) -> Translations {
22
28
let mut translations: Translations = HashMap :: new ( ) ;
23
29
24
- let project_dir = project_root ( ) ;
30
+ let mut project_dir = project_root ( ) ;
25
31
let build_directory = project_dir. to_str ( ) . unwrap ( ) ;
26
32
let locales = format ! ( "{}/**/i18n.json" , build_directory) ;
27
- println ! ( "Reading {}" , & locales) ;
28
-
29
- for entry in glob ( & locales) . expect ( "Failed to read glob pattern" ) {
33
+ build_debug ! ( "Reading {}" , & locales) ;
34
+ // TODO: once this works, get from external directory/location arguments from xtask script
35
+ project_dir. pop ( ) ; //sibling directory
36
+ project_dir. push ( "sigchat" ) ;
37
+ let external_directory = project_dir. to_str ( ) . unwrap ( ) ;
38
+ let external_locales = format ! ( "{}/**/i18n.json" , external_directory) ;
39
+ build_debug ! ( "Reading external {}" , & external_locales) ;
40
+ let paths = glob ( & locales) . expect ( "Failed to read glob pattern for in tree fiels" ) ;
41
+ let external_paths = glob ( & external_locales) . expect ( "Filed to read glob pattern for external files" ) ;
42
+ for entry in paths. chain ( external_paths) {
30
43
let entry = entry. unwrap ( ) ;
44
+ build_debug ! ( "{:?}" , entry) ;
31
45
println ! ( "cargo:rerun-if-changed={}" , entry. display( ) ) ;
32
46
let file = File :: open ( entry) . expect ( "Failed to open the file" ) ;
33
47
let mut reader = std:: io:: BufReader :: new ( file) ;
0 commit comments