-
Notifications
You must be signed in to change notification settings - Fork 148
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Scope config option to isolate translations #140
Conversation
7bae168
to
91be629
Compare
It is looking good 👍🏻, there are some failed tests though |
Thanks for your input, Tim! I glanced over the pipeline logs and it looks like tests are failing on the master branch too for the same reasons. As usual, test pipelines stop being reliable after a while... I can look into the details to try and fix it, but I don't think it's related to the change I made. |
Hmm, indeed, |
- Add Rails 8 to test matrix - Add excludes for incompatable Ruby/Rails combinations - Fix sqlite3 dependencies for older Rails versions
Allow the entire backend to use translations only from a subset of the translation records.
@timfjord I've rebased onto the latest master, but the CI pipeline had issues again so I went ahead and made some changes. It was mostly just an issue with sqlite3, which needed to be fixed to a specific version once again. While I was at it, I added Ruby 3.3 and Rails 8 to the matrix. For Ruby head, I got an error I don't really understand for Rails 6 & 7, so I excluded these combinations from the matrix. Here's the error from the failing pipeline in case you want to take a look. Since it's head, it could change with the next commit, and I thought having a working pipeline for now might be the better option.
Other than that, I made almost no other changes, so I'd appreciate a merge if you're still satisfied with the implementation 😃 |
@vipera Thanks for your contribution and for fixing the CI 💚 |
Released as v1.4.0 |
In my usage of this gem, I ran into a situation where I'd like two very related applications that are organizationally distinct but part of the same domain (e.g. public web application and its admin/management application) to connect to the same database.
However, I'd like them not to share translation data, and found that difficult to do without overriding methods in
I18n::Backend::ActiveRecord
. So instead, I added this feature to my fork, and wanted to see what you think about it and whether you'd be interested in having it in the main codebase.Essentially I added a
scope
field to the migration and if the configuration option is set, then all reads/writes will be limited to only those records with that particular scope identifier. I wanted to maintain compatibility with existing tables that don't have a scope, or even newly created tables where someone wants to remove the scope field from the migration if they won't be using it.I've added two tests showing how I think the behaviour should work and a readme paragraph. Thanks taking the time to look this over☺️