[Bf-blender-cvs] [70dab694c1c] temp-eevee-next-cryptomatte: I18n: Fix lighting preferences error messages

Damien Picard noreply at git.blender.org
Tue Aug 23 12:59:55 CEST 2022


Commit: 70dab694c1c5d6ef08668867ed6b6ceceb2f4cea
Author: Damien Picard
Date:   Mon Aug 22 15:33:39 2022 +0200
Branches: temp-eevee-next-cryptomatte
https://developer.blender.org/rB70dab694c1c5d6ef08668867ed6b6ceceb2f4cea

I18n: Fix lighting preferences error messages

While the current situation sort of works, a proper translation cannot
be achieved in every language. Separate messages for each lighting
type.

===================================================================

M	release/scripts/startup/bl_ui/space_userpref.py

===================================================================

diff --git a/release/scripts/startup/bl_ui/space_userpref.py b/release/scripts/startup/bl_ui/space_userpref.py
index ba8608c4e28..1b155d22bdf 100644
--- a/release/scripts/startup/bl_ui/space_userpref.py
+++ b/release/scripts/startup/bl_ui/space_userpref.py
@@ -8,6 +8,7 @@ from bpy.types import (
 from bpy.app.translations import (
     contexts as i18n_contexts,
     pgettext_iface as iface_,
+    pgettext_tip as tip_,
 )
 
 
@@ -2092,7 +2093,10 @@ class StudioLightPanelMixin:
             for studio_light in lights:
                 self.draw_studio_light(flow, studio_light)
         else:
-            layout.label(text=iface_("No custom %s configured") % self.bl_label)
+            layout.label(text=self.get_error_message())
+
+    def get_error_message(self):
+        return tip_("No custom %s configured") % self.bl_label
 
     def draw_studio_light(self, layout, studio_light):
         box = layout.box()
@@ -2119,6 +2123,9 @@ class USERPREF_PT_studiolight_matcaps(StudioLightPanel, StudioLightPanelMixin, P
         layout.operator("preferences.studiolight_install", icon='IMPORT', text="Install...").type = 'MATCAP'
         layout.separator()
 
+    def get_error_message(self):
+        return tip_("No custom MatCaps configured")
+
 
 class USERPREF_PT_studiolight_world(StudioLightPanel, StudioLightPanelMixin, Panel):
     bl_label = "HDRIs"
@@ -2129,6 +2136,9 @@ class USERPREF_PT_studiolight_world(StudioLightPanel, StudioLightPanelMixin, Pan
         layout.operator("preferences.studiolight_install", icon='IMPORT', text="Install...").type = 'WORLD'
         layout.separator()
 
+    def get_error_message(self):
+        return tip_("No custom HDRIs configured")
+
 
 class USERPREF_PT_studiolight_lights(StudioLightPanel, StudioLightPanelMixin, Panel):
     bl_label = "Studio Lights"
@@ -2141,6 +2151,9 @@ class USERPREF_PT_studiolight_lights(StudioLightPanel, StudioLightPanelMixin, Pa
         op.filter_glob = ".sl"
         layout.separator()
 
+    def get_error_message(self):
+        return tip_("No custom Studio Lights configured")
+
 
 class USERPREF_PT_studiolight_light_editor(StudioLightPanel, Panel):
     bl_label = "Editor"



More information about the Bf-blender-cvs mailing list