diff mde/i18n/I18nTranslation.d @ 24:32eff0e01c05

Only locally-changed options are stored in user-config now. Log levels revised. Options sub-classes are handled more generically and can be added without changing the Options class. Options changed at run-time are tracked, and on exit merged with user options and saved. Revised log levels as set out in policies.txt and as used in code. committer: Diggory Hardy <diggory.hardy@gmail.com>
author Diggory Hardy <diggory.hardy@gmail.com>
date Thu, 27 Mar 2008 16:15:21 +0000
parents 838577503598
children 611f7b9063c6
line wrap: on
line diff
--- a/mde/i18n/I18nTranslation.d	Thu Mar 27 10:58:57 2008 +0000
+++ b/mde/i18n/I18nTranslation.d	Thu Mar 27 16:15:21 2008 +0000
@@ -94,9 +94,9 @@
     {
         bool[ID] loadedSecs;        // set of all locales/sections loaded; used to prevent circular loading
         ID[] secsToLoad             // locales/sections to load (dependancies may be added)
-        = [cast(ID) Options.misc.L10n];  // start by loading the current locale
+        = [cast(ID) miscOpts.L10n];  // start by loading the current locale
         
-        I18nTranslation transl = new I18nTranslation (name, Options.misc.L10n);
+        I18nTranslation transl = new I18nTranslation (name, miscOpts.L10n);
         
         IReader reader;
         try {
@@ -153,8 +153,8 @@
             char[][] fields = split (stripBrackets (dt));
             
             if (fields.length < 1) {
-                // This tag is invalid, but since we don't want execution to halt just log a warning:
-                logger.warn ("For name "~name~", L10n "~L10n~": tag with ID "~cast(char[])id~" has no data");
+                // This tag is invalid, but this fact doesn't need to be reported elsewhere:
+                logger.error ("For name "~name~", L10n "~L10n~": tag with ID "~cast(char[])id~" has no data");
                 return;
             }
             // If the tag already exists, don't replace it
@@ -202,9 +202,6 @@
     //END Data
     
     debug (mdeUnitTest) unittest {
-        // This gets used before it is normally created (test incase this changes).
-        if (Options.misc is null) Options.misc = new OptionsMisc;
-        
         /* Relies on file: conf/L10n/i18nUnitTest.mtt
         * Contents:
         *********
@@ -219,8 +216,8 @@
         
         // Hack a specific locale...
         // Also to allow unittest to run without init.
-        char[] currentL10n = Options.misc.L10n;
-        Options.misc.L10n = "test-1";
+        char[] currentL10n = miscOpts.L10n;
+        miscOpts.L10n = "test-1";
         
         I18nTranslation transl = load ("i18nUnitTest");
         
@@ -239,7 +236,7 @@
         // Only check extra entries are allowed but ignored.
         
         // Restore
-        Options.misc.L10n = currentL10n;
+        miscOpts.L10n = currentL10n;
         
         logger.info ("Unittest complete.");
     }