Error on child site with different localization

This is a place to discuss how to adapt mojoPortal to the needs of different cultures. Before asking questions here please first review the localization documentation.

This thread is closed to new posts. You must sign in to post in the forums.
3/17/2009 10:32:50 AM
Gravatar
Total Posts 33

Error on child site with different localization

Good morning!

I'm having this issue after creating a child site, making them related, and forcing "cultures" (languages) on both, the main site is English (en-US), the child site is french (fr-CA).

I can login to the main site, then go to the child site, and everything's fine - I'm still logged in and the page is indeed in french. However, if I signout from either site and then try to click on the login button in the french site, I get the following error:

Server Error in '/' Application.
--------------------------------------------------------------------------------

Object reference not set to an instance of an object.
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.NullReferenceException: Object reference not set to an instance of an object.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:


[NullReferenceException: Object reference not set to an instance of an object.]
mojoPortal.Web.UI.Pages.LoginPage.PopulateLabels() +232
mojoPortal.Web.UI.Pages.LoginPage.Page_Load(Object sender, EventArgs e) +532
System.Web.UI.Control.OnLoad(EventArgs e) +98
mojoPortal.Web.mojoBasePage.OnLoad(EventArgs e) +9
System.Web.UI.Control.LoadRecursive() +71
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +4279

 


--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:2.0.50727.1433; ASP.NET Version:2.0.50727.1433

This is the only error I've seen up to now on the french child site, I'll report any other errors.

3/18/2009 7:19:56 AM
Gravatar
Total Posts 18439

Re: Error on child site with different localization

Hi,

The problem with forcing a specific culture is if the resource files for that culture have missing keys you can get null reference exceptions. So I recommend you don't force cultures unless you can keep the resources up to date for all the cultures you are forcing.

It is not needed to force the culture when implementing muliple sites for different languages. No matter what he language of your site is, it may or may not be the language preference of the user. Now of course content coming from the database will be in the language of the site but labels and button text come from resource files and in my opinion the default resource handling for culture is the best. The default behavior is to use the resources for the user's browser language preference. If there are no resources or missing keys for the user's language it falls back to en-US (which is the only resources that are guaranteed t be up to date).

So, if a user visits mojoportal.com which is an English site but their browser language is set to French, then they will see French labels and buttons. If they only speak a little English this may help them.

I implemented the ability to force culture because it was asked for, but those who use it must be willing to update the resources for every release to make sure there are no missing keys for their languages. Ideally they would send me the updated resources. Most of the time I think all languages except English have missing keys, they are rarely kept 100% up to date.

Best,

Joe

ps

Thanks for posting the tutorial in the forum! I saw also your blog post and I think I will make a page with links to community tutorials and link to your blog post. I definitely can use help with tutorials and documentation!

3/19/2009 1:17:26 PM
Gravatar
Total Posts 33

Re: Error on child site with different localization

I'm a sucker for tutorials, I love 'em.

My issues with using browser settings is that all (except very few exceptions where people specifically requested it) our computers are in English even though a good part of our users are french - so the browser language is always english no matter what. We still want users to be able to use the page in french.

I'm a bit annoyed to be honest that everytime I get an error in mojoPortal, it's never clear on anything. I'd expect that if it's an error that's "known", it would tell me what the error is - in this case, mojoportal might catch the error and tell me "the ressource file for language (fr) is missing an entry under (whatever) so this page cannot be displayed properly". In another case where the GD libraries were missing, I might get a similar message, "The GD library is not installed on this server", maybe even displaying the page anyway with limited functionality.

Of course, as far as I know mojo is a bit "younger" than software like Drupal which does catch these errors, os maybe you're not to the point of development where error catching is possible... But is it planned at least?

In the meantime, I'll check the ressource files, but the error tells me absolutely nothing.

3/19/2009 1:47:34 PM
Gravatar
Total Posts 18439

Re: Error on child site with different localization

Hi,

We do the best we can and are always improving, obviosuly some people are moving to mojoPortal from Drupal even though Drupal has been around longer. So we must be doing some things right.

On the GD error you got at some strange linux host. mojoPortal has no direct dependency on GD and I have never ever encountered that error or had it reported before. Mono has a dependency on it for their implementation of ASP.NET, mojoPortal just depends on ASP.NET. I have no plans to test whether all the Mono dependencies are there, that is outside the scope of mojoPortal. Development is not free, not even open source development, I must stay focused on adding value. I will only be spinning my wheels and getting no where if I try to handle every possible thing that could happen under all configurations and environments.

Its a simple ASP.NET fact that if you force a particular culture to be used for resources, the resource files need to be complete for that culture. We set a label just using simple syntax btnSave.Text = Resources.ResourceFileName.ResourceKey

It would be crazy to wrap a try catch around every label assignment. The only correct solution if you want to force a particular culture is to make sure the resources for that culture are up to date, I cannot keep them update myself, it has to come from the community, I only speak English.

One of our consultants from Italy, Wlater Ferrari has begun work on a tool to help identify missing resource keys and makes it easy to fill in the missing ones. Once this is complete it may help in keeping the different translations up to date.

Though I see your point about French users with their browsers set to English, and understand why you want to force French, I cannot change that fact that missing keys are going to cause exceptions. In many cases it is usually better to go with the browser preferences. For example the mojoPortal Persian Community, mostly will have Persian speaking visitors but if an English speaker like me stumbles upon the site the labels adapting to my language help at least a little.

You've been trying mojoPortal on all different environments and dbs, sorry if it annoys you to find some errors in some configurations but nothing is perfect and I am striving only for excellence not perfection.

Best,

Joe

 

3/19/2009 4:11:57 PM
Gravatar
Total Posts 33

Re: Error on child site with different localization

Alright, I do understand that this is a technical issue that is neither easy to take care of, nor is a priority. I can accept that as a valid answer.

I'm happy to hear that people are switching from Drupal to mojoPortal, that is a good sign indeed. And I know what you're doing right - when mojo works, it works well, and it's so easy to use even my bosses understand it ;)

In terms of the GD error... I just stopped trying to install mojo on a host that's out of my control. If I want to install it at home, at least I'll have control over what's happening and what's installed - though I do suggest, if you're not doing a script to test against dependancies, that those dependancies be at least written in a list somewhere. I know that just installing IIS6/7 and dotNet Framework 3.5 is fine on most systems though, so I'm not sure if that's even necessary? I guess it's just on mono that this becomes an issue.

And in terms of the original problem of the localization... Unfortunately, even after creating a .fr.resx (some without actually translating anything) for each known file in App_GlobalResources, it seems that I'm getting the same error. This means that it's not the resource file that's missing - but one specific entry in one specific file that doesn't exist. It might be misnamed, or added after the translation was done... I'm probably just going to re-created my own ressource files for French, from the original files, but this is major pain in the backside...


I do hope that Walter is able to come up with his tool in due time, it will be an awesome help to the translating community of mojo and I'm happy to hear it's coming along.

I'll keep you appraised, and I will probably send you the fr-CA localization files once they are completed (they might differ from ones sent by people in France, if only because french Canadians are mostly Quebecers and we cousins don't always understand what the other's blabbering about!)

Cheers,

Eric.

 

3/19/2009 4:26:16 PM
Gravatar
Total Posts 18439

Re: Error on child site with different localization

Hi Eric,

Glad you understand. It may be different with Drupal in that they may actually depend on GD or it may be a common problem, but with mojoportal neither is true. The things that are common problems (like medium trust issues) I do try to handle gracefully and give meaningful error messages.

My testing on Mono is always using OpenSuse which is usually less prone to problems vs other distros, since the Mono guys are from Novell. And my testing is fairly cursory on Mono, not exhaustive, I wish I had more time for testing on Mono and really hope the new release of Mono coming soon is solid. I know that the Mono team uses mojoportal for some QA, but I don't think even they test mojoPortal thoroughly. Back in 2004 during the .NET 1.1 days I was for over a year running mojoportal.com on Mono and at that time I had to test more and be more proactive myself about reporting bugs to the Mono team, but when 2.0 .NET came out I had to move back to windows hosting and take advantage of new possibilities and there has been a catchup for the Mono project in supporting 2.0. And now it seems similar going to 3.5 .NET. I can't yet feel confident in recommending Mono or mission critical sites but hope someday soon I will be able to do that. The possibilites for making VM appliances you can host in the cloud with openSuse using SuseStudio are really promising, even Amazon cloud support is coming in SuseStudio, its awesome stuff.

I will make a build of Walter's localization tool and email it to you tommorrow, the source code is in our svn repository under https://forgesvn1.novell.com/svn/mojoportal/tools/mojoResourceManager

Its functional now but is in need of some polish.

Best,

Joe

3/19/2009 10:43:50 PM
Gravatar
Total Posts 33

Re: Error on child site with different localization

Got the tool, still too newbie to understand how to run it... :(

I think I'll go buy an ASP.NET book and just huddle in a corner and read it this weekend. Drive my fiance nuts :P

3/20/2009 9:15:21 AM
Gravatar
Total Posts 18439

Re: Error on child site with different localization

Hi Eric,

I've just compiled a build of this tool. You can download it frome here : http://www.mojoportal.com/tools.aspx

After you unzip it just double click the  MojoResourceManager.exe to run it. 

It has to work with the mojoPortal souce code not release packages. If you have the mojoportal code checked out from svn trunk (or from the .zip) just point the tool at the root folder of the source code.

It needs some work as languages are hard coded. I just added some that were missing and I added fr-CA, though there are no .resx files for that yet, you could create them by copy the .fr.resx files and renqame them to .fr-CA.resx and then drop them into the appropriate folders like Web/App_GlobalREsources, mojoPortal.Web.Features.UI/App_GlobablResources, and WebStore.UI/App_GlobalResources

Best,

Joe

3/20/2009 12:57:57 PM
Gravatar
Total Posts 33

Re: Error on child site with different localization

Worked like a charm after I copied the ressources files from mojoportal.features.ui/app_globalresources to web/app_globalresources :) I guess the structure changed at one point?

There's still the issue of not all of the resource files being "seen" automatically (for example it doesn't load accesskeys.resx) but that's a good start. I can't wait to see this tool being release - or made part of mojoPortal if that's your plan!

You must sign in to post in the forums. This thread is closed to new posts.