# Open Source Contribution - Getting Started: i18n background generating rake?

**URL:** <https://www.ruby-forum.com/t/open-source-contribution-getting-started-i18n-background-generating-rake/189846>\
**Category:** Rails I18n\
**Created:** [June 8, 2010, 7:25pm UTC](https://www.ruby-forum.com/t/open-source-contribution-getting-started-i18n-background-generating-rake/189846 "2010-06-08T19:25:12Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![indigoi](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/b3f665/32.png) [@indigoi](https://www.ruby-forum.com/u/indigoi)\
**Post date:** [June 8, 2010, 7:25pm UTC](https://www.ruby-forum.com/t/open-source-contribution-getting-started-i18n-background-generating-rake/189846/1 "2010-06-08T19:25:12Z")

</div>

Hello i18n community of rails. I’ve been programming RoR for a few  
years now, and want to test my chops contributing to some open source  
projects, I have a special interest in i18n and have an Idea, though i  
wanted to get some feedback on the first the validity (and usability)  
of the idea, and then second on the potential implementation (caveats,  
major problems, etc.).

What I’m interested in doing is creating an backend generating rake  
task and to create the default key pair automatically so the key is  
the actual sentence in your html.erb file.

For example in my code rather than have t(".welcome\_message") and then  
in my en.yml have a key value pair, i could put something akin to  
t(".Welcome to my Web page") which after rake could generate the key  
value pair similar to this:

welcome\_to\_my\_web\_page: “Welcome to my Web page”

Do you think such functionality would be useful to someone getting  
started with i18n, or to a veteran having the ability to modify the  
key value pair and view the changes in the html.erb at the same time  
(keeping things a little more dry) ?

If you would desire this type of functionality what types of technical  
hurdles would I expect to face? I wouldn’t want special characters in  
my keys, and I also wouldn’t want the keys themselves to be entire  
paragraphs, are there any other caveats you see?

If this has already been tried let me know, again i’m just getting  
started “giving back” to the community, so this may not be the right  
idea, and/or project. Whatever your opinions or thoughts are please  
share them!

---

<div class="post-metadata">

**Author:** ![indigoi](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/b3f665/32.png) [@indigoi](https://www.ruby-forum.com/u/indigoi)\
**Post date:** [June 8, 2010, 7:35pm UTC](https://www.ruby-forum.com/t/open-source-contribution-getting-started-i18n-background-generating-rake/189846/2 "2010-06-08T19:35:09Z")

</div>

Yes, that is useful. Since I just got off my Globalize 1 addiction, I  
am missing the alternative, less cumbersome way of coding I18n apps.

What I came up with was a plugin that combines a database backend for  
I18n, fallbacks and some of the func. you mentioned, e.g.

de:  
“Hello World”: “Hallo Welt!”

Feel free to poke around:

[http://github.com/jfesslmeier/globalize\_bridge](http://github.com/jfesslmeier/globalize_bridge)

Greetings,  
Juergen

---

<div class="post-metadata">

**Author:** ![indigoi](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/b3f665/32.png) [@indigoi](https://www.ruby-forum.com/u/indigoi)\
**Post date:** [June 8, 2010, 7:40pm UTC](https://www.ruby-forum.com/t/open-source-contribution-getting-started-i18n-background-generating-rake/189846/3 "2010-06-08T19:40:25Z")

</div>

Hi Richard,

Nice to see that you’re willing to contribute.

The idea you present remind me a bit of gettext. I like the detection  
part, but I’m not that comfortable with using real texts as keys.  
They’re fragile and I don’t think you should keep all the strings  
inside your views. Or are you suggesting that the rake file changes  
the view from \<%= t(".Welcome to my webpage") %\> to \<%=  
t(".welcome\_to\_my\_webpage") as well? I don’t know if that is handy.

You are also going to have problems with longer strings, which will  
clog your locale files.

I believe Zigzag Chen already did something similar with his  
ready\_for\_i18n gem. Unfortunately, he died recently.

Remember: i18n is one of the harder problems in programming, so be  
prepared for some setbacks.

Good luck!

- iain

---

<div class="post-metadata">

**Author:** ![indigoi](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/b3f665/32.png) [@indigoi](https://www.ruby-forum.com/u/indigoi)\
**Post date:** [June 8, 2010, 10:33pm UTC](https://www.ruby-forum.com/t/open-source-contribution-getting-started-i18n-background-generating-rake/189846/4 "2010-06-08T22:33:08Z")

</div>

Hi  
I have implemented a similar solution using an added string method  
(to\_local(key))  
That means I just write “Welcome to my Web page”.to\_local(:view) or  
any other key header, using a sing a text mate bundle (using sven’s  
bundle as a starting point) that generates a key of the kind you want  
in all locals

if you are interested I can send you the code

* * *

Hans M.  
St: Larsgatan 50, 58224 Linköping, Sweden  
Phone: +46708371202

8 jun 2010 kl. 18.26 skrev Richard S.:

---

<div class="post-metadata">

**Author:** ![indigoi](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/b3f665/32.png) [@indigoi](https://www.ruby-forum.com/u/indigoi)\
**Post date:** [June 10, 2010, 8:58pm UTC](https://www.ruby-forum.com/t/open-source-contribution-getting-started-i18n-background-generating-rake/189846/5 "2010-06-10T20:58:57Z")

</div>

It sounds like this area is open up to quite a bit of interpretation,  
this was excellent feedback, and it looks like i’ll have to do some  
homework before I start as there maybe some existing solutions. Hans,  
do you have your code posted on github by any chance?

–  
Richard

---

<div class="post-metadata">

**Author:** ![indigoi](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/b3f665/32.png) [@indigoi](https://www.ruby-forum.com/u/indigoi)\
**Post date:** [June 8, 2010, 10:41pm UTC](https://www.ruby-forum.com/t/open-source-contribution-getting-started-i18n-background-generating-rake/189846/6 "2010-06-08T22:41:55Z")

</div>

I agree that my solutions has some problems, but i really simplify the  
t ask if you have a lot of strings  
The main problem is that you generate new keys each time you change  
the string and ends upp with many unused keys  
This problem can then be solved by an existing rake task

Mybe some combination would be useful.  
I there are long string I use som key instead and if there a a lot of  
text I use different html files

* * *

Hans M.  
St: Larsgatan 50, 58224 Linköping, Sweden  
Phone: +46708371202

8 jun 2010 kl. 19.38 skrev Iain H.:
