-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Add fluent builtin Tera function. #1040
Conversation
How does passing args work? |
Oh yes sorry. It works as you would expect. You name the arguments in the function call and they are converted to arguments for fluent. I've linked the tera function implementation below. {% fluent(lang="en-US", key="menu-item", arg="hello") %} |
e7e57d4
to
4400d9a
Compare
@Keats Hey, sorry for not getting back to this sooner, I was polishing up a new release of the underlying library that should now have more documentation on how it works. I'm unsure about what tests need to be added and where to add documentation for this feature in Zola If you could give me any advice on what you think needs to be added for this be ready to be merged, I would really appreciate it! |
I need to think a bit on the best way to integrate fluent to Zola. I think the easiest test would be to add translations to the test_site_i18n site and check that it works well but we do need to figure out the structure etc |
So I personally don't know if there's a lot that needs to change on Zola's side. The Aside from that I want to make a few additions to this PR which is changing Another thing that I'm not sure if we want to include in this PR or separately would be to add I was thinking of just adding a languages = [
{ code = "fr", draft = true },
{ code = "de" },
] One thing to consider is how to make this work with the current blog content localisation system ( |
Draft languages can definitely be added later on. |
@Keats Im currently preparing a new release of tokei at the moment but once that’s finished I’ll polish up this PR and make a post on the Zola forums asking people to try it out. |
Thanks for tokei by the way! |
Have you guys have an ETA on this? Is there any way I can help? |
Hey, unfortunately I've had less time than I've hoped and there's some migration work to implement this right, so for now I'm going to close this PR. @BertalanD If you'd like to continue on the PR I'd be happy to help out with documentation, answer any questions, and review code. I've listed the details of what I think is required for this feature to be ready.
|
Should the user be able to override Fluent messages of themes? I think we also need to set a clear hierarchy for Fluent resources, like:
The algorithm for determining which Fluent resources get loaded should be the following:
A template author should not need to duplicate all of the messages just to account for slight regional differences in spelling. We should use @XAMPPRocky In the example above, the template
The template
|
This change was proposed by XAMPPRocky in getzola#1040.
Co-authored-by: GitHub Action <action@github.com>
This change was proposed by XAMPPRocky in getzola#1040.
@BertalanD It seems there's some merge conflicts. I created a rebased version at https://github.com/XAMPPRocky/zola/blob/fluent-rebased have a look and if it's good I can push it to here. |
Sure, go ahead.
|
Here's a quick to-do
|
@BertalanD Thank you for writing this, and I agree with that general direction however I think we should separate some of those items as I don't think they are all required for this to be ready to be merged versus being "feature complete". For example I think it's okay if the algorithm for loading locales isn't perfect at first (I'm also not sure which parts of it are already implemented by |
Don't worry about that bit, the reload system is going to change as soon as I have time ™️ |
Writing this up as a TO-DO for myself but I'm curious if it seems reasonable. We should probably add an I need help with making Which theme should I start porting over to the new localization system? I have the time to work on something that isn't available for Zola yet. |
Going to close this for now as it is now out of sync with the main branch. |
Could you open an issue for what you think is needed on the fluent-templates side and we can discuss there? |
This adds a new tera builtin function
fluent
function if there's fluent localisations directory. Obviously more documentation, and tests are needed, but I wanted to open a PR to discuss how the feature should work before doing that.Tera Example
Sanity check:
Code changes
(Delete or ignore this section for documentation changes)
next
branch?If the change is a new feature or adding to/changing an existing one: