Commons talk:SVG Translate tool

From Wikimedia Commons, the free media repository
Jump to navigation Jump to search

Blank character[edit]

Hi,
How can I "translate" a letter/word by a blank space ? For what I see, when you don't put anything in the translated box, the original language is keept on the image. - Simon Villeneuve 15:26, 20 August 2019 (UTC)

If a plain space does not work, then try entering a nonbreaking space, Unicode character U+00A0. On Windows, press and hold down the Alt key; on the numeric keypad type "0160", and then release the Alt key. Make sure your numeric keypad is enabled; I toggle mine with the NumLock key. See http://www.fileformat.info/info/unicode/char/00a0/index.htm Glrx (talk) 18:07, 20 August 2019 (UTC)
Thank you ! I sorted it out yesterday in the afternoon.
I'll finish my French translation of File:Antarctica.svg today. It was really hard mainly because the space between the characters aren't the same in English and French (as far as I can see in the preview window). - Simon Villeneuve 12:21, 21 August 2019 (UTC)

Problem with Antarctica[edit]

Forcing French with |lang=fr

Hi again,
I have 2 questions about File:Antarctica.svg :
1- Why there's no option to show the map in French, as I can see, by example, for File:Asymmetric (PSF).svg ?
2- Why the file I have uploaded is lighter (3.93 Mio) than the precedent one (4.32 Mio) ? - Simon Villeneuve 14:45, 21 August 2019 (UTC)

@NKohli (WMF), JoKalliauer:
  1. The file page does not show a French (or other language) option due to the lazy scanning behavior of MediaWiki (MW). MW only looks at the first 0.25 or 0.50 Mio (I forget which) of an SVG file and then stops. If it does not find any systemLanguage attributes (the SVG attribute used for language selection), then it presumes the SVG file does not have any. The fix would be to have MW scan the whole file (not likely to happen anytime soon). The workaround is to put an invisible translated phrase at the beginning of the file so MW will find it. (The visible text may not be moved up because it must be painted on top of the 3.5 Mio that describe the geography.)
    <switch visibility="hidden">
      <text systemLanguage="en">en</text>
      <text systemLanguage="fr">fr</text>
      <text>default</text>
    </switch>
    
  2. I believe the byte difference is just spaces and newlines. The original file is about 50,000 lines of indented XML. The output of SVG Translate is 300 lines with no indentation. So the difference could be losing about 10 bytes per line times 50k lines for 0.5 Mio.
It's a beautiful map, but it would be better if the SVG file were under 0.2 Mio. I'd like MW to directly serve small SVG files rather than converting them to PNG files.
Also, the map is yet another example that MW should support textPath. I've seen many such examples recently, and it is changing my view on how important text on a path is.
Glrx (talk) 16:32, 21 August 2019 (UTC)
Hi
Thanks for this precise and complete answer !
I have putted your "systemlanguage line" in the first line of the file, but it doesn't show the French option on Commons. I don't know why. Does it is already too far ? I've try to put it before, but it broke the file. - Simon Villeneuve 19:14, 21 August 2019 (UTC)
@Simon Villeneuve: You put the insertion at about the 3 MB mark, so it would not work. I do not want to have an edit collision with you, so let me know when you are not editing the file, and I will insert the code. Also, you should be aware that cache synchronization issues can arise. A displayed image may not be the most recent. Glrx (talk) 19:37, 21 August 2019 (UTC)
I went ahead an did the edit. If you've made changes, just overwrite mine and I will redo them. The language dropdown works. MB lines really slow my code editor down.... Glrx (talk) 20:02, 21 August 2019 (UTC)
Thank you for everything !
I still didnt find what you have done. The first line of character exceed the window and I can't find something with "systemLanguage" inside. - Simon Villeneuve 23:35, 21 August 2019 (UTC)
You may be viewing a cached version of the file. The first several lines of the file should be relatively short. Open the SVG file (https://upload.wikimedia.org/wikipedia/commons/c/c0/Antarctica.svg) in Chrome and then right click to view page source. Lines 20 to 24. Glrx (talk) 01:17, 22 August 2019 (UTC)
I corrected phab:T35245 (slightly misplaced text, see "Qeen Maud Mtns"), but not phab:T36947 (bad kering), but sadly I noticed that the french version got some minor textissues, which I tried to improve.  — Johannes Kalliauer - Talk | Contributions 09:31, 25 August 2019 (UTC)
Sadly, the file has many text issues, and the translation tool some of those issues more difficult to sort out. Glrx (talk) 15:55, 25 August 2019 (UTC)