-
Notifications
You must be signed in to change notification settings - Fork 1
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
Translate blocks #39
Comments
@olafgrabienski I agree that the best option is the last one:
I think we should work towards that. Here is the config file {
"_config_name": "block.custom.nav_call_to_action_icons",
"delta": "nav_call_to_action_icons",
"info": "Nav Call to Action Icons",
"title": "",
"body": {
"value": "<div class=\"container\">\r\n <div class=\"row\">\r\n <div class=\"col nav-apply-for-assistance nav-cta\">\r\n<div class=\"pencil-icon nav-circle\">\r\n<a href=\"/webform/apply-assistance\">\r\n<webicon icon=\"simple-line:pencil\"/></a>\r\n</div>\r\n <a href=\"webform/apply-assistance\">Apply<br />for<br />Assistance</a>\r\n </div>\r\n <div class=\"col nav-volunteer nav-cta\">\r\n<div class=\"puzzle-icon nav-circle\">\r\n<a href=\"/webform/volunteer\">\r\n <webicon icon=\"simple-line:puzzle\" class=\"puzzle-piece\"/></a>\r\n</div>\r\n <a href=\"/webform/volunteer\">Volunteer</a>\r\n </div>\r\n <div class=\"col nav-partners nav-cta\">\r\n<div class=\"badge-icon nav-circle\">\r\n<a href=\"/partners\">\r\n <webicon icon=\"simple-line:badge\"/></a>\r\n</div>\r\n <a href=\"/partners\">Our Projects<br />and<br />Nonprofit Partners</a>\r\n </div>\r\n </div>\r\n</div>",
"format": "full_html"
},
"description": "A reusable custom block."
} off the top of my head we could:
something like that; it will probably get a little hairy, but it will be worth the effort IMHO. |
That sounds exciting! And I guess we could need more feedback, will ask for it in Gitter. |
If you don't mind having nodes directly accessible there's also the option of using a content type of "snippets" that's translatable. I've had to do that in D7. How does i18n do it again? |
I am not a Backdrop user yet, but still doing a lot of D7, most of the projects multilingual in some way. I completely stopped using blocks "directly" for content, it's a pain whenever a customer wants something to be changed after some time. Here's what I use instead: having a content type called "Promotion Block", with all the necessary fields, some Display Suite sauce (i.e. to help link the entire block IF link field has been filled out). Then I use the D7 node block module to place the block in the layout. Since I started using this approach, I managed to handle also quite tricky i18n problems (well, all of them are complex in some way;-). I did not see any downside so far, it's compeletely fieldable, it's available in translation management, customers understand it and like it (which was never the case with having content in blocks... did you ever had to explain the difference to a customer....got you;-). It also allowed me to get rid of Panels. |
@herbdool + @mazzech Thanks for your feedback! If I understand correctly, both your suggestions correspond to the "Use nodes for blocks" approach mentioned in the issue description. A nice concept in my opinion, especially as Backdrop allows to place existing content (nodes) as blocks in layouts out of the box. @herbdool I think for Backdrop4Good it would be okay if 'block snippet' nodes were directly accessible. But there will be other use cases where it isn't desirable. As you know, there are some ideas to build a system of page-less nodes, the latest focus of the issue was however to rely on contrib modules, for instance on Rabbit Hole (which is not ready to use yet, afaik). That said, the "use nodes for blocks" approach remains a workaround for experienced site builders. I'm sure that I'll use it as long there is no more direct solution, and we should consider it for Backdrop4Good as well. But I'd still be happy if Backdrop could also provide the option to make blocks directly translatable. That would be the most straightforward approach in my opinion. (Drupal 8 provides the direct option as well.) @herbdool Unfortunately I don't know how i18n is doing it technically. Have you seen serundeputy's implementation ideas above? |
Yes, and it's a fieldable solution (I do not know if BD blocks are either) |
@mazzech Backdrop custom blocks are not fieldable so far. The feature is discussed in the mentioned System of page-less nodes issue but I don't think that it will be implemented soon. I agree, fieldability is a point for the "Use nodes for blocks" approach. Another point is that nodes are content while blocks are configuration, which feels a bit strange if you're actually putting content in a block. |
@olafgrabienski It might be for more experienced site builders, but from my experience it's much more logical for content creators and has some great advantages architectual-wise. From my understanding it'a also in line with the pageless approach you mentioned. And IMHO it's a huge advantage when it comes to multilingual environment, and the translation proces itself, compared to blocks. It's also compatible with Display Suite (while D7 blocks are not), which I use a lot, sometimes 10+ different view modes per content type. |
From a user experience pov, blocks are content. The fact that what we have in core now is configuration is only because that was much easier than turning blocks into content-entities, which is what happened in Drupal 8. For Backdrop, I prefer the pageless nodes solution, it's simpler in concept and people already know how to work with nodes. For BackdropForGood we have two options:
Option #1 might be a better short-term solution since we can implement it right away. But option #2 will need to happen anyway, as there are likely other non-block things that are stored in configuration that will also need to be translated eventually. At this point, it's a matter of what needs to happen first. :) @serundeputy I think adding a |
For reference: looks like this is the main issue for translating config: backdrop/backdrop-issues#704 🍿 |
On Backdrop4Good, we're translating content at the moment (see section 5 in the issue description of [Meta] Make Backdrop4Good multilingual). Content translation doesn't need necessarily to happen first but it would be nice to continue with it, so I'm open to go for option 1 and to tackle configuration translation later. (Apart from that, I really like the node + rabbit hole approach.) What do you think, @serundeputy? |
I'm fine with that approach @olafgrabienski if it unblocks you. Just for reference I put in a PR to get a start on config translation against backdrop/backdrop: backdrop/backdrop#2044 |
Good to know, @serundeputy! Testing Rabbit Hole which looks already good I became aware that we have to fix a core issue before we can use the nodes for blocks approach on Backdrop4Good: "Add Existing Content" block doesn't respect the "Show author and date information" checkbox |
@olafgrabienski I've added a PR against the core issue: backdrop/backdrop-issues#2536 |
@serundeputy That's great! I saw that the PR is already reviewed and the issue has status RTBC. Tested the sandbox as well, works as expected, nice! |
@serundeputy IIRC, to replace the custom blocks in Backdrop4Good by translatable 'node blocks' we have to wait on a new Backdrop version which will probably include the fix for "Existing content" blocks. The same applies to #31 for translating 'normal' nodes. So it might be a good idea when I continue with other tasks in the meantime. |
Hey @olafgrabienski So I've started rewriting the block module for translatable blocks and I've developed some kind of prototype .. please see https://github.com/bjoern-st/block It is working, but for now I'm totally unhappy with the backwards-compatibility section .. So feedback and issues are very welcome Cheers Bjoern |
@bjoern-st Thanks for your feedback! I'm also skeptical about config translation for custom blocks: holding primarily content, custom blocks don't seem to fit very well in the configuration paradigm. That said, I'm not sure about the technical background and if it however would make sense to build a translation interface around configuration, or if it's better to choose an alternative. Speaking of which, I'm looking forward to test your rewrite in the next days, even if I won't be able to give feedback on backwards-compability, but I will install it and try it out. To do so, I just replace |
@olafgrabienski Yes, that is correct. |
@bjoern-st I've tested the rewritten rewritten block module. Translation of custom blocks is working in the backend: On a German / English site I was able to add a translation of a custom block and to edit both of the variations separately afterwards. (I was a bit puzzled that the English and the German variation were both called translations.) What are you thoughts about the frontend integration? When I place a translated block in a Layout, I only see the English variation on the respective page, even if I'm on a German page. |
Sorry, that was not correct. Using the Default Layout, I see the German block variation on a German page. (It didn't work on the Home page layout.) |
@bjoern-st Are you up to make an issue and provide a PR in the core issue with your rewrite of the Block module to get more feedback and to discuss the approach more detailed? AFAIK, there is no issue yet in the core queue to make blocks directly translatable. I guess we have to discuss the different approaches for block translation then in the core queue and while dev meetings. To make the start easier, I'll try to summarize the discussion of this issue in the next comment. |
Thanks again for all your feedback on Block translation! There has been made some progress on different approaches in the meantime, let me shortly summarize: (1) Collapsible block groups
(2) [CMI] Add config translation
(3) Use nodes for blocks
(4) Make blocks directly translatable
|
Hey @olafgrabienski, Sorry for the delayed answers. At first: thank you for your work here and thank you for your feedback!! Perhaps my thoughts for the different approaches: 2:) There is not even an UI to edit a config file .. 3:) Great thing! If it is going to work, the block module might be unnecessary .. but I like it :-) So, if this might be a alternative I'll of course like to make a PR against the core. But this is only - as mentioned, some kind of prototype. I had some time left and I tried to solve this, so it needs revisions, discussion and feedback! Cheers Bjoern |
I think that rabbit hole is a good solution for the immediate future, since we should be able to release it soon and let people proceed with their projects while we find a more long-term solution. As I mentioned in our call, I think that any config translation system that we put in place should allow the translations to be stored in the same configuration file as the original text. That way any translations can be deployed along with related changes to the original text, and also be more performant since queries wouldn't need to be made to the database. Nate seemed to think that we shouldn't go that route in general, and instead stick to the existing translation system which uses the t() function and stores the translations in the database. However, the config blocks are a special case where we might be able to try storing translations in the config files and see how that works in terms of usability. |
I've an unpleasant update: over in the core issue about pageless nodes it turned out that the promising "nodes for blocks" approach doesn't help with block translation. backdrop/backdrop-issues#100 (comment):
backdrop/backdrop-issues#100 (comment):
:-/ |
Just a brief detail, not sure if this helps... I also recommended the node approach, which I am using in current D7 projects (after fiddling around with Panels, Panelizer, Paragraphs and every possible combination of them;-) But the D7 Node Block approach has a small difference: it places a checkbox on every node "to be rendered also as block" or similar. After saving the node, the block is there. I am not sure if this changes anything for this issue here, compared to the "make block, search for content" approach. |
I've finally filed two core issues regarding block translation:
|
There are a few custom blocks with content on the Backdrop4Good site:
alt
attribute)In contrast to nodes, blocks are not directly translatable by Backdrop at the moment. There is a workaround described in the core issue, UX: Layout UI: Collapsible block groups:
Drawback, pointed out in the same issue description:
@klonos suggested to not wait on Backdrop 2 with extended language support but to improve the situation by adding "Collapsible block groups", i.e. the option "to group multiple blocks together and somehow collapse them so they don't get in the way all the time. That way one could create a [...] group of blocks that would include all the language-specific [...] blocks".
The "Collapsible block groups" suggestion got some positive feedback but there were also other suggestions based on different language related and block related core issues which made no more progress at a certain point. Subsequently, there were no more activities in the issue. In my opinion, the suggestion of @klonos remains an interesting approach to translate blocks.
So, to translate blocks on Backdrop4Good, there is one workaround which should work: create one block per language and set respective visibility conditions. In my opinion it's not ideal but manageable (Backdrop4Good is being translated to 4 languages at the moment).
There are however a couple of approaches to improve the situation. I'd like to discuss them first, as Backdrop4Good is a use case for general multilanguage improvements in Backdrop. Here are the approaches I'm aware of:
My favorite is the last one: make blocks directly translateable. This feature was also requested several times in the central Backdrop contrib i18n issue but i18n is far from working in Backdrop. So let's have a look at i18n and see if it's possible to port the block translation option to Backdrop core.
The text was updated successfully, but these errors were encountered: