Skip to content

Commit

Permalink
Merge 90f9385 into 9fe4541
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelDCurran authored Sep 30, 2024
2 parents 9fe4541 + 90f9385 commit 6b9d864
Show file tree
Hide file tree
Showing 9 changed files with 342 additions and 140 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ source/louis
dlldata.c
*.pdb
.sconsign.dblite
user_docs/*/*.md.sub
user_docs/*/*.html
user_docs/*/*.css
extras/controllerClient/x86/nvdaController.h
Expand Down
15 changes: 14 additions & 1 deletion projectDocs/dev/developerGuide/sconscript
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,20 @@ env = env.Clone()
devDocsOutputDir = outputDir.Dir("devDocs")

# Build the developer guide and move it to the output directory
htmlFile = env.md2html("developerGuide.md")
mdFile = env.File("developerGuide.md")
# first substitute some variables such as NvDA version and URL into the markdown file
mdFileSub = env.Substfile(
target=mdFile.abspath.replace(".md", ".md.sub"),
source=mdFile,
SUBST_DICT={
"NVDA_VERSION": env["version"],
},
)
htmlFile = env.Command(
target=mdFile.abspath.replace(".md", ".html"),
source=mdFileSub,
action=[f'@{sys.executable} user_docs/md2html.py convert "$SOURCE" "$TARGET"'],
)
devGuide = env.Command(
target=devDocsOutputDir.File("developerGuide.html"), source=htmlFile, action=Move("$TARGET", "$SOURCE")
)
Expand Down
89 changes: 58 additions & 31 deletions projectDocs/translating/crowdin.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Translating using Crowdin

Crowdin is used to translate the main NVDA interface.
Crowdin is used to translate the main NVDA interface and user documentation.
NVDA's Crowdin project: <https://crowdin.com/project/nvda>.

This document covers setting up a Crowdin account, connecting it with PoEdit, and translating the main interface using Crowdin and PoEdit.
This document covers setting up a Crowdin account, connecting it with PoEdit, and translating the main interface and user documentation using Crowdin and PoEdit.

## Setup

Expand All @@ -20,44 +20,26 @@ Alternatively, you can use the [Crowdin web interface](https://support.crowdin.c
As PoEdit only supports viewing approved strings, large translators team need to co-ordinate submitting unapproved strings to prevent conflicts.
Using Crowdin's interface avoids this problem.

PoEdit supports connecting with Crowdin directly.
PoEdit's homepage is: <http://www.poedit.net/>

1. Download the latest Windows PoEdit version at <https://poedit.net/download>
1. Install it by following the on-screen instructions, the default options should be sufficient.
1. When launching PoEdit:
1. Choose "Translate cloud project"
1. Connect your Crowdin account
1. Select NVDA and the language you wish to translate

### Translation reviews

Translated strings will need to be reviewed and approved by a proofreader before being included in NVDA.
A proofreader is required for each language.
Proofreader status is granted on a case-by-case basis by messaging the [translators mailing list](https://groups.io/g/nvda-translations) or <info@nvaccess.org>

Proofreaders approve strings using the [Crowdin web interface](https://support.crowdin.com/online-editor/).
PoEdit does not support viewing unapproved strings from other translators.
When manually uploading to Crowdin from PoEdit, proofreaders are able to auto-approve all submitted strings.
Due to accessibility issues, for now translation approvals have been disabled on Crowdin.
Any translation uploaded to Crowdin is automatically available in the project.
However, joining the project as a translator is by invitation only.

## Translation workflows

There are 3 common workflows for translating with Crowdin:
There are 2 common workflows for translating with Crowdin:

1. Only on Crowdin's web interface, either with:
- only one proofreader approving their own translations,
- or with many translators making suggestions and a proofreader approving them.
1. Multiple translators translating on PoEdit.
- Using Crowdin cloud synchronization.
- Proofreaders approve the translations on Crowdin's web interface.
1. Translating on PoEdit without cloud synchronization and performing manual uploads to Crowdin.
- Translators with proofreader status can upload strings manually with automatic approval.
As such, this may be a preference for single or small-team translators using PoEdit.
- Manual uploads without cloud synchronization means conflicts can occur, translator teams must be co-ordinated if following this approach.
1. Translating strings directly via Crowdin's interface. Or
1. Downloading from Crowdin, translating with Poedit and uploading again.

## Translating using PoEdit

After opening a .po file you will be placed on a list with all of the strings to translate.
After opening a .po or .xliff file you will be placed on a list with all of the strings to translate.

You can read the status bar to see how many strings have already been translated, the number of untranslated messages, and how many are fuzzy.
A fuzzy string is a message which has been automatically translated, thus it may be wrong.
Expand All @@ -77,12 +59,15 @@ Each time you press this key, PoEdit saves the po file, and if you check compile

NVDA provides additional shortcuts for PoEdit which are described in [the User Guide](https://www.nvaccess.org/files/nvda/documentation/userGuide.html#Poedit).

If you are unsure of meaning of the original interface message, consult automatic comments (also called translator comments), by pressing `control+shift+a`.
If you are unsure of the meaning of the original interface message, consult automatic comments (also called translator comments), by pressing `control+shift+a`.
Some comments provide an example output message to help you understand what NVDA will say when speaking or brailling such messages.

## Translating the interface
## Translating NVDA's interface

* Download nvda.po from the Files section of your language on Crowdin.
* Open the po file in Poedit, translate, and save the file.
* Upload the po file back to Crowdin.

Open "nvda.po" for the language you want to translate in PoEdit.
Alternatively, you can use the [Crowdin interface directly](https://support.crowdin.com/online-editor/).

### Messages with formatting strings
Expand Down Expand Up @@ -160,11 +145,53 @@ In Crowdin, this information appears at the end of the context section.

### Testing the interface translation

1. To test the current interface messages, save the current nvda.po file, and copy the nvda.mo file to the following location: `nvdadir/locale/langcode/LC_MESSAGES`
1. To test the current interface messages, save the current nvda.po file in Poedit, and copy the nvda.mo file to the following location: `nvdadir/locale/langcode/LC_MESSAGES`
- `nvdadir`: the directory where NVDA has been installed
- `langcode`: the ISO 639-1 language code for your language (e.g. en for English, es for Spanish, etc.)
1. Restart NVDA, then go to the NVDA menu, go to Preferences and choose General Settings, or press `NVDA+control+g` to open General Settings.
1. From the language list, select your language (if it is listed), press `enter` and say yes when you're asked to restart NVDA.
1. The messages you have translated should now be heard or brailled in your native language provided that the synthesizer you are using supports your language or a braille code for your language exists.

Whenever you add or update your interface translations, repeat the steps above (copying the updated .mo file and restarting NVDA) to test your updated translation messages.

## Translating NvDA' s user documentation

Documentation available for translation includes:
* The NVDA user guide (userGuide.xliff)
* The NVDA What's New document (changes.xliff)

To translate any of these files:

* Download the xliff file from the Files section of your language on Crowdin.
* Make sure to choose "Download" not "Export xliff".
* Make a copy of this file.
* Open the po file in Poedit, translate, and save the file.
* Use the nvdaL10nUtil program to strip the xliff so that it only contains translations that were added / changed. E.g.
```
nvdaL10nUtil stripXliff -o <old xliff file> <translated xliff file> <output stripped xliff file>
```
* Upload the xliff file back to Crowdin. If it is a stripped xliff file, it is safe to check the `allow target to match source` checkbox.

Alternatively, you can use the [Crowdin interface directly](https://support.crowdin.com/online-editor/).

### Translating markdown
The English NVDA user documentation is written in markdown syntax.
The xliff file you are directly translating has been generated from that markdown file.
It contains the content of any line that requires translation, shown in the order it appears in the original markdown file.

Structural lines that do not contain any translatable content (such as blank lines, hidden table header rows, table header body separator lines etc) are not included here.

Structural syntax from the beginning and end of lines (such as heading prefix like `###`, heading anchors like `{#Introduction}`, and initial and final vertical bars on table rows) has been removed from the content to translate, but is available to view in the translator notes for that line.
Content may still however contain inline markdown syntax such as links, inline code fences (`\``), and table column separators (`|`).
This syntax must be kept intact when translating.

All strings for translation contain translator notes which include:
* Line: the original line number in the markdown file.
* prefix: any structural markdown on the line before this content.
* Suffix: any structural markdown on the line after this content.

### Verifying your translation
When ever you have saved the xliff file with Poedit, you can use the nvdaL10nUtil program to generate the html version of the documentation file. E.g.
```
nvdaL10nUtil xliff2html -t [userGuide|changes|keyCommands] -l <lang> <xliff file> <output html file>
```
13 changes: 4 additions & 9 deletions projectDocs/translating/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,14 @@ For further information please see the [Release Process page](https://github.com
You can view [Crowdin](https://crowdin.com/project/nvda) for an up to date report on the status of translating the NVDA interface.
If you would like to improve or would like to work on a new language, please write to the [NVDA translations mailing list](https://groups.io/g/nvda-translations).

The translation status of user documentation (User Guide and Changes) can only be checked by translators.

## New Localization

Start by subscribing to the translation list above so that you can get help and advice.

The current process for translation is split between multiple processes:

- Crowdin for the NVDA interface
- The legacy SVN translation system for the User Guide and Changes files.
This is planned to move to Crowdin.
- The legacy SVN translation system for Character Descriptions, Symbols and Gestures.
This is planned to move to GitHub.
- Crowdin for the NVDA interface and user documentation
- Github for Character Descriptions, Symbols and Gestures.

Read [Files to be Localized](#files-to-be-localized) to learn the translation for process for these.

Expand All @@ -57,6 +52,6 @@ Note that linked guides may be out of date, as the translation system is undergo
- characterDescriptions.dic: names of characters in your language, see [Translating Character Descriptions](https://www.nvaccess.org/files/nvda/documentation/developerGuide.html#characterDescriptions) for more info.
- symbols.dic: names of symbols and punctuation in your language, see [Translating Symbols](https://www.nvaccess.org/files/nvda/documentation/developerGuide.html#symbolPronunciation) for more information.
- gestures.ini: remapping of gestures for your language, see [Translating Gestures](https://www.nvaccess.org/files/nvda/documentation/developerGuide.html#TranslatingGestures) for more information.
- userGuide.md: the User Guide, see [Translating the User Guide](https://github.com/nvaccess/nvda/wiki/TranslatingUserGuide) for more information.
- changes.md (optional): a list of changes between releases, see [Translating Changes](https://github.com/nvaccess/nvda/wiki/TranslatingChanges) for more information.
- userGuide.md: the User Guide, see [Translating using Crowdin](./crowdin.md) for more information.
- changes.md (optional): a list of changes between releases, see [Translating using Crowdin](./crowdin.md) for more information.
- Add-ons (optional): a set of optional features that users can install, see [Translating Addons](https://github.com/nvaccess/nvda/wiki/TranslatingAddons) for more information.
2 changes: 2 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ pycaw==20240210

# Packaging NVDA
py2exe==0.13.0.2
# xliff2html is packaged with nuitka
nuitka==2.4.8

# Creating XML unit test reports
unittest-xml-reporting==3.2.0
Expand Down
37 changes: 31 additions & 6 deletions sconstruct
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,6 @@ env = Environment(
tools=[
"textfile",
"gettextTool",
"md2html",
"doxygen",
"recursiveInstall",
"m4",
Expand Down Expand Up @@ -346,7 +345,23 @@ for xliffFile in env.Glob(os.path.join(userDocsDir.path, "*", "*.xliff")):
)
# Allow all markdown files to be converted to html in user_docs
for mdFile in env.Glob(os.path.join(userDocsDir.path, "*", "*.md")):
htmlFile = env.md2html(mdFile)
# first substitute some variables such as NvDA version and URL into the markdown file
mdFileSub = env.Substfile(
target=mdFile.abspath.replace(".md", ".md.sub"),
source=mdFile,
SUBST_DICT={
"NVDA_VERSION": env["version"],
"NVDA_URL": versionInfo.url,
"NVDA_COPYRIGHT_YEARS": versionInfo.copyrightYears,
},
)
lang = os.path.split(os.path.dirname(mdFile.path))[-1]
docType = os.path.basename(mdFile.path).split(".")[0]
htmlFile = env.Command(
target=mdFile.abspath.replace(".md", ".html"),
source=mdFileSub,
action=[f'@{sys.executable} user_docs/md2html.py -l {lang} -t {docType} "$SOURCE" "$TARGET"'],
)
styleInstallPath = os.path.dirname(mdFile.abspath)
installedStyle = env.Install(styleInstallPath, styles)
installedHeadingsStyle = env.Install(styleInstallPath, numberedHeadingsStyle)
Expand All @@ -362,11 +377,14 @@ for mdFile in env.Glob(os.path.join(userDocsDir.path, "*", "*.md")):
env.Depends(htmlFile, mdFile)

# Create key commands files
for userGuideFile in env.Glob(os.path.join(userDocsDir.path, "*", "userGuide.md")):
keyCommandsHtmlFile = env.md2html(
userGuideFile.abspath.replace("userGuide.md", "keyCommands.html"), userGuideFile
for userGuideFileSub in env.Glob(os.path.join(userDocsDir.path, "*", "userGuide.md.sub")):
lang = os.path.split(os.path.dirname(userGuideFileSub.path))[-1]
keyCommandsHtmlFile = env.Command(
target=userGuideFileSub.abspath.replace("userGuide.md.sub", "keyCommands.html"),
source=userGuideFileSub,
action=[f'@{sys.executable} user_docs/md2html.py -l {lang} -t keyCommands "$SOURCE" "$TARGET"'],
)
env.Depends(keyCommandsHtmlFile, userGuideFile)
env.Depends(keyCommandsHtmlFile, userGuideFileSub)

# Build unicode CLDR dictionaries
env.SConscript("cldrDict_sconscript", exports=["env", "sourceDir"])
Expand Down Expand Up @@ -713,3 +731,10 @@ source = env.Dir(os.path.join(os.getcwd(), "dist"))
# Putting the target in the output dir automatically causes AppVeyor to package it as an artefact
target = env.File(os.path.join(outputDir.abspath, "library_modules.txt"))
env.Alias("moduleList", env.GenerateModuleList(target, source))

nvdaL10nUtil = env.Command(
target=outputDir.File("nvdaL10nUtil.exe"),
source="user_docs/nvdaL10nUtil.py",
ENV=os.environ,
action=f"nuitka --standalone --onefile --output-dir=./output --include-module=mdx_truly_sane_lists --include-module=markdown_link_attr_modifier --include-module=mdx_gh_links user_docs/nvdaL10nUtil.py",
)
Loading

0 comments on commit 6b9d864

Please sign in to comment.