Skip to content
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, feat] Add basic context (msgctxt) support #5234

Merged
merged 7 commits into from Aug 21, 2019

Commits on Aug 21, 2019

  1. [i18n, feat] Add basic dgettext (msgctxt) support

    References koreader#5232
    
    Given an entry in the PO file like the following:
    
    ```
    msgctxt "systemstat"
    msgid "    Total"
    msgstr "Totaal"
    ```
    
    It can be addressed using:
    
    ```lua
    _("systemstat", "    Total")
    ```
    
    This allows to distinguish between separate instances of the same string, for example "Pages" meaning "Number of pages" and "Pages" meaning "Display of pages".
    
    Extraction of this code pattern is not yet implemented by nightswatcher. xgettext didn't yet support Lua back in 2013 when all this was first added to the program, but now it does. Therefore it might make the most sense to replace the current Python extraction script with xgettext itself.
    
    By default it only understands gettext.dgettext(), but that can be addressed by passing some extra command line arguments, for example:
    
    ```
    xgettext -l lua -c --keyword=_:1c,2 *.lua
    ```
    Frenzie committed Aug 21, 2019
    Copy the full SHA
    b38f818 View commit details
    Browse the repository at this point in the history
  2. remove duplication

    Frenzie committed Aug 21, 2019
    Copy the full SHA
    29584d8 View commit details
    Browse the repository at this point in the history
  3. rename context to domain

    Frenzie committed Aug 21, 2019
    Copy the full SHA
    0e0e9bb View commit details
    Browse the repository at this point in the history
  4. Revert "rename context to domain"

    This reverts commit 0e0e9bb.
    Frenzie committed Aug 21, 2019
    Copy the full SHA
    a992501 View commit details
    Browse the repository at this point in the history
  5. pgettext proposal

    Frenzie committed Aug 21, 2019
    Copy the full SHA
    f644813 View commit details
    Browse the repository at this point in the history
  6. typo

    Frenzie committed Aug 21, 2019
    Copy the full SHA
    8251788 View commit details
    Browse the repository at this point in the history
  7. typo part 2

    Frenzie committed Aug 21, 2019
    Copy the full SHA
    1832e9e View commit details
    Browse the repository at this point in the history