DayZ 1.24
Loading...
Searching...
No Matches
CheckLocTool.c
Go to the documentation of this file.
1[WorkbenchPluginAttribute("Check localisation in UI", "Find non localised text in UI", "ctrl+l", "", {"ResourceManager"})]
3{
6
8 {
9 if (src)
10 {
11 int idx = src.VarIndex("text");
12
13 if (idx != -1)
14 {
15 string text;
16 if (src.Get(idx, text) && !text.Contains("#"))
17 m_results.Insert("Text = \"" + text + "\" in Widget: " + src.GetName());
18 }
19
20 FindTexts(src.GetChildren());
21 FindTexts(src.GetSibling());
22 }
23 }
24
25 void CheckTextIDs(string file)
26 {
27 m_module.SetOpenedResource(file);
28 WidgetSource cont = m_module.GetContainer();
29 int lastIndex = m_results.Count();
30 FindTexts(cont);
31 if (lastIndex != m_results.Count())
32 {
33 m_results.InsertAt(file + ":", lastIndex);
34 m_results.Insert("");
35 }
36 }
37
38 override void Run()
39 {
40 m_module = Workbench.GetModule("ResourceManager");
41 Workbench.SearchResources(".layout", CheckTextIDs);
42
43 if (m_results.Count())
44 {
45 string res;
46 foreach (string file: m_results)
47 {
48 res += file;
49 res += "\n";
50 }
51 }
52 else
53 res = "All texts are localised.";
54
55 Workbench.Dialog("Results", res);
56 }
57};
RestartDayzTool DayZTool WorkbenchPluginAttribute("DayZ Run", "Just for testing", "ctrl+2", "", {"ScriptEditor"})
Definition DayZTools.c:62
void CheckTextIDs(string file)
void FindTexts(WidgetSource src)
Definition CheckLocTool.c:7
override void Run()
proto native external bool SetOpenedResource(string filename)
proto native external BaseContainer GetContainer(int index=0)
static proto native void Dialog(string caption, string text)
static proto native WBModuleDef GetModule(string type)
static proto bool SearchResources(string filter, func callback)