accept_languages
comes from the browser, and in some browsers I am allowed to input a custom locale, whatever I want. So I can put any syntactically valid locale. For example ja-Cyrl-ZA
(Japanese in South Africa written in Cyrillic script).
Some other browsers only give you a limited list to choose from. Some don't even allow you to specify a region, only a language. Some give you a very short list of countries.
So there are differences between browsers.
If what you really want is a list of languages used in a country, independent of Accept-Languages
, this might be a good source of info in a machine readable format:
https://github.com/unicode-org/cldr/blob/main/common/supplemental/supplementalData.xml
See the <territoryInfo>
section.
For example the info about South Africa is a line 4365:
<territory type="ZA" gdp="767200000000" literacyPercent="93" population="56463600"> <!--South Africa-->
<languagePopulation type="en" literacyPercent="99" populationPercent="31" officialStatus="official" references="R1265"/> <!--English-->
<languagePopulation type="zu" literacyPercent="50" populationPercent="24" officialStatus="official_regional"/> <!--Zulu-->
<languagePopulation type="xh" literacyPercent="50" populationPercent="18" officialStatus="official_regional"/> <!--Xhosa-->
<languagePopulation type="af" literacyPercent="99" populationPercent="13" officialStatus="official_regional"/> <!--Afrikaans-->
<languagePopulation type="nso" literacyPercent="50" populationPercent="9.4" officialStatus="official_regional"/> <!--Northern Sotho-->
<languagePopulation type="tn" literacyPercent="50" populationPercent="8.2" officialStatus="official_regional"/> <!--Tswana-->
<languagePopulation type="st" literacyPercent="50" populationPercent="7.9" officialStatus="official_regional"/> <!--Southern Sotho-->
<languagePopulation type="ts" literacyPercent="50" populationPercent="4.4" officialStatus="official_regional"/> <!--Tsonga-->
<languagePopulation type="ss" literacyPercent="50" populationPercent="2.7" officialStatus="official_regional"/> <!--Swati-->
<languagePopulation type="ve" literacyPercent="50" populationPercent="2.3" officialStatus="official_regional"/> <!--Venda-->
<languagePopulation type="hi" literacyPercent="69" populationPercent="2"/> <!--Hindi-->
<languagePopulation type="nr" literacyPercent="50" populationPercent="1.6" officialStatus="official_regional"/> <!--South Ndebele-->
<languagePopulation type="sw" literacyPercent="50" populationPercent="0.0018"/> <!--Swahili-->
</territory>