mo29cg / nvda-chatGPT

15 stars 7 forks source link

Fix add-on translatability #10

Closed CyrilleB79 closed 1 year ago

CyrilleB79 commented 1 year ago

Hello

Here are the fixes so that you get translators comments. This fix contains two parts:

  1. Update the Python sources in the buildVars.py, as already discussed by e-mail (sorry, I have looked at the wrong line and thought that your update was erroneous)

  2. For each non-ASCII Python file, declare the encoding. This is not necessary anymore for Python 3 files, but gettext still requires it as soon as a string contains non ascii character, even if it is not a translatable string.

Note: In instructions.py, there seems to be only a "zero width joiner" character at line 6, juste after the word "key". I have considered that it was a mistake and have removed it. If it was not, you may want to put the encoding declaration line in this file too.

CyrilleB79 commented 1 year ago

In answer to your last e-mail, I realize that I had not read the initial message:

In your initial message, you wrote:

But here is a problem.I've annotated all of the translatable text with "# Translators: ". But, when I create "nvda.po" file with poedit, any of the annotations do not show up.

I think I correctly annotated it like line 37 of this file.

https://github.com/mo29cg/nvda-chatGPT/blob/main/addon/globalPlugins/nvdaChatGPT/__init__.py#L37

It seems that you need to put a comment for all strings, even if they are the same. "Ask chatGPT" appears three times in the file (lines 38, 118 and 143). One of them was missing the translators comment.

I have fixed this in the branch of this PR (as well as a typo).

There are still other strings without translators comments. I let you fix them.

The initial modifications of this PR are not directly linked to your initial request. But you should keep them. Indeed, to get the translation strings, I do: scons pot which generates the .pot file that I can then use as template in poedit to create a .po file.

The scons pot command was not working before this PR and is now working. Generating the .pot file may be useful for translators. But it's also mandatory to support the scons pot command if you wish to include your add-on in the international community translation framework.