locked
support different languages direction in html RRS feed

  • Question

  • User1785863221 posted

    Hi,

    Im trying to write a MasterPage  that  can displayed both in english and in hebrew (I use tables for the layout). 

     What is the best method for displaying the table cells Right To Left  when the user selects hebrew

    and  Left To Right for english . (also different alignment in each cell for hebrew and english).

    Thanks,

    Tal88

     

    Sunday, December 16, 2007 4:47 AM

Answers

  • User-503940700 posted

      dir Attribute for language direction

    Many times we also need to set the direction of the localized text (which is set using the dir attribute of the <html> or the <body> tag). This is neccessary because some languages are read from right-to-left (RTL), for e.g. Arabic, instead of the standard left-to-right (LTR) like Hindi and English. This can be achieved quite easily by setting the dir attribute to appropriate value from the .resx file. 

    First create a Direction (you use any name) field in all your resource files, setting its property to RTL or LTR based on individual resource files. For Arabic, the value of this field would be RTL and for Hindi it would be LTR. Then set the same in the dir attribute of the <body> tag as:

     

     

    <body runat="server" dir="<%$ Resources: TestSiteResources, Direction %>">

    This will set the right direction as the value will come from the resouce file based on the current thread's culture.

    I pasted this from my article: I think this is one of the better ways to structure your localized text.

    Vivek

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, December 18, 2007 8:33 AM

All replies

  • User-319574463 posted

     Look at http://www.guysmithferrier.com/ and in particular at Guy Smith's book ISBN 0321341384. The book is available online at Safari books at http://safari.oreilly.com/0321341384

    Also his presentation http://www.guysmithferrier.com/downloads/teni18n.pdf

      I will have a look for you in Guy Smith and run a few experiments using "he" as the language code.

    Sunday, December 16, 2007 11:54 AM
  • User-503940700 posted

    Hi,

    Refer the last sections in this article:

    http://www.codeproject.com/KB/aspnet/localizationByVivekTakur.aspx


    Hope this helps,

    Vivek

    Tuesday, December 18, 2007 7:10 AM
  • User1785863221 posted

    Hi,

    Thanks for the reply it will help,

    My problem is more with the layout. in other words,  if I use a table to construct the layout of my page,

    sometimes the order of the cells in a tabel's row (I dont have problem with localizing the content of the cells) will be opposite in english from the order in LTR languages such as

    Arabic and Hebrew.

    for example :

    in hebrew  / arabic:

    <tr> <td id=1></td><td id=2</td><td id=3></td></tr>

    in English:

    <tr> <td id=3></td><td id=2</td><td id=1></td></tr>

    Im looking for a good method to generate (on runtime) the table cells according to the Page's culture .

    any idea?

    Thanks,

    Tal88

    Tuesday, December 18, 2007 8:04 AM
  • User-503940700 posted

      dir Attribute for language direction

    Many times we also need to set the direction of the localized text (which is set using the dir attribute of the <html> or the <body> tag). This is neccessary because some languages are read from right-to-left (RTL), for e.g. Arabic, instead of the standard left-to-right (LTR) like Hindi and English. This can be achieved quite easily by setting the dir attribute to appropriate value from the .resx file. 

    First create a Direction (you use any name) field in all your resource files, setting its property to RTL or LTR based on individual resource files. For Arabic, the value of this field would be RTL and for Hindi it would be LTR. Then set the same in the dir attribute of the <body> tag as:

     

     

    <body runat="server" dir="<%$ Resources: TestSiteResources, Direction %>">

    This will set the right direction as the value will come from the resouce file based on the current thread's culture.

    I pasted this from my article: I think this is one of the better ways to structure your localized text.

    Vivek

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, December 18, 2007 8:33 AM