This repository has been archived by the owner on Oct 3, 2024. It is now read-only.
forked from japetheape/gettext_to_i18n
-
Notifications
You must be signed in to change notification settings - Fork 0
Transforms gettext to I18n API and generate SimpleBackend locale files
License
mattherick/gettext_to_i18n
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
GettextToI18n ============= This plugin will convert your complete Rails project from Gettext calls to the new i18n api calls introduced in Rails 2.2.2. Please Backup your Code before running this plugin. It will touch your code and things could always go wrong. Example ======= CONTROLLERS: Following code is placed in apps/controllers/articles_controller.rb def foo flash[:notice] = _("Some string that will be translated") render :foo end this will be converted into: def foo flash[:notice] = I18n.t("controllers.articles.some_string_that0") render :foo end it will place an entry into config/locales/controllers/articles_controller/en.yml en: controllers: articles_controller: some_string_that0: "Some string that will be translated, into %{lan}}" The same way this plugin works with Models, Helpers, Mailers and files in lib. With the views it works a little bit different. VIEWS: Following string is placed in apps/views/articles/index.html.haml <%=_("Another string that will be translated, into %{lan}", % {:lan => 'english'}) %> will be converted into: <%=t(:another_string_that0, :lan => 'english' %> it will place an entry into config/locales/views/articles/en.yml en: articles: index: another_string_that0: "Another string that will be translated, into %{lan}}" It will follow the lazy lookup standard. If a yml-file already exists, it will merge the existing entries with the new entries, without deleting stuff. This plugin does not cover an automatically translation from model attributes and error messages yet. But it should help you to migrate from gettext to I18n. Usage ======= To convert all your views, controllers, models, mailers, helper and lib files to the new format. rake gettext_to_i18n:transform But you can also uncomment a few types in the plugin code (base.rb), and just convert the views in the first step. Further you can configure the languages the way you like it. You can translate for example just from English to German, or ten languages in one step. Installation ======= ./script/plugin install github.com/mattherick/gettext_to_i18n/ ------------- This is a fork from Jaap van der Meer (http:/japetheape/gettext_to_i18n) Copyright (c) 2010 Matthias Frick, released under the MIT license
About
Transforms gettext to I18n API and generate SimpleBackend locale files
Resources
License
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published
Languages
- Ruby 86.5%
- JavaScript 13.5%