-
Notifications
You must be signed in to change notification settings - Fork 72
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
i18n for fixed problem description strings #150
Comments
Yes please! We've felt a need for this, and tried to do something like it for BOI 2018: https://github.com/nordicolympiad/baltic-olympiad-2018/tree/master/templates. Some phrases could be reused from there. (That used latex includes though, which made the problems non-freestanding and Kattis people unhappy. Which we should have solved by copying the files into every problem folder, but that would have been a bit annoying for us, as well as making updates harder, and we were too stressed to do it.) |
I see. What I’ve done so far is only to streamline the result of problem2pdf, which means localising exactly the 5 strings defined in Many of the other strings you mention seems to “live” somewhere else (constraints, memorylimit), and I’m unsure what to override. To be honest, I don’t even know if the HTML page that ends up on a Kattis instance is produced by problemtools/problem2html , or if Kattis has its own version. (The localisation that really triggers my OCD is what one should do about language-specific conventions for decimal numbers: “Förklaring för exempel 1: Den sammanlagda sträckningen är 14,233345”.) |
Ah, yeah, the additional strings are probably a separate discussion from this (though they would be very useful). Time limit/memory limit were from when we created freestanding pdfs of the problems, those strings wouldn't appear on the web. Kattis does use problem2html, and yes, the strings work with HTML as well. |
I can submit a pull request from my branch any time, but maybe it’s premature. It works with the problems that I’ve tried it on, including the warmups from the Swedish olympics. I’ve tested with explicit selection form the command line, presence of various problem.xx.tex, single problem.sv.tex, without command line flags, etc. Seems to work, and degrade somewhat gracefully if it can’t find the proper files, but I may be naive about which environments it would be run in. |
Problemtools allows problem descriptions in multiple languages, but the fixed headlines are hard-coded in English like this:
problemtools/problemtools/templates/latex/problemset.cls
Line 222 in 063b68a
It would be nice if those few headlines were localised, based on the two-letter language code of the problem description file.
One way I can think of doing that, implemented on https://github.com/thorehusfeldt/problemtools/tree/feat/i18n is to provide localisations in a yaml file in the template directory
/problemtools/templates/latex/strings.yaml
Then
/problemtools/templates/latex/template.tex
gets a few new placeholders:and the templating mechanism in
problemtools/template.py
takes care of replacing strings intoself.language
, falling back on English.Other approaches exist, such as using templates in
problemset.cls
. Or using babel. But the above works, and is quite light-weight.The text was updated successfully, but these errors were encountered: