0

この記号を使用するUAEの国際化を設定しています:د.إ

しかし、それを私のen-UAE.rbに接続すると:

  :currency => {
    :format => {
      :unit => 'د.إ',
      :precision => 2,
      :format => '%u%n'
    }
  }

それは生成します:

100.00د.إ

私が望むところ:

( i actually can't get the symbol to appear before the number here either.. ) 
4

1 に答える 1

2

You symbol IS appearing before the number!

But "before" means "to the left" in a LTR (left to right) context, and means "to the right" in a RTL (right to left) context.

The numbers are always displayed LTR, but they don't change the context after them (so, the whole number block can be considered as single "neutral" thing).

So, whe have a single line of 2 elements: an arabic string and a "neutral" number. The number being "neutral", it will behave "as if" it where of the same kind of the neighboring elements (here the nesting in pairs can produce surprizing resultas sometimes). In our case the neighbor is a preceding RTL element, so the number behave as if it where a block in RTL; two RTL elements, the first one displays at the right of the second (before means to the right).

Displaying "before" as "to the left" is only valid in LTR contexts; but it would be imho an error to push a LTR context when using an arabic letters symbol. If you are in a LTR context it would be better to use a neutral symbol (like $ € etc. there is a one-character unicode symbol for rial that should be what you want), or use latin letters (eg: "rial" or "AER").

But for a string of arabic letters before a number the correct behaviour is that the number appears to the left of the text (after is to the left in RTL)

You should search for "bidi" and learn how it works; only then will you be able to correctly handle those complex issues.

Some sites (there are much more):

于 2013-02-22T08:36:14.253 に答える