0

Specifying user language preference in OAuth application

I've developed an OAuth application in Traditional Chinese language and one of the problem we encountered is that the Yahoo! login page always displays in English the first time the user is told to login. We believe this language difference has made many of our users decide not to proceed to login because they don't understand the language on it despite the Yahoo! logo and "yahoo.com" string in the URL.

The documentation that comes with the PHP SDK does not mention how to specify the user language preference when making OAuth request. After searching the YDN, I found only one page the mentioned related topic : OAuth Authorization Flow

http://developer.yahoo.com/oauth/guide/oauth-auth-flow.html

In this page a parameter called "xoauth_lang_pref" was mentioned, but the PHP SDK document does not contain any related information. After all I decided to modify the Yahoo.inc source code. Here is the modification I've made:

First in line #27, after the $YahooConfig array, I added the following:

CODE
// ---------------
// Hacked. To specify the login page language.
// ---------------
$YahooConfig["XOAUTH_LANG_PREF"] = "tw"; // "zh-tw" won't work.
// ---------------
// End hacking.
// ---------------


Then in line #1467 (this line number is AFTER adding the above code), I modified the line to:

CODE
$response = $client->post($baseUrl, "application/x-www-form-urlencoded",
array("oauth_callback" => $callback, "xoauth_lang_pref" => $YahooConfig["XOAUTH_LANG_PREF"]));


After these modification the login page now always displays in Traditional Chinese (for Taiwan).

I hope this would help someone that develops in languages other than English. smile.gif

by
1 Reply
  • Thanks for posting this comment.

    We do support localized authorization flows. We will look into adding some prominence to this feature in the documents.

    Regards,
    Sabari
    Y! Membership

    QUOTE (乳瑪琳 @ Jun 17 2009, 08:36 AM) <{POST_SNAPBACK}>
    I've developed an OAuth application in Traditional Chinese language and one of the problem we encountered is that the Yahoo! login page always displays in English the first time the user is told to login. We believe this language difference has made many of our users decide not to proceed to login because they don't understand the language on it despite the Yahoo! logo and "yahoo.com" string in the URL.

    The documentation that comes with the PHP SDK does not mention how to specify the user language preference when making OAuth request. After searching the YDN, I found only one page the mentioned related topic : OAuth Authorization Flow

    http://developer.yahoo.com/oauth/guide/oauth-auth-flow.html

    In this page a parameter called "xoauth_lang_pref" was mentioned, but the PHP SDK document does not contain any related information. After all I decided to modify the Yahoo.inc source code. Here is the modification I've made:

    First in line #27, after the $YahooConfig array, I added the following:

    CODE
    // ---------------
    // Hacked. To specify the login page language.
    // ---------------
    $YahooConfig["XOAUTH_LANG_PREF"] = "tw"; // "zh-tw" won't work.
    // ---------------
    // End hacking.
    // ---------------


    Then in line #1467 (this line number is AFTER adding the above code), I modified the line to:

    CODE
    $response = $client->post($baseUrl, "application/x-www-form-urlencoded",
    array("oauth_callback" => $callback, "xoauth_lang_pref" => $YahooConfig["XOAUTH_LANG_PREF"]));


    After these modification the login page now always displays in Traditional Chinese (for Taiwan).

    I hope this would help someone that develops in languages other than English. :)
    0

Recent Posts

in OAuth General Discussion YDN SDKs