UNPKG

@newrelic/gatsby-theme-newrelic

Version:

[![Community Project header](https://github.com/newrelic/opensource-website/raw/master/src/images/categories/Community_Project.png)](https://opensource.newrelic.com/oss-category/#community-project)

16 lines (11 loc) 424 B
const { getI18nConfig } = require('../../src/utils/config'); const getLocale = ({ location }, themeOptions) => { const { locales, defaultLocale } = getI18nConfig(themeOptions); const [, base] = location.pathname.split('/'); const locale = locales .filter((locale) => !locale.isDefault) .find(({ locale }) => locale === base) || defaultLocale; return locale.locale; }; module.exports = getLocale;