marxjohnson / btsyncindicator

Bittorrent Sync indicator for linux desktops
GNU Lesser General Public License v3.0
41 stars 5 forks source link

Problems when Web Interface is set to a language that is not English #24

Closed pjssilva closed 10 years ago

pjssilva commented 11 years ago

I am Brazilian, so I tried to set btsync web ui to Portuguese. After doing that the indicator does not work correctly. The reason is that the information it retrieves from th server is translates, so, for example the status "Synced", becomes "Sincronizado". The indicator fails then to parse the information.

In fact, to check this I added a line to the source code to print the information retrieved from the server (at line 249 of current source code of v. 0.10). If I set bitsync web interface to English this is what I get (I ERASED the secrets):

{u'folders': [{u'peers': [{u'status': u'Synced on 10/19/13 09:08:30', u'direct': 1, u'name': u'quorra -- pjssilva'}, {u'status': u'Synced on 10/19/13 09:07:55', u'direct': 1, u'name': u'trinity - pjssilva'}], u'name': u'/home/pjssilva/syncdir', u'iswritable': 1, u'secret': u'ERASED', u'readonlysecret': u'ERASED', u'size': u'112.0 MB in 168 files'}], u'speed': u'0.0 kB/s up, 0.0 kB/s down'}

Look at the status result, it starts with "Synced", a string that is used in the code. Now, If I change the interface to Portuguese (Brasil), it becomes:

{u'folders': [{u'peers': [{u'status': u'Sincronizado em 10/19/13 09:08:30', u'direct': 1, u'name': u'quorra -- pjssilva'}, {u'status': u'Sincronizado em 10/19/13 09:07:55', u'direct': 1, u'name': u'trinity - pjssilva'}], u'name': u'/home/pjssilva/syncdir', u'iswritable': 1, u'secret': u'ERASED', u'readonlysecret': u'ERASED', u'size': u'112.0 MB em 168 arquivos '}], u'speed': u'0.0 kB/s upload, 0.0 kB/s download'}

Now, the status starts with "Sincronizado", which is synced in Portuguese. This was making the indicator behave badly until I switched it back to English.

tuxpoldo commented 11 years ago

Instead of implementing the parsing of return codes in each supported language, we should check if it is possible to ask for the required language directly from the request.

marxjohnson commented 10 years ago

Hopefully in the not-too-distant future we wont be reliant on localised strings to determine if a peer is synced, so I'm not going to put effort into fixing this issue at the moment. If it doesn't look like the solution I'm hoping for will be forthcoming, then I'll re-visit this later.

marxjohnson commented 10 years ago

As the Sync API I was hoping to rely on at the time of the above comment now looks like it wont be usable due to licensing issues, we need a fix for this.