Skip to content

Locale "sr-Latn" is not working: supporting script subtags #10

@747

Description

@747

In r18n/locale.rb:

self.class.name.split('::').last.split(/([A-Z][a-z]+)/)[1, 2]

This line seems to have an easy logic error, because:

$ irb
irb(main):001:1* module R18n
irb(main):002:2*   class RuFooBarBaz
irb(main):003:1*   end
irb(main):004:1* end
=> nil
irb(main):005:0> l = R18n::RuFooBarBaz.new
=> #<R18n::RuFooBarBaz:0x00007fffdeb58610>
irb(main):006:0> l.class.name.split('::').last.split(/([A-Z][a-z]+)/)[1, 2]
=> ["Ru", ""]
irb(main):007:0> l.class.name.split('::').last.split(/([A-Z][a-z]+)/)
=> ["", "Ru", "", "Foo", "", "Bar", "", "Baz"]

Perhaps the problem has been elusive because it was introduced with the parent locale function (2c88300), and no one tried to use different locales under the same parent locale at once.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions