This commit is contained in:
louiscklaw
2025-02-01 01:16:09 +08:00
commit 91fab4a5d5
4178 changed files with 407527 additions and 0 deletions

BIN
task1/_tools/update_content/content/lessons/App assets.zip (Stored with Git LFS) Normal file

Binary file not shown.

View File

@@ -0,0 +1,330 @@
[
{
"name": "vocabulary",
"path": "vocabulary",
"content": [
{
"cat_name": "Technology",
"cat_image": "/data/Lesson/images/technology.png",
"content": [
{
"word": "keyboard",
"word_c": "鍵盤",
"sample_e": "I type on my keyboard.",
"sample_c": "我用鍵盤打字。",
"sound": "/data/Lesson/sounds/keyboard.mp3",
"image": "/data/Lesson/images/keyboard.jpg"
},
{
"word": "mouse",
"word_c": "滑鼠",
"sample_e": "I use a mouse to click.",
"sample_c": "我用滑鼠點選。",
"sound": "/data/Lesson/sounds/mouse.mp3",
"image": "/data/Lesson/images/mouse.jpg"
},
{
"word": "computer",
"word_c": "電腦",
"sample_e": "My computer is very fast.",
"sample_c": "我的電腦速度非常快。",
"sound": "/data/Lesson/sounds/computer.mp3",
"image": "/data/Lesson/images/computer.jpg"
},
{
"word": "mobile phone",
"word_c": "手機",
"sample_e": "I call my friend on my mobile phone.",
"sample_c": "我用手機打電話給朋友。",
"sound": "/data/Lesson/sounds/mobile phone.mp3",
"image": "/data/Lesson/images/mobilephone.jpg"
},
{
"word": "social media",
"word_c": "社交媒體",
"sample_e": "I share photos on social media.",
"sample_c": "我在社交媒體上分享照片。",
"sound": "/data/Lesson/sounds/social media.mp3",
"image": "/data/Lesson/images/socialmedia.jpg"
}
]
},
{
"cat_name": "Art",
"cat_image": "/data/Lesson/images/art.png",
"content": [
{
"word": "watercolor",
"word_c": "水彩",
"sample_e": "I like to paint with watercolor.",
"sample_c": "我喜歡用水彩畫畫。",
"sound": "/data/Lesson/sounds/watercolor.mp3",
"image": "/data/Lesson/images/watercolor.jpg"
},
{
"word": "photography",
"word_c": "攝影",
"sample_e": "I need a camera to do photography.",
"sample_c": "我需要照相機來進行攝影。",
"sound": "/data/Lesson/sounds/photography.mp3",
"image": "/data/Lesson/images/photography.jpg"
},
{
"word": "palette",
"word_c": "調色盤",
"sample_e": "He mixes colors on his palette.",
"sample_c": "他在調色板上調色。",
"sound": "/data/Lesson/sounds/palette.mp3",
"image": "/data/Lesson/images/palette.jpg"
},
{
"word": "artist",
"word_c": "藝術家",
"sample_e": "The artist paints beautiful pictures.",
"sample_c": "藝術家畫出美麗的圖畫。",
"sound": "/data/Lesson/sounds/artist.mp3",
"image": "/data/Lesson/images/artist.jpg"
},
{
"word": "canvas",
"word_c": "畫布",
"sample_e": "We draw on a canvas.",
"sample_c": "我們在畫布上畫畫。",
"sound": "/data/Lesson/sounds/canvas.mp3",
"image": "/data/Lesson/images/canvas.jpg"
}
]
},
{
"cat_name": "Nature",
"cat_image": "/data/Lesson/images/nature.png",
"content": [
{
"word": "flood",
"word_c": "洪水",
"sample_e": "The flood covered the streets.",
"sample_c": "洪水覆蓋了街道。",
"sound": "/data/Lesson/sounds/flood.mp3",
"image": "/data/Lesson/images/flood.jpg"
},
{
"word": "typhoon",
"word_c": "颱風",
"sample_e": "A typhoon brings strong wind and rain.",
"sample_c": "颱風帶來強風大雨。",
"sound": "/data/Lesson/sounds/typhoon.mp3",
"image": "/data/Lesson/images/typhoon.jpg"
},
{
"word": "ocean",
"word_c": "海洋",
"sample_e": "We can find jellyfish in the ocean.",
"sample_c": "我們可以在海洋中找到水母。",
"sound": "/data/Lesson/sounds/ocean.mp3",
"image": "/data/Lesson/images/ocean.jpg"
},
{
"word": "canyon",
"word_c": "峽谷",
"sample_e": "We hiked in the canyon.",
"sample_c": "我們在峽谷遠足。",
"sound": "/data/Lesson/sounds/canyon.mp3",
"image": "/data/Lesson/images/canyon.jpg"
},
{
"word": "mammal",
"word_c": "哺乳動物",
"sample_e": "A dog is a mammal.",
"sample_c": "狗是一種哺乳動物。",
"sound": "/data/Lesson/sounds/mammal.mp3",
"image": "/data/Lesson/images/mammal.jpg"
}
]
},
{
"cat_name": "Workplace",
"cat_image": "/data/Lesson/images/workplace.png",
"content": [
{
"word": "interview",
"word_c": "面試",
"sample_e": "I have a job interview tomorrow.",
"sample_c": "我明天有一個工作面試。",
"sound": "/data/Lesson/sounds/interview.mp3",
"image": "/data/Lesson/images/interview.jpg"
},
{
"word": "president",
"word_c": "總統",
"sample_e": "The president of the U.S. is Donald Trump now.",
"sample_c": "現在的美國總統是唐納德·川普。",
"sound": "/data/Lesson/sounds/president.mp3",
"image": "/data/Lesson/images/president.jpg"
},
{
"word": "manager",
"word_c": "經理",
"sample_e": "My manager helps me at work.",
"sample_c": "我的經理在工作中幫助我。",
"sound": "/data/Lesson/sounds/manager.mp3",
"image": "/data/Lesson/images/manager.jpg"
},
{
"word": "intern",
"word_c": "實習生",
"sample_e": "The intern is learning a lot.",
"sample_c": "實習生學到了很多東西。",
"sound": "/data/Lesson/sounds/intern.mp3",
"image": "/data/Lesson/images/intern.jpg"
},
{
"word": "promotion",
"word_c": "升遷",
"sample_e": "She got a promotion at her job.",
"sample_c": "她在工作中得到了升遷。",
"sound": "/data/Lesson/sounds/promotion.mp3",
"image": "/data/Lesson/images/promotion.jpg"
}
]
},
{
"cat_name": "Sports",
"cat_image": "/data/Lesson/images/sports.png",
"content": [
{
"word": "athlete",
"word_c": "運動員",
"sample_e": "He is a great track athlete.",
"sample_c": "他是一位出色的田徑運動員。",
"sound": "/data/Lesson/sounds/athlete.mp3",
"image": "/data/Lesson/images/athlete.jpg"
},
{
"word": "coach",
"word_c": "教練",
"sample_e": "My coach trains me every week.",
"sample_c": "我的教練每個星期都會訓練我。",
"sound": "/data/Lesson/sounds/coach.mp3",
"image": "/data/Lesson/images/coach.jpg"
},
{
"word": "competitor",
"word_c": "競爭者",
"sample_e": "She is my competitor in the race.",
"sample_c": "她是我在比賽中的競爭對手。",
"sound": "/data/Lesson/sounds/competitor.mp3",
"image": "/data/Lesson/images/competitor.jpg"
},
{
"word": "kayaking",
"word_c": "划皮艇",
"sample_e": "We went kayaking on the lake.",
"sample_c": "我們去湖上划皮艇。",
"sound": "/data/Lesson/sounds/kayaking.mp3",
"image": "/data/Lesson/images/kayaking.jpg"
},
{
"word": "badminton",
"word_c": "羽毛球",
"sample_e": "I play badminton with my friends.",
"sample_c": "我和朋友一起打羽毛球",
"sound": "/data/Lesson/sounds/badminton.mp3",
"image": "/data/Lesson/images/badminton.jpg"
}
]
},
{
"cat_name": "News",
"cat_image": "/data/Lesson/images/news.png",
"content": [
{
"word": "inflation",
"word_c": "通貨膨脹",
"sample_e": "Inflation makes products more expensive.",
"sample_c": "通貨膨脹使產品更加昂貴。",
"sound": "/data/Lesson/sounds/inflation.mp3",
"image": "/data/Lesson/images/inflation.jpg"
},
{
"word": "poverty",
"word_c": "貧窮",
"sample_e": "Poverty is a serious problem.",
"sample_c": "貧窮是一個嚴重的問題。",
"sound": "/data/Lesson/sounds/poverty.mp3",
"image": "/data/Lesson/images/poverty.jpg"
},
{
"word": "global warming",
"word_c": "全球暖化",
"sample_e": "Global warming affects the earth.",
"sample_c": "全球暖化會影響地球。",
"sound": "/data/Lesson/sounds/global warming.mp3",
"image": "/data/Lesson/images/globalwarming.jpg"
},
{
"word": "discrimation",
"word_c": "歧視",
"sample_e": "Discrimination is unfair to people.",
"sample_c": "歧視對人們不公平。",
"sound": "/data/Lesson/sounds/discrimation.mp3",
"image": "/data/Lesson/images/discrimation.jpg"
},
{
"word": "suicide",
"word_c": "自殺",
"sample_e": "A man committed suicide last week.",
"sample_c": "上周有一個人自殺了。",
"sound": "/data/Lesson/sounds/suicide.mp3",
"image": "/data/Lesson/images/suicide.jpg"
}
]
},
{
"cat_name": "Basic",
"cat_image": "/data/Lesson/images/basic.png",
"content": [
{
"word": "Monday",
"word_c": "星期一",
"sample_e": "Monday is the first day of the week.",
"sample_c": "星期一是一周的第一天。",
"sound": "/data/Lesson/sounds/Monday.mp3",
"image": "/data/Lesson/images/Monday.jpg"
},
{
"word": "Tuesday",
"word_c": "星期二",
"sample_e": "They learn English on Tuesday.",
"sample_c": "他們星期二學習英語。",
"sound": "/data/Lesson/sounds/Tuesday.mp3",
"image": "/data/Lesson/images/Tuesday.jpg"
},
{
"word": "Wednesday",
"word_c": "星期三",
"sample_e": "Every Wednesday, we go to the park.",
"sample_c": "每個星期三,我們都會去公園。",
"sound": "/data/Lesson/sounds/Wednesday.mp3",
"image": "/data/Lesson/images/Wednesday.jpg"
},
{
"word": "Thursday",
"word_c": "星期四",
"sample_e": "I eat at my mother's place on Thursdays.",
"sample_c": "每個星期四, 我在媽媽家吃飯。",
"sound": "/data/Lesson/sounds/Thursday.mp3",
"image": "/data/Lesson/images/Thursday.jpg"
},
{
"word": "Friday",
"word_c": "星期五",
"sample_e": "I party with my friends every Friday night.",
"sample_c": "每個星期五晚上,我都會和朋友們開派對。",
"sound": "/data/Lesson/sounds/Friday.mp3",
"image": "/data/Lesson/images/Friday.jpg"
}
]
}
]
}
]

View File

@@ -0,0 +1,76 @@
"use strict";
// read './APP_Vocab_List.xlsx'
// the first row is the header
// coloumns name are 'Word', 'CHI_trans', 'ENG_Sample_sentence', 'CHI_trans_sentence', 'mp3 filename', 'jpg filename', 'Category'
// convert name to 'word', 'word_c', 'sample_e', 'sample_c', 'sound', 'image', 'category'
// for a json array row by row
// write output to content.json
const PUBLIC_ASSETS_HOME = "/data/Lesson";
const PUBLIC_IMAGE_HOME = `${PUBLIC_ASSETS_HOME}/images`;
const PUBLIC_SOUND_HOME = `${PUBLIC_ASSETS_HOME}/sounds`;
const xlsx = require("xlsx");
const fs = require("fs");
const path = require("path");
const workbook = xlsx.readFile("./APP_Vocab_List.xlsx");
const worksheet = workbook.Sheets["Sheet1"];
const whole_sheet = xlsx.utils.sheet_to_json(worksheet, { header: 1 });
const sheet_without_header = whole_sheet.slice(1);
const json_step1 = sheet_without_header.map((row, i) => {
const saintized_row = row.map((r) => r.trim());
return {
word: saintized_row[0],
word_c: saintized_row[1],
sample_e: saintized_row[2],
sample_c: saintized_row[3],
sound: saintized_row[4],
image: saintized_row[5],
category: saintized_row[6],
cat_image: saintized_row[7],
};
});
const json_step2 = json_step1.map((r) => {
return {
word: r.word,
word_c: r.word_c,
sample_e: r.sample_e,
sample_c: r.sample_c,
sound: path.join(PUBLIC_SOUND_HOME, r.sound),
image: path.join(PUBLIC_IMAGE_HOME, r.image),
category: r.category,
cat_image: path.join(PUBLIC_IMAGE_HOME, r.cat_image),
};
});
var json_categories = [...new Set(json_step2.map((r) => r.category))].map(
(cat) => {
return {
cat_name: cat,
cat_image: json_step2.filter((r) => r.category == cat)[0].cat_image,
content: json_step2
.filter((r) => r.category == cat)
.map((r) => {
delete r.cat_image;
delete r.category;
return r;
}),
//
};
}
);
var json_output = [
{
name: "vocabulary",
path: "vocabulary",
content: json_categories,
},
];
fs.writeFileSync("content.json", JSON.stringify(json_output, null, 2));