mirror of
https://github.com/hpware/news-analyze.git
synced 2025-06-23 21:14:23 +00:00
EXTREMELY basic translating in the newsView page. & made the about
window i18n available & added GOALS_BEFORE_NEXT_DEVLOG.md file to track what goals should I hit before getting a another devlog.
This commit is contained in:
parent
d2099074a7
commit
3abfe46464
5 changed files with 89 additions and 22 deletions
4
GOALS_BEFORE_NEXT_DEVLOG.md
Normal file
4
GOALS_BEFORE_NEXT_DEVLOG.md
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
# Goals before the next devlog
|
||||||
|
(Hopefuly it can be done like on jun/7?)
|
||||||
|
1. Get the custom Groq api thingy work
|
||||||
|
2. Get Translation into news, newsView, aboutNewsorg & sources
|
|
@ -5,33 +5,37 @@ const emit = defineEmits(["windowopener", "error", "loadValue"]);
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
values?: string;
|
values?: string;
|
||||||
}>();
|
}>();
|
||||||
|
const { t } = useI18n();
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<div class="justify-center align-center text-center flex flex-col">
|
<div class="justify-center align-center text-center flex flex-col">
|
||||||
<div class="flex flex-col">
|
<div class="flex flex-col">
|
||||||
<span class="text-xl">為什麼要做網站?</span>
|
<span class="text-xl">{{ t("about.why") }}</span>
|
||||||
|
<span>{{ t("about.bulletpoints.1") }}</span>
|
||||||
|
<span>{{ t("about.bulletpoints.2") }}</span>
|
||||||
<span
|
<span
|
||||||
>1. 台灣媒體真的很爛,要嘛有超多偏見,或是比較偏小孩不能看的新聞 (aka
|
>3.
|
||||||
擦邊通過的</span
|
<span class="line-through">{{
|
||||||
|
t("about.bulletpoints.3half")
|
||||||
|
}}</span></span
|
||||||
>
|
>
|
||||||
<span
|
|
||||||
>2. 這個網站是為了讓大家可以更方便的比較新聞,可以分析新聞的偏見</span
|
|
||||||
>
|
|
||||||
<span>3. <span class="line-through">學 TailwindCSS</span></span>
|
|
||||||
</div>
|
</div>
|
||||||
<hr />
|
<hr />
|
||||||
<div class="flex flex-col">
|
<div class="flex flex-col">
|
||||||
<span class="text-xl">關於開發者</span>
|
<span class="text-xl">{{ t("about.aboutDev.title") }}</span>
|
||||||
<span class="text-center align-center justify-center">開發者:yh</span>
|
<span class="text-center align-center justify-center">{{
|
||||||
|
t("about.aboutDev.dev")
|
||||||
|
}}</span>
|
||||||
<span class="text-center align-center justify-center"
|
<span class="text-center align-center justify-center"
|
||||||
>聯絡信箱:<a href="mailto:public+newscompareauthor@yuanhau.com"
|
>{{ t("about.aboutDev.contactEmailStarter")
|
||||||
|
}}<a href="mailto:public+newscompareauthor@yuanhau.com"
|
||||||
>public@yuanhau.com</a
|
>public@yuanhau.com</a
|
||||||
></span
|
></span
|
||||||
>
|
>
|
||||||
</div>
|
</div>
|
||||||
<hr />
|
<hr />
|
||||||
<div class="flex flex-col">
|
<div class="flex flex-col">
|
||||||
<span class="text-xl">版權資訊</span>
|
<span class="text-xl">{{ t("about.copyrigthtInfo") }}</span>
|
||||||
<copyrightInfo class="justify-center align-center text-center" />
|
<copyrightInfo class="justify-center align-center text-center" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,25 +1,23 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
// FOR THIS MODULE DO NOT USE THE ?APPNAME URL TYPE, IT WILL FALL AT ALL TIMES, I HAVE NO CLUE WHY IS BEHAVIOR HAPPENING RN?
|
||||||
import { SparklesIcon, UserIcon, NewspaperIcon } from "lucide-vue-next";
|
import { SparklesIcon, UserIcon, NewspaperIcon } from "lucide-vue-next";
|
||||||
|
import translate from "translate";
|
||||||
|
|
||||||
|
interface translateInterfaceText {
|
||||||
|
translateText: string;
|
||||||
|
}
|
||||||
|
const translateItem: Record<string, translateInterfaceText> = {};
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
values?: string;
|
values?: string;
|
||||||
applyForTranslation: {
|
applyForTranslation: Boolean;
|
||||||
type: Boolean;
|
windowTranslateState: Boolean;
|
||||||
required: true;
|
|
||||||
};
|
|
||||||
windowTranslateState: {
|
|
||||||
type: Boolean;
|
|
||||||
required: true;
|
|
||||||
};
|
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
const { applyForTranslation, windowTranslateState } = props;
|
const { applyForTranslation, windowTranslateState } = props;
|
||||||
|
|
||||||
watch((applyForTranslation) => {}); // Translate when requested?
|
|
||||||
|
|
||||||
const slug = props.values; // Make the props.values static to the window NOT the entire thing and no arrays.
|
const slug = props.values; // Make the props.values static to the window NOT the entire thing and no arrays.
|
||||||
|
|
||||||
// FOR THIS MODULE DO NOT USE THE ?APPNAME URL TYPE, IT WILL FALL AT ALL TIMES, I HAVE NO CLUE WHY IS BEHAVIOR HAPPENING RN?
|
|
||||||
const { data, error, pending } = useFetch(`/api/news/get/lt/${slug.trim()}`);
|
const { data, error, pending } = useFetch(`/api/news/get/lt/${slug.trim()}`);
|
||||||
console.log(data.value);
|
console.log(data.value);
|
||||||
console.log(error.value);
|
console.log(error.value);
|
||||||
|
@ -28,6 +26,38 @@ const isGenerating = ref(false);
|
||||||
const summaryText = ref("");
|
const summaryText = ref("");
|
||||||
const { locale } = useI18n();
|
const { locale } = useI18n();
|
||||||
const likeart = ref([]);
|
const likeart = ref([]);
|
||||||
|
// Translating logic
|
||||||
|
const translateText = ref(false);
|
||||||
|
const translatedBefore = ref(false);
|
||||||
|
watch(
|
||||||
|
() => props.applyForTranslation,
|
||||||
|
(value) => {
|
||||||
|
if (value === true) {
|
||||||
|
translateText.value = true;
|
||||||
|
if (!data.value) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
startTranslating(data.value.title);
|
||||||
|
startTranslating(data.value.origin);
|
||||||
|
startTranslating(data.value.author);
|
||||||
|
data.value.paragraph.forEach((i, element) => {
|
||||||
|
console.log(element);
|
||||||
|
//startTranslating(data.value.)
|
||||||
|
});
|
||||||
|
// NOT retranslating AGAIN
|
||||||
|
translatedBefore.value = true;
|
||||||
|
} else {
|
||||||
|
translateText.value = false;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
); // Translate when requested?
|
||||||
|
|
||||||
|
const startTranslating = async (text: string) => {
|
||||||
|
translateItem[text] = {
|
||||||
|
translateText: await translate(text, { from: "zh", to: "en" }),
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
const aiSummary = async () => {
|
const aiSummary = async () => {
|
||||||
activateAiSummary.value = true;
|
activateAiSummary.value = true;
|
||||||
isGenerating.value = true;
|
isGenerating.value = true;
|
||||||
|
@ -87,6 +117,7 @@ const aiSummary = async () => {
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex flex-col bg-gray-500">
|
<div class="flex flex-col bg-gray-500">
|
||||||
|
<!--Similar articles-->
|
||||||
<div class="flex flex-row" v-for="item in likeart">
|
<div class="flex flex-row" v-for="item in likeart">
|
||||||
<img /><!--Image-->
|
<img /><!--Image-->
|
||||||
<div class="flex flex-col">
|
<div class="flex flex-col">
|
||||||
|
|
|
@ -116,5 +116,19 @@
|
||||||
"title": "Terms of service",
|
"title": "Terms of service",
|
||||||
"content": "N/A"
|
"content": "N/A"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"about": {
|
||||||
|
"why": "Why make this website?",
|
||||||
|
"bulletpoints": {
|
||||||
|
"1": "1. Taiwan's news network is really shit, either they have a bunch of stupid opinions, or just news that are not appropriate for kids ",
|
||||||
|
"2": "2. This website's goal is to everyone see news a bit easier, and can also compare them.",
|
||||||
|
"3half": "Learn Tailwind"
|
||||||
|
},
|
||||||
|
"aboutDev": {
|
||||||
|
"title": "About the dev",
|
||||||
|
"dev": "developer:yh",
|
||||||
|
"contactEmailStarter": "Contact Email:"
|
||||||
|
},
|
||||||
|
"copyrightInfo": "Copyright Info"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -114,5 +114,19 @@
|
||||||
"title": "Terms of service",
|
"title": "Terms of service",
|
||||||
"content": "N/A"
|
"content": "N/A"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"about": {
|
||||||
|
"why": "為什麼要做網站?",
|
||||||
|
"bulletpoints": {
|
||||||
|
"1": "1. 台灣媒體真的很爛,要嘛有超多偏見,或是比較偏小孩不能看的新聞 (aka 擦邊通過的",
|
||||||
|
"2": "2. 這個網站是為了讓大家可以更方便的比較新聞,可以分析新聞的偏見",
|
||||||
|
"3half": "學 TailwindCSS"
|
||||||
|
},
|
||||||
|
"aboutDev": {
|
||||||
|
"title": "關於開發者",
|
||||||
|
"dev": "開發者:yh",
|
||||||
|
"contactEmailStarter": "聯絡信箱:"
|
||||||
|
},
|
||||||
|
"copyrightInfo": "版權資訊"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue