netwerk/necko-config.h.in
author Zibi Braniecki <zbraniecki@mozilla.com>
Thu, 14 Sep 2017 15:21:33 -0700
changeset 424146 48109fce6741a2448a9d71f48deccbd72f732003
parent 170017 260fbed9b3efc47a42a6caa46f99c69504f69e1d
child 427990 ce6e2f914c96563ef4d4b2dd2bb10fe1b9fd2a33
permissions -rw-r--r--
Bug 1400006 - Extend language negotiation in LocaleService to support looking for the best likelySubtag for the locale with region stripped. r=Pike, a=lizzard Add additional logic to our language negotation to do apply likelySubtags when a direct match is not available. Currently, if the user specifies the locale with region, and we do not have a direct for that region, we pick all locales for the same language and other regions in no order. The example of where it returns suboptimal results: 1) Requested locale "en-CA" 2) Available locales ["en-ZA", "en-GB", "en-US"] 3) Negotiated locales ["en-ZA", "en-GB", "en-US"] This would not happen, if the user requested a generic "de", "en" etc.: 1) Requested locale "en" 2) Available locales ["en-ZA", "en-GB", "en-US"] 3) Negotiated locales ["en-US", "en-ZA", "en-GB"] because after not finding a direct match, we would use likelySubtags to extend "en" to "en-Latn-US" and then find the priority match in "en-US". This patch extends this logic to "en-US" or "de-LU" by adding a step which strips the region tag and then applies likelySubtag on the result. This means that in absence of direct match the following fallbacks would happen: "de-LU" -> "de-DE" "es-CL" -> "es-ES" "en-CA" -> "en-US" This does not affect languages that use multiple scripts, so ar, sr and zh are not affected. MozReview-Commit-ID: BR1WrgXSf6a

/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

#ifndef _NECKO_CONFIG_H_
#define _NECKO_CONFIG_H_

#undef NECKO_COOKIES

#undef NECKO_WIFI

#undef NECKO_PROTOCOL_about
#undef NECKO_PROTOCOL_data
#undef NECKO_PROTOCOL_device
#undef NECKO_PROTOCOL_file
#undef NECKO_PROTOCOL_ftp
#undef NECKO_PROTOCOL_http
#undef NECKO_PROTOCOL_res
#undef NECKO_PROTOCOL_rtsp
#undef NECKO_PROTOCOL_viewsource
#undef NECKO_PROTOCOL_websocket
#undef NECKO_PROTOCOL_wyciwyg

#endif