home
products
contribute
download
documentation
forum
Home
Forums
New posts
Search forums
What's new
New posts
All posts
Latest activity
Members
Registered members
Current visitors
Donate
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Search titles only
By:
Menu
Log in
Register
Navigation
Install the app
Install
More options
Contact us
Close Menu
Forums
MediaPortal 2
General
Globalization string management tool
Contact us
RSS
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="Albert" data-source="post: 686993" data-attributes="member: 67886"><p><strong>AW: Globalization string management tool</strong></p><p></p><p>I absolutely understand your problem with those string instances which are composed at runtime. You're absolutely right, it is not computable which of those dynamic occurences are globalized strings. That's the reason why such a "Find unused strings" function potentially can never find all occurences. Always a user has to look over the result, and the tool must be built to make it possible for the user to check each single search result.</p><p></p><p>The tool should be a help for devs who used localization resources as said in the guidelines (which are not written yet...). That means, in code we have localization string references like this:</p><p></p><p>[CODE]</p><p> public const string RES_PLAYLIST_LOAD_NO_PLAYLIST = "[Media.PlaylistLoadNoPlaylistText]";</p><p></p><p> ...</p><p></p><p> dialogManager.ShowDialog(SkinBase.General.Consts.RES_SYSTEM_ERROR, Consts.RES_PLAYLIST_LOAD_NO_PLAYLIST, DialogType.OkDialog, false, null);</p><p>[/CODE]</p><p></p><p>That example is taken from the <em>Media</em> plugin.</p><p>Another way to reference localized strings is to use those placeholders as literal constants in the code like</p><p></p><p>[CODE]</p><p> SomeMethod("[SomeSection.SomeString]");</p><p>[/CODE]</p><p></p><p>To scan both of those strings, you simply need to scan for "[ at the beginning, n alpha-num chars, a dot, n alpha-num chars and ]" at the end. Something like "\"[\w*\.\w*]\"" or similar.</p><p></p><p>Simply ignore strings which don't match that pattern, for example strings which are composed in code like in the weather plugin:</p><p>[CODE]</p><p> localizedWord = localization.ToString("[Weather."+tokenSplit+"]");</p><p>[/CODE]</p><p>Here, the person using the tool must know what he does, i.e. if the string manager tool says "String Weather.XYZ doesn't seem to be used", he must know that the weather plugin does such a hack. But that's the problem of code which doesn't explicitly declare globalization strings like the Media plugin does.</p><p>Later, a function which finds potential matches would be nice. It could scan for the regex pattern "\"[.*]\" for example.</p><p></p><p>In the XAML files, parsing should be more simple, here, the simple regex pattern should always work.</p><p></p><p></p><p>In your PM, you asked how to identify plugin dependencies. Such dependencies are defined in the <em>plugin.xml</em> file, you can see an example in the <em>Media</em> plugin. So the string management tool also needs to parse plugin descriptors (the plugin.xml files are called plugin descriptors). The parser class is <em>PluginDirectoryDescriptor</em>.</p></blockquote><p></p>
[QUOTE="Albert, post: 686993, member: 67886"] [b]AW: Globalization string management tool[/b] I absolutely understand your problem with those string instances which are composed at runtime. You're absolutely right, it is not computable which of those dynamic occurences are globalized strings. That's the reason why such a "Find unused strings" function potentially can never find all occurences. Always a user has to look over the result, and the tool must be built to make it possible for the user to check each single search result. The tool should be a help for devs who used localization resources as said in the guidelines (which are not written yet...). That means, in code we have localization string references like this: [CODE] public const string RES_PLAYLIST_LOAD_NO_PLAYLIST = "[Media.PlaylistLoadNoPlaylistText]"; ... dialogManager.ShowDialog(SkinBase.General.Consts.RES_SYSTEM_ERROR, Consts.RES_PLAYLIST_LOAD_NO_PLAYLIST, DialogType.OkDialog, false, null); [/CODE] That example is taken from the [I]Media[/I] plugin. Another way to reference localized strings is to use those placeholders as literal constants in the code like [CODE] SomeMethod("[SomeSection.SomeString]"); [/CODE] To scan both of those strings, you simply need to scan for "[ at the beginning, n alpha-num chars, a dot, n alpha-num chars and ]" at the end. Something like "\"[\w*\.\w*]\"" or similar. Simply ignore strings which don't match that pattern, for example strings which are composed in code like in the weather plugin: [CODE] localizedWord = localization.ToString("[Weather."+tokenSplit+"]"); [/CODE] Here, the person using the tool must know what he does, i.e. if the string manager tool says "String Weather.XYZ doesn't seem to be used", he must know that the weather plugin does such a hack. But that's the problem of code which doesn't explicitly declare globalization strings like the Media plugin does. Later, a function which finds potential matches would be nice. It could scan for the regex pattern "\"[.*]\" for example. In the XAML files, parsing should be more simple, here, the simple regex pattern should always work. In your PM, you asked how to identify plugin dependencies. Such dependencies are defined in the [I]plugin.xml[/I] file, you can see an example in the [I]Media[/I] plugin. So the string management tool also needs to parse plugin descriptors (the plugin.xml files are called plugin descriptors). The parser class is [I]PluginDirectoryDescriptor[/I]. [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
MediaPortal 2
General
Globalization string management tool
Contact us
RSS
Top
Bottom