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
I18n: Switch locale helpers #1466
Conversation
Thanks for diving in @joallard. I'm traveling right now, but will try to review and comment soon. |
You're absolutely right, this extension is really crufty. I've merged in a lot of features, not knowing which are good or bad because I only use i18n in the simplest way, myself. We'd love any direction, code and ideas you have. I really like this iterative approach, slowly adding features rather than a complete do-over. I'm going to push out v4 beta 1 today, so let's save this for beta 2. And we need to track down that failing test. |
Awesome. I'll go forward then! |
I can't find where the layout option has been implemented. The tests have been added after the implementation. Pointers? |
Should be this: https://github.com/middleman/middleman/blob/master/middleman-core/lib/middleman-core/core_extensions/front_matter.rb#L44-L45 I think it's unrelated to i18n, but it is related to changing the order things run in. |
About that failing test: it's because Routing overrides the Frontmatter layout setting with what's in |
Can I get help on this? |
Haven't had time. |
@joallard Can this be brought up to date with beta2? |
Okay, let me get to it |
@joallard While you're at it, can you target the |
Will do |
Can't do I rebased on master, but there are still some failures. |
Any updates for the issue? |
@tdreyno Is it okay if this is a master-only patch? (ie v4 I presume?) |
Yes |
Does this PR add support for I18n'ed frontmatter keys (as per the title of the PR)? I don't see it in the code... |
@tdreyno I'm a little busy at the moment, and my confusion with the failing tests and ext load order (among larger components) has prevented me from being more proactive in fixing this PR, but let me know if there's anything I can do or answer. I'd be happy to help Middleman get a killer i18n any way I can, it's a truly great project you've made you guys. |
Cool. I'll try rebasing and see where things stand now. Thanks! |
Any updates on this? |
Seeing
|
What I'm tiptoeing around is the (Btw, the rebase fixed the extension priorities that seem to have magically been sorted out) |
a80c139
to
853e90f
Compare
Whew! And here we are. Works. Rebased. That required concentration. As we can see (I activated verbose commit mode), it pretty much comes in one piece. It's dependent on #1996, so we'll solve that first. What's left:
We'll probably get some edge cases too to add in there. Maybe @tdreyno you can give me some tips or things to watch out for for that |
Also, is there a reason we don't use Pry out of the box in dev? |
Next up: remove the (*) |
@joallard I think because we used to support versions of Ruby which didn't support pry... but now, good to include by default |
7dd882b
to
89c9437
Compare
FYI here's my I18n helper methods I've added to my Middleman setup: https://gist.github.com/johnnyshields/98a695df51b1e99f3593579d3c9a3fd1 One thing to note is that my primary locale is Japanese, so my site root (/) is Japanese, and other locales are at /en/... etc. Would be good if this can be support in this PR. |
I had a refactor lingering, it's pushed at e67608d. @tdreyno you'll probably notice that I've got references to the (The refactor commit has failures, but the first commit is good iirc. This is not exactly priority no.1 for me at the moment, but I wanted to share my work so someone could build off of it in case.) |
Hi! I just wanted to take a moment to thank yinz for the ongoing work on this issue. This (year-long!) thread has been really informative and has helped me figure out how to move forward with my Middleman project. I also really appreciate the supportive tone and graceful acknowledgement that OSS is hard, language is hard, and people are busy. Thanks again for sticking with this. 👍 |
Looking for a passing build, but happy to review whenever |
I don't have so much time to dedicate to this right now, but it should be only a matter of fixing a few loose ends on the tip of the branch. I'm happy to help if someone wants to pick it back up. |
That liquid error is a whole other thing I need to clean up (likely by removing tests for old versions of liquid), you can ignore it |
Hi, any update on this one? |
I've been hacking Middleman a lot (by monkey patching and reopening some framework classes) to get Internationalization, Blogging and Directory Indexes playing along for my personal website. I think I grasp how the code currently on master works and I'd love to contribute, but I don't know what the project standards are, how the code should be tested, if there's any backwards compatible behavior that should not be broken, etc. I'd really appreciate any information. I'm looking forward to solving this issue, since the solution I've made for my website just feels like a complete duct tape mess and I'm pretty sure that would break in the next Middleman release. It just would be freaking nice to get it working in a cleaner way. Cheers! |
I also spent a lot of time, having to understand nearly all messy internals to be able to duct tape our locale switch helpers together. |
Any updates? |
@dorellang If you can write a specification of how it should work, we can convert that to a Cucumber test |
This was a good run, y'all, it brings back memories. 😉 Glad you were able to clean this one up @tdreyno |
This is as a follow-up to #1390 and #924.
In practice, the following helpers are being added:
(integrated intolocale_path(page_id, locale = I18n.locale)
, so we can easily construct eg. a<nav>
with language-agnostic keys.url_for(*args, locale:)
and thuslink_to
)other_locales
andother_locale
, some niceties for the following method...switch_locale_path(locale = other_locale)
, so we can easily switch language while staying on the same resourceInternally,
I recycled
@maps
that seemed to be useless and used it as a localization map, it would now look like this:Which makes it easy to find a localized path.
The extension is in bad need of a refactor. I can do some things if the feedback is positive.
I've had to prioritize loading the Frontmatter extension before I18n, because we're using the
page_id
frontmatter key. Since Routing depends on I18n, this means Frontmatter is now before Routing as opposed to after. Don't know what this means for the rest of the features.Work in progress; please comment.