Author: igorz
Date: 2007-03-27 11:24:35 -0500 (Tue, 27 Mar 2007)
New Revision: 75027
Modified:
trunk/mcs/class/System.Web/System.Web/SiteMapNode.cs
trunk/mcs/class/System.Web/System.Web/XmlSiteMapProvider.cs
Log:
2007-03-27 Igor Zelmanovich <[EMAIL PROTECTED]>
* SiteMapNode.cs:
* XmlSiteMapProvider.cs: fixed: Localize Site-Map Data.
Modified: trunk/mcs/class/System.Web/System.Web/SiteMapNode.cs
===================================================================
--- trunk/mcs/class/System.Web/System.Web/SiteMapNode.cs 2007-03-27
16:16:10 UTC (rev 75026)
+++ trunk/mcs/class/System.Web/System.Web/SiteMapNode.cs 2007-03-27
16:24:35 UTC (rev 75027)
@@ -35,6 +35,7 @@
using System.Web.UI;
using System.Web.UI.WebControls;
using System.ComponentModel;
+using System.Resources;
namespace System.Web {
public class SiteMapNode : IHierarchyData, INavigateUIData, ICloneable {
@@ -206,14 +207,15 @@
object o =
HttpContext.GetGlobalResourceObject (values [0], values [1]);
if (o is string)
return (string) o;
- } catch (Exception) {
}
+ catch
(MissingManifestResourceException) {
+ }
+
+ if (throwIfNotFound && defaultValue ==
null)
+ throw new
InvalidOperationException (String.Format ("The resource object with classname
'{0}' and key '{1}' was not found.", values [0], values [1]));
}
}
- if (throwIfNotFound && defaultValue == null)
- throw new InvalidOperationException ();
-
return defaultValue;
}
@@ -235,8 +237,9 @@
object o = HttpContext.GetGlobalResourceObject
("Web.sitemap", reskey);
if (o is string)
return (string) o;
- } catch (Exception) {
}
+ catch (MissingManifestResourceException) {
+ }
return null;
}
Modified: trunk/mcs/class/System.Web/System.Web/XmlSiteMapProvider.cs
===================================================================
--- trunk/mcs/class/System.Web/System.Web/XmlSiteMapProvider.cs 2007-03-27
16:16:10 UTC (rev 75026)
+++ trunk/mcs/class/System.Web/System.Web/XmlSiteMapProvider.cs 2007-03-27
16:24:35 UTC (rev 75027)
@@ -128,7 +128,8 @@
if (String.IsNullOrEmpty (value))
return false;
string val = value.TrimStart (new char[] {' ', '\t'});
- if (String.IsNullOrEmpty (value) || !val.ToLower
(CultureInfo.InvariantCulture).StartsWith ("$resources:"))
+ if (val.Length < 11 ||
+ String.Compare (val, 0, "$resources:", 0, 11,
StringComparison.InvariantCultureIgnoreCase) != 0)
return false;
val = val.Substring (11);
@@ -137,8 +138,8 @@
string[] parts = val.Split (',');
if (parts.Length < 2)
return false;
- resClass = parts [0];
- resKey = parts [1];
+ resClass = parts [0].Trim ();
+ resKey = parts [1].Trim ();
if (parts.Length == 3)
resDefault = parts [2];
else if (parts.Length > 3)
@@ -157,21 +158,19 @@
if (GetAttributeLocalization (title, out resClass, out
resKey, out resDefault)) {
PutInCollection ("title", resClass, resKey, ref
explicitResourceKeys);
- if (resDefault != null)
- title = resDefault;
+ title = resDefault;
}
if (GetAttributeLocalization (description, out
resClass, out resKey, out resDefault)) {
PutInCollection ("description", resClass,
resKey, ref explicitResourceKeys);
- if (resDefault != null)
- description = resDefault;
+ description = resDefault;
}
string value;
foreach (XmlNode att in xmlNode.Attributes) {
if (GetAttributeLocalization (att.Value, out
resClass, out resKey, out resDefault)) {
PutInCollection (att.Name, resClass,
resKey, ref explicitResourceKeys);
- value = resDefault != null ? resDefault
: String.Empty;
+ value = resDefault;
} else
value = att.Value;
PutInCollection (att.Name, value, ref
attributes);
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches