Dayz Explorer  1.24.157551 (v105080)
Dayz Code Explorer by Zeroy
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 {
4  ref array<string> m_results = new array<string>;
5  WBModuleDef m_module;
6 
7  void FindTexts(WidgetSource src)
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  {
18  m_results.Insert("Text = \"" + text + "\" in Widget: " + src.GetName());
19  }
20  }
21 
22  FindTexts(src.GetChildren());
23  FindTexts(src.GetSibling());
24  }
25  }
26 
27  void CheckTextIDs(string file)
28  {
29  m_module.SetOpenedResource(file);
30  WidgetSource cont = m_module.GetContainer();
31  int lastIndex = m_results.Count();
32  FindTexts(cont);
33  if (lastIndex != m_results.Count())
34  {
35  m_results.InsertAt(file + ":", lastIndex);
36  m_results.Insert("");
37  }
38  }
39 
40  override void Run()
41  {
42  m_module = Workbench.GetModule("ResourceManager");
43  Workbench.SearchResources(".layout", CheckTextIDs);
44 
45  if (m_results.Count())
46  {
47  string res;
48  foreach(string file: m_results)
49  {
50  res += file;
51  res += "\n";
52  }
53  }
54  else
55  {
56  res = "All texts are localised.";
57  }
58 
59  Workbench.Dialog("Results", res);
60  }
61 };
CheckLocalisationPlugin
Definition: checkloctool.c:2
Workbench
Definition: workbenchapi.c:6
WBModuleDef
Definition: workbenchapi.c:19
WorkbenchPluginAttribute
CheckLocalisationPlugin WorkbenchPluginAttribute
WorkbenchPlugin
Definition: workbenchapi.c:101
Run
override void Run()
Definition: dayztools.c:8
array< string >
WidgetSource
Definition: enentity.c:22