Locale: Convert to using a single text domain #83212

Closed
opened 2020-11-30 05:58:24 +01:00 by Aaron Carlisle · 6 comments
Member

Currently for the user manual sphinx outputs one po-file per rst file. However, in order for use to use weblate #68588 we need to move to a single text domain meaning sphinx outputs one po file for the full documentation project.
This is a really simple change, see below, but has some pros and cons.

Pros:

  • Works with weblate
  • Duplicate translations are merged into one, e.g. translators dont have to translate "Introduction" dozens of times
  • RST files can be moved while keeping translations (@Blendify thinks)

Cons:

  • Translations may have to be started from scratch (@Blendify is looking into this)
  • Translators will be working on the same file so merge conflicts might happen more.
Although, blender's main translations use a single domain and this doesn't seem to be a problem

The Patch


Note this requires sphinx 3.3.1

P1828: (An Untitled Masterwork)

Index: manual/conf.py
===================================================================
--- manual/conf.py	(revision 7444)
+++ manual/conf.py	(working copy)
@@ -167,7 +167,7 @@
 
 # translations
 locale_dirs = ['../locale/']   # Path to locale
-gettext_compact = False     # optional.
+gettext_compact = "blender_manual"     # optional.
 
 # Quit warnings about missing download file
 # suppress_warnings = ['download.not_readable']

Merging current po files


Current po files might be able to be merged to keep existing translations when making the merge.
This might be possible with the following workflow:

Run this script in the blender_docs directory

P1829: (An Untitled Masterwork)

make gettext
for lang in locale/*
do
   for cat in $(find $lang/LC_MESSAGES/ -name "*.po"); do
      msguniq --use-first $cat > /tmp/uniq.po
      mv /tmp/uniq.po $cat
   done
   msgcat $(find $lang/LC_MESSAGES/ -name "*.po") > $lang/LC_MESSAGES/temp.po
   msgmerge --output=$lang/LC_MESSAGES/blender_manual.po $lang/LC_MESSAGES/temp.po build/gettext/blender_manual.pot
   find $lang/LC_MESSAGES/* ! -name sphinx.po ! -name blender_manual.po -delete
done

After running this script the resulting blender_manual.po will need an updated po header text which needs to be done manually.

Currently for the user manual sphinx outputs one po-file per rst file. However, in order for use to use weblate #68588 we need to move to a single text domain meaning sphinx outputs one po file for the full documentation project. This is a really simple change, see below, but has some pros and cons. Pros: - Works with weblate - Duplicate translations are merged into one, e.g. translators dont have to translate "Introduction" dozens of times - RST files can be moved while keeping translations (@Blendify thinks) Cons: - ~~Translations may have to be started from scratch (@Blendify is looking into this)~~ - Translators will be working on the same file so merge conflicts might happen more. ``` Although, blender's main translations use a single domain and this doesn't seem to be a problem ``` The Patch **** Note this requires sphinx 3.3.1 [P1828: (An Untitled Masterwork)](https://archive.blender.org/developer/P1828.txt) ``` Index: manual/conf.py =================================================================== --- manual/conf.py (revision 7444) +++ manual/conf.py (working copy) @@ -167,7 +167,7 @@ # translations locale_dirs = ['../locale/'] # Path to locale -gettext_compact = False # optional. +gettext_compact = "blender_manual" # optional. # Quit warnings about missing download file # suppress_warnings = ['download.not_readable'] ``` Merging current po files **** Current po files might be able to be merged to keep existing translations when making the merge. This might be possible with the following workflow: Run this script in the blender_docs directory [P1829: (An Untitled Masterwork)](https://archive.blender.org/developer/P1829.txt) ```bash make gettext for lang in locale/* do for cat in $(find $lang/LC_MESSAGES/ -name "*.po"); do msguniq --use-first $cat > /tmp/uniq.po mv /tmp/uniq.po $cat done msgcat $(find $lang/LC_MESSAGES/ -name "*.po") > $lang/LC_MESSAGES/temp.po msgmerge --output=$lang/LC_MESSAGES/blender_manual.po $lang/LC_MESSAGES/temp.po build/gettext/blender_manual.pot find $lang/LC_MESSAGES/* ! -name sphinx.po ! -name blender_manual.po -delete done ``` After running this script the resulting `blender_manual.po` will need an updated po header text which needs to be done manually.
Aaron Carlisle self-assigned this 2020-11-30 05:58:24 +01:00
Author
Member

Changed status from 'Needs Triage' to: 'Confirmed'

Changed status from 'Needs Triage' to: 'Confirmed'
Author
Member

Added subscriber: @Blendify

Added subscriber: @Blendify

Added subscriber: @rlneumiller

Added subscriber: @rlneumiller
Author
Member

I will be implementing this next week.

I will be implementing this next week.
Author
Member

Done, see rBMT6047 and rBM7814

Done, see rBMT6047 and rBM7814
Author
Member

Changed status from 'Confirmed' to: 'Resolved'

Changed status from 'Confirmed' to: 'Resolved'
Sign in to join this conversation.
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender-manual#83212
No description provided.