Commit aaa3bd56 authored by Duhoux Pierre-Louis's avatar Duhoux Pierre-Louis

Fix #6 by creating function to replace [mdi-xxx] from i18n labels by actual icon

parent ab3560e6
......@@ -403,7 +403,7 @@
"description": "Message displayed when the reading list does not display any manga because of categories states"
},
"list_no_manga_message": {
"message": "<strong>No manga in your list</strong>. To add a manga in the reading list, just go read a manga on a site supported by All Mangas Reader. Each manga you are reading is added or updated in the All Mangas Reader reading list. You can start reading a manga by searching one using the <v-icon>mdi-magnify</v-icon>",
"message": "<strong>No manga in your list</strong>. To add a manga in the reading list, just go read a manga on a site supported by All Mangas Reader. Each manga you are reading is added or updated in the All Mangas Reader reading list. You can start reading a manga by searching one using the [mdi-magnify]",
"description": "Message displayed when the reading list is empty"
},
"list_import_samples": {
......
......@@ -65,7 +65,7 @@
</div>
<!-- No mangas yet -->
<div v-if="!allMangas.length" class="amr-nomangas">
<p v-html="i18n('list_no_manga_message')">
<p v-html="convertIcons(i18n('list_no_manga_message'))">
</p>
<p>
<a @click.prevent="importSamples()">{{ i18n("list_import_samples")}}</a>
......@@ -170,6 +170,7 @@ export default {
components: { MangaGroup, Categories },
methods: {
i18n: (message, ...args) => i18n(message, ...args),
convertIcons: str => utils.convertIcons(str),
importSamples() {
// we don't do this.$store.dispatch("importSamples"); because to load list of chapters, implementations rely on jQuery, which is not loaded in pages, rely on background page to do so
browser.runtime.sendMessage({ action: "importSamples" });
......
......@@ -40,4 +40,8 @@ export function countUsed(category, mangas) {
} else {
return mangas.reduce((nb, mg) => mg.cats.includes(category.name) ? nb + 1 : nb, 0);
}
}
/** replace string inside brackets by html tag for icon */
export function convertIcons(input) {
return input.replace(/\[mdi-(.+)\]/g,'<i aria-hidden="true" class="v-icon mdi mdi-$1"></i>');
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment