mirror of
https://github.com/ansible/awx.git
synced 2026-01-11 01:57:35 -03:30
Default to lang in catalog when browser preference unavailable
When strings aren't available for the browser's preferred locale, default to one with strings to avoid displaying raw javascript variables.
This commit is contained in:
parent
3077cb9802
commit
8db88e979e
@ -30,7 +30,12 @@ const ProtectedRoute = ({ children, ...rest }) =>
|
||||
|
||||
function App() {
|
||||
const catalogs = { en, ja };
|
||||
const language = getLanguageWithoutRegionCode(navigator);
|
||||
let language = getLanguageWithoutRegionCode(navigator);
|
||||
if (!Object.keys(catalogs).includes(language)) {
|
||||
// If there isn't a string catalog available for the browser's
|
||||
// preferred language, default to one that has strings.
|
||||
language = 'en';
|
||||
}
|
||||
const match = useRouteMatch();
|
||||
const { hash, search, pathname } = useLocation();
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user