Skip to content

Commit

Permalink
Merge branch 'master' into refactor-masu
Browse files Browse the repository at this point in the history
  • Loading branch information
khaitruong922 authored Sep 2, 2024
2 parents 1af6bc9 + cab7793 commit c811ea8
Show file tree
Hide file tree
Showing 18 changed files with 123 additions and 32 deletions.
File renamed without changes.
9 changes: 9 additions & 0 deletions .github/ISSUE_TEMPLATE/3-language-feature.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
name: Language specific issue
about: Report a language-specific issue or feature request
title: '[REPLACE ME WITH YOUR REQUESTED LANGUAGE]: '
labels: 'area/linguistics'
assignees: ''

---

File renamed without changes.
File renamed without changes.
3 changes: 2 additions & 1 deletion .github/workflows/bench.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
name: Performance Benchmarks

permissions:
contents: read
on:
push:
branches: [master]
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
# supported CodeQL languages.
#
name: "CodeQL"

permissions:
contents: read
on:
push:
branches: [ "master" ]
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/publish-edge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ jobs:
environment: cd
outputs:
result: ${{ steps.webStorePublish.outcome }}
permissions:
actions: write
steps:
- uses: robinraju/release-downloader@a96f54c1b5f5e09e47d9504526e96febd949d4c2 # pin@v1.11
with:
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ jobs:
runs-on: ubuntu-latest
permissions:
actions: write
contents: write
steps:
- name: Dispatch publish-chrome
uses: aurelien-baudet/workflow-dispatch@3133c5d135c7dbe4be4f9793872b6ef331b53bc7 # pin@v2
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/scorecard.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
persist-credentials: false

- name: "Run analysis"
uses: ossf/scorecard-action@dc50aa9510b46c811795eb24b2f1ba02a914e534 # v2.3.3
uses: ossf/scorecard-action@62b2cac7ed8198b15735ed49ab1e5cf35480ba46 # v2.4.0
with:
results_file: results.sarif
results_format: sarif
Expand Down
21 changes: 18 additions & 3 deletions ext/data/recommended-dictionaries.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,28 @@
{
"ja": {
"terms": [
{"name": "Jitendex", "url": "https://github.com/stephenmk/stephenmk.github.io/releases/latest/download/jitendex-yomitan.zip"}
{
"name": "Jitendex",
"downloadUrl": "https://github.com/stephenmk/stephenmk.github.io/releases/latest/download/jitendex-yomitan.zip",
"description": "A free and openly licensed Japanese-to-English dictionary with example sentences, usage notes, etymology notes, cross references, antonyms, definition notes.",
"homepage": "https://jitendex.org"
}
],
"kanji": [
{"name": "KANJIDIC", "url": "https://github.com/themoeway/jmdict-yomitan/releases/latest/download/KANJIDIC_english.zip"}
{
"name": "KANJIDIC",
"downloadUrl": "https://github.com/themoeway/jmdict-yomitan/releases/latest/download/KANJIDIC_english.zip",
"description": "An English dictionary with readings, meanings, stroke order diagrams, frequency, grade level, JLPT level and frequency of kanji characters.",
"homepage": "https://github.com/themoeway/jmdict-yomitan?tab=readme-ov-file#kanjidic-for-yomitan"
}
],
"frequency": [
{"name": "BCCWJ", "url": "https://github.com/Kuuuube/yomitan-dictionaries/releases/download/yomitan-permalink/BCCWJ_SUW_LUW_combined.zip"}
{
"name": "BCCWJ",
"downloadUrl": "https://github.com/Kuuuube/yomitan-dictionaries/releases/download/yomitan-permalink/BCCWJ_SUW_LUW_combined.zip",
"description": "Based on the Balanced Corpus of Contemporary Written Japanese covering books, magazines, newspapers, blogs, forums, textbooks, and legal documents among others.",
"homepage": "https://github.com/Kuuuube/yomitan-dictionaries?tab=readme-ov-file#bccwj-suw-luw-combined"
}
],
"grammar": [],
"pronunciation": []
Expand Down
65 changes: 55 additions & 10 deletions ext/data/schemas/recommended-dictionaries-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,23 @@
"type": "object",
"required": [
"name",
"url"
"downloadUrl",
"description"
],
"properties": {
"name": {
"type": "string",
"minLength": 2
},
"url": {
"downloadUrl": {
"type": "string",
"minLength": 2
},
"description": {
"type": "string",
"minLength": 2
},
"homepage": {
"type": "string",
"minLength": 2
}
Expand All @@ -33,14 +42,23 @@
"type": "object",
"required": [
"name",
"url"
"downloadUrl",
"description"
],
"properties": {
"name": {
"type": "string",
"minLength": 2
},
"url": {
"downloadUrl": {
"type": "string",
"minLength": 2
},
"description": {
"type": "string",
"minLength": 2
},
"homepage": {
"type": "string",
"minLength": 2
}
Expand All @@ -53,14 +71,23 @@
"type": "object",
"required": [
"name",
"url"
"downloadUrl",
"description"
],
"properties": {
"name": {
"type": "string",
"minLength": 2
},
"url": {
"downloadUrl": {
"type": "string",
"minLength": 2
},
"description": {
"type": "string",
"minLength": 2
},
"homepage": {
"type": "string",
"minLength": 2
}
Expand All @@ -73,14 +100,23 @@
"type": "object",
"required": [
"name",
"url"
"downloadUrl",
"description"
],
"properties": {
"name": {
"type": "string",
"minLength": 2
},
"url": {
"downloadUrl": {
"type": "string",
"minLength": 2
},
"description": {
"type": "string",
"minLength": 2
},
"homepage": {
"type": "string",
"minLength": 2
}
Expand All @@ -93,14 +129,23 @@
"type": "object",
"required": [
"name",
"url"
"downloadUrl",
"description"
],
"properties": {
"name": {
"type": "string",
"minLength": 2
},
"url": {
"downloadUrl": {
"type": "string",
"minLength": 2
},
"description": {
"type": "string",
"minLength": 2
},
"homepage": {
"type": "string",
"minLength": 2
}
Expand Down
2 changes: 1 addition & 1 deletion ext/info.html
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ <h2 id="links">Links</h2>
<li>Support and source code: <a href="https://github.com/themoeway/yomitan" rel="noreferrer noopener">Github</a></li>
<li>Release notes: <a href="https://github.com/themoeway/yomitan/releases" rel="noreferrer noopener" data-href-format="https://github.com/themoeway/yomitan/releases/tag/{version}" id="release-notes-this-version-link">This version</a> | <a href="https://github.com/themoeway/yomitan/releases" rel="noreferrer noopener">All versions</a></li>
<li>More extension information: <a href="/permissions.html">Permissions</a> | <a href="/legal.html">Licenses</a> | <a href="/issues.html">Issues</a></li>
<li>Enjoying Yomitan? Help us by writing a review on the Firefox/Chrome store! <a href="https://addons.mozilla.org/en-US/firefox/addon/yomitan/">Firefox</a> | <a href="https://chromewebstore.google.com/detail/yomitan/likgccmbimhjbgkjambclfkhldnlhbnn">Chrome</a></li>
<li>Enjoying Yomitan? Help us by writing a review on the Firefox/Chrome/Edge store! <a href="https://addons.mozilla.org/en-US/firefox/addon/yomitan/">Firefox</a> | <a href="https://chromewebstore.google.com/detail/yomitan/likgccmbimhjbgkjambclfkhldnlhbnn">Chrome</a> | <a href="https://microsoftedge.microsoft.com/addons/detail/yomitan/idelnfbbmikgfiejhgmddlbkfgiifnnn">Edge</a></li>
</ul>
</div></div></div></div>
</div>
Expand Down
6 changes: 6 additions & 0 deletions ext/js/language/language-descriptors.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,12 @@ const languageDescriptors = [
removeAlphabeticDiacritics,
},
},
{
iso: 'hi',
iso639_3: 'hin',
name: 'Hindi',
exampleText: 'पढ़ने के लिए',
},
{
iso: 'hu',
iso639_3: 'hun',
Expand Down
16 changes: 13 additions & 3 deletions ext/js/pages/settings/dictionary-import-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ export class DictionaryImportController {

/**
*
* @param {import('dictionary-recommended.js').Dictionary[]} recommendedDictionaries
* @param {import('dictionary-recommended.js').RecommendedDictionary[]} recommendedDictionaries
* @param {HTMLElement} dictionariesList
* @param {Set<string>} installedDictionaryNames
* @param {Set<string>} installedDictionaryDownloadUrls
Expand All @@ -214,15 +214,25 @@ export class DictionaryImportController {
}
const template = this._settingsController.instantiateTemplate('recommended-dictionaries-list-item');
const label = querySelectorNotNull(template, '.settings-item-label');
const description = querySelectorNotNull(template, '.description');
/** @type {HTMLAnchorElement} */
const homepage = querySelectorNotNull(template, '.homepage');
/** @type {HTMLButtonElement} */
const button = querySelectorNotNull(template, '.action-button[data-action=import-recommended-dictionary]');
button.disabled = installedDictionaryNames.has(dictionary.name) || installedDictionaryDownloadUrls.has(dictionary.url);
button.disabled = installedDictionaryNames.has(dictionary.name) || installedDictionaryDownloadUrls.has(dictionary.downloadUrl);

const urlAttribute = document.createAttribute('data-import-url');
urlAttribute.value = dictionary.url;
urlAttribute.value = dictionary.downloadUrl;
button.attributes.setNamedItem(urlAttribute);

label.textContent = dictionary.name;
description.textContent = dictionary.description;
if (dictionary.homepage) {
homepage.target = '_blank';
homepage.href = dictionary.homepage;
} else {
homepage.remove();
}

dictionariesList.append(template);
}
Expand Down
4 changes: 4 additions & 0 deletions ext/templates-settings.html
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,10 @@
<div class="settings-item-inner">
<div class="settings-item-left">
<strong><div class="settings-item-label"></div></strong>
<div class="settings-item-description description"></div>
<div class="settings-item-description">
<a class="homepage">Homepage</a>
</div>
</div>
<div class="settings-item-right">
<button type="button" class="action-button" data-action="import-recommended-dictionary" data-import-url="">Download</button>
Expand Down
20 changes: 11 additions & 9 deletions types/ext/dictionary-recommended.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,22 @@
*/

export type RecommendedDictionaries = {
[key: string]: LanguageDictionaries;
[key: string]: LanguageRecommendedDictionaries;
};

export type LanguageDictionaries = {
terms: Dictionary[];
kanji: Dictionary[];
frequency: Dictionary[];
grammar: Dictionary[];
pronunciation: Dictionary[];
export type LanguageRecommendedDictionaries = {
terms: RecommendedDictionary[];
kanji: RecommendedDictionary[];
frequency: RecommendedDictionary[];
grammar: RecommendedDictionary[];
pronunciation: RecommendedDictionary[];
};

export type Dictionary = {
export type RecommendedDictionary = {
name: string;
url: string;
downloadUrl: string;
description: string;
homepage?: string;
};

export type RecommendedDictionariesTest = {
Expand Down
1 change: 1 addition & 0 deletions types/ext/language-descriptors.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ type AllTextProcessors = {
grc: {
pre: CapitalizationPreprocessors & AlphabeticDiacriticsProcessor;
};
hi: Record<string, never>;
hu: {
pre: CapitalizationPreprocessors;
};
Expand Down

0 comments on commit c811ea8

Please sign in to comment.