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

Add support for other languages #2

Open
k-nut opened this issue Feb 3, 2014 · 11 comments
Open

Add support for other languages #2

k-nut opened this issue Feb 3, 2014 · 11 comments

Comments

@k-nut
Copy link

k-nut commented Feb 3, 2014

Other languages such as German and French use different ways to quote. I implemented a basic mechanism to adapt to the language of the document which is set via <html lang='de'>. You can try it out with the commits from my fork. It seems to work for German but the French is getting mixed up by the 'em in one of the first paragraphs in the badger.html. Would you like to merge this into your version once it is working?

@kellym
Copy link
Owner

kellym commented Feb 3, 2014

Great idea! I'd definitely would like to merge it in -- multi-language support would be super useful.

@k-nut
Copy link
Author

k-nut commented Feb 4, 2014

I found out that in order to solve the problem mentioned there needs to be a dedicated way to handle apostrophes for abbreviations. This is not a problem in English since you just use the same symbol that you use for a single quotation mark. This is not the case in German and French though. So there needs to be a way to properly find those. Any ideas?

@cedricmay
Copy link

👍

@callumacrae
Copy link
Collaborator

@k-nut: I appreciate that you're probably not interested in doing this any more, but if you are (or if anyone else wants to have a go), I think a state machine would be useful here. Unfortunately, most libraries to do that in JS are bigger than this library! Still, I think it would be a useful feature—possibly in another file (smartquotes.js and smartquotes.multilang.js`?).

@k-nut
Copy link
Author

k-nut commented Mar 2, 2015

Hey @callumacrae I would sure love to finish this. I got the German version running after all and would at least like to include that. How do you think a state machine could be useful here? And splitting this into another file for multilang support seems like a good idea!

@callumacrae
Copy link
Collaborator

I'm not sure, but if you gave me a specific case where regular expressions wouldn't do the trick, I could try to explain an example.

@k-nut
Copy link
Author

k-nut commented Mar 2, 2015

Well one problem for example are years like '93. They are replaced by the character that also is the beginning single quote () in English. In German & French the beginning single quote is another character though ()... I guess that this could be worked around with regex as well. It's been quite some time since I last checked the code...

@callumacrae
Copy link
Collaborator

I see. So de and fr use different characters for quotes and abbreviations, which en uses the same?

I can't see any way around that short of replacing both the start and end quote at the same time. I wonder how other libraries handle this.

@k-nut
Copy link
Author

k-nut commented Mar 2, 2015

As far as I am able to tell that is right. I'm not a language/typography expert though... Good question how the other libraries handle this!

@callumacrae
Copy link
Collaborator

I can't even find any other libraries that do this!

@j-rieck
Copy link

j-rieck commented Apr 10, 2015

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

No branches or pull requests

5 participants