UI: Language Selection Changes
Removal of 'Translation' checkbox. Enable translation options when selecting non-English languages. Differential Revision: https://developer.blender.org/D7210 Reviewed by Brecht Van Lommel
This commit is contained in:
parent
53981c7fb6
commit
968619d036
|
@ -242,21 +242,14 @@ class USERPREF_PT_interface_translation(InterfacePanel, CenterAlignMixIn, Panel)
|
|||
def poll(cls, context):
|
||||
return bpy.app.build_options.international
|
||||
|
||||
def draw_header(self, context):
|
||||
prefs = context.preferences
|
||||
view = prefs.view
|
||||
|
||||
self.layout.prop(view, "use_international_fonts", text="")
|
||||
|
||||
def draw_centered(self, context, layout):
|
||||
prefs = context.preferences
|
||||
view = prefs.view
|
||||
|
||||
layout.active = view.use_international_fonts
|
||||
|
||||
layout.prop(view, "language")
|
||||
|
||||
flow = layout.grid_flow(row_major=False, columns=0, even_columns=True, even_rows=False, align=False)
|
||||
flow.active = (bpy.app.translations.locale != 'en_US')
|
||||
|
||||
flow.prop(view, "use_translate_tooltips", text="Tooltips")
|
||||
flow.prop(view, "use_translate_interface", text="Interface")
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
* \note Use #STRINGIFY() rather than defining with quotes.
|
||||
*/
|
||||
#define BLENDER_VERSION 283
|
||||
#define BLENDER_SUBVERSION 12
|
||||
#define BLENDER_SUBVERSION 13
|
||||
/** Several breakages with 280, e.g. collections vs layers. */
|
||||
#define BLENDER_MINVERSION 280
|
||||
#define BLENDER_MINSUBVERSION 0
|
||||
|
|
|
@ -26,6 +26,10 @@
|
|||
#include "BLI_math.h"
|
||||
#include "BLI_utildefines.h"
|
||||
|
||||
#ifdef WITH_INTERNATIONAL
|
||||
# include "BLT_translation.h"
|
||||
#endif
|
||||
|
||||
#include "DNA_anim_types.h"
|
||||
#include "DNA_curve_types.h"
|
||||
#include "DNA_scene_types.h"
|
||||
|
@ -740,6 +744,15 @@ void BLO_version_defaults_userpref_blend(Main *bmain, UserDef *userdef)
|
|||
userdef->gpu_flag |= USER_GPU_FLAG_OVERLAY_SMOOTH_WIRE;
|
||||
}
|
||||
|
||||
if (!USER_VERSION_ATLEAST(283, 13)) {
|
||||
/* If Translations is off then language should default to English. */
|
||||
if ((userdef->transopts & USER_DOTRANSLATE_DEPRECATED) == 0) {
|
||||
userdef->language = ULANGUAGE_ENGLISH;
|
||||
}
|
||||
/* Clear this deprecated flag. */
|
||||
userdef->transopts &= ~USER_DOTRANSLATE_DEPRECATED;
|
||||
}
|
||||
|
||||
/**
|
||||
* Versioning code until next subversion bump goes here.
|
||||
*
|
||||
|
|
|
@ -32,6 +32,10 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Locale Ids. Auto will try to get local from OS. Our default is English though. */
|
||||
#define ULANGUAGE_AUTO 0
|
||||
#define ULANGUAGE_ENGLISH 1
|
||||
|
||||
bool BLT_is_default_context(const char *msgctxt);
|
||||
const char *BLT_pgettext(const char *msgctxt, const char *msgid);
|
||||
|
||||
|
|
|
@ -253,7 +253,8 @@ void BLT_lang_free(void)
|
|||
}
|
||||
|
||||
#ifdef WITH_INTERNATIONAL
|
||||
# define ULANGUAGE ((U.language >= 0 && U.language < num_locales) ? U.language : 0)
|
||||
# define ULANGUAGE \
|
||||
((U.language >= ULANGUAGE_AUTO && U.language < num_locales) ? U.language : ULANGUAGE_ENGLISH)
|
||||
# define LOCALE(_id) (locales ? locales[(_id)] : "")
|
||||
#endif
|
||||
|
||||
|
@ -264,7 +265,7 @@ void BLT_lang_set(const char *str)
|
|||
const char *short_locale = str ? str : LOCALE(ulang);
|
||||
const char *short_locale_utf8 = NULL;
|
||||
|
||||
if ((U.transopts & USER_DOTRANSLATE) == 0) {
|
||||
if (U.language == ULANGUAGE_ENGLISH) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -388,13 +389,7 @@ static void blt_lang_check_ime_supported(void)
|
|||
{
|
||||
#ifdef WITH_INPUT_IME
|
||||
const char *uilng = BLT_lang_get();
|
||||
if (U.transopts & USER_DOTRANSLATE) {
|
||||
ime_is_lang_supported = STREQ(uilng, "zh_CN") || STREQ(uilng, "zh_TW") ||
|
||||
STREQ(uilng, "ja_JP");
|
||||
}
|
||||
else {
|
||||
ime_is_lang_supported = false;
|
||||
}
|
||||
ime_is_lang_supported = STREQ(uilng, "zh_CN") || STREQ(uilng, "zh_TW") || STREQ(uilng, "ja_JP");
|
||||
#else
|
||||
ime_is_lang_supported = false;
|
||||
#endif
|
||||
|
|
|
@ -81,7 +81,7 @@ const char *BLT_pgettext(const char *msgctxt, const char *msgid)
|
|||
bool BLT_translate(void)
|
||||
{
|
||||
#ifdef WITH_INTERNATIONAL
|
||||
return BLI_thread_is_main() && (U.transopts & USER_DOTRANSLATE);
|
||||
return BLI_thread_is_main() && (U.language != ULANGUAGE_ENGLISH);
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
|
|
|
@ -1124,7 +1124,7 @@ typedef enum eUserpref_Translation_Flags {
|
|||
USER_TR_UNUSED_2 = (1 << 2), /* cleared */
|
||||
USER_TR_UNUSED_3 = (1 << 3), /* cleared */
|
||||
USER_TR_UNUSED_4 = (1 << 4), /* cleared */
|
||||
USER_DOTRANSLATE = (1 << 5),
|
||||
USER_DOTRANSLATE_DEPRECATED = (1 << 5), /* Deprecated in 2.83. */
|
||||
USER_TR_UNUSED_6 = (1 << 6), /* cleared */
|
||||
USER_TR_UNUSED_7 = (1 << 7), /* cleared */
|
||||
USER_TR_NEWDATANAME = (1 << 8),
|
||||
|
|
|
@ -307,14 +307,27 @@ static void rna_userdef_screen_update_header_default(Main *bmain, Scene *scene,
|
|||
USERDEF_TAG_DIRTY;
|
||||
}
|
||||
|
||||
static void rna_userdef_font_update(Main *UNUSED(bmain),
|
||||
Scene *UNUSED(scene),
|
||||
PointerRNA *UNUSED(ptr))
|
||||
{
|
||||
BLF_cache_clear();
|
||||
UI_reinit_font();
|
||||
}
|
||||
|
||||
static void rna_userdef_language_update(Main *UNUSED(bmain),
|
||||
Scene *UNUSED(scene),
|
||||
PointerRNA *UNUSED(ptr))
|
||||
{
|
||||
BLF_cache_clear();
|
||||
BLT_lang_set(NULL);
|
||||
UI_reinit_font();
|
||||
USERDEF_TAG_DIRTY;
|
||||
|
||||
const char *uilng = BLT_lang_get();
|
||||
if (STREQ(uilng, "en_US")) {
|
||||
U.transopts &= ~(USER_TR_IFACE | USER_TR_TOOLTIPS | USER_TR_NEWDATANAME);
|
||||
}
|
||||
else {
|
||||
U.transopts |= (USER_TR_IFACE | USER_TR_TOOLTIPS | USER_TR_NEWDATANAME);
|
||||
}
|
||||
}
|
||||
|
||||
static void rna_userdef_script_autoexec_update(Main *UNUSED(bmain),
|
||||
|
@ -4716,21 +4729,15 @@ static void rna_def_userdef_view(BlenderRNA *brna)
|
|||
prop = RNA_def_property(srna, "font_path_ui", PROP_STRING, PROP_FILEPATH);
|
||||
RNA_def_property_string_sdna(prop, NULL, "font_path_ui");
|
||||
RNA_def_property_ui_text(prop, "Interface Font", "Path to interface font");
|
||||
RNA_def_property_update(prop, NC_WINDOW, "rna_userdef_language_update");
|
||||
RNA_def_property_update(prop, NC_WINDOW, "rna_userdef_font_update");
|
||||
|
||||
prop = RNA_def_property(srna, "font_path_ui_mono", PROP_STRING, PROP_FILEPATH);
|
||||
RNA_def_property_string_sdna(prop, NULL, "font_path_ui_mono");
|
||||
RNA_def_property_ui_text(prop, "Mono-space Font", "Path to interface mono-space Font");
|
||||
RNA_def_property_update(prop, NC_WINDOW, "rna_userdef_language_update");
|
||||
RNA_def_property_update(prop, NC_WINDOW, "rna_userdef_font_update");
|
||||
|
||||
/* Language. */
|
||||
|
||||
prop = RNA_def_property(srna, "use_international_fonts", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "transopts", USER_DOTRANSLATE);
|
||||
RNA_def_property_ui_text(
|
||||
prop, "Translate UI", "Enable UI translation and use international fonts");
|
||||
RNA_def_property_update(prop, NC_WINDOW, "rna_userdef_language_update");
|
||||
|
||||
prop = RNA_def_property(srna, "language", PROP_ENUM, PROP_NONE);
|
||||
RNA_def_property_enum_items(prop, rna_enum_language_default_items);
|
||||
# ifdef WITH_INTERNATIONAL
|
||||
|
|
Loading…
Reference in New Issue