5

多言語のASP.NETサイトがあります。言語の1つはアラビア語(ar-SA)です。カルチャを切り替えるには、次のコードを使用します。

Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture(Name)
Thread.CurrentThread.CurrentUICulture = New CultureInfo(Name)

たとえば、記事の日付を表示する場合、これを行うだけで、ローカリゼーションAPIがすべてを処理します。

<%#Eval("DatelineDate","{0:d MMMM yyyy}")%>

問題は、これがヒジュラ暦を使用して日付を表示することです(たとえば、2008年は1429としてレンダリングされます)。クライアントは、グレゴリオ暦を使用して日付を表示したいと考えています(もちろん、月の名前やその他すべてをアラビア語でレンダリングします)。これどうやってするの?

4

2 に答える 2

12

Answer:

Turns out the ar-SA culture is the only one to use the Hijiri calendar; all the other Arabic cultures use Gregorian. Here are the different date formats in Arabic (a bit messed up because WMD doesn't support seem to support RTL text).

ar-AE 11 ديسمبر 2008 
ar-BH 11 ديسمبر 2008 
ar-DZ 11 ديسمبر 2008 
ar-EG 11 ديسمبر 2008 
ar-IQ 11 كانون الأول 2008 
ar-JO 11 كانون الأول 2008 
ar-KW 11 ديسمبر 2008 
ar-LB 11 كانون الأول 2008 
ar-LY 11 ديسمبر 2008 
ar-MA 11 دجنبر 2008 
ar-OM 11 ديسمبر 2008 
ar-QA 11 ديسمبر 2008 
ar-SA 13 ذو الحجة 1429 
ar-SY 11 كانون الأول 2008 
ar-TN 11 ديسمبر 2008 
ar-YE 11 ديسمبر 2008 

And for what it's worth here's the quick & dirty code I used to generate this list:

    Response.Write("<table width=300px>")
    For Each ci As CultureInfo In (From c As CultureInfo In CultureInfo.GetCultures(CultureTypes.AllCultures) Order By c.Name Where c.Name.StartsWith("ar-"))
        Thread.CurrentThread.CurrentCulture = CultureInfo.GetCultureInfo(ci.Name)
        Thread.CurrentThread.CurrentUICulture = New CultureInfo(ci.Name)
        Response.Write(String.Format("<tr><td>{0}</td> <td style='direction:rtl;font-size:20px;'>{1:d MMMM yyyy}</td></tr>", ci.Name, Today))

    Next
    Response.Write("</table>")
    Response.End()

More cultures at http://www.massimilianobianchi.info/max/articles/22/UI-culture-list-and-codes.aspx

于 2008-12-11T17:20:38.137 に答える
2

別のアラビア語ロケールを使用できます。それらの唯一の違いは、日付形式です...

于 2009-01-25T04:38:16.137 に答える