export default function getLang(context) {
  const {
    location,
    metadata,
  } = context
  const {
    i18n,
  } = metadata
  const firstURIlevel = location.pathname.split("/")[1]
  return i18n[firstURIlevel] ? firstURIlevel : "fr"
}

import invariant from "invariant"

export default function getLang(context) {
  const {
    location,
    metadata: { i18n },
  } = context

  invariant(location, "'location' is required from the context")
  invariant(i18n, "'metadata.i18n' is required from the context")

  const firstURIlevel = location.pathname.split("/")[0]
  return i18n[firstURIlevel] ? firstURIlevel : "fr"
}

Fix lang detection (/en/ is in french...)
Fix lang detection (/en/ is in french...)
