{"id":18790061,"url":"https://github.com/webhippie/gettext_i18n_rails_js","last_synced_at":"2025-12-29T11:22:18.807Z","repository":{"id":4350346,"uuid":"5486401","full_name":"webhippie/gettext_i18n_rails_js","owner":"webhippie","description":"Extends gettext_i18n_rails making your .PO files available to client side javascript as JSON","archived":false,"fork":false,"pushed_at":"2025-03-03T08:31:52.000Z","size":246,"stargazers_count":28,"open_issues_count":4,"forks_count":35,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-05T14:02:59.060Z","etag":null,"topics":["gettext","i18n","rails","ruby","rubygem"],"latest_commit_sha":null,"homepage":"https://github.com/webhippie/gettext_i18n_rails_js","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/webhippie.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2012-08-20T20:28:08.000Z","updated_at":"2025-03-03T08:31:55.000Z","dependencies_parsed_at":"2022-08-23T17:10:29.848Z","dependency_job_id":"ff20a5fb-e7fd-4f8a-9ea0-85f1b46a8dd8","html_url":"https://github.com/webhippie/gettext_i18n_rails_js","commit_stats":{"total_commits":127,"total_committers":26,"mean_commits":4.884615384615385,"dds":0.7795275590551181,"last_synced_commit":"fd99efcb99c67267bb908ba506ae32a86bc18e71"},"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webhippie%2Fgettext_i18n_rails_js","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webhippie%2Fgettext_i18n_rails_js/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webhippie%2Fgettext_i18n_rails_js/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webhippie%2Fgettext_i18n_rails_js/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/webhippie","download_url":"https://codeload.github.com/webhippie/gettext_i18n_rails_js/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247755560,"owners_count":20990620,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["gettext","i18n","rails","ruby","rubygem"],"created_at":"2024-11-07T21:09:47.963Z","updated_at":"2025-12-29T11:22:18.802Z","avatar_url":"https://github.com/webhippie.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# gettext_i18n_rails_js\n\n[![Test Status](https://github.com/webhippie/gettext_i18n_rails_js/actions/workflows/testing.yml/badge.svg)](https://github.com/webhippie/gettext_i18n_rails_js/actions/workflows/testing.yaml) [![Join the Matrix chat at https://matrix.to/#/#webhippie:matrix.org](https://img.shields.io/badge/matrix-%23webhippie%3Amatrix.org-7bc9a4.svg)](https://matrix.to/#/#webhippie:matrix.org) [![Codacy Badge](https://app.codacy.com/project/badge/Grade/51f241a0f0d7490cae0bdc04387f9d13)](https://app.codacy.com/gh/webhippie/gettext_i18n_rails_js/dashboard?utm_source=gh\u0026utm_medium=referral\u0026utm_content=\u0026utm_campaign=Badge_grade) [![Gem Version](https://badge.fury.io/rb/gettext_i18n_rails_js.svg)](https://badge.fury.io/rb/gettext_i18n_rails_js)\n\nExtends [gettext_i18n_rails](https://github.com/grosser/gettext_i18n_rails),\nmaking your .PO files available to client side javascript as JSON. It will find\ntranslations inside your .js, .coffee, .handlebars and .mustache files, then it\nwill create JSON versions of your .PO files so you can serve them with the rest\nof your assets, thus letting you access all your translations offline from\nclient side javascript.\n\n## Versions\n\nFor a list of the tested and supported Ruby and Rails versions please take a\nlook at the [workflow][workflow].\n\n## Installation\n\n```ruby\ngem 'gettext_i18n_rails_js', '~\u003e 3.0.0'\n```\n\n## Versioning\n\nThis library aims to adhere to [Semantic Versioning 2.0.0][semver]. Violations\nof this scheme should be reported as bugs. Specifically, if a minor or patch\nversion is released that breaks backward compatibility, a new version should be\nimmediately released that restores compatibility. Breaking changes to the public\nAPI will only be introduced with new major versions.\n\nAs a result of this policy, you can (and should) specify a dependency on this\ngem using the [Pessimistic Version Constraint][pvc] with two digits of precision.\n\nFor example:\n\n```ruby\nspec.add_dependency 'gettext_i18n_rails_js', '~\u003e 3.0.0'\n```\n\n## Usage\n\nSet up your rails application with gettext support as usual, afterwards just\nexecute the following rake task to export your translations to JSON:\n\n```bash\nrake gettext:po_to_json\n```\n\nPer default this will reconstruct the ```locale/\u003clang\u003e/app.po``` structure as\njavascript files inside ```app/assets/javascripts/locale/\u003clang\u003e/app.js```\n\nThe gem provides the [Jed](https://github.com/SlexAxton/Jed) library to use the\ngenerated javascript files. It also provides a global ```__``` function that\nmaps to `Jed#gettext`. The Jed instance used by the client side ```__```\nfunction is pre-configured with the ```lang``` attribute specified in your main\nHTML tag. Before anything, make sure your page's HTML tag includes a valid\n```lang``` attribute, for example:\n\n```haml\n%html{ manifest: \"\", lang: I18n.locale }\n```\n\nOnce you're sure your page is configured with a locale, then you should add\nboth your javascript locale files and the provided javascripts to your\napplication.js\n\n```js\n//= require_tree ./locale\n//= require gettext/all\n```\n\nThe default function name is ```window.__```, to avoid conflicts with\nunderscore.js. If you want to alias the function to something else in your\njavascript you should also instruct the javascript and coffeescript parser to\nlook for a different function when finding your translations within the config\nfile ```config/gettext_i18n_rails_js.yml```, these are valid available options:\n\n```yml\noutput_path: \"app/assets/javascripts/locale\"\nhandlebars_function: \"__\"\njavascript_function: \"__\"\njed_options:\n  pretty: false\n```\n\nIf you prefer an initializer file within your rails application you can use\nthat in favor of the YML configuration as well:\n\n```ruby\nGettextI18nRailsJs.config do |config|\n  config.output_path = \"app/assets/javascripts/locale\"\n\n  config.handlebars_function = \"__\"\n  config.javascript_function = \"__\"\n\n  config.jed_options = {\n    pretty: false\n  }\nend\n```\n\n## Contributing\n\nFork -\u003e Patch -\u003e Spec -\u003e Push -\u003e Pull Request\n\n## Authors\n\n*   [Thomas Boerger](https://github.com/tboerger)\n*   [Nubis](https://github.com/nubis)\n*   [Other contributors](https://github.com/webhippie/gettext_i18n_rails_js/graphs/contributors)\n\n## License\n\nMIT\n\n## Copyright\n\n```\nCopyright (c) 2012-2015 Dropmysite.com \u003chttps://dropmyemail.com\u003e\nCopyright (c) 2015 Webhippie \u003chttp://www.webhippie.de\u003e\n```\n\n[workflow]: https://github.com/webhippie/gettext_i18n_rails_js/blob/master/.github/workflows/testing.yml\n[semver]: http://semver.org\n[pvc]: http://guides.rubygems.org/patterns/#pessimistic-version-constraint\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwebhippie%2Fgettext_i18n_rails_js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwebhippie%2Fgettext_i18n_rails_js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwebhippie%2Fgettext_i18n_rails_js/lists"}