Skip to content
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

Added support for Right-To-Left languages #532

Merged
merged 2 commits into from
Apr 21, 2022

Conversation

MeirKriheli
Copy link
Contributor

No description provided.

@netlify
Copy link

netlify bot commented Mar 30, 2022

Deploy Preview for gohugo-ananke-theme-demo canceled.

Name Link
🔨 Latest commit a5510f3
🔍 Latest deploy log https://app.netlify.com/sites/gohugo-ananke-theme-demo/deploys/625935beb3b1b80008fe2e31

@regisphilibert
Copy link
Member

Hi @MeirKriheli this looks great thank you!

Do you have a repo with a language where this would apply? I'm curious to test it against the default

@MeirKriheli
Copy link
Contributor Author

MeirKriheli commented Mar 30, 2022

Not yet, I'm in the process of converting my blog from self written generator to Hugo, attached a couple of screenshots. Also working on adding Hebrew translation.

Here are some screenshots:

image
image

How about me adding Hebrew content to exampleSite?

@regisphilibert
Copy link
Member

How about me adding Hebrew content to exampleSite?

I'd rather not have to many languages in there, but I have my own sandbox where I stress test the theme with some edge cases, if you could share some hebrew md files with me, that would be great!

Thanks

@MeirKriheli
Copy link
Contributor Author

Here's the WIP of the website I'm working on:
https://github.com/MeirKriheli/meirkrihelicom

@regisphilibert
Copy link
Member

Hi @MeirKriheli thanks for sharing this repo. I realize the languageDirection setting has only been introduced in Hugo 0.67.1. This theme currently as min version support of 64.

As a result running a previous version, $.Site.Language.LanguageDirection will break. We have several options:

  • Wait for Bump minVersion from 0.64.0 to 0.84.0 #541
  • Wrap your evaluation of the site's language direction in a partial which will check for the version before using the .LanguageDirection method. And use given function throughout (See /func directory for code examples)

The latter is great as updating the language direction evaluation logic will be very easy to update in the future.

Let me know if you need any pointer for the function but I guess {{ if ge hugo.Version "0.67.1" }} will be plenty.

Thanks!

@MeirKriheli
Copy link
Contributor Author

@regisphilibert added language-direction partial. Is that what you had in mind?

@regisphilibert regisphilibert merged commit 19242fd into theNewDynamic:master Apr 21, 2022
@regisphilibert
Copy link
Member

Thanks a lot, I revisited your logic a tiny bit without notifying you as was in a the middle of publishing a release and felt this had to be part of it.

I made the dir attribute only added if the languageDirection is explicitly set, so no user gets any surprise. c49009b

Thanks a lot for your work!

tstephen pushed a commit to tstephen/gohugo-theme-ananke that referenced this pull request Jun 9, 2022
* Added support for Right-To-Left languages

* Added language-direction partial
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants