Adding further languages - about the pattern filesWhat we have nowCurrently, there's support for - English
- German
- French
- Dutch (thanks to Remco Bloemen)
- Swedish (thanks to Andreas Johansson)
- Spanish (thanks to Luis Pabón)
- Malayalam, Tamil, Hindi, Oriya, Kannda, Telugu, Bengali, Gujarati and Panjabi (thanks to Santhosh Thottingal)
- Italian (thanks to Stefano Gorini)
- Finnish (thanks to Olli Wilkman)
- Russian (thanks to Dmitry Vedernikov)
- Polish (thanks to Kamil)
- Danish (thanks to Henrik Ryom)
- Portuguese (thanks to Lailson Bandeira)
- Hungarian (thanks to Péter Nagy)
- Czech (thanks to Martin Hasoň)
- Ukrainian (thanks to Alexey Grekov)
- Turkish (thanks to Andreas Lappe)
- Armenian (coming soon thanks to Sahak Petrosyan)
But Hyphenator is written in a manner that makes it easy to add support for other languages. What you can doTo add a further language, a language pattern file is needed. If you have a (complete) list of hyphenated words you may be able to compute patterns by your own (if you can, you know how). If not, go to http://www.ctan.org and search the LaTeX hyphenation patterns for your language (be aware of the license!) Next steps you will have to do: - to convert the patterns
- to build a pattern file
- to change code in Hyphenator.js
- send-in changings and patterns if you feel like (I'll take you as a supporter for this language, you'll get full attribution)
Converting the patternsVersion >1.2.0- make shure that the licence of the pattern file allows reuse for Hyphenator.js
- work on a copy of the file, call it lang.js (e.g. 'en.js')
- convert the file to UTF-8
- replace the lccodes (if any) by their respective characters
- remove all comments (from '%' to the EOL) from the LaTeX patterns.
- replace all linebreaks by a single space. At the end there should only be patterns in the file, separated by spaces.
- use compressor.html (that comes with the Hyphenator-package) to build the patterns and information for Hyphenator.js
Version <1.0.2- LaTeX patterns are coming in this form: .ab3s2. To see the difference I use underline instead of point. A simple search&replace will do the trick: _ab3s2
- All pattern files should be encoded with UTF-8 (with BOM).
- Copy an other pattern file and replace the patterns.
- Adjust the other variables as following:
| Hyphenator.leftmin | On the old line, there shall remain this number of letters at minimum (preventing e.g. ' a-') |
| Hyphenator.rightmin | This number of letters at minimum are on the newline (preventing e.g. '-a ') |
| Hyphenator.shortestPattern | The sortest pattern in the list (for better performance). Do not count the numbers! E.g. the pattern _ab3s2 has a length of four (4). |
| Hyphenator.longestPattern | The longest pattern in the list (for better performance). Do not count the numbers! E.g. the pattern _ab3s2 has a length of four (4). |
| Hyphenator.specialChars | Non-ASCII-letters used in this language. |
- Dont forget to change the language on the first line and to change the filename accordingly.
adapt code in HyphenatorThere is one thing you HAVE to change and one thing you SHOULD change in Hyphenator.js: - languageHint: Add the new language to the list. Please use the ISO 639-1-Code for the language to be supported.
- prompterStrings: This strings are used if the language of a document isn't defined. Please translate this short text to the language to be supported.
Make some tests to see, if it works! send in changings and patternsIf you like to support Hyphenator, you may send in the work you've done. You'll get full attribution. I will ask you to put your Mail in the header of the pattern file (see nl.js for example).
|
ađfầ
Hungarian - comming soon (thanks to Péter Nagy)
comming -> coming
Thanks