Skip to content

Commit

Permalink
Pass dictionary alias to all anki type
Browse files Browse the repository at this point in the history
  • Loading branch information
khaitruong922 committed Jul 30, 2024
1 parent 2863a8e commit dbaba41
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 4 additions & 2 deletions ext/js/data/anki-note-data-creator.js
Original file line number Diff line number Diff line change
Expand Up @@ -393,10 +393,11 @@ function convertKanjiStat({name, category, content, order, score, dictionary, va
function getKanjiFrequencies(dictionaryEntry) {
/** @type {import('anki-templates').KanjiFrequency[]} */
const results = [];
for (const {index, dictionary, dictionaryIndex, dictionaryPriority, character, frequency, displayValue} of dictionaryEntry.frequencies) {
for (const {index, dictionary, dictionaryAlias, dictionaryIndex, dictionaryPriority, character, frequency, displayValue} of dictionaryEntry.frequencies) {
results.push({
index,
dictionary,
dictionaryAlias,
dictionaryOrder: {
index: dictionaryIndex,
priority: dictionaryPriority,
Expand Down Expand Up @@ -685,14 +686,15 @@ function getTermPitchesInner(pitches) {
function getTermPhoneticTranscriptions(dictionaryEntry) {
const results = [];
const {headwords} = dictionaryEntry;
for (const {headwordIndex, dictionary, dictionaryIndex, dictionaryPriority, pronunciations} of dictionaryEntry.pronunciations) {
for (const {headwordIndex, dictionary, dictionaryAlias, dictionaryIndex, dictionaryPriority, pronunciations} of dictionaryEntry.pronunciations) {
const {term, reading} = headwords[headwordIndex];
const phoneticTranscriptions = getPronunciationsOfType(pronunciations, 'phonetic-transcription');
const termPhoneticTranscriptions = getTermPhoneticTranscriptionsInner(phoneticTranscriptions);
results.push({
index: results.length,
expressionIndex: headwordIndex,
dictionary,
dictionaryAlias,
dictionaryOrder: {
index: dictionaryIndex,
priority: dictionaryPriority,
Expand Down
2 changes: 2 additions & 0 deletions types/ext/anki-templates.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ export type KanjiStat = {
export type KanjiFrequency = {
index: number;
dictionary: string;
dictionaryAlias: string;
dictionaryOrder: {
index: number;
priority: number;
Expand Down Expand Up @@ -276,6 +277,7 @@ export type TermPhoneticTranscription = {
index: number;
expressionIndex: number;
dictionary: string;
dictionaryAlias: string;
dictionaryOrder: {
index: number;
priority: number;
Expand Down

0 comments on commit dbaba41

Please sign in to comment.