-
Notifications
You must be signed in to change notification settings - Fork 49
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
Generate code using language fallback #236
base: v8/dev
Are you sure you want to change the base?
Conversation
jvtroyen
commented
Apr 16, 2020
- Added appSetting to enable generation of language fallback
- Added property on PropertyModel to indicate Variant property
- Added fallback parameter to this.Value<>() for Variant properties, when appSetting is true
This is a PR for #235, any way to link them correctly? |
Isn't this already implemented in #206 and available in the latest source? |
Hi @ronaldbarendse , Back on topic. As a developer, I want to use The view-designer (who is a separate front-end developer, not the back-end doctype-designer) would have to chain fallback for each property in his views. One final example. What if the fallback chain was
If I understand correctly the argumentation for extension methods:
In the view, that means you need to code depending in the given culture, whereas the fallback-parameter should simply be allowed to do it's work and present the use of Model.Title with fallback baked in. |
@jvtroyen As per #206 (comment), you should get the title within the current culture or using the language fallback (as configured on the languages themselves) with If you want a custom language fallback (not using the fallback chain configured on the languages), you should use a default value, e.g. IMHO ModelsBuilder should keep its API as close to the Umbraco core |
I see your point about the usefulness of these extension-methods, but I'd still counter by stating that the people designing the views (not developers, but they manage) would need to use On the other hand : I've read many threads and discussions about these extension-methods and version 4. I saw the different branches in the code, but what version on nuget contains these? |
The new extension methods in PR #206 aren't released yet, but will probably be included in the next You currently don't have to add If ModelsBuilder starts generating default fallbacks, it should be generic (and also include E.g. a |
In the meantime, I'm more up to speed with what v4 is. The things I want to avoid, are:
I like what you're proposing, though. An assembly attribute to pick the default fallback. I'll give implementing it a try, both in v8 and v4. |
@jvtroyen There's another approach: implement your own |
That is an excellent tip. Trying it out right now. I guess we can close this as we are no longer in the realm of ModelsBuilder. |
@jvtroyen As per discussion above: this can be implemented by implementing/overriding the property in the generated model or change the registered |