Καλώς ορίσατε στο dotNETZone.gr - Σύνδεση | Εγγραφή | Βοήθεια

rousso's .net blog

the .net blog of Yannis Roussochatzakis
CS default language problems

I run into an issue today regarding Community Server 1.1 (CS 1.1).

I changed the default language in communityServer.config from en-US to el-GR, only to get a runtime error.

The change:

<Core defaultLanguage="el-GR" … >

The error:

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.FormatException: Index (zero based) must be greater than or equal to zero and less than the size of the argument list.

Source Error:

Line 49: message = FindControl("Message") as Literal;
Line 50: if(message != null)
Line 51: message.Text = string.Format(ResourceManager.GetString("DisplayUserWelcome_AlternateUserWelcome"), CSContext.Current.SiteSettings.SiteName);


Source File: C:\Documents and Settings\rousso\My Documents\Visual Studio Projects\CS\1.1\50615src\src\Controls\User\AnonymousUserControl.cs    Line: 51

Stack Trace:

[FormatException: Index (zero based) must be greater than or equal to zero and less than the size of the argument list.] System.Text.StringBuilder.AppendFormat(IFormatProvider provider, String format, Object[] args) +1232
System.String.Format(IFormatProvider provider, String format, Object[] args) +65
System.String.Format(String format, Object arg0) +47
CommunityServer.Controls.AnonymousUserControl.AttachChildControls() 
CommunityServer.Controls.TemplatedWebControl.CreateChildControls() 
System.Web.UI.Control.EnsureChildControls() +100
...
System.Web.UI.Control.PreRenderRecursiveInternal() +125
System.Web.UI.Page.ProcessRequestMain() +1499

After meddling around a a little bit I pin pointed the problem to a translation error.

I turns out that the Greek language resource files located in /Languages/el-GR/Resources.xml were not properly (if at all) converted to reflect changes in code between version 1.0 and 1.1 of CS.

This line was the problem:

<resource name="DisplayUserWelcome_AlternateUserWelcome">Καλώς ορίσατε στο {0} {1}</resource>

There, two String.Format arguments are obviously expected. On the other hand, line 51 of AnonymousUserControl.cs, only passes one (see source error above).

Removing the second placeholder from the format string solves the problem:

<resource name="DisplayUserWelcome_AlternateUserWelcome">Καλώς ορίσατε στο {0}</resource>

The same stands for fr-FR (French) language resources I checked. Probably for others too.

If you can read Greek see my relevant posts in dotnetzone.gr. Also if you are looking to solve the same problem for the Greek (Hellenic) language see these posts in dotnetzone.gr where you can get the corrected translation for Greek text and buttons (it is attached to the post).

 

Share
Posted: Παρασκευή, 5 Αυγούστου 2005 3:44 μμ από το μέλος rousso
Δημοσίευση στην κατηγορία:

Σχόλια:

Χωρίς Σχόλια

Έχει απενεργοποιηθεί η προσθήκη σχολίων από ανώνυμα μέλη