-
Notifications
You must be signed in to change notification settings - Fork 129
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
Czech translation #499
Czech translation #499
Conversation
Added Czech translation for the Base game, Intrigue, Dark Ages, Seaside. - ReportLab only supports ISO-8859-1 (Latin1) encoding. Czech language (and others) are not supported in Latin1. Added code in draw.py which loads TTF version of Times Roman font when a non Latin1 language is selected in options. - Pirate Ship contains a new +X coins element. Added corresponding icon to image resources.
Added Times Roman TTF requirement for non Latin1 languages to README.md
Added more detailed explanation of what happens if Times Roman TTF fonts are missing
"CZ" is not defined in ISO 639-1. Changing "cz" to "cs", including folders and db files rename.
Updated CardSorter to use locale based sorting (instead of the previous "strip_accents()" method). Fixes a bug in the previous version which resulted in e.g. Czech language cards to be sorted incorrectly. Correct CZ sorting ("sa" > "sc" > "šb > "ta") vs incorrect ("sa" > "šb" > "sc" > "ta"). Works OK even in German (de).
Thanks! I'll try to get to testing and reviewing this weekend. |
As a note right away, it does look like you need to Also, look at the failing card db compile tests? |
- Linted using "pre-commit run --all-files"
I have run |
Additional "doit update_languages" to rebuild the latest cs databases (to reflect sets_cs.json fix from the previous commit).
Looks like the |
Yeah, this needs at least the full locale name (language_REGION) like |
Seems it is a bit more complicated than that :/ All tests pass OK on my Windows machine (running Python 3.8.18, so same as the test job). The root cause seems to be related to Docker Ubuntu image for the GitHub Action job not having the necessary locales available / set. Together with using incorrect language codes (as you pointed out). Surprisingly the default language codes work on Windows as I wrote above... I will see if I can figure out some workaround, if not I will revert the locale based sorting back to at least have the rest of the PR working.... Some interesting reading: |
1) Added all necessary locale languages to the Workflows (compile_card_db.yml and lint_and_test.yml) 2) Also OS dependent locale.setlocale switch in main.py 3) Had to rename "nl_du" to "nl_nl" to match a correct language code
I think I managed to figure it out. Required 3 fixes:
All tests should pass now (tested the Workflows on my local machine using |
- Exception handling when the locale cannot be set (will not set locale and sort by the default locale) - Added locale based sorting information to readme
Added some error handling for when the locale cannot be set (mainly on Linux systems). In that case it will generate a warning and revert to default locale based warning. I think this together with my previous commit is finally a "safe" solution. I also added explanation to Installation section of The |
This works for me locally now. I'm guessing you maybe need |
Added sudo to YAML workflow actions
Right - as you say, for whatever reason it works without |
So I'd like to land this, but I'm getting
on my mac. Same in one of the units tests. Will try to figure out what's going on. |
Updated README.md to add sudo command when installing locales in Linux systems
Sorry, I cannot help with that much - do not have Mac :-/ Everything works OK on my Windows 10 and Ubuntu 22.04... |
This seems to have something to do with not specifying an encoding in the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems to crash on Mac in this form - can you try a 'UTF-8' encoding for comparisons?
Thanks for the detailed write up of those options @smrky1 Since we have a dockerfile now, IMO the best option would be 4. We can easily install |
Remember we need to make sure that all of this also works for the online version running in AWS Lambda, which is the access point for most (almost all) users. It's probably not too hard to get that working, but may mean additional work on my side. I'm leaning towards just making pyicu an optional dependency that we use if present, current behaviour if not. To note, I'm also travelling for work the next week or so so may be slow to respond. |
Makes sense: you can have Lambdas run arbitrary images, so some configuration changes needed but should work fine. Might be able to install the pyicu at runtime also but it's probably better to pre-build it.
That seems reasonable, we can bake it in to the docker image for easy access if folks need it (and avoid all the install hassles that @smrky1 documented above). I'll make the dockerfile change in this branch.
Safe travels! |
Well, you can't run arbitrary images, just ones based on supported lambda runtimes or close matches. Plus, the function I use is currently an automatically generated one via CDK's python lambda support, not a custom docker lambda. I can switch it, but again, a bit of work :). So yeah, I'd say
|
OK, agreed! I will take care of 1) in the next few days. @nickv2002 While you're at it... I checked you dockerfile (being completely new to Docker), and it is not clear to me what line 4 does: Is |
Yeah lots of complexity details there, I was being overly general and you know the implementation details much better. (Just for ref, here the feature I was thinking of and a python example.)
Sounds good to me.
That's a way to get the fonts into the image by copying them from somewhere else (in this case another image) rather than hosting fonts in this repo. |
Might be worth adding to the documentation information on how to set it up correctly then. When I run
|
@smrky1 thanks for that note, it was an arch mismatch (that line is just pulling files, but it still looks for the image of the same arch, I fixed by telling it the specific arch to use). Fixed and merged over here: #503 along with adding
|
Fixed Czech sets translation (removed <br> tags + fixed unclosed <i> in Dark Ages)
- Added optional PyICU support for correct dividers sorting (based on the selected language). - Removed the previous `locale` based sorting (not working on all OS, crashes on macOS) - Updated README.md accordingly
Removed install locales from workflows, no longer needed (based on the switch to PyICU)
Added PyICU install to workflows (Ubuntu only)
Remove local files from .gitignore
Added pyCharm project (.idea) to .gitignore
|
- Added Czech translation for Alchemy, Cornucopia, Hinterlands, Prosperity + promo cards - Fixed wrong Peddler description: +2 Coin -> +1 Coin
FYI, I completed the translation of all expansions available in Czech language translation). In the process I found out that the original English set has wrong Peddler description: "+2 Coin" -> should be "+1 Coin". Will rename the pull request title to reflect this. |
Just getting back to this, will review before I go on my next trip next week. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me overall, minor comment.
You'll need to rerun precommit run --all-files
as I bumped the black version which seems to have changed formatting.
Implicit sys.modules call to detect icu availability replaced with a helper "have_icu" variable.
Only today I found some time to review your feedback. I rerun linting + replaced the implicit sys.modules call to detect icu availability with a helper "have_icu" variable... |
I just deployed this to the online generator (sumpfork/bgtools_web#40) with instances of all the needed fonts and pyicu for sorting. Took a bunch of work, but I think it's mostly correct now. |
Added Czech translation for the Base game, Intrigue, Dark Ages, Seaside. Required a couple more changes: