{"id":19010289,"url":"https://github.com/railsware/handlebars_assets_i18n","last_synced_at":"2026-06-18T18:31:41.226Z","repository":{"id":17907478,"uuid":"20865581","full_name":"railsware/handlebars_assets_i18n","owner":"railsware","description":"Very simple handlebars_assets internationalization for .hamlbars and .slimbars templates","archived":false,"fork":false,"pushed_at":"2014-06-15T21:21:43.000Z","size":120,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":8,"default_branch":"master","last_synced_at":"2026-03-27T10:08:22.045Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/railsware.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-06-15T21:18:49.000Z","updated_at":"2023-07-25T13:52:11.000Z","dependencies_parsed_at":"2022-09-09T05:11:16.717Z","dependency_job_id":null,"html_url":"https://github.com/railsware/handlebars_assets_i18n","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/railsware/handlebars_assets_i18n","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/railsware%2Fhandlebars_assets_i18n","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/railsware%2Fhandlebars_assets_i18n/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/railsware%2Fhandlebars_assets_i18n/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/railsware%2Fhandlebars_assets_i18n/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/railsware","download_url":"https://codeload.github.com/railsware/handlebars_assets_i18n/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/railsware%2Fhandlebars_assets_i18n/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34503507,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-18T02:00:06.871Z","response_time":128,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":[],"created_at":"2024-11-08T19:10:42.846Z","updated_at":"2026-06-18T18:31:41.198Z","avatar_url":"https://github.com/railsware.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# HandlebarsAssetsI18n\n\nVery simple [handlebars_assets](https://github.com/leshill/handlebars_assets) internationalization for `.hamlbars` and `.slimbars` that allows your to have precompiled translated templates for each desired locale. So that you don't need translate it on client side on the fly.\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n    gem 'handlebars_assets_i18n'\n\n## Configuration\n\nBy default templates will be precompiled with all available locales.\nYou can restrict it using `locales` configuration option:\n\n```ruby\nHandlebarsAssets::Config.locales = [:en, :de]\n```\n\n## How it works\n\nIf you file is `app/javascripts/templates/shared/errors.hamlbars` or `app/javascripts/templates/shared/errors.slimbars` and your locales are `:en` and `:de` then the assets pipeline will compile code for each locale and store it under corresponding names `HandlebarsAssets['shared/errors_en']` and `HandlebarsAssets['shared/errors_de']`.\n\n\n## Using with Marionette\n\nExport current locale in your `layouts/application.html.haml` to client side:\n\n```haml\n...\n:javascript\n  MyApp.locale = '#{I18n.locale}'\n...\n```\n\nInternationalize your Marionette renderer:\n\n```coffee\n\nMarionette.Renderer.render = (template, context) -\u003e\n  template = \"#{template}_#{MyApp.locale}\"\n\n  unless HandlebarsTemplates[template]\n    throw \"Template '#{template}' not found!\"\n\n  HandlebarsTemplates[template](data)\n\n```\n\nThat's all.\n\nNow you can use `I18n.translate` and `I18n.localize` helpers in `.hamlbars` or `.slimbars`.\nAlso if you use this gem with `rails` then you can use rails `t` and `l` helpers`:\n\n\n```hamlbars\n%h2\n  =t 'title.errors'\n\n%ul\n  {{#each errors}}\n  %li {{.}\n  {{/each}}\n```\n\n## Benefits\n\n* Easy to plug in.\n* Fast due to precompiled templates with translations.\n* No I18n javascript code required.\n* Translation keys are not exported to client side.\n\n## Penalty of Simplicity\n\n* Please remember that translation is performed on precompilation phase. Not at runtime.\n* You must recompile templates if you changed translations in `config/locales`.\n* You can't use interpolation features.\n\n## Author\n\n[Andriy Yanko](http://ayanko.github.io/)\n\n## License\n\n* Copyright (c) 2014 Railsware [www.railsware.com](http://www.railsware.com)\n* [MIT](www.opensource.org/licenses/MIT)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frailsware%2Fhandlebars_assets_i18n","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frailsware%2Fhandlebars_assets_i18n","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frailsware%2Fhandlebars_assets_i18n/lists"}