Changeset 1480


Ignore:
Timestamp:
1/6/2010 8:47:59 AM (5 years ago)
Author:
lowjoel
Message:

Replace the behaviour of EraserSettings?.GetCurrentCulture?() to yield the most suitable UI culture to use so that when defaults are used it is appropriate even for cases when the Eraser has not yet been localised to the system locale.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eraser6/6.0/Eraser/Settings.cs

    r1357 r1480  
    266266 
    267267        /// <summary> 
    268         /// Gets the current UI culture, correct to the top-level culture (i.e., English 
    269         /// instead of English (United Kingdom)) 
     268        /// Gets the most specific UI culture with a localisation available, defaulting to English 
     269        /// if none exist. 
    270270        /// </summary> 
    271271        /// <returns>The CultureInfo of the current UI culture, correct to the top level.</returns> 
    272272        private static CultureInfo GetCurrentCulture() 
    273273        { 
     274            System.Reflection.Assembly entryAssembly = System.Reflection.Assembly.GetEntryAssembly(); 
    274275            CultureInfo culture = CultureInfo.CurrentUICulture; 
    275             while (culture.Parent != CultureInfo.InvariantCulture) 
     276            while (culture.Parent != CultureInfo.InvariantCulture && 
     277                !S.LocalisationExists(culture, entryAssembly)) 
     278            { 
    276279                culture = culture.Parent; 
     280            } 
     281 
     282            //Default to English if any of our cultures don't exist. 
     283            if (!S.LocalisationExists(culture, entryAssembly)) 
     284                culture = new CultureInfo("en"); 
    277285 
    278286            return culture; 
Note: See TracChangeset for help on using the changeset viewer.