Subject: Re: [sup-talk] i18n?

From: Christopher Bertels <[email-masked]>
Date: Tue, 06 Oct 2009 22:35:46 +0200

Excerpts from William Morgan's message of Di Okt 06 17:38:39 +0200 2009:
> This looks great. A couple comments:

Cool, good to know you like it!

> 1. I would prefer that uppercase substitution symbols made lowercase.
> The uppercase seems weird and un-Rubyish to me.

Ok, sounds good. I thought making them uppercase to let them be more
distict from the rest of the string but since we surround them by #{}
as in Ruby, you're making a good point here. I'll change that.

> 2. I think it would be nice to have a simple module along the lines of:
> 
>   module M17n
>     def m s, o={}; I18n[m, o] end
>   end
> 
> and to have that be the primary entry point when you want a translated
> string. Then classes can include that module if they want m17n support,
> and instead of writing
> 
>   I18n["text", { :var => value }]
> 
> you can have
> 
>   m("text", :var => value)
> 
> which is a little easier to read, IMO.

Same here. Think this is nicer, too.

> 3. Should we call it m17n instead of i18n? I think that might be a
> little more accurate. Perhaps too nitpicky. What do you think?

I couldn't care less about the name - but I guess m17n fits better,
since it's just multilingualization. :)

> 4. A finishing touch would be to have sup-config ask the user what
> language they are interested in.

Alright, cool. I'll add that as well, once I have the rest changed & working.

Cheers,
Christopher.
-- 
================================
Christopher Bertels
http://www.adztec-independent.de
GPG Key ID: 0x2345b203
_______________________________________________
sup-talk mailing list
[email-masked]
http://rubyforge.org/mailman/listinfo/sup-talk

---

From: Fabio Riga <[email-masked]>
Date: Wed, 21 Oct 2009 14:29:59 +0200

Excerpts from Christopher Bertels's message of mar ott 20 14:33:35 +0200 2009:
> Just wondering, if anyone is still interested in this, since no one has replied
> yet.
Well, I'm really interested, but I'm just a user. I could only make
Italian translation, but how? Is it a normal gettext .po file? What I
have to do?

Cheers,
Fabio

---

From: Christopher Bertels <[email-masked]>
Date: Mon, 05 Oct 2009 18:00:25 +0200

I think I've translated most of sup's UI-related part (translating
error messages doesn't seem like a good idea, since we really don't
want multilingual bug-reports and exception logs...) I'd like to hear
some feedback and/or opinions/suggestions and would like to see it
integrated into sup. I'll add more translations, if I find anything I
havent missed yet and that is part of the user interface.

Cheers,
Christopher.

---

From: William Morgan <[email-masked]>
Date: Tue, 03 Nov 2009 07:13:10 -0800

Reformatted excerpts from Tero Tilus's message of 2009-11-03:
> IMO you get to choose what we start with.

Yeah, Christopher has a working implementation of this already using
yaml, and I'm happy to merge it if he changes the keys to strings as
discussed.
-- 
William <[email-masked]>
_______________________________________________
sup-talk mailing list
[email-masked]
http://rubyforge.org/mailman/listinfo/sup-talk

---

From: Christopher Bertels <[email-masked]>
Date: Tue, 03 Nov 2009 15:05:01 +0100

Excerpts from William Morgan's message of Mo Nov 02 13:13:01 +0100 2009:
> Reformatted excerpts from Tero Tilus's message of 2009-10-23:
> > Why not default to the english strings as translation keys and
> > fallback to key itself in case of missing translation?
> 
> Christopher, what do you think?

Sounds OK to me. Should we use gettext then or rely on .yaml files for
any additional translations then? I haven't used gettext yet and from
what I remember it lookes weird, at least the ruby binding did.
Maybe it's very easy though.
-- 
================================
Christopher Bertels
http://www.adztec-independent.de
GPG Key ID: 0x2345b203
_______________________________________________
sup-talk mailing list
[email-masked]
http://rubyforge.org/mailman/listinfo/sup-talk

---

From: Fabio Riga <[email-masked]>
Date: Tue, 03 Nov 2009 01:01:08 +0100

Excerpts from Tero Tilus's message of lun nov 02 14:58:09 +0100 2009:
> William Morgan, 2009-11-02 14:12:
> > Tero's comment wasn't about gettext, as far as I understand it.
> 
> You had me right.  I was talking about the approach to i18n in general.

Sorry, I think the problem here is my English. I understood Tero's
comment wasn't about gettext, I was the one suggesting: "everybody's
using gettext, why don't we?"

> > There are Ruby gettext bindings but they look like a pain in the ass
> > to use, and it's pretty trivial to replace it a language like Ruby.
> 
> Also they are pretty trivial to wrap behind nice interface in a
> language like Ruby.  "Been there, done that!".t  :)

And you both answered that question... I'm just a hobbyist ruby
programmer, never used gettext. I transleted a program that use it (my
previous mail client :D) so I can read a .po file (I don't understand
why this is a problem, though). I thought it was an easy, ready-made
thing to implement, if I'm wrong, no problem, there is always a better
solution.

> > I believe he was thinking about something like git grep. You see a
> > weird message displayed by Sup, you want to find the code that's
> > generating it, you can git grep the source for the message directly.
> 
> That was exactly what I was thinking.
> 
> Having weird keys in code imo also slows down development.  If I want
> to (write code to) display a simple message to user, with "original
> language as key" approac i just write "my message".t (or whatever the
> l10n interface is) instead of modifying some yaml file somewhere and
> then copy-pasting the key from there to code. I just plain code and
> let somebody else figure out the translation later or.
> 
Sorry, I don't understand what you mean. The idea is to (1) have a branch
for every language? Translators directly write in the code? Or (2)  "original
language as key" means a way to substitute "on the fly" the original
string with another one in the current locale? In this way you always need a
yaml file, or a ruby hash, or a .po file (you can implement it in another
way, but is the gettext approach...).

So, I played a little with irb... do you mean something like:

class String
  def t
    l10n_hash[self] || self
  end
end

Sounds good to me...

"bye bye".t
=> "ciao ciao"

---

From: Christopher Bertels <[email-masked]>
Date: Tue, 03 Nov 2009 16:23:52 +0100

> yaml, and I'm happy to merge it if he changes the keys to strings as

Alright, I'll change that then and tell you here when I'm done.

---

From: Christopher Bertels <[email-masked]>
Date: Tue, 20 Oct 2009 14:33:35 +0200

Just wondering, if anyone is still interested in this, since no one has replied yet.

---

From: Fabio Riga <[email-masked]>
Date: Fri, 23 Oct 2009 13:23:06 +0200

Excerpts from Tero Tilus's message of ven ott 23 09:00:21 +0200 2009:
> Excerpts from 's message of pe loka 02 15:52:47 +0300 2009:
> > Please tell me what you think.
> 
> fallback to key itself in case of missing translation?  This has imo
> several advantages.  You can go grep the source using what you see in
> sup UI (instead of first greping language yaml).

Well, I finally read the code and I agree with Tero. I also think that the
use of gettext will be simpler for both developer and translator. In
this way, every time a developer add a new string he need to write it
twice, or another developer has to hack it. Instead with gettext the
developer write his string, surrounded with _() or n_() and he's done
(tell me, if I'm wrong).

Furthermore people used to .po files (like me) will know what to do and
are already provided with tools for that purpose (i.e. Vim :-) ).

Can anyone explain me where and why a translated string in the UI should be
searchable with a regular expression? (Maybe this question is due to the
fact that I still don't understand sup internals...)

Cheers,
Fabio

---

From: William Morgan <[email-masked]>
Date: Mon, 02 Nov 2009 04:12:41 -0800

Reformatted excerpts from Fabio Riga's message of 2009-10-23:
> Well, I finally read the code and I agree with Tero. I also think that
> the use of gettext will be simpler for both developer and translator.
> In this way, every time a developer add a new string he need to write
> it twice, or another developer has to hack it. Instead with gettext
> the developer write his string, surrounded with _() or n_() and he's
> done (tell me, if I'm wrong).

Tero's comment wasn't about gettext, as far as I understand it. There
are Ruby gettext bindings but they look like a pain in the ass to use,
and it's pretty trivial to replace it a language like Ruby.

> Furthermore people used to .po files (like me) will know what to do
> and are already provided with tools for that purpose (i.e. Vim :-) ).

That is a downside, definitely.

> fact that I still don't understand sup internals...)

I believe he was thinking about something like git grep. You see a weird
message displayed by Sup, you want to find the code that's generating
it, you can git grep the source for the message directly.
-- 
William <[email-masked]>
_______________________________________________
sup-talk mailing list
[email-masked]
http://rubyforge.org/mailman/listinfo/sup-talk

---

From: William Morgan <[email-masked]>
Date: Mon, 02 Nov 2009 04:13:01 -0800

---

From: Tero Tilus <[email-masked]>
Date: Fri, 23 Oct 2009 10:00:21 +0300

Why not default to the english strings as translation keys and
fallback to key itself in case of missing translation?  This has imo
several advantages.  You can go grep the source using what you see in
sup UI (instead of first greping language yaml).  Adding new strings
is cumbersome with (mostly unnecessary) key indirection.  Code is more
readable when messages are inlined.  If you change a string a check of
translations is forced (there is no translation for the changed
version).  Most translation workflow tools expect this kind of
behavior.

-- 
Tero Tilus ## 050 3635 235 ## http://tero.tilus.net/
_______________________________________________
sup-talk mailing list
[email-masked]
http://rubyforge.org/mailman/listinfo/sup-talk

---

From: Guillaume Quintard <[email-masked]>
Date: Wed, 21 Oct 2009 18:41:00 +0200

> Italian translation, but how? Is it a normal gettext .po file? What I

Same here, with french translation.
Sorry for the late reply.

-- 
Guillaume

---

From: Tero Tilus <[email-masked]>
Date: Tue, 03 Nov 2009 17:08:00 +0200

Christopher Bertels, 2009-11-03 16:05:
> Should we use gettext then or rely on .yaml files for any additional
> translations then? I haven't used gettext yet and from what I
> remember it lookes weird, at least the ruby binding did.  Maybe it's
> very easy though.

The l10n backend is an implementation detail.  If we really need to we
can change backend later down the road if it is decoupled enough from
the i18n of sup itself.  IMO you get to choose what we start with.
And William gets to choose if he accepts the patches or not.  ;)

---

From: Christopher Bertels <[email-masked]>
Date: Tue, 06 Oct 2009 23:56:19 +0200

OK, I've changed it as mentioned.
See my previously mentioned gitorious branch.

Cheers,
Christopher.

---

From: Tero Tilus <[email-masked]>
Date: Tue, 03 Nov 2009 03:22:44 +0200

Fabio Riga, 2009-11-03 02:01:
> Sorry, I don't understand what you mean. The idea is to (1) have a
> branch for every language? Translators directly write in the code?
> Or (2) "original language as key" means a way to substitute "on the
> fly" the original string with another one in the current locale?

The second one, yes.  God save us from the first!

> So, I played a little with irb... do you mean something like:

Exactly.

---

From: William Morgan <[email-masked]>
Date: Tue, 06 Oct 2009 08:38:39 -0700

Hi Christopher,

Reformatted excerpts from Christopher Bertels's message of 2009-10-05:
> I'd like to hear some feedback and/or opinions/suggestions and would
> like to see it integrated into sup. I'll add more translations, if I
> find anything I havent missed yet and that is part of the user
> interface.

  module M17n

you can have

  m("text", :var => value)

---

From: Christopher Bertels <[email-masked]>
Date: Wed, 21 Oct 2009 20:37:34 +0200

> Italian translation, but how? Is it a normal gettext .po file? What I

Get my sup clone git repository at gitorious: 

$ git clone git://gitorious.org/~bakkdoor/sup/bakkdoors-clone.git

Then, checkout the i18n branch.

$ cd bakkdoors-clone
$ git checkout i18n

Then have a look at the m17n folder. You should find a de.yaml and
en.yaml file.  They are for german and english translations. You can
create your own translation files in there. For example, fr.yaml for
french or it.yaml for italian.  Have a look at en.yaml to see, what
the original texts are (in english) and come up with your own
translation. That's basically it. Then, if you have sup set up to run
from that branch, you can set within your sup config file
(~/.sup/config.yaml) to use any language, e.g.:

:language: de

for german. Sup will then look into the m17n folder for a file called "de.yaml"

I hope that helped.

Cheers,
Christopher.

---

From: William Morgan <[email-masked]>
Date: Mon, 02 Nov 2009 06:59:48 -0800

> let somebody else figure out the translation later or.

I tend to agree.

---

From: Tero Tilus <[email-masked]>
Date: Mon, 02 Nov 2009 15:58:09 +0200

>> Can anyone explain me where and why a translated string in the UI
>> should be searchable with a regular expression?
>