Hey all.
I'm looking for comments regarding an extension I knocked up today and its viability for Wikimedia wikis:
https://github.com/Jarry1250/TranslateSvg
The extension removes the need for duplicating a file (an administrative nightmare) when you want to translate it. It does this by creating an extra information flow:
[[File:Example.svg|thumb|120px|lang=en]] => rsvg "...Example.svg" "120px-en-Example.svg" (lang='en') => Displays in English [[File:Example.svg|thumb|120px|lang=fr]] => rsvg "...Example.svg" "120px-fr-Example.svg" (lang='fr') => Displays in French
It means rsvg SVG to PNG will finally "understand" the <switch> tag, enabling fully translatable SVGs [1]. It would eventually work in tandem with a translating interface, e.g. through TranslateWiki and/or a local special page.
The only issue I know of is that the renderer will create a new file every time you change the language parameter, causing a drain on memory/storage space. How do we handle this for random thumb sizes at the moment?
All comments appreciated
Harry (User:Jarry1250)
On Thu, Dec 8, 2011 at 1:55 PM, Harry Burt jarry1250@gmail.com wrote:
Hey all.
I'm looking for comments regarding an extension I knocked up today and its viability for Wikimedia wikis:
https://github.com/Jarry1250/TranslateSvg
The extension removes the need for duplicating a file (an administrative nightmare) when you want to translate it. It does this by creating an extra information flow:
[[File:Example.svg|thumb|120px|lang=en]] => rsvg "...Example.svg" "120px-en-Example.svg" (lang='en') => Displays in English [[File:Example.svg|thumb|120px|lang=fr]] => rsvg "...Example.svg" "120px-fr-Example.svg" (lang='fr') => Displays in French
It means rsvg SVG to PNG will finally "understand" the <switch> tag, enabling fully translatable SVGs [1]. It would eventually work in tandem with a translating interface, e.g. through TranslateWiki and/or a local special page.
Awesome! I like the way you're saving updates back into the file using the native <switch> capability.
This might need some additional work when we start serving native SVG images for supporting browsers, though, since we'd need to override that language from the system default. But we'll probably want to do other processing like minification anyway, so that may dovetail in nicely.
The only issue I know of is that the renderer will create a new file every
time you change the language parameter, causing a drain on memory/storage space. How do we handle this for random thumb sizes at the moment?
We basically just allow them to expand until something happens that clears the whole lot for a given image (updating it, deleting it, running a cache purge on it).
Yes it's kinda nasty. :(
-- brion
Hoi, At the Toolserver there is a (localisable) tool that allows for the localisation of texts in a SVG image.. Does your functionality work together with this ? Thanks, Gerard
On 8 December 2011 22:55, Harry Burt jarry1250@gmail.com wrote:
Hey all.
I'm looking for comments regarding an extension I knocked up today and its viability for Wikimedia wikis:
https://github.com/Jarry1250/TranslateSvg
The extension removes the need for duplicating a file (an administrative nightmare) when you want to translate it. It does this by creating an extra information flow:
[[File:Example.svg|thumb|120px|lang=en]] => rsvg "...Example.svg" "120px-en-Example.svg" (lang='en') => Displays in English [[File:Example.svg|thumb|120px|lang=fr]] => rsvg "...Example.svg" "120px-fr-Example.svg" (lang='fr') => Displays in French
It means rsvg SVG to PNG will finally "understand" the <switch> tag, enabling fully translatable SVGs [1]. It would eventually work in tandem with a translating interface, e.g. through TranslateWiki and/or a local special page.
The only issue I know of is that the renderer will create a new file every time you change the language parameter, causing a drain on memory/storage space. How do we handle this for random thumb sizes at the moment?
All comments appreciated
Harry (User:Jarry1250)
[1] https://developer.mozilla.org/en/SVG/Element/switch _______________________________________________ Wikitech-l mailing list Wikitech-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikitech-l
On 08/12/11 22:55, Harry Burt wrote:
Hey all.
I'm looking for comments regarding an extension I knocked up today and its viability for Wikimedia wikis:
Looks very good. It was damn simple! I just have a comment, you do
$language = ( isset( $params['lang'] ) ) ? $params['lang'] : '';
but the default value of rasterize $language is null, and you perform a strict comparison:
if( $language !== null){
Thus, I'd change the ternary above to
$language = ( isset( $params['lang'] ) ) ? $params['lang'] : '';
It's probably worth to add to the native Svg rasterizer, too. We would need to add a MediaWiki frontend to -at least- get the svg languages, ideally also to allow on-wiki translation. If the given language is not available in the svg, perhaps MediaWiki should automatically replace it by an appropiate fallback in the thumbnail call.
Have you already requested commit access?
I once was thinking about something like that, but I didn't know the <switch> tag existed. Really awesome, great functionality! I hope it can be used on Commons soon.
2011/12/8 Harry Burt jarry1250@gmail.com
Hey all.
I'm looking for comments regarding an extension I knocked up today and its viability for Wikimedia wikis:
https://github.com/Jarry1250/TranslateSvg
The extension removes the need for duplicating a file (an administrative nightmare) when you want to translate it. It does this by creating an extra information flow:
[[File:Example.svg|thumb|120px|lang=en]] => rsvg "...Example.svg" "120px-en-Example.svg" (lang='en') => Displays in English [[File:Example.svg|thumb|120px|lang=fr]] => rsvg "...Example.svg" "120px-fr-Example.svg" (lang='fr') => Displays in French
It means rsvg SVG to PNG will finally "understand" the <switch> tag, enabling fully translatable SVGs [1]. It would eventually work in tandem with a translating interface, e.g. through TranslateWiki and/or a local special page.
The only issue I know of is that the renderer will create a new file every time you change the language parameter, causing a drain on memory/storage space. How do we handle this for random thumb sizes at the moment?
All comments appreciated
Harry (User:Jarry1250)
[1] https://developer.mozilla.org/en/SVG/Element/switch _______________________________________________ Wikitech-l mailing list Wikitech-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikitech-l
wikitech-l@lists.wikimedia.org