Search code examples
phpzend-frameworklocale

How to retrieve layout orientation from Zend_Locale?


I know that there is a LDML entry in Zend_Locale_Data for layout orientation based on locale:

<layout>
    <orientation characters="right-to-left"/>
</layout>

But I don't know how to retrieve it. I tried this:

Zend_Locale::getTranslationList('layout');

In returned array I couldn't find this information. Where is the problem?


Solution

  • The orientation information is in the characters and lines entries in the returned array. If those entries are empty, then Zend_Locale doesn't have any information about that locale's orientation, meaning it's "normal" (characters left-to-right, lines top-to-bottom).

    For example, calling getTranslationList for Arabic:

    Zend_Locale::getTranslationList('layout', 'ar');
    

    returns an array with characters set to 'right-to-left', and lines blank.

    On the other hand, the same call with a locale of 'mn_Mong_CN' returns an array with characters set to 'top-to-bottom' and lines set to 'left-to-right'.