Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API: String entries are not localized #406

Closed
dragotin opened this issue Oct 8, 2015 · 9 comments
Closed

API: String entries are not localized #406

dragotin opened this issue Oct 8, 2015 · 9 comments
Milestone

Comments

@dragotin
Copy link

dragotin commented Oct 8, 2015

The API returns strings in the subject and the message tag at least. These are in an english locale, not translated.

If I read the code correctly, there is no way for the client to specify the language the server should return. That could either be done with an additional parameter, or, via the Accept-Language header as described here: http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html

This blocks owncloud/client#3732

@nickvergessen
Copy link
Contributor

They are translated with the language the user selected in the web UI, should be sufficient?

@dragotin
Copy link
Author

dragotin commented Oct 8, 2015

No, I do not think so. Client- and server language settings have nothing to do with each other.

@dragotin dragotin removed the question label Oct 8, 2015
@nickvergessen
Copy link
Contributor

I guess the number of people that have client and server set to different languages is pretty low, but I can try to read the language from the accept-language header, if you think it is really necessary.

@dragotin
Copy link
Author

dragotin commented Oct 8, 2015

Yes, I think that. There seems to be a considerable number of people who never open the web interface but only sync in large organizations. An example might be an US company with a branch in china, they will have an english server by default, but the desktops of the people will be in their locale.

I don't think we want to force them to go to their personal settings on a for them unknown website first (in a language they do not understand) to switch. It's the small things that make a good software perfect ;-)

@DeepDiver1975
Copy link
Member

The language is already taken from the Accept-Language header in core - see https://github.com/owncloud/core/blob/master/ocs/v1.php#L49

@nickvergessen
Copy link
Contributor

yeah just found that as well and it works for me using curl, when I hardcode the value in https://github.com/owncloud/core/blob/master/lib/private/l10n.php#L107 and https://github.com/owncloud/core/blob/master/lib/private/l10n.php#L113

@DeepDiver1975
Copy link
Member

$ curl -H "Accept-Language:de;q=0.8" http://admin:admin@localhost:8080/ocs/v1.php/cloud/activity
<?xml version="1.0"?>
<ocs>
 <meta>
  <status>ok</status>
  <statuscode>100</statuscode>
  <message/>
 </meta>
 <data>
  <element>
   <id>10</id>
   <subject>Du hast IMG_2003.JPG, IMG_2004.JPG, IMG_2020.JPG und 3 weitere erstellt</subject>
   <message></message>
   <file>/IMG_2003.JPG</file>
   <link>http://localhost:8080/index.php/apps/files?dir=%2F</link>
   <date>2015-10-08T10:38:46+00:00</date>
  </element>
  <element>
   <id>4</id>
   <subject>Du hast IMG_2035.JPG, IMG_2110.JPG, IMG_2148.JPG und IMG_2165.JPG erstellt</subject>
   <message></message>
   <file>/IMG_2035.JPG</file>
   <link>http://localhost:8080/index.php/apps/files?dir=%2F</link>
   <date>2015-10-08T10:38:19+00:00</date>
  </element>
 </data>
</ocs>
$ curl -H "Accept-Language:es;q=0.8" http://admin:admin@localhost:8080/ocs/v1.php/cloud/activity
<?xml version="1.0"?>
<ocs>
 <meta>
  <status>ok</status>
  <statuscode>100</statuscode>
  <message/>
 </meta>
 <data>
  <element>
   <id>10</id>
   <subject>Ha creado IMG_2003.JPG, IMG_2004.JPG, IMG_2020.JPG y 3 más</subject>
   <message></message>
   <file>/IMG_2003.JPG</file>
   <link>http://localhost:8080/index.php/apps/files?dir=%2F</link>
   <date>2015-10-08T10:38:46+00:00</date>
  </element>
  <element>
   <id>4</id>
   <subject>Ha creado IMG_2035.JPG, IMG_2110.JPG, IMG_2148.JPG y IMG_2165.JPG</subject>
   <message></message>
   <file>/IMG_2035.JPG</file>
   <link>http://localhost:8080/index.php/apps/files?dir=%2F</link>
   <date>2015-10-08T10:38:19+00:00</date>
  </element>
 </data>
</ocs>

@DeepDiver1975
Copy link
Member

from my pov this can be closed since it's working

@dragotin
Copy link
Author

dragotin commented Oct 8, 2015

Yes, thanks & my apologies. I tested with 8.0.x where it's not yet working...

@dragotin dragotin closed this as completed Oct 8, 2015
@nickvergessen nickvergessen added this to the 8.2-current milestone Oct 8, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants