comparison mde/content/Items.d @ 107:20f7d813bb0f

Translation: now has a file for each locale, instead of a file for each section. Items updated; all strings translated. New unittest for Translation; I realised the old one wasn't run anymore. Changed unittest data and conf dirs.
author Diggory Hardy <diggory.hardy@gmail.com>
date Sun, 30 Nov 2008 17:17:56 +0000
parents 08651e8a8c51
children c9fc2d303178
comparison
equal deleted inserted replaced
106:7f7b40fed72b 107:20f7d813bb0f
49 if (opts.contentList is null) 49 if (opts.contentList is null)
50 loadTransl (opts, n); 50 loadTransl (opts, n);
51 list[i++] = opts.contentList; 51 list[i++] = opts.contentList;
52 } 52 }
53 Options.allContentList = new ContentList (h, list); 53 Options.allContentList = new ContentList (h, list);
54 Options.allContentList.name ("Options"); //FIXME 54 Translation trl = Translation.get (h);
55 Translation.Entry trle = trl.getStruct (h);
56 Options.allContentList.name (trle.name, trle.desc);
55 } 57 }
56 return Options.allContentList; 58 return Options.allContentList;
57 } 59 }
58 h = head (item); 60 h = head (item);
59 auto p = h in Options.optionsClasses; 61 auto p = h in Options.optionsClasses;
66 68
67 auto q = (h = head (item)) in p.content; 69 auto q = (h = head (item)) in p.content;
68 if (q && item is null) // enforce item is an exact match 70 if (q && item is null) // enforce item is an exact match
69 return *q; 71 return *q;
70 } 72 }
71 } else if (h == "quit" && item is null) { 73 } else if (h == "imde") {
72 quit.name ("Quit"); //FIXME 74 if (!imdeTransl) {
73 return quit; 75 Translation trl = Translation.get (h);
76 Translation.Entry trle = trl.getStruct ("quit");
77 quit.name (trle.name, trle.desc);
78 imdeTransl = true;
79 }
80 h = head (item);
81 if (h == "quit" && item is null) {
82 quit.name ("Quit"); //FIXME
83 return quit;
84 }
74 } 85 }
75 throw new ContentItemException (h); 86 throw new ContentItemException (h);
76 } 87 }
77 88
78 private: 89 private:
90 return ret; 101 return ret;
91 } 102 }
92 103
93 void loadTransl (Options p, char[] n) { 104 void loadTransl (Options p, char[] n) {
94 debug logger.trace ("Loading translation strings for Options."~n); 105 debug logger.trace ("Loading translation strings for Options."~n);
95 Translation trans = Translation.load ("L10n/"~n); 106 Translation trans = Translation.get (n);
96 Translation.Entry transled = trans.getStruct (n); 107 Translation.Entry transled = trans.getStruct (n);
97 p.contentList = new ContentList (n, p.content); 108 p.contentList = new ContentList (n, p.content);
98 p.contentList.name (transled.name, transled.desc); 109 p.contentList.name (transled.name, transled.desc);
99 foreach (s, v; p.content) { 110 foreach (s, v; p.content) {
100 transled = trans.getStruct (s); 111 transled = trans.getStruct (s);
101 v.name (transled.name, transled.desc); 112 v.name (transled.name, transled.desc);
102 } 113 }
103 } 114 }
115
116 bool imdeTransl = false; // Has section imde been translated?