mirror of
https://github.com/blender/blender
synced 2026-09-29 04:37:17 +03:00
I18n: Translate color management using a new translation context
Many UI messages are extracted from the OpenColorIO config, including color spaces and families, displays, views, view transforms, and looks. The risk of a translation collision between these data and other messages is quite high, especially if using an OCIO config other than the built-in one. This commit changes extraction and translation so that all these strings are translated with the new "Color Management" translation context. It does not reuse the existing "Color" context, in the unlikely event of a collision with other color-related stuff in the UI. Suggested by Bastien Montagne while reviewing !160883. Pull Request: https://projects.blender.org/blender/blender/pulls/161053
This commit is contained in:
parent
29b250ad2e
commit
fa663e3b59
8 changed files with 28 additions and 16 deletions
|
|
@ -966,17 +966,18 @@ def dump_ocio_config(msgs, reports, settings):
|
|||
# This assumes the default Blender config is used when we extract messages.
|
||||
import PyOpenColorIO as OCIO
|
||||
config = OCIO.GetCurrentConfig()
|
||||
translation_context = bpy.app.translations.contexts.color_management
|
||||
|
||||
for display in config.getDisplays():
|
||||
msgsrc = "Display name from OCIO config"
|
||||
process_msg(
|
||||
msgs, settings.DEFAULT_CONTEXT, display, msgsrc,
|
||||
msgs, translation_context, display, msgsrc,
|
||||
reports, None, settings,
|
||||
)
|
||||
for view in config.getViews(display):
|
||||
msgsrc = "View name from OCIO display " + display
|
||||
process_msg(
|
||||
msgs, settings.DEFAULT_CONTEXT, view, msgsrc,
|
||||
msgs, translation_context, view, msgsrc,
|
||||
reports, None, settings,
|
||||
)
|
||||
description = config.getDisplayViewDescription(display, view)
|
||||
|
|
@ -989,7 +990,7 @@ def dump_ocio_config(msgs, reports, settings):
|
|||
for view_transform in config.getViewTransforms():
|
||||
msgsrc = "View transform name from OCIO config"
|
||||
process_msg(
|
||||
msgs, settings.DEFAULT_CONTEXT, view_transform.getName(), msgsrc,
|
||||
msgs, translation_context, view_transform.getName(), msgsrc,
|
||||
reports, None, settings,
|
||||
)
|
||||
description = config.getDisplayViewDescription(display, view)
|
||||
|
|
@ -1010,7 +1011,7 @@ def dump_ocio_config(msgs, reports, settings):
|
|||
source = "OCIO config"
|
||||
msgsrc = "Look name from " + source
|
||||
process_msg(
|
||||
msgs, settings.DEFAULT_CONTEXT, name, msgsrc,
|
||||
msgs, translation_context, name, msgsrc,
|
||||
reports, None, settings,
|
||||
)
|
||||
msgsrc = "Look description from " + source
|
||||
|
|
@ -1024,7 +1025,7 @@ def dump_ocio_config(msgs, reports, settings):
|
|||
name = colorspace.getName()
|
||||
msgsrc = "Colorspace name from OCIO config"
|
||||
process_msg(
|
||||
msgs, settings.DEFAULT_CONTEXT, name, msgsrc,
|
||||
msgs, translation_context, name, msgsrc,
|
||||
reports, None, settings,
|
||||
)
|
||||
description = colorspace.getDescription()
|
||||
|
|
@ -1038,7 +1039,7 @@ def dump_ocio_config(msgs, reports, settings):
|
|||
for family_part in family.split(family_separator):
|
||||
msgsrc = "Colorspace family from OCIO config"
|
||||
process_msg(
|
||||
msgs, settings.DEFAULT_CONTEXT, family_part, msgsrc,
|
||||
msgs, translation_context, family_part, msgsrc,
|
||||
reports, None, settings,
|
||||
)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue