Page MenuHome

Modifications for `Alt-F1` to work for the new translations
ClosedPublic

Authored by Aaron Carlisle (Blendify) on Jan 16 2016, 3:36 AM.

Details

Summary

Now that we support a translated manual we can add support for it again in blender.

I am kinda guessing at what I am doing here. I would like to do this to learn the basics of modifying Blender.
Right now it does not go to the translated page but instead the English. I dont know if I did something wrong or if it is disabled some where else in the code

Diff Detail

Event Timeline

Aaron Carlisle (Blendify) retitled this revision from to Modifications for `Alt-F1` to work for the new translations .
Aaron Carlisle (Blendify) updated this object.
Aaron Carlisle (Blendify) set the repository for this revision to rBA Blender Add-ons.
Aaron Carlisle (Blendify) removed rBA Blender Add-ons as the repository for this revision.

Better diff

Bastien Montagne (mont29) edited edge metadata.

In addition to small notes in comments below, would be nice to also sort language list alphabetically imho, makes it easier when searching if one is already in or not e.g.

Otherwise, looks good to me.

modules/rna_manual_reference.py
28

Farsi and Persian are (practically) the same thing.

72–74

would be simpler to do (since we are changing it):

if LANG is not None:
    url_manual_prefix = url_manual_prefix.replace("manual", "manual/" + LANG)

Note that this fixes placement of slash…

This revision is now accepted and ready to land.Jan 16 2016, 9:28 AM

I still having some issues. Even before that changes you mentioned but it still does not go to the translated manual.

modules/rna_manual_reference.py
72–74

When I do that I get:

Error calling <function _blender_default_map at 0x000001A19F020AE8>
Traceback (most recent call last):
  File "C:\Users\Aaron\Downloads\Blender\blender-2.76-b211e41-win64\blender-2.76.0-git.b211e41-AMD64\2.76\scripts\modules\bpy\utils\__init__.py", line 661, in manual_map
    prefix, url_manual_mapping = cb()
  File "C:\Users\Aaron\Downloads\Blender\blender-2.76-b211e41-win64\blender-2.76.0-git.b211e41-AMD64\2.76\scripts\modules\bpy\utils\__init__.py", line 639, in _blender_default_map
    import rna_manual_reference as ref_mod
  File "C:\Users\Aaron\Downloads\Blender\blender-2.76-b211e41-win64\blender-2.76.0-git.b211e41-AMD64\2.76\scripts\addons\modules\rna_manual_reference.py", line 73
    if LANG is not None:
                       ^
SyntaxError: invalid syntax

Looks like it is sorted by the abbreviation.

I get this in the UI also when taking your suggestion:

No reference available 'render.render', Update info in 'rna_manual_reference.py' or callback to bpy.utils.manual_map()

Not sure what you are doing to get a syntax error here, please update your diff?

Anyway, it indeed does not work, since keys of that language dictionary do not match what's returned by C.user_preferences.system.language at all! Should be ISO codes, like fr_FR, es, sr_RS@latin, etc., see release/datafiles/locale/languages file.

You'll also have to handle the 'DEFAULT' option, which uses default system language, maybe by parsing value returned by os.environ['LANG'], but not sure this works on windows as well. :/

Bastien Montagne (mont29) requested changes to this revision.Jan 17 2016, 10:08 AM
Bastien Montagne (mont29) edited edge metadata.
This revision now requires changes to proceed.Jan 17 2016, 10:08 AM
Aaron Carlisle (Blendify) edited edge metadata.
Aaron Carlisle (Blendify) set the repository for this revision to rBA Blender Add-ons.
  • Fix for ISO codes
  • Simplify changing of the URL
Aaron Carlisle (Blendify) marked an inline comment as done.Jan 17 2016, 4:29 PM
Aaron Carlisle (Blendify) added inline comments.
modules/rna_manual_reference.py
28

I am thinking about just removing this a just stating which languages are available for the manual

Aaron Carlisle (Blendify) edited edge metadata.

Again fix for languages

This revision is now accepted and ready to land.Jan 17 2016, 5:02 PM
Aaron Carlisle (Blendify) edited edge metadata.

Update comments

This revision was automatically updated to reflect the committed changes.