Crosswords 0.3.3: Double Dutch

It’s time for another GNOME Crosswords release! This time we had a focus on I18N support. I also got patches from another new contributor – Philip – who added some nice improvements, dutch-language support, and a downloader.

New features include:

  • A preferences dialog to let you filter puzzle sets by language. This gives us a way to only show puzzles either in your current language or in all languages. It opens the door for puzzle sets and downloaders in different languages.
  • Translation support. We have Dutch and Spanish translations now. It would be great to see more languages available for the next release.
  • Don’t grab focus when clicking on a clue. This was a small change that had a big impact on playability.
  • Copy/Paste support for the grid.
  • Undo/Redo support for the game.
  • Use the shiny new libadwaita AboutWindow.
  • Input now works on MacOS, making it fully playable on that platform.
  • Dutch-language crosswords work with the ‘IJ’ cell.

Wait, what’s that last one???

Amazingly enough, it turns out that Dutch crosswords allow an ‘IJ’ digraph in the same cell. This is an interesting twist on the crossword, as you can add an ‘I’ and ‘J’ character independently, as well as together.

Dutch puzzle showing IJ cell
Dutch puzzle showing an ‘IJ’ cell

To support this, I added a Quirks object that can be used to modify the behavior of the game. Beyond Dutch support, I started adding support for rebus-style crosswords as a second quirk. I imagine having to add more as we add additional language support.

Fortunately, we already supported strings within answers so this wasn’t too hard to implement. However, I’m not 100% sure I got the input controls correct. If you’re a Dutch crossword solver, I’d love to hear from you. I also hooked up the quirks to the help overlay so it only shows the special input mode when you have a puzzle that needs it (or are running it in Dutch).

I also added another extension to the .ipuz implementation to specify the locale of puzzles. We use that to filter puzzles, and add the quirks.

Lessons learned:

I thought I’d write down the things that I got stuck on this cycle in the hopes it saves other people time in the future:

Recoloring SVGs

GtkImage has the really convenient ability to recolor images when the appearance changes from light to dark. As far as I can tell, that functionality isn’t exported, so to use it you have to load the svg as a symbolic icon. Despite the documentation, it’s pretty finicky to get that correct so make sure to read all the documentation carefully. In addition, GtkImage really wants the image to be icon sized. You can override that with gtk_image_set_pixel_size().

recolored locked puzzles
Thanks to Sam for the new icons, shown here recolored.

Translating keyfiles with meson

We use keyfiles (aka, .desktop files) as a config file format to define the puzzle sets. These config files have user-visible strings added to them them, and then are compiled into a gresource file. This was surprisingly hard to get translated. Some notes:

  • xgettext supports –keyword=Keyword and -kKeyword to define custom keywords to translate. Unfortunately, despite being documented otherwise, msgfmt only supports –keyword=Keyword. Don’t use -k.
  • Meson doesn’t allow you to pass the language type to xgettext for an arbitrary file. In order to force it to use the correct type, I had to name my config file puzzle.config.desktop.in, and rename it to puzzle.config post-translation.
  • There’s no way for meson to have a compile-time dependency on the po files for i18n.merge_file(). In order to test it, I had to remove the translated desktop file in order to force rebuild it after every translation change. Meson 0.64 is supposed to fix this.

What’s next?

  • I’m giving a talk at GUADEC! Come hear the details of how this game was built and some interesting facts about crosswords. Sadly, I’m scheduled at the same time as the always-popular gnome shell update, but hopefully a few people will be interested in what I have to say.
  • To fully support internationalization, we need to support other languages for the wordlist. There’s an open bug for it. The work here shouldn’t be too hard, but will require a decent amount of work to make sure we’re multi-byte clean.
  • And as always, if you are interested in writing and publishing crosswords, let me know!

Download on FLATHUB

 

Leave a Reply

Your email address will not be published. Required fields are marked *