spec/isodoc/i18n_spec.rb in isodoc-1.8.2.2 vs spec/isodoc/i18n_spec.rb in isodoc-1.8.3
- old
+ new
@@ -1080,9 +1080,47 @@
.new({ i18nyaml: "spec/assets/i18n.yaml" })
.convert("test", presxml, true)))
.to be_equivalent_to xmlpp(output)
end
+ it "processes LTR within RTL" do
+ c = IsoDoc::Convert.new({})
+ c.convert_init(<<~"INPUT", "test", false)
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
+ <bibdata type="standard">
+ <language>fa</language>
+ <script>Arab</script>
+ </bibdata>
+ </iso-standard>
+ INPUT
+ expect(c.i18n.l10n("hello!", "en", "Latn")).to eq "‎hello!‎"
+ end
+
+ it "processes Hebrew RTL within LTR" do
+ c = IsoDoc::Convert.new({})
+ c.convert_init(<<~"INPUT", "test", false)
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
+ <bibdata type="standard">
+ <language>en</language>
+ </bibdata>
+ </iso-standard>
+ INPUT
+ expect(c.i18n.l10n("hello!", "he", "Hebr")).to eq "‏hello!‏"
+ end
+
+ it "processes Arabic RTL within LTR" do
+ c = IsoDoc::Convert.new({})
+ c.convert_init(<<~"INPUT", "test", false)
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
+ <bibdata type="standard">
+ <language>en</language>
+ </bibdata>
+ </iso-standard>
+ INPUT
+ expect(c.i18n.l10n("hello!", "fa", "Arab")).to eq "؜hello!؜"
+ end
+
+
private
def mock_i18n
allow_any_instance_of(::IsoDoc::I18n)
.to receive(:load_yaml)