Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix assignment path with kz locale #35

Merged
merged 3 commits into from
Dec 21, 2023
Merged

Conversation

Malcom1986
Copy link
Contributor

No description provided.

Copy link
Contributor

@corsicanec82 corsicanec82 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Также предложу заодно обновить список версий нод на каких тестируем
node-version: [14, 16, 18]
Например взять крайние версии и одну среднюю - [14, 18, 21]

@@ -36,7 +36,8 @@ const getLessonData = (lessonUrl) => {
};

const generateAssignmentPath = (repoPath, courseSlug, lessonSlug, locale) => {
const courseSlugWithLocale = locale === 'en' ? courseSlug : `${courseSlug}-${locale}`;
const normalizedLocale = locale === 'kz' ? 'ru' : locale;
const courseSlugWithLocale = locale === 'en' ? courseSlug : `${courseSlug}-${normalizedLocale}`;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

locale === 'en' так а тут уже по идее надо использовать локаль полученную на предыдущем шаге normalizedLocale

@@ -36,7 +36,8 @@ const getLessonData = (lessonUrl) => {
};

const generateAssignmentPath = (repoPath, courseSlug, lessonSlug, locale) => {
const courseSlugWithLocale = locale === 'en' ? courseSlug : `${courseSlug}-${locale}`;
const normalizedLocale = locale === 'kz' ? 'ru' : locale;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

давай просто определим константу на уровне модуля - объект с маппингом локалей на языки

const contentLocales = {
  ru: 'ru',
  kz: 'ru',
  en: 'en',
  es: 'es',
};

и будем юзать там где нужно

contentLocales[locale]

@@ -11,11 +11,11 @@ const assignmentResetCmd = require('../../src/commands/assignment/reset.js');
const { initSettings } = require('../../src/config.js');
const { readDirP, getFixturePath, getAssignmentConfig } = require('../helpers/index.js');

const buildLessonUrl = (courseSlug, lessonSlug) => (
`https://ru.hexlet.io/courses/${courseSlug}/lessons/${lessonSlug}/theory_unit`
const buildLessonUrl = (locale, courseSlug, lessonSlug) => (
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

кажется что проще добавить локаль третим параметром с дефолтным значением ru
И тогда достаточно будет поставить только там где кастом - kz

@corsicanec82 corsicanec82 merged commit 2c229fb into Hexlet:main Dec 21, 2023
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants