Skip to content
This repository has been archived by the owner on Sep 26, 2024. It is now read-only.

Commit

Permalink
chore: add config for english only (#5611)
Browse files Browse the repository at this point in the history
  • Loading branch information
habib-deriv authored Sep 11, 2023
1 parent ca4ea65 commit 79313f0
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 13 deletions.
16 changes: 3 additions & 13 deletions gatsby-node.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/* eslint-disable import/order */
const language_config = require(`./i18n-config.js`)
const language_config_en = require(`./i18n-config-en.js`)
const path = require('path')

const translations_cache = {}
Expand Down Expand Up @@ -44,18 +45,6 @@ exports.onCreatePage = ({ page, actions }) => {
redirectInBrowser: true,
isPermanent: true,
})
createRedirect({
fromPath: `/careers/locations/minsk`,
toPath: `/careers/`,
redirectInBrowser: true,
isPermanent: true,
})
createRedirect({
fromPath: `/careers/locations/minsk/`,
toPath: `/careers/`,
redirectInBrowser: true,
isPermanent: true,
})
}

if (is_responsible_trading) {
Expand Down Expand Up @@ -197,8 +186,9 @@ exports.onCreatePage = ({ page, actions }) => {
isPermanent: true,
})
}
const is_english = process.env.GATSBY_LANGUAGE === 'en'

Object.keys(language_config).map((lang) => {
Object.keys(is_english ? language_config_en : language_config).map((lang) => {
// Use the values defined in "locales" to construct the path
const { path, is_default } = language_config[lang]
const localized_path = is_default ? page.path : `${path}${page.path}`
Expand Down
9 changes: 9 additions & 0 deletions i18n-config-en.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module.exports = {
en: {
is_default: true,
path: 'en',
display_name: 'English',
short_name: 'EN',
affiliate_lang: 0,
},
}

0 comments on commit 79313f0

Please sign in to comment.