Feature request: Allow setting document language for hyphenation
See original GitHub issueIt would be nice if Homebrewery allowed setting document language other than English. All it would do would be placing a lang
attribute on the appropriate HTML element.
The main use case is hyphenation, which requires the correct HTML lang
attribute to be set. Specifically: I would like to typeset documents in English and Russian with hyphenation. While I can set hyphens: auto
in CSS, currently neither language works because there is no lang
attribute in the document, so the browser doesn’t know which language to hyphenate for.
Issue Analytics
- State:
- Created 2 years ago
- Comments:11 (1 by maintainers)
Top Results From Across the Web
Native language hyphenation - InDesign UserVoice
Hi John, maybe this could help. In my german Indesign Version under Preferences > Hyphenation i can choose "Duden".
Read more >Control hyphenation - Microsoft Support
Hyphenate part of a document manually · Select the text that you want to hyphenate. · On the Tools menu, click Hyphenation. ·...
Read more >Working with Hyphenation in C#|Aspose.Words for .NET
Since different languages use different norms and rules for word hyphenation, the optimal solution for correct hyphenation is to use special dictionaries.
Read more >optional fields in setup | Hyphenopoly - GitHub Pages
To hyphenate a text, its language needs to be known to the system (be it native CSS hyphenation or Hyphenopoly.js). Thus the language...
Read more >hyphens | CSS-Tricks
Conditional hyphenation characters inside a word, if present, take priority over automatic resources when determining hyphenation points within ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
The appropriate element would likely be the
<div class="pages">
, which wraps all the individual pages.In the brew properties panel we could put a simple text field with default value of
en
. We’d need to allow for more than 2 characters as valid lang attribute values includes “zh-Hans”, “zh-Hant”, “ru-Cyrl-BY” etc.Hmm … the max length can be figured from https://www.ietf.org/rfc/bcp/bcp47.txt … it’s late, I’m tired, and I left my ABNF decoder ring at home.
So I have the above set up except instead of hardcoding both the code and the ‘name’ it only needs the code, and the display name is automatically given in that language. Same end result, but with less work.
I am working on setting the regexp pattern now. I see your basic pattern
[a-z]{2,3}(-.*)?
and that seems good enough to prevent entering ‘English’ or similar names…is that ‘good enough’ for our purposes? Or should we use a more robust pattern as given here:Note, on initial testing with this, it still allows for “English” as a valid entry, so i’m not sure if this regexp needs tweaking or if that is desirable.
This also only is a regexp pattern…it would allow for invalid values as long as they fit the pattern. So instead, we could use a library like IETF Language Tags which would provide methods for checking against the actual list of language codes.
I’m just not sure how deep we want to go? If we settle for just a limited list, it isn’t hard to add languages later…it would just be adding the correct code to an array without even worrying about the displayName, since that is automatically taken care of.
I’ll upload my branch today. And for now i’m just going to use your pattern.