0

I'm working on a project that has a web application module that generates localized emails upon request. The app requires html templates localization for several languages. I decided to go with asp.net resource files since the email layout is not likely to change and the amount of keys needed was relatively small.

I'm using Global Resources and have around 15 different resource files for the required locales. I have my default resource file in English ("EmailTemplates.resx") and then several localized resource files ("EmailTemplates.ru-RU.resx", "EmailTemplates.zh-CN.resx", "EmailTemplates.it-IT.resx", "EmailTemplates.id-ID.resx", etc).

Among the resource files, I have two arabic ones: "EmailTemplates.ar-AE.resx" which is actually in English and "EmailTemplates.ar-SA.resx" which is in Arabic.

All the emails for non Arabic locales work perfectly. The app picks up the required locale and uses the corresponding resource files. But when I try to request the Arabic ones, it always fall back to the default resource file.

The way I'm setting up the culture is based on the data requested, and not the browser settings:

Thread.CurrentThread.CurrentUICulture = new CultureInfo(culture);
Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture(culture);

While debugging I can see that the CultureInfo is properly set to "ar-SA" or "ar-AE" but when the app retrieves the corresponding resource value, it always picks up the default one.

I have entered Arabic data in the default resource file for testing purposes, and the Arabic text displays just fine, so I'm sure that it is not a font or HTML layout issue.

I have searched all around the Internet, proved different approaches, and no luck. The "ar-SA" and "ar-AE" are valid CultureInfo values and the app compiles without issues, but it seems that whenever I request the Arabic emails, the app can't find the Arabic resource files.

Any ideas? I'd really appreciate any hits and help !

Cheers!

arbbot
  • 303
  • 2
  • 6
  • Wild guess: is it possible that the thread the actually sends the email, uses the wrong locale? Try loading the email content from your "main" thread (whatever that means), configured with the right locale, and then queue the email deliver from there. – Dario Solera Dec 14 '11 at 08:30
  • The thing is that it actually works for all the other locales. There's nothing in the code differentiating one locale from other. The way I'm loading the app global resources is the same for all different CultureInfo values. This is why I don't see how is it possible that it is working for all languages except for the Arabic ones. – arbbot Dec 14 '11 at 12:32
  • I see. Perhaps it has something to do with the fact that Arabic is right-to-left. – Dario Solera Dec 14 '11 at 13:35
  • Hi Dario. Thanks for the comments. I thought it might be a right-to-left problem but the app is able to display database content which is in Arabic. Also, if I add Arabic content to the default resource file it is displayed without issues, so I believe the text direction is not actually the issue. – arbbot Dec 15 '11 at 16:52

1 Answers1

1

Please use the language without the culture info Eg. EmailTemplates.ar.resx

because the browser you are using might not have the Arabic in different cultures as i checked with my chrome .or try adding the language with that culture.example ar-AE ar-SA etc,But anyway it has the Arabic language without culture and it works.