Made language fetching normalize language code to a form with _ insted of -

This commit is contained in:
pezcurrel 2023-01-01 16:51:20 +01:00
parent 184cf49d16
commit a4486403c7

View file

@ -355,7 +355,8 @@ if ($idata['IsMastodon'] && $idata['Version']>='4.0.0') {
}
// domain_count is gone from api v2, and we won't resort to api v1 just to get it when ver. >= 4.0.0
if (isset($buf['languages']) && is_array($buf['languages']))
$idata['languages']=$buf['languages'];
foreach ($buf['languages'] as $lang)
$idata['languages'][]=str_replace('-','_',$lang);
if (isset($buf['rules']) && is_array($buf['rules']))
foreach ($buf['rules'] as $rule)
if (isset($rule['id']) && is_string($rule['id']) && !isempty($rule['id']) && isset($rule['text']) && is_string($rule['text']) && !isempty($rule['text']))
@ -466,7 +467,8 @@ if ($idata['IsMastodon'] && $idata['Version']>='4.0.0') {
if (isset($buf['contact_account']['header']) && is_string($buf['contact_account']['header']) && !isempty($buf['contact_account']['header']))
$idata['AdmHeader']=trim($buf['contact_account']['header']);
if (isset($buf['languages']) && is_array($buf['languages']))
$idata['languages']=$buf['languages'];
foreach ($buf['languages'] as $lang)
$idata['languages'][]=str_replace('-','_',$lang);
if (isset($buf['rules']) && is_array($buf['rules']))
foreach ($buf['rules'] as $rule)
if (isset($rule['id']) && is_string($rule['id']) && !isempty($rule['id']) && isset($rule['text']) && is_string($rule['text']) && !isempty($rule['text']))