{"id":14956026,"url":"https://github.com/jonathanhefner/dub_thee","last_synced_at":"2025-11-11T20:25:10.517Z","repository":{"id":62557574,"uuid":"140119198","full_name":"jonathanhefner/dub_thee","owner":"jonathanhefner","description":"Rails page titles via I18n","archived":false,"fork":false,"pushed_at":"2023-03-18T17:36:06.000Z","size":60,"stargazers_count":5,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-12-17T11:40:28.298Z","etag":null,"topics":["page-title","rails","ruby","ruby-on-rails"],"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/jonathanhefner.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"MIT-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":"2018-07-07T21:56:25.000Z","updated_at":"2022-06-11T11:00:05.000Z","dependencies_parsed_at":"2024-09-24T13:24:53.109Z","dependency_job_id":null,"html_url":"https://github.com/jonathanhefner/dub_thee","commit_stats":{"total_commits":60,"total_committers":1,"mean_commits":60.0,"dds":0.0,"last_synced_commit":"74fc75834701efadcc432e30edc35913c1d4d650"},"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonathanhefner%2Fdub_thee","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonathanhefner%2Fdub_thee/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonathanhefner%2Fdub_thee/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonathanhefner%2Fdub_thee/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jonathanhefner","download_url":"https://codeload.github.com/jonathanhefner/dub_thee/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":230873837,"owners_count":18293349,"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":["page-title","rails","ruby","ruby-on-rails"],"created_at":"2024-09-24T13:12:12.125Z","updated_at":"2025-11-11T20:25:10.487Z","avatar_url":"https://github.com/jonathanhefner.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# dub_thee\n\nRails page titles via I18n.  For example, given the following\napplication layout:\n\n```html+erb\n\u003c!-- app/views/layouts/application.html.erb --\u003e\n\n\u003chtml\u003e\n  \u003chead\u003e\n    \u003ctitle\u003e\u003c%= page_title %\u003e | My Web Site\u003c/title\u003e\n  \u003c/head\u003e\n  ...\n\u003c/html\u003e\n```\n\nAnd the following translations:\n\n```yaml\n## config/locales/page_title.en.yml\n\nen:\n  page_title:\n    home:\n      index: \"Welcome\"\n```\n\nThe \"app/views/home/index.html.erb\" view will automatically be titled\n\"Welcome | My Web Site\".\n\nThe `page_title` helper fetches the title via `I18n.t`, using the\ncontroller name and action name to make up the translation key.  Any\naction name is allowed, however \"create\", \"update\", and \"delete\" are\nspecial-cased to instead fetch the titles of their render-on-failure\ncounterparts: \"new\", \"edit\", and \"show\", respectively.\n\n\n## Variable interpolation\n\nFor more dynamic titles, view assignment variables are made available\nfor interpolation.  Additionally, the [i18n-interpolate_nested] gem\nis included to enable attribute interpolation.  For example, given the\nfollowing translations:\n\n```yaml\n## config/locales/page_title.en.yml\n\nen:\n  page_title:\n    products:\n      show: \"%{product.name} (%{product.brand})\"\n```\n\nThe value of `page_title` for \"app/views/products/show.html.erb\" will be\nequivalent to `\"#{@product[:name]} (#{@product[:brand]})\"`.\n\n[i18n-interpolate_nested]: https://rubygems.org/gems/i18n-interpolate_nested\n\n\n## Generic titles\n\nGeneric action titles (i.e. not controller-specific) are also supported.\nTo allow such titles to be slightly more dynamic, two additional values\nare provided for interpolation: `plural` is the `String#titleize`'d name\nof the controller, and `singular` is the `String#singularize`'d form of\n`plural`.  For example, given the following translations:\n\n```yaml\n## config/locales/page_title.en.yml\n\nen:\n  page_title:\n    index: \"%{plural}\"\n    new: \"New %{singular}\"\n```\n\nThe value of `page_title` for \"app/views/part_orders/index.html.erb\"\nwill be `\"Part Orders\"`, and for \"app/views/locations/index.html.erb\"\nwill be `\"Locations\"`.  Likewise, the value of `page_title` for\n\"app/views/part_orders/new.html.erb\" will be `\"New Part Order\"`, and for\n\"app/views/locations/new.html.erb\" will be `\"New Location\"`.\n\n\n## Additional logic\n\nAdditional logic can be incorporated by using the `@page_title`\nvariable.  If `@page_title` is set, the `page_title` helper will simply\nreturn `@page_title`.  Thus, individual views can implement more nuanced\ntitle logic.  For example, given the following translations:\n\n```yaml\n## config/locales/page_title.en.yml\n\nen:\n  page_title:\n    users:\n      show: \"%{user.name}\"\n```\n\nAnd the following view:\n\n```html+erb\n\u003c!-- app/views/users/show.html.erb --\u003e\n\n\u003c% @page_title = \"Your Profile\" if current_user == @user %\u003e\n\n...\n```\n\nThe value of `page_title` in \"app/views/layouts/application.html.erb\"\nwill be `\"Your Profile\"` if the current logged-in user is viewing their\nown profile.  Else, it will be equivalent to `\"#{@user[:name]}\"`.\n\n\n## Installation\n\nAdd the gem to your Gemfile:\n\n```bash\n$ bundle add dub_thee\n```\n\nAnd run the install generator:\n\n```bash\n$ rails generate dub_thee:install\n```\n\n\n## Contributing\n\nRun `bin/test` to run the tests.\n\n\n## License\n\n[MIT License](MIT-LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjonathanhefner%2Fdub_thee","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjonathanhefner%2Fdub_thee","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjonathanhefner%2Fdub_thee/lists"}