mirror of
https://github.com/Insality/druid.git
synced 2025-06-27 10:27:47 +02:00
#163 Default locale id from text node for lang_text component
This commit is contained in:
parent
54f80aeccd
commit
f534baf2ee
@ -24,7 +24,7 @@ local LangText = component.create("lang_text")
|
||||
--- Component init function
|
||||
-- @tparam LangText self
|
||||
-- @tparam node node The text node
|
||||
-- @tparam string locale_id Default locale id, optional
|
||||
-- @tparam string locale_id Default locale id or text from node as default
|
||||
-- @tparam bool no_adjust If true, will not correct text size
|
||||
function LangText.init(self, node, locale_id, no_adjust)
|
||||
self.druid = self:get_druid()
|
||||
@ -34,9 +34,7 @@ function LangText.init(self, node, locale_id, no_adjust)
|
||||
|
||||
self.on_change = Event()
|
||||
|
||||
if locale_id then
|
||||
self:translate(locale_id)
|
||||
end
|
||||
self:translate(locale_id or gui.get_text(self.node))
|
||||
|
||||
return self
|
||||
end
|
||||
|
@ -210,7 +210,7 @@ nodes {
|
||||
}
|
||||
type: TYPE_TEXT
|
||||
blend_mode: BLEND_MODE_ALPHA
|
||||
text: "Button:"
|
||||
text: "ui_section_button"
|
||||
font: "game"
|
||||
id: "text_button"
|
||||
xanchor: XANCHOR_NONE
|
||||
@ -604,7 +604,7 @@ nodes {
|
||||
}
|
||||
type: TYPE_TEXT
|
||||
blend_mode: BLEND_MODE_ALPHA
|
||||
text: "Text:"
|
||||
text: "ui_section_text"
|
||||
font: "game"
|
||||
id: "text_text"
|
||||
xanchor: XANCHOR_NONE
|
||||
@ -848,7 +848,7 @@ nodes {
|
||||
}
|
||||
type: TYPE_TEXT
|
||||
blend_mode: BLEND_MODE_ALPHA
|
||||
text: "Timer:"
|
||||
text: "ui_section_timer"
|
||||
font: "game"
|
||||
id: "text_timer"
|
||||
xanchor: XANCHOR_NONE
|
||||
@ -1029,7 +1029,7 @@ nodes {
|
||||
}
|
||||
type: TYPE_TEXT
|
||||
blend_mode: BLEND_MODE_ALPHA
|
||||
text: "Progress bar:"
|
||||
text: "ui_section_progress"
|
||||
font: "game"
|
||||
id: "text_progress"
|
||||
xanchor: XANCHOR_NONE
|
||||
@ -1320,7 +1320,7 @@ nodes {
|
||||
}
|
||||
type: TYPE_TEXT
|
||||
blend_mode: BLEND_MODE_ALPHA
|
||||
text: "Slider:"
|
||||
text: "ui_section_slider"
|
||||
font: "game"
|
||||
id: "text_slider"
|
||||
xanchor: XANCHOR_NONE
|
||||
@ -1611,7 +1611,7 @@ nodes {
|
||||
}
|
||||
type: TYPE_TEXT
|
||||
blend_mode: BLEND_MODE_ALPHA
|
||||
text: "Radio:"
|
||||
text: "ui_section_radio"
|
||||
font: "game"
|
||||
id: "text_radio"
|
||||
xanchor: XANCHOR_NONE
|
||||
@ -2234,7 +2234,7 @@ nodes {
|
||||
}
|
||||
type: TYPE_TEXT
|
||||
blend_mode: BLEND_MODE_ALPHA
|
||||
text: "Checkbox:"
|
||||
text: "ui_section_checkbox"
|
||||
font: "game"
|
||||
id: "text_checkbox"
|
||||
xanchor: XANCHOR_NONE
|
||||
@ -2857,7 +2857,7 @@ nodes {
|
||||
}
|
||||
type: TYPE_TEXT
|
||||
blend_mode: BLEND_MODE_ALPHA
|
||||
text: "Input:"
|
||||
text: "ui_section_input"
|
||||
font: "game"
|
||||
id: "text_input"
|
||||
xanchor: XANCHOR_NONE
|
||||
|
@ -25,14 +25,14 @@ end
|
||||
|
||||
|
||||
local function setup_texts(self)
|
||||
self.druid:new_lang_text("text_button", "ui_section_button")
|
||||
self.druid:new_lang_text("text_text", "ui_section_text")
|
||||
self.druid:new_lang_text("text_timer", "ui_section_timer")
|
||||
self.druid:new_lang_text("text_progress", "ui_section_progress")
|
||||
self.druid:new_lang_text("text_slider", "ui_section_slider")
|
||||
self.druid:new_lang_text("text_radio", "ui_section_radio")
|
||||
self.druid:new_lang_text("text_checkbox", "ui_section_checkbox")
|
||||
self.druid:new_lang_text("text_input", "ui_section_input")
|
||||
self.druid:new_lang_text("text_button")
|
||||
self.druid:new_lang_text("text_text")
|
||||
self.druid:new_lang_text("text_timer")
|
||||
self.druid:new_lang_text("text_progress")
|
||||
self.druid:new_lang_text("text_slider")
|
||||
self.druid:new_lang_text("text_radio")
|
||||
self.druid:new_lang_text("text_checkbox")
|
||||
self.druid:new_lang_text("text_input")
|
||||
|
||||
self.druid:new_lang_text("text_translated", "ui_text_example")
|
||||
self.druid:new_lang_text("text_button_lang", "ui_text_change_lang")
|
||||
|
Loading…
x
Reference in New Issue
Block a user