[HN Gopher] Implementing UI translation in SumatraPDF, a C++ Win...
       ___________________________________________________________________
        
       Implementing UI translation in SumatraPDF, a C++ Windows
       application
        
       Author : jandeboevrie
       Score  : 40 points
       Date   : 2025-09-25 19:17 UTC (3 hours ago)
        
 (HTM) web link (blog.kowalczyk.info)
 (TXT) w3m dump (blog.kowalczyk.info)
        
       | on_the_train wrote:
       | I'm also trying to avoid the gettext monstrosity to be introduced
       | into our c++ codebase after making equality great experiences
       | with a self-build solution in previous teams. It's ok so solve
       | easy problems by yourself. Good for the author for thinking for
       | himself.
        
         | AndriyKunitsyn wrote:
         | It is okay to solve easy problems by yourself. It is not okay
         | to treat hard problems as easy problems because you lack domain
         | knowledge.
         | 
         | Compared to gettext, OP's solution doesn't have positional
         | formatting or support for additional plural forms.
        
       | NooneAtAll3 wrote:
       | Looking at strings in the linked apptranslator.org website, a lot
       | of them have ampersands (&) e.g. "&Back" or "&Book View"
       | 
       | What do those mean?
       | 
       | Translations seem to put them in the middle sometimes
       | 
       | ---
       | 
       | on the other hand, there are languages even with "0 untranslated
       | strings" that have untranslated "unused strings" - what are those
       | about, and is it okay to not have those be tracked?
        
         | godshatter wrote:
         | It's been a while, but that might mean that (in the example
         | above) B is the shortcut key for that menu item.
        
         | mananaysiempre wrote:
         | Windows convention for access keys (as opposed to keyboard
         | shortcuts). E.g. you can choose &File > &Open by pressing Alt-F
         | then O (as an alternative to Ctrl-O), with the requisite keys
         | underlined when you press Alt; you can choose the dialog option
         | labelled &Abort by pressing Alt-A, with the requisite key
         | always underlined in the traditional Win32 toolkit. (By
         | convention, OK and Cancel don't get access keys, as you can
         | always use Enter and Escape respectively instead.) Not every
         | menu item gets a shortcut, but in a competently designed
         | Windows UI every one gets an accelerator.
         | 
         | (This idea is nice but not without its problems. For those of
         | us who regularly use more than one keyboard layout or even
         | system locale, it doesn't work all that well.)
        
         | ayi wrote:
         | When you press ALT on windows you will see that some characters
         | on menu items are underlined. When you press alt and these
         | letters you can open that menu. To indicate which character to
         | act as that you put & before that.
        
         | neerajsi wrote:
         | Looks like the ampersands appear in menu items to indicate the
         | keyboard shortcut key to navigate to that item.
         | 
         | https://willus.com/mingw/colinp/win32/resources/menu.html
        
       | rikafurude21 wrote:
       | I had to implement multilingual UI for my app recently and the
       | best method I found was using an LLM API inside a script which
       | just runs on build and anytime a new text field gets added it
       | gets the translations and stores it in a JSON where the right
       | strings are picked based on system language or user settings. The
       | annoying part was adjusting the entire UI to the new 'dynamic'
       | string selection functionality but other than that, the tokens I
       | had generated only cost maybe a dollar. I suggest the author
       | looks into that, because waiting for user submissions could take
       | some time
        
       | bramblerose wrote:
       | The solution to the "interface/tooling to translate" problem, at
       | least for open source applications, is https://translatewiki.net/
       | , with the additional benefit that it comes with a team of
       | experts that can help you understand how to deal with stuff you
       | might be unfamiliar with, such as RTL languages and plural forms.
        
       | Kwpolska wrote:
       | > [gettext] also doesn't solve the 2 hard problems. I would still
       | have to write code to extract strings from source code and build
       | a way to allow users to translate them easily.
       | 
       | The first problem is solved by the xgettext tool.
       | 
       | The second problem is solved by services like Transifex. Or by
       | telling people to use Poedit and having them submit GitHub pull
       | requests.
       | 
       | At the same time, gettext does solve the issue of plural forms.
       | This solution does not.
        
         | kevin_thibedeau wrote:
         | Poedit is a cross platform offline GUI that makes it easy for
         | translators to incrementally perform their work. This was a
         | whole lot of unnecessary NIH. Even if LGPL isn't viable, you
         | could use all the tooling and reimplement the hashing in your
         | own code.
         | 
         | https://poedit.net
        
       ___________________________________________________________________
       (page generated 2025-09-25 23:00 UTC)