# Merging locales

**URL:** <https://www.ruby-forum.com/t/merging-locales/198662>\
**Category:** Rails I18n\
**Created:** [November 5, 2010, 12:26am UTC](https://www.ruby-forum.com/t/merging-locales/198662 "2010-11-05T00:26:59Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dobai-Pataky\_BSSSSl](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/77aa72/32.png) [@Dobai-Pataky\_BSSSSl](https://www.ruby-forum.com/u/Dobai-Pataky_BSSSSl)\
**Post date:** [November 5, 2010, 12:26am UTC](https://www.ruby-forum.com/t/merging-locales/198662/1 "2010-11-05T00:26:59Z")

</div>

Hi

I am trying to find some rake task that supports the managing of  
locales. I have many unused keys, there are missing keys and there are  
each locale have old and new locale-files. I have found some rake  
tasks that support this kind of managing but I also need

1. I am trying to merge two en-locales to one file.  
Anyone that knows how to do that or knows about a plugin, code snippet  
etc that does the job

2. I also want to add a I18n key with a value e.g. views. help: Hjlp  
to the correct position in a locale file  
Anyone that knows how to do that or knows about a plugin, code snippet  
etc that does the job

---

<div class="post-metadata">

**Author:** ![marmolin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/71e660/32.png) [@marmolin](https://www.ruby-forum.com/u/marmolin)\
**Post date:** [November 5, 2010, 8:40am UTC](https://www.ruby-forum.com/t/merging-locales/198662/2 "2010-11-05T08:40:25Z")

</div>

On Fri, Nov 5, 2010 at 00:25, Hans M.  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)wrote:

> 1. I also want to add a I18n key with a value e.g. views. help: Hjlp to  
> the correct position in a locale file  
> Anyone that knows how to do that or knows about a plugin, code snippet etc  
> that does the job

This might be helpful: [Helps you update Rails i18n YAML files programmatically. · GitHub](https://gist.github.com/293581)

---

<div class="post-metadata">

**Author:** ![marmolin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/71e660/32.png) [@marmolin](https://www.ruby-forum.com/u/marmolin)\
**Post date:** [November 5, 2010, 8:59am UTC](https://www.ruby-forum.com/t/merging-locales/198662/3 "2010-11-05T08:59:16Z")

</div>

Henry  
Thanks  
This seems to solve one of my problems, but I am still looking for a  
solution of the problem of merging locale fies

* * *

Hans M.  
St: Larsgatan 50, 58224 Linkping, Sweden  
Phone: +46708371202

5 nov 2010 kl. 08.39 skrev Henrik N.:

---

<div class="post-metadata">

**Author:** ![marmolin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/71e660/32.png) [@marmolin](https://www.ruby-forum.com/u/marmolin)\
**Post date:** [November 8, 2010, 4:05pm UTC](https://www.ruby-forum.com/t/merging-locales/198662/4 "2010-11-08T16:05:13Z")

</div>

Hi,

maybe it’s not exactly what you want but there exist tool for managing  
locales under ruby.  
Try look at:

> **[GitHub - pejuko/i18n-translators-tools: This package brings you useful...](https://github.com/pejuko/i18n-translators-tools)**
>
> This package brings you useful utility and library which can help you to handle locale files and translations in your Ruby projects. It is build upon i18n library and extends it's simple format...

---

<div class="post-metadata">

**Author:** ![marmolin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/71e660/32.png) [@marmolin](https://www.ruby-forum.com/u/marmolin)\
**Post date:** [November 5, 2010, 9:08am UTC](https://www.ruby-forum.com/t/merging-locales/198662/5 "2010-11-05T09:08:43Z")

</div>

henry  
Looking through your code again I realize that it could be used also  
for merging files if the file to be merged are transformed to a serie  
of key - value lines, and I have found some code that I could refactor  
for that purpose (see git://gist.github.com/583424.git), if no one  
has a more simple solution

* * *

Hans M.  
St: Larsgatan 50, 58224 Linkping, Sweden  
Phone: +46708371202

5 nov 2010 kl. 08.39 skrev Henrik N.:
