KeyValue backend and links issues

Hey guys,

I’ve been working on a KeyValue backend for I18n. The implementation
is quite straightforward and works with different data stores (as
TokyoCabinet and Redis).

Most of the base work was already ported to the I18n master branch but
before merging the KeyValue backend, I need to make all tests pass.
Currently, there is just one test failing:

http://github.com/svenfuchs/i18n/blob/master/test/api/tests/link.rb#L38

The test fails because it’s finding the absolute key instead of the
relative. I could make it pass but there are two issues:

  1. The current test does not make sense at all to me. If the test
    pass, it means that the following expression evaluates to false:

I18n.t(“foo.link”) == I18n.t(“link”, :scope => :foo)

  1. The behavior described in the test (to give preference to relative
    key) makes impossible to link to the absolute key if I have a key with
    the same name in the relative scope

In my opinion, we should observe exactly the opposite behavior: it
should always reference to the absolute key.

So, what do you guys think? Does anyone actually have a use case for
the current behavior?

Hi,

I don’t use links in translations at all. I think your reasons to
change it are reason enough to change it.
I18n is a tricky library to understand, so consistency should a be
very important goal.

Iain

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs