-
Notifications
You must be signed in to change notification settings - Fork 11
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
Bring back i18n_string integration #67
Comments
WIP here: #116 |
@laryn, as per your message in the Rules issue queue, I'll take over working on bringing this back to Entity Plus. I'll close your PR and will submit a new one soon. Thanks! |
Thank you! |
Fixes backdrop-contrib#67 Based on backdrop-contrib#116 (Thanks, @laryn !)
PR #148 submitted and ready for review (based on #116 - thanks, @laryn!). This issue has two "sister issues" that are needed for Rules translation (and tests) to work: #144 and #146 Testing this is tricky, as this is an API used mostly by Rules and maybe other contrib. I'll figure out some steps to do so, though. |
I've made some substantial changes in the approach: Instead of bringing back this functionality the way it was in D7 (as an 'inc' to the main module), I've decided to create a new submodule called The reasoning behind this is that this functionality, which integrates with Since all this functionality never existed in Backdrop's Entity Plus, this addition of a submodule should not present any backward compatibility problems. The only possible problem may be D7 upgrades that have custom entities that relied on this functionality. In those cases, the "Translate" tab will not show up until the submodule is enabled, but the translations should still work for strings that were translated in D7. One more aspect that needs to be resolved before this is ready to be merged: When using entity metadata wrappers, most entity properties (e.g. non-field-API fields that have their own columns in the entity table, such as a "Title" or "Created") use a callback named Still, while rare, to avoid this problem, we'll need to check whether the entity class contains method I'll add this soon. |
What I have so far can be tested in the following way... But first a quick explanation of what this functionality does: it creates the ability for users to manually translate text entered in custom entity properties. For example, if your custom entity has a property called "Title", you can enter any text there, and the Internationalization functionality will "pick it up" and allow you to translate it through the translation interface. Then when you visit the entity page in another language ( In addition, this functionality adds a tab "Translate" in the Admin UI for the custom entity type. So, to test:
|
The latest commit modifies To test:
$w = entity_metadata_wrapper('basic_entity_plus', 1); // Use the correct ID
$w->language('es');
dpm($w->title->value()); You should see the translated title. |
I'm going to let you guys (@argiepiano, @laryn) sort this one out. I don't think I can probe much beyond blindly following @argiepiano's recipe above. |
Looks and works great from my testing. My only comment is that we should also make |
Thanks, @laryn! Done. |
Issue #67. Bring back i18n functionality
I'm working to clean up Rules and the i18n_rules submodule extends
EntityDefaultI18nStringController
-- this doesn't exist in Backdrop. Maybe we should addentity.i18n.inc
into Entity Plus from the Entity module for D7?The text was updated successfully, but these errors were encountered: