Are there anyone that plan to work on a D8 version of this module?
LanguageManager::getFallbackCandidates
There is now support for string fallback in core:
#2122175: String translation does not honor language fallback
So we should be able to choose for each language if we want fallback for strings only, or also content/entity fallback.
Maybe we could also make a hook to make it possible for more fine-adjusting custom fallback logics, I can imagine cases where we want some specific entities/content-types to always fallback to default language, or always fallback to default language for registered users, or make it possible to create country dependent fallback languages (like we have now in D7), but move that part out of the module. So a hook for custom solutions would be great.
I also think this issue can be worth to check out:
#2019055: Switch from field-level language fallback to entity-level language fallback
Hope more people will come with their thought on a D8 release, especially the maintainers.
| Comment | File | Size | Author |
|---|---|---|---|
| #10 | language_fallback.zip | 3.09 KB | siliconmind |
| #4 | sublanguage.zip | 2.25 KB | gábor hojtsy |
Comments
Comment #1
matsbla commented@Jelle_S, attiks:
Are there any plans? Do you need help?
Please give your feedback
Comment #2
attiks commentedFor the moment we don't have the time (or client / funding) to do it, if you want to give it a go, feel free and we will review the patches.
I think entity fallback is the most sane approach
Comment #3
gábor hojtsyHere, I ported the module, you just need to replace "sublanguage" with "language_fallback". Needed it for a session I am doing *tomorrow*:
sublanguage.info.yml:
sublanguage.module
config/schema/sublanguage.schema.yml
Sorry no time for the patch form now.
Comment #4
gábor hojtsyComment #5
attiks commented@Gábor Hojtsy thanks
Comment #7
attiks commentedRenamed and committed as 8.x-1.x, dev release will be available in 12 hours.
Comment #8
siliconmind commentedHave a look at alternate approach in OOP/Symfony style. It uses custom
language_managerservice and and implements fallback by overridingConfigurableLanguageManager::getFallbackCandidates(). The solution uses config files but can be easily be updated to include UI.I know that those ugly hooks weren't removed from core entirely but I don't see a reason why we should still use them in places where we don't need them.
Comment #9
gábor hojtsy@SiliconMind: there is no reason to swap out the whole language manager for this feature, that is why the hook is there. If some other module also wants to swap out the language manager for some other fun thing, then your feature is killed entirely. Using the hooks you can integrate with more modules and your feature is less prone to disappearing entirely.
Comment #10
siliconmind commented@Gabor I'm aware of that but on the other hand this is actually a core feature and using hooks for it feels just awkward. Especially since we actually run Symfony under the hood. Also hooks hurt performance more than swapping services. Anyway, I'm uploading the whole thing for reference.
Comment #11
gábor hojtsyThat hook is a core feature as well, that is how my code worked.
Comment #12
jose reyero commentedWhile I agree with @Gábor, I think there's something we are failing to communicate and maybe it should be written somewhere because it may be somehow frustrating for module developers.
IMO there's some missing documentation/policy about "why replacing core services/components is not usually the best practice for contrib modules". Actually I think contrib modules doing that should be getting some special tag as they won't work with other contrib modules doing the same...
@Gábor, do you think this is worth some documentation / policy discussion? Because so far this handbook page seems to be actually encouraging people to replace core services in contrib modules, https://www.drupal.org/node/2026959
Comment #13
gábor hojtsy@Jose Reyero: I don't think we need to discuss a "policy" for that, I think its crystal clear. Added this to https://www.drupal.org/node/2026959/revisions/view/7345813/8762001
Comment #14
jose reyero commented@Gábor Hojtsy,
Much better, thanks.
Comment #16
penyaskitoLooks like the 8.x-1.x-dev release was never created.
Comment #17
attiks commentedStrange, on phone right now, will have to check tomorrow
Comment #18
penyaskitoCreated #2593903: [language_fallback] Language Fallback in the Drupal 8 Contrib Porting Tracker project (https://www.drupal.org/project/contrib_tracker)
Comment #19
kalpaitch commentedAs discussed with @attiks I'm planning to incorporate some of the extra 7.x-2.x functionality. I have a use for it.
Comment #20
attiks commentedCode is cleaned, bate release created