lbry-desktop/ui/constants/homepage_languages.js
saltrafael 712e02db16
Use locale/get response to suggest homepage and language switch (#839)
* Use locale/get response to suggest homepage and language switch

* Fix language modal condition

* Fixes from review

* Fixes from review

* Fix gdpr

* string

* Fix multiple options behavior

* Fix gdpr and use only one fetch

* Only show if no languages set or loaded

* pt-br

* Fix ad

* Fix homepage select

* Fix zh langs
2022-03-02 09:44:01 -05:00

21 lines
576 B
JavaScript

import { getLanguageEngName } from 'constants/languages';
const HOMEPAGE_LANGUAGES = {
en: getLanguageEngName('en'),
fr: getLanguageEngName('fr'),
es: getLanguageEngName('es'),
de: getLanguageEngName('de'),
zh: getLanguageEngName('zh'),
ru: getLanguageEngName('ru'),
'pt-BR': getLanguageEngName('pt-BR'),
};
export function getHomepageLanguage(code) {
// -----override-----
if (code === 'zh-Hans' || code === 'zh-Hant') return HOMEPAGE_LANGUAGES.zh;
// ------------------
return HOMEPAGE_LANGUAGES[code] || null;
}
export default HOMEPAGE_LANGUAGES;