Bug 131435

Summary: [EFL][WK2] Add API to set preferred languages
Product: WebKit Reporter: Ryuan Choi <ryuan.choi>
Component: WebKit EFLAssignee: Ryuan Choi <ryuan.choi>
Status: RESOLVED FIXED    
Severity: Normal CC: bunhere, cdumez, commit-queue, gyuyoung.kim, lucas.de.marchi, sergio
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch
none
Patch none

Description Ryuan Choi 2014-04-09 06:11:52 PDT
Service provider may check thst "Accept-Language".

This API will be used to change preference of "Acceept-Language"
Comment 1 Ryuan Choi 2014-04-09 07:07:16 PDT
Created attachment 228958 [details]
Patch
Comment 2 Jinwoo Song 2014-04-09 17:52:46 PDT
Comment on attachment 228958 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=228958&action=review

> Source/WebKit2/UIProcess/API/efl/ewk_context.cpp:573
> +    if (languages) {

Why don't you make an early return when the language parameter is null?

> Source/WebKit2/UIProcess/API/efl/ewk_context.h:437
> + * @param languages the list of preferred languages (char * as data)

s/char */char* ?
Move this line below the description.

> Source/WebKit2/UIProcess/API/efl/ewk_context.h:440
> + * header that will be included in the network requests

Put a period at the end of the sentence.

> Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_context.cpp:276
> +    ASSERT_STREQ("en-US", s_acceptLanguages.utf8().data());

The default locale may be different from the system environment.
Comment 3 Ryuan Choi 2014-04-09 18:20:51 PDT
Comment on attachment 228958 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=228958&action=review

>> Source/WebKit2/UIProcess/API/efl/ewk_context.cpp:573
>> +    if (languages) {
> 
> Why don't you make an early return when the language parameter is null?

Null is used to clear user preferred langague.

I will mention it in doxygen.

>> Source/WebKit2/UIProcess/API/efl/ewk_context.h:437
>> + * @param languages the list of preferred languages (char * as data)
> 
> s/char */char* ?
> Move this line below the description.

OK.

>> Source/WebKit2/UIProcess/API/efl/ewk_context.h:440
>> + * header that will be included in the network requests
> 
> Put a period at the end of the sentence.

OK

>> Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_context.cpp:276
>> +    ASSERT_STREQ("en-US", s_acceptLanguages.utf8().data());
> 
> The default locale may be different from the system environment.

If I am right, run-efl-tests will change the locale for non-english user.

Isn't it enough?
Comment 4 Ryuan Choi 2014-04-09 18:29:48 PDT
Created attachment 229010 [details]
Patch
Comment 5 Gyuyoung Kim 2014-04-09 18:53:05 PDT
Comment on attachment 229010 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=229010&action=review

> Source/WebKit2/ChangeLog:8
> +        Application may need to change the list of "Accept-Language".

According to this description, this APIs may not be used by application. I'm not sure we have to add new APIs without clear reason.

> Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_context.cpp:243
> +static String s_acceptLanguages;

I prefer to use a primitive type in out of WebKit. Because it may occur symbol visibility problem when running layout test.

In this case, "const char*" looks proper that String.
Comment 6 Ryuan Choi 2014-04-09 19:17:16 PDT
(In reply to comment #5)
> (From update of attachment 229010 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=229010&action=review
> 
> > Source/WebKit2/ChangeLog:8
> > +        Application may need to change the list of "Accept-Language".
> 
> According to this description, this APIs may not be used by application. I'm not sure we have to add new APIs without clear reason.
> 
Some contents providers can check Accept-Language field of request header and send different contents to the applications.
http://www.w3.org/International/questions/qa-lang-priorities.en.php

So, good browsers have the power to change it.

> > Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_context.cpp:243
> > +static String s_acceptLanguages;
> 
> I prefer to use a primitive type in out of WebKit. Because it may occur symbol visibility problem when running layout test.
> 
> In this case, "const char*" looks proper that String.

OK, I will.
Comment 7 Jinwoo Song 2014-04-09 19:23:15 PDT
Comment on attachment 228958 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=228958&action=review

>>> Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_context.cpp:276
>>> +    ASSERT_STREQ("en-US", s_acceptLanguages.utf8().data());
>> 
>> The default locale may be different from the system environment.
> 
> If I am right, run-efl-tests will change the locale for non-english user.
> 
> Isn't it enough?

If then, that's fine.
Comment 8 Ryuan Choi 2014-04-09 19:30:18 PDT
Created attachment 229016 [details]
Patch
Comment 9 Gyuyoung Kim 2014-04-09 19:31:13 PDT
Comment on attachment 229016 [details]
Patch

LGTM
Comment 10 WebKit Commit Bot 2014-04-09 21:05:20 PDT
Comment on attachment 229016 [details]
Patch

Clearing flags on attachment: 229016

Committed r167062: <http://trac.webkit.org/changeset/167062>
Comment 11 WebKit Commit Bot 2014-04-09 21:05:27 PDT
All reviewed patches have been landed.  Closing bug.