Skip to content

Commit

Permalink
Rename languages to LANGUAGES_DATA
Browse files Browse the repository at this point in the history
  • Loading branch information
MarvNC committed Feb 3, 2024
1 parent e4ffa50 commit 488072a
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/constants.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* @type {Record<Language, { name: string, shortName: string, langCode: string }>}
*/
const languages = {
const LANGUAGES_DATA = {
yue: {
name: '廣東話',
shortName: '粵',
Expand Down Expand Up @@ -79,7 +79,7 @@ const COMPRESSED_IMAGES_FOLDER = './compressedImages';
const IMAGE_RESIZE_WIDTH = 400;

export {
languages,
LANGUAGES_DATA,
IMAGE_FOLDER,
COMPRESSED_IMAGES_FOLDER,
IMAGE_RESIZE_WIDTH,
Expand Down
4 changes: 2 additions & 2 deletions src/util/entryParse/parseEntryToJson.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { languages } from '../../constants.js';
import { LANGUAGES_DATA } from '../../constants.js';

/**
*
Expand Down Expand Up @@ -158,7 +158,7 @@ function parseLanguageData(text) {
continue;
}
// Check if the language is a possible language
if (!languages[matchedLang]) {
if (!LANGUAGES_DATA[matchedLang]) {
throw new Error(`Invalid language: ${matchedLang}`);
}
// Else a language is found
Expand Down
4 changes: 2 additions & 2 deletions src/util/yomitan/convertSenseToSC.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { languages } from '../../constants.js';
import { LANGUAGES_DATA } from '../../constants.js';
import { isStringSentence } from '../textHandling/textUtils.js';
import { convertTextToSC } from './parseTextToSC.js';

Expand Down Expand Up @@ -187,7 +187,7 @@ function convertLanguageEntryToListItems(
* @type {import('yomichan-dict-builder/dist/types/yomitan/termbank').StructuredContent[]}
*/
const languageLiScArray = [];
const languageInfo = languages[language];
const languageInfo = LANGUAGES_DATA[language];
for (const languageText of languageTexts) {
/**
* @type {import('yomichan-dict-builder/dist/types/yomitan/termbank').StructuredContent[]}
Expand Down

0 comments on commit 488072a

Please sign in to comment.