Skip to content
  • Didier Roche's avatar
    Support C Gettext translations. · 1743fbfd
    Didier Roche authored and Carlos Soriano Sánchez's avatar Carlos Soriano Sánchez committed
    UI files needs C Gettext to be initiliazed. This one can only work from
    .mo files and not from memory binary data.
    
    Consequently, if useCgettext is set to true:
    - external mode isn't impacted (mo files are on disk), apart from local
    choice (see below)
    - embedded mode select the correct mo data (from localization.go embedded
    data) and dump it into a temporary locale directory structure with
    that file content on application startup, before initializing C gettext.
    This will be cleaned up on shutdown.
    - dev mode is like embedded mode with an additional startup step: we
    compile the corresponding po file to mo file first. This modes thus
    requires `msgfmt` to be on system where people run this dev mode weeport
    binary.
    
    To ensure we are loading from the Go side the same locale than the one
    gettext would choose for ui files, we are going to use the returned locale
    by setlocale() instead of our algorithm.
    If useCgettext is set to false, we disable the whole C determinism and
    initialization for locales.
    1743fbfd