-
Notifications
You must be signed in to change notification settings - Fork 42
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
Dynamically passing content key from model to template #36
Comments
@jeffharrell is there no way within Controller to access language bundle to match a key value for current locale to a dynamic object returned from DB? Say I have a Lucene search that includes facets with stats I want to update in sparklines as pages load, and sparkline file is include. I need sparkline file to be able to iterate through list of objects in model with stat count, list of bars, and a label to dynamically build 2 - 5 of these sparklines. The counts are okay but the label needs to match a key in bundle for current locale. I cannot seem to find a way to get this to work without hard-coding templates and lose the ability to just include a dynamic sparkline file that accepts list and renders mini stats. Example model
Problem is even if I include key values matching bundle properties, since bundles evaluated at build time I'm unable to dynamically build this row of sparklines with the label for each stat. I cannot seem to find a way to render this content dynamically on the page and match language bundle key. Goal would be to have a dust template that iterates through Idea would be that the model includes label |
@jeffharrell I built a helper to solve the issue short term and sharing on my personal page at: https://github.com/mikesparr/Kraken_Example_i18n_Helper I'll keep my eyes open if you solve dynamically matching keys in Controller or have a better way to do this but hopefully this will help others in short term. Feel free to share, take, etc. |
We're moving away from build-time localization of templates, so this will be moot in the new design. |
What will be the new design without build-time localization? |
Templates will include |
I read in #21 that you cannot pass in content key dynamically to a template. I am curious whether my issue in #35 could be solved by having a list of keys in the model object and the template could evaluate those keys and inject the proper content from the current resource bundle.
Example Model:
Example property bundle:
On the template perhaps:
I appreciate steer on how best to accomplish #35 and whether this might be possible but I'm missing something.
The text was updated successfully, but these errors were encountered: