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="davidf" data-source="post: 686922" data-attributes="member: 19484"><p>Albert,</p><p></p><p>I can think of tons of things to do with them - if there is a valid source of data. </p><p></p><p>The strings_<lang>.xml are currently the only reliable source of data. Take for instance the code from WeatherDotComCatcher:</p><p>[code]</p><p> ILocalization localization = ServiceRegistration.Get<ILocalization>();</p><p> // handle only mappings of different spellings</p><p> if (string.Compare(tokenSplit, "T-Storms", true) == 0 || string.Compare(tokenSplit, "T-Storm", true) == 0)</p><p> localizedWord = localization.ToString("[Weather.TStorm]");</p><p> else if (string.Compare(tokenSplit, "Cloudy", true) == 0)</p><p> localizedWord = localization.ToString("[Weather.Clouds]");</p><p> else if (string.Compare(tokenSplit, "Shower", true) == 0 ||</p><p> string.Compare(tokenSplit, "T-Showers", true) == 0)</p><p> localizedWord = localization.ToString("[Weather.Showers]");</p><p> else if (string.Compare(tokenSplit, "Isolated", true) == 0)</p><p> localizedWord = localization.ToString("[Weather.Scattered]");</p><p> else if (string.Compare(tokenSplit, "Gale", true) == 0 ||</p><p> string.Compare(tokenSplit, "Tempest", true) == 0)</p><p> localizedWord = localization.ToString("[Weather.Storm]");</p><p> else </p><p> // for all other tokens do a direct lookup</p><p> localizedWord = localization.ToString("[Weather."+tokenSplit+"]");</p><p></p><p> localizedLine.AppendFormat("{0} ", localizedWord ?? tokenSplit); //if not found, let fallback</p><p> }</p><p> return localizedLine.ToString();</p><p></p><p>[/code]</p><p></p><p>with all the code inspection in the world there is no way to determine that [Weather.DewPoint] is valid (or invalid for that matter). One way to get around this is to make the use of localized strings explicit:</p><p></p><p>[LocalizedString("Weather.DewPoint")] or similar somewhere in the code (or more likely assembly) where it can be examined and compared against the strings_<lang>.xml files to determine if any are missing or extra. Similarly [ImportedLocalizedString("Media.MusicMenuItem")] could be used to declare uses of imported strings.</p><p></p><p>So far we have achieved a chore for devs, so to make it work a carrot (or two) is needed. </p><p></p><p>1. Carrot (and stick): A tool to run (after compilation?) which will prompt on new and missing strings and test for the existence of imported strings.</p><p>2. Another tool to manage translations/editing of existing files (this is pretty close to what's there). It would need the functionality of the tool in 1 to be complete rounded solution.</p><p></p><p>Without a second source of data most of the really useful functionality is not possible or it would have disproportionate time needed spent (and wouldn't every be accurate as can be seen).</p><p></p><p>Achieving a second source of data to make string management work correctly needs a change - it simply cannot work with only one data source. My preference would be a method which can be used on assemblies rather than on code - as sometimes code will not be easily available.</p><p></p><p>Skin files are a slightly different proposition and would more easily be parsed.</p><p></p><p>Opinions/alternatives welcome <img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" class="smilie smilie--sprite smilie--sprite8" alt=":D" title="Big Grin :D" loading="lazy" data-shortname=":D" /></p><p></p><p>David</p></blockquote><p></p>
[QUOTE="davidf, post: 686922, member: 19484"] Albert, I can think of tons of things to do with them - if there is a valid source of data. The strings_<lang>.xml are currently the only reliable source of data. Take for instance the code from WeatherDotComCatcher: [code] ILocalization localization = ServiceRegistration.Get<ILocalization>(); // handle only mappings of different spellings if (string.Compare(tokenSplit, "T-Storms", true) == 0 || string.Compare(tokenSplit, "T-Storm", true) == 0) localizedWord = localization.ToString("[Weather.TStorm]"); else if (string.Compare(tokenSplit, "Cloudy", true) == 0) localizedWord = localization.ToString("[Weather.Clouds]"); else if (string.Compare(tokenSplit, "Shower", true) == 0 || string.Compare(tokenSplit, "T-Showers", true) == 0) localizedWord = localization.ToString("[Weather.Showers]"); else if (string.Compare(tokenSplit, "Isolated", true) == 0) localizedWord = localization.ToString("[Weather.Scattered]"); else if (string.Compare(tokenSplit, "Gale", true) == 0 || string.Compare(tokenSplit, "Tempest", true) == 0) localizedWord = localization.ToString("[Weather.Storm]"); else // for all other tokens do a direct lookup localizedWord = localization.ToString("[Weather."+tokenSplit+"]"); localizedLine.AppendFormat("{0} ", localizedWord ?? tokenSplit); //if not found, let fallback } return localizedLine.ToString(); [/code] with all the code inspection in the world there is no way to determine that [Weather.DewPoint] is valid (or invalid for that matter). One way to get around this is to make the use of localized strings explicit: [LocalizedString("Weather.DewPoint")] or similar somewhere in the code (or more likely assembly) where it can be examined and compared against the strings_<lang>.xml files to determine if any are missing or extra. Similarly [ImportedLocalizedString("Media.MusicMenuItem")] could be used to declare uses of imported strings. So far we have achieved a chore for devs, so to make it work a carrot (or two) is needed. 1. Carrot (and stick): A tool to run (after compilation?) which will prompt on new and missing strings and test for the existence of imported strings. 2. Another tool to manage translations/editing of existing files (this is pretty close to what's there). It would need the functionality of the tool in 1 to be complete rounded solution. Without a second source of data most of the really useful functionality is not possible or it would have disproportionate time needed spent (and wouldn't every be accurate as can be seen). Achieving a second source of data to make string management work correctly needs a change - it simply cannot work with only one data source. My preference would be a method which can be used on assemblies rather than on code - as sometimes code will not be easily available. Skin files are a slightly different proposition and would more easily be parsed. Opinions/alternatives welcome :D David [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
MediaPortal 2
General
Globalization string management tool
Contact us
RSS
Top
Bottom