Forum: Rails I18n Removing apostrophe from possessive

Posted by Tony Maserati (abletony84)
on 2010-06-08 18:06
(Received via mailing list)
Hi,

I'm using i.e. <%= t :search_users_posts, :possessive => true %> to get
"Search user's posts". But what if the language I'm translating it to
doesn't use apostrophe, how do I translate such things / remove it?

Thanks
Posted by Jürgen Feßlmeier (Guest)
on 2010-06-08 18:12
(Received via mailing list)
Conjugations, etc. tough one and a real pain, I agree. Norman Clark is
working on a library that is attempting to solve that. You can check
it out here:

http://github.com/norman/spanish

I would love if any of that would make it into the standard I18n gem.

Greetings,
Juergen
Posted by Andrés Gutiérrez (andresgutgon)
on 2010-06-08 18:16
(Received via mailing list)
2010/6/8 Tony Maserati <abletony84@gmail.com>

> Hi,
>
> I'm using i.e. <%= t :search_users_posts, :possessive => true %> to get
> "Search user's posts". But what if the language I'm translating it to
> doesn't use apostrophe, how do I translate such things / remove it?
>
> Thanks
>

<%= t :search_users_posts %>
en.yml :
   search_users_posts: "Search user's posts"
es.yml
   search_users_posts: "Buscar los post del usuario"

Sorry, i don't understand the problem
Posted by Norman Clarke (Guest)
on 2010-06-08 18:18
(Received via mailing list)
On Tue, Jun 8, 2010 at 12:05, Jürgen Feßlmeier
<jfesslmeier@googlemail.com>wrote:

> Conjugations, etc. tough one and a real pain, I agree. Norman Clark is
> working on a library that is attempting to solve that. You can check it out
> here:
>
> http://github.com/norman/spanish
>
> I would love if any of that would make it into the standard I18n gem.
>
>
Thanks for the mention, though I should say I'm still a long way off 
from
having any of that implemented. It's unfortunately still just vaporware. 
:)
Posted by Tony Maserati (abletony84)
on 2010-06-08 18:19
(Received via mailing list)
My bad, I shoulda explained, what I'm doing is something like
search_users_posts: "Search {{user}} posts"

2010/6/8 Andrés gutiérrez <andresgutgon@gmail.com>
Posted by Andrés Gutiérrez (andresgutgon)
on 2010-06-08 18:27
(Received via mailing list)
2010/6/8 Tony Maserati <abletony84@gmail.com>

> My bad, I shoulda explained, what I'm doing is something like
> search_users_posts: "Search {{user}} posts"
>

<%= t :search_users_posts, :user => @user.name %>
en.yml :
   search_users_posts: "Search {{user}}'s posts"
es.yml
   search_users_posts: "Buscar los post de {{user}}"

Sorry, I think I still do not understand your problem.

2010/6/8 Andrés gutiérrez <andresgutgon@gmail.com>
Posted by Tony Maserati (abletony84)
on 2010-06-08 19:09
(Received via mailing list)
Yeah you're right man, why don't I just do that. I was looking at what 
our
previous developer did. Thanks a lot Mr Andrés!

2010/6/8 Andrés gutiérrez <andresgutgon@gmail.com>
Posted by Andrés Gutiérrez (andresgutgon)
on 2010-06-08 19:53
(Received via mailing list)
2010/6/8 Tony Maserati <abletony84@gmail.com>

> Yeah you're right man, why don't I just do that. I was looking at what our
> previous developer did. Thanks a lot Mr Andrés!
>
> I love being useful

Greetings
Posted by Tony Maserati (abletony84)
on 2010-06-10 08:24
(Received via mailing list)
The problem is actually, that:

<%= t :search_users_posts, :user => @user.name %>

search_users_posts: "Search {{user}}'s posts"

Produces "Search user <http://test>'s posts" (that orphan 's doesn't 
look
too good)

And not "Search user's <http://test> posts" which the following would
produce:

<%= t :search_users_posts, :user => @user.name, :possessive => true %>

search_users_posts: "Search {{user}} posts"

Is there an easy way to fix this?

2010/6/8 Andrés gutiérrez <andresgutgon@gmail.com>
Posted by Jürgen Feßlmeier (Guest)
on 2010-06-10 13:39
(Received via mailing list)
Unfortunately there is no easy solution, and your case is still a
simple one, as your substitute is the user name.

"Search {{user}} posts" % [link_to("{{user}}'s" % [h(@user.name)],
user_path(@user))]

This works great in English but not in other languages.

It becomes a real pain, when you substitute entire words of a
sentence, you end up with bad grammar in other languages.  Consider
this:

"Please accept this {{post}}!"

In the example below, if you substitute {{post}} for "blog" or
"article", it still makes lots of sense in English, but in Spanish,
German, etc. you have to deal with gender (der Artikel, e.g.  "el",
"la") or conjugations, (German: der (nominative), des (genitiv),
dessen (dativ), dem (akkusative)).

The solutions I can think of today are:

* change the sentence structure so it works for other languages ->
least common denominator, does not really sound great, difficult as
you may not know enough about the languages

* don't substitute, e.g. have multiple combination for same sentence
depending on context

Greetings,
Juergen
Posted by Andrés Gutiérrez (andresgutgon)
on 2010-06-10 15:45
(Received via mailing list)
2010/6/10 Tony Maserati <abletony84@gmail.com>

> And not "Search user's <http://test> posts" which the following would
> produce:
>
> <%= t :search_users_posts, :user => @user.name, :possessive => true %>
>
>
> search_users_posts: "Search {{user}} posts"
>
> Is there an easy way to fix this?


I don't know. You would may put the entire phrase  inside the link
<%= link_to  I18n.t(:search_users_posts, :user => @user.name),
your_route_path(@user) %>

#=> Search user's posts <http://test/>
Posted by Tony Maserati (abletony84)
on 2010-06-11 16:32
(Received via mailing list)
Thank y'all so much for this valuable insight. I decided to do as you
suggested Jürgen and cut the Gordian Knot by just changing the sentence
structure.

Thanks again!

On Thu, Jun 10, 2010 at 1:32 PM, Jürgen Feßlmeier <
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.