Example #1
0
 private static ResourceBundle GetBundleImpl(String bundleName,
                                             Locale locale_0, Assembly loader_1)
 {
     if (bundleName != null)
     {
         ResourceBundle bundle;
         if (!locale_0.Equals(Locale.GetDefault()))
         {
             String localeName = locale_0.ToString();
             if (localeName.Length > 0)
             {
                 localeName = "_" + localeName; //$NON-NLS-1$
             }
             if ((bundle = HandleGetBundle(bundleName, localeName, false,
                                           loader_1)) != null)
             {
                 return(bundle);
             }
         }
         String localeName_2 = Locale.GetDefault().ToString();
         if (localeName_2.Length > 0)
         {
             localeName_2 = "_" + localeName_2; //$NON-NLS-1$
         }
         if ((bundle = HandleGetBundle(bundleName, localeName_2, true, loader_1)) != null)
         {
             return(bundle);
         }
         throw new MissingManifestResourceException("KA029"); //$NON-NLS-1$
     }
     throw new NullReferenceException();
 }
Example #2
0
 /// <summary>
 /// Finds the named resource bundle for the specified locale.
 /// </summary>
 ///
 /// <param name="bundleName">the name of the resource bundle</param>
 /// <param name="locale_0">the locale</param>
 /// <param name="loader_1">the ClassLoader to use</param>
 /// <returns>ResourceBundle</returns>
 /// <exception cref="MissingResourceException">when the resource bundle cannot be found</exception>
 public static ResourceBundle GetBundle(String bundleName, Locale locale_0,
                                        Assembly loader_1)
 {
     if (loader_1 == null)
     {
         throw new NullReferenceException();
     }
     if (bundleName != null)
     {
         ResourceBundle bundle;
         if (!locale_0.Equals(Locale.GetDefault()))
         {
             if ((bundle = HandleGetBundle(bundleName, "_" + locale_0, false, //$NON-NLS-1$
                                           loader_1)) != null)
             {
                 return(bundle);
             }
         }
         if ((bundle = HandleGetBundle(bundleName,
                                       "_" + Locale.GetDefault(), true, loader_1)) != null)
         { //$NON-NLS-1$
             return(bundle);
         }
         throw new MissingManifestResourceException("KA029"); //$NON-NLS-1$
     }
     throw new NullReferenceException();
 }