Skip to content

Commit

Permalink
Merge pull request #2940 from wordpress-mobile/fix/cherrypick_locale_…
Browse files Browse the repository at this point in the history
…v3_fix

Cherry picking #2938 in 2.59.2
  • Loading branch information
oguzkocer authored Jan 9, 2024
2 parents aaafa4c + 2695646 commit 3c288bf
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@
import okhttp3.HttpUrl;

public abstract class BaseWPComRestClient {
private static final String WPCOM_V1_PREFIX = "/wpcom/v1";
private static final String WPCOM_V2_PREFIX = "/wpcom/v2";
private static final String WPCOM_V3_PREFIX = "/wpcom/v3";
private static final String LOCALE_PARAM_NAME_FOR_V1 = "locale";
private static final String LOCALE_PARAM_NAME_FOR_V2 = "_locale";

Expand Down Expand Up @@ -152,7 +153,8 @@ private void addAcceptHeaderIfNeeded(BaseRequest request) {


private @NonNull String getLocaleParamName(@NonNull String url) {
return url.contains(WPCOM_V1_PREFIX) ? LOCALE_PARAM_NAME_FOR_V1 : LOCALE_PARAM_NAME_FOR_V2;
return url.contains(WPCOM_V2_PREFIX) || url.contains(WPCOM_V3_PREFIX) ? LOCALE_PARAM_NAME_FOR_V2
: LOCALE_PARAM_NAME_FOR_V1;
}

protected @Nullable HttpUrl getHttpUrlWithLocale(@NonNull String url) {
Expand Down

0 comments on commit 3c288bf

Please sign in to comment.