There was already some talk with davidf about a new string management tool. But I guess I should make development talk more public, so I write some requirements for the new tool down here.
This thread should be used for further discussions about the requirements for that tool. Basically me and davidf are talking.
I don't want to see unrelated messages in this thread. VERY good ideas are allowed, but can also be sent to me by PM.
We'll see if that works. If not, the next development discussions will be internal again.
MP2 globalization basics
The resource management is quite simple. Technical, it works like this:
The localization system scans all plugins for language folders (language folders are registered in the plugin.xml file; the string management tool could look into the plugin.xml and find the language directory automatically, for example). In the language folders, the files strings_XX.xml are read, with XX=current language.
String files look like this:
Section names and string names are case-insensitive, but should be written in the correct case.
Some text names also are like this, which is valid:
Not valid is a section name with dots inside.
The files are read into a map with two levels, first level is section names mapped to section instances, section instances contain another map with string names mapped to string values.
String values can also contain placeholders, like this:
But that should not be interesting for the resource management tool development.
After all files are read, we have one big map of sections with many maps with strings. All resources are put together into one big map (scan for collisions would be sensible here to be done in your tool).
Requirements for the new string management tool
The idea for the new tool is, that every plugin brings all strings which are needed in that plugin. It is also allowed to access strings of referenced plugins (your tool could check that no strings from plugins are accessed which are not referenced explicitly).
My idea is now that the tool should show ALL strings, in different grouping modes: Per plugin, per section, per language etc.
If you select one string, the tool shows where it is defined and where it is used. I also want to see the code which uses it, with the string reference highlighted.
Strings which are concatenated in the code like "[" + SectionName + "." + StringName + "]", COULD be found by your tool and displayed as potential matches, but that isn't needed for the first version.
I want functions like "Find missing strings", "Find unused strings" etc., I'm sure there are many more sensible functions.
I want refactoring functions (rename of a string, move a string to a different section, to a different file, to a new file, ...)
I want a function to create missing strings in a target language, where the string names are copied from a source language (english, for example). That is needed if someone wants to create or update language resources of another language. The new strings should be saved in files which are located next to the strings with their original string.
I'm sure you can imagine many more useful functions if you think about which work someone has to do to edit localization resources effectively.
You see, the final tool needs much more complex data structures than the current simple tool. I guess you need a sort of database for the strings in the background. And I would hold all data in memory, tracking what was changed and writing the changes in the target files on "save".
Much, much work.
This thread should be used for further discussions about the requirements for that tool. Basically me and davidf are talking.
I don't want to see unrelated messages in this thread. VERY good ideas are allowed, but can also be sent to me by PM.
We'll see if that works. If not, the next development discussions will be internal again.
MP2 globalization basics
The resource management is quite simple. Technical, it works like this:
The localization system scans all plugins for language folders (language folders are registered in the plugin.xml file; the string management tool could look into the plugin.xml and find the language directory automatically, for example). In the language folders, the files strings_XX.xml are read, with XX=current language.
String files look like this:
Code:
<Section Name="Abc">
<String Name="Xyz" Text="Hallo"/>
</Section>
Section names and string names are case-insensitive, but should be written in the correct case.
Some text names also are like this, which is valid:
Code:
<Section Name="Abc">
<String Name="Rst.Uvw.Xyz" Text="Hallo"/>
</Section>
Not valid is a section name with dots inside.
The files are read into a map with two levels, first level is section names mapped to section instances, section instances contain another map with string names mapped to string values.
String values can also contain placeholders, like this:
Code:
<String Name="StringWithPlaceholders" Text="Hallo {0}"/>
After all files are read, we have one big map of sections with many maps with strings. All resources are put together into one big map (scan for collisions would be sensible here to be done in your tool).
Requirements for the new string management tool
The idea for the new tool is, that every plugin brings all strings which are needed in that plugin. It is also allowed to access strings of referenced plugins (your tool could check that no strings from plugins are accessed which are not referenced explicitly).
My idea is now that the tool should show ALL strings, in different grouping modes: Per plugin, per section, per language etc.
If you select one string, the tool shows where it is defined and where it is used. I also want to see the code which uses it, with the string reference highlighted.
Strings which are concatenated in the code like "[" + SectionName + "." + StringName + "]", COULD be found by your tool and displayed as potential matches, but that isn't needed for the first version.
I want functions like "Find missing strings", "Find unused strings" etc., I'm sure there are many more sensible functions.
I want refactoring functions (rename of a string, move a string to a different section, to a different file, to a new file, ...)
I want a function to create missing strings in a target language, where the string names are copied from a source language (english, for example). That is needed if someone wants to create or update language resources of another language. The new strings should be saved in files which are located next to the strings with their original string.
I'm sure you can imagine many more useful functions if you think about which work someone has to do to edit localization resources effectively.
You see, the final tool needs much more complex data structures than the current simple tool. I guess you need a sort of database for the strings in the background. And I would hold all data in memory, tracking what was changed and writing the changes in the target files on "save".
Much, much work.