weblate

Import Complex Sphinx Translations into Weblate


I'm using import_project to bring in components from a sphinx document set. Where this is falling apart is my sub directory structure:

 - docs
  - _locale
   - fr
    - LC_MESSAGES
     - file.po
     - file2.po
      - directory
       - file.po
       - file2.po        
      - directory2
       - file.po
       - file2.po

The import command ./manage.py import_project --file-format po project-name git@bitbucket.org:xxx/xxx.git master 'docs/_locale/*/LC_MESSAGES/**.po' doesn't look at the directory and it's sub files. Further because the sub directory files has like named files, there is a conflict how the import_project would map files to components (if I run import_project for each sub directory).

Any tips?

Thanks,

Mike


Solution

  • There is no direct way right now, but you can import them folder by folder.

    $ ./manage.py import_project --name-template 'Directory 1: %s' \
        --file-format po \
        project https://github.com/project/docs.git master \
        'docs/locale/*/LC_MESSAGES/dir1/**.po'
    $ ./manage.py import_project --name-template 'Directory 2: %s' \
        --file-format po \
        project https://github.com/project/docs.git master \
        'docs/locale/*/LC_MESSAGES/dir2/**.po'
    

    PS: I've also added this example to the documentation.

    Update: There are more comfortable ways to configure Sphinx documentation localization these days.