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

MMD localization #37

Open
fletcher opened this issue Mar 4, 2017 · 4 comments
Open

MMD localization #37

fletcher opened this issue Mar 4, 2017 · 4 comments

Comments

@fletcher
Copy link
Owner

fletcher commented Mar 4, 2017

For the most part, the language used in MultiMarkdown documents don't matter. Whatever language you write in is the same text used in the output document.

An exception to this, however, is that there are a few phrases used in the HTML source, such as:

return to body
see footnote
see citation
see glossary

MMD-6 includes the i18n.h file to allow automatic translation of these phrases to other languages, without a performance hit.

The default language is English. Support is built in for German (missing 1 translation). Template strings are in place for Spanish.

Additional languages can be added easily.

  1. kNumberOfLanguages needs to be incremented.
  2. lc_lookup() needs to be modified -- a new language should be added to that function following the template for English/Spanish/German. The order is CRUCIALLY IMPORTANT.
  3. lc_languages() needs to be updated. The language added must be at the end of the list (in other words, the order must match that of lc_lookup(). The two letter code should be the official one for the new language.
  4. i18n_language_from_string() needs to be updated for the new language as well, using the lower case two letter code. Again, follow the template for German and Spanish.

Adding a new string is a bit more complicated, and should not generally need to be done. The TranslateTest() function is useful when doing so, however.

If you want to add/improve the translation functionality, please submit a pull request with the proposed changes. (Please use the develop branch for pull requests so I can properly merge and test.)

Thanks!!

@mn4367
Copy link

mn4367 commented Mar 7, 2017

The missing german translation for see glossary is siehe Glossar. Personally I'd prefer if all of the german translations would start with a capital letter like in Siehe Glossar. You never "start a sentence" with a lowercase letter in German and these hints could be seen as a sentence. But other users may have a different view on that.

@fletcher
Copy link
Owner Author

fletcher commented Mar 8, 2017

Thanks. You don't start sentences in English with lower case letters, either, but we're probably more relaxed about whether something is a sentence or not. :)

I changed the German translations to start with uppercase letters for you though...

@mn4367
Copy link

mn4367 commented Mar 9, 2017

Thanks! I saw that siehe Zitat still starts with a lowercase s ;-)

Although it seems to be fairly easy to add translations for additional languages this is only possible for users with software development skills. One solution which would add a lot of flexibility to MMD is the use of metadata in the document to provide translations for these strings. It could look like this:

mmd-hint-body:           Zum Haupttext
mmd-hint-footnote:       Siehe Fußnote
mmd-hint-citation:       Siehe Zitat
mmd-hint-glossary:       Siehe Glossar

If one (or all) of the keys above is missing the default value form i18n.h could be used. If a key is present but has no value the hint in the generated output could just be ignored.

Together with the lang-attribute this could go even further:

lang:                       fr
mmd-hint-fr-body:           Retour au texte principal
mmd-hint-fr-footnote:       Voir note de bas de page
mmd-hint-fr-citation:       Voir citation
mmd-hint-fr-glossary:       Voir glossaire
mmd-hint-de-body:           Zum Haupttext
mmd-hint-de-footnote:       Siehe Fußnote
mmd-hint-de-citation:       Siehe Zitat
mmd-hint-de-glossary:       Siehe Glossar

In the example above MMD would use the mmd-hint-fr-* metadata entries to generate the translations. But maybe this is already a bit out of scope since it could also be achieved with a transclusion in the metadata area.

@fletcher
Copy link
Owner Author

German is fixed. Thanks! I added the French as well.

It actually doesn't take much in the way of software development skills to copy and paste a few lines in the code, but either way I'm happy to update when people send translations to me.

As per the other discussion, I think a complex metadata system is the wrong way to go. In this case, it would require a different system that would have a more negative impact on performance as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants