Revert "Internalisation"

This commit is contained in:
nelson.li
2025-08-11 20:47:10 +08:00
committed by GitHub
parent 378954e4aa
commit 91f8d4c725
7 changed files with 25 additions and 150 deletions
-61
View File
@@ -1,61 +0,0 @@
# GitHub Pages Deployment Guide
This project has been configured with automatic deployment of GitHub Pages, and users can experience the complete Gantt charting function online.
## 🌐 Online visit
**Demo Address**: https://nelson820125.github.io/jordium-gantt-vue3/
## 🔧 Deployment Configuration
### Automated deployment
Projects are automatically deployed to GitHub Pages using GitHub Actions:
- **Triggering condition**: Push to `main` or `master` branch
- **Build Command**: `npm run build:pages`
- **Deployment Directory**: `./dist`
- **Workflows**: `.github/workflows/deploy-github-pages.yml`
### Enable GitHub Pages manually
1. Enter the GitHub repository settings page
2. Find the "Pages" setting options
3. Select "Source" as "GitHub Actions"
4. Push code to the main branch and automatically trigger deployment
## 📁 Construct the product
- **Development and Construction**: `npm run build` → `dist/`
- **GitHub Pages**: `npm run build:pages` → `dist/` (contains the correct base path)
- **NPM package build**: `npm run build:lib` → `npm-package/dist/`
## 🛠️ Local Preview
```bash
# Installation dependencies
npm install
# Start the development server
npm run dev
# Build and preview the production version
npm run build:pages
npm run preview
```
## 🔄 Update deployment
GitHub Actions will automatically:
1. Check out the code
2. Install Node.js and dependencies
3. Build demo application
4. Deploy to GitHub Pages
## 📝 Notes
- Deployment usually takes 1-5 minutes to take effect
- Make sure GitHub Pages is enabled in repository settings
- Custom domain names need to be configured in the `demo/public/CNAME` file
- Static resource paths use relative paths to ensure normal loading in the Pages environment
+5 -16
View File
@@ -1,10 +1,5 @@
<script setup lang="ts"> <script setup lang="ts">
import { ref, computed, watch, onMounted, onUnmounted } from 'vue' import { ref, computed, watch, onMounted, onUnmounted } from 'vue'
import { useI18n } from '../composables/useI18n'
const { locale, setLocale, getTranslation ,t} = useI18n()
interface Props { interface Props {
modelValue?: string | [string, string] modelValue?: string | [string, string]
@@ -73,10 +68,6 @@ const formatDisplayDate = (dateStr: string) => {
return `${date.getFullYear()}-${String(date.getMonth() + 1).padStart(2, '0')}-${String(date.getDate()).padStart(2, '0')}` return `${date.getFullYear()}-${String(date.getMonth() + 1).padStart(2, '0')}-${String(date.getDate()).padStart(2, '0')}`
} }
const getMonth = (key: string): string => {
return getTranslation(key)
}
// 显示值 // 显示值
const displayValue = computed(() => { const displayValue = computed(() => {
if (props.type === 'daterange') { if (props.type === 'daterange') {
@@ -473,7 +464,6 @@ const yearList = computed(() => {
return years return years
}) })
/*
// 月份名称 // 月份名称
const monthNames = [ const monthNames = [
'一月', '一月',
@@ -490,7 +480,6 @@ const monthNames = [
'十二月', '十二月',
] ]
const weekDays = ['日', '一', '二', '三', '四', '五', '六'] const weekDays = ['日', '一', '二', '三', '四', '五', '六']
*/
// 生命周期 // 生命周期
onMounted(() => { onMounted(() => {
@@ -747,7 +736,7 @@ const panelStyle = computed(() => {
&lt;&lt; &lt;&lt;
</button> </button>
<span class="el-month-picker__header-label" @click="showYearSelector($event)"> <span class="el-month-picker__header-label" @click="showYearSelector($event)">
{{ currentYear }} {{ currentYear }}
</span> </span>
<button type="button" class="el-picker-panel__icon-btn" @click="nextYear"> <button type="button" class="el-picker-panel__icon-btn" @click="nextYear">
&gt;&gt; &gt;&gt;
@@ -755,7 +744,7 @@ const panelStyle = computed(() => {
</div> </div>
<div class="el-month-picker__content"> <div class="el-month-picker__content">
<div <div
v-for="(monthName, index) in t.monthNames" v-for="(monthName, index) in monthNames"
:key="index" :key="index"
class="el-month-picker__item" class="el-month-picker__item"
:class="{ 'is-current': index === currentMonth }" :class="{ 'is-current': index === currentMonth }"
@@ -777,10 +766,10 @@ const panelStyle = computed(() => {
</button> </button>
<span class="el-date-picker__header-label"> <span class="el-date-picker__header-label">
<span class="el-date-picker__header-year" @click="showYearSelector($event)"> <span class="el-date-picker__header-year" @click="showYearSelector($event)">
{{ currentYear }} {{ currentYear }}
</span> </span>
<span class="el-date-picker__header-month" @click="showMonthSelector($event)"> <span class="el-date-picker__header-month" @click="showMonthSelector($event)">
{{ t.monthNames[currentMonth] }} {{ monthNames[currentMonth] }}
</span> </span>
</span> </span>
<button type="button" class="el-picker-panel__icon-btn" @click="nextMonth"> <button type="button" class="el-picker-panel__icon-btn" @click="nextMonth">
@@ -794,7 +783,7 @@ const panelStyle = computed(() => {
<div class="el-date-picker__content"> <div class="el-date-picker__content">
<!-- 星期标题 --> <!-- 星期标题 -->
<div class="el-date-table__header"> <div class="el-date-table__header">
<div v-for="day in t.weekDays" :key="day" class="el-date-table__header-cell"> <div v-for="day in weekDays" :key="day" class="el-date-table__header-cell">
{{ day }} {{ day }}
</div> </div>
</div> </div>
+8 -14
View File
@@ -2,13 +2,6 @@
import { computed, ref, onUnmounted } from 'vue' import { computed, ref, onUnmounted } from 'vue'
import type { Milestone } from '../models/classes/Milestone' import type { Milestone } from '../models/classes/Milestone'
import { TimelineScale } from '../models/types/TimelineScale' import { TimelineScale } from '../models/types/TimelineScale'
import { useI18n } from '../composables/useI18n'
const { setLocale, getTranslation } = useI18n()
const t = (key: string): string => {
return getTranslation(key)
}
interface Props { interface Props {
date: string // 里程碑日期 date: string // 里程碑日期
@@ -485,26 +478,26 @@ const handleMilestoneMouseLeave = () => {
// 格式化日期显示 // 格式化日期显示
const formatDisplayDate = (dateStr: string): string => { const formatDisplayDate = (dateStr: string): string => {
if (!dateStr) return t('dateNotSet') //Not Set if (!dateStr) return '未设置'
try { try {
const date = new Date(dateStr) const date = new Date(dateStr)
if (isNaN(date.getTime())) return t('dateNotSet') if (isNaN(date.getTime())) return '未设置'
const year = date.getFullYear() const year = date.getFullYear()
const month = String(date.getMonth() + 1).padStart(2, '0') const month = String(date.getMonth() + 1).padStart(2, '0')
const day = String(date.getDate()).padStart(2, '0') const day = String(date.getDate()).padStart(2, '0')
return `${year}-${month}-${day}` return `${year}-${month}-${day}`
} catch { } catch {
return t('dateNotSet') return '未设置'
} }
} }
// Tooltip内容 Target date // Tooltip内容
const tooltipContent = computed(() => { const tooltipContent = computed(() => {
const milestoneName = props.name || props.milestone?.name || t('milestone') const milestoneName = props.name || props.milestone?.name || '里程碑'
const targetDate = formatDisplayDate(props.date || props.milestone?.startDate || '') const targetDate = formatDisplayDate(props.date || props.milestone?.startDate || '')
return `${t('milestone')}${milestoneName} <br> ${t('targetDate')}${targetDate}` return `里程碑:${milestoneName} - 目标日期${targetDate}`
}) })
// 组件销毁时清理事件监听器 // 组件销毁时清理事件监听器
@@ -688,7 +681,8 @@ const calculateMilestonePositionFromTimelineData = (
top: `${tooltipPosition.y}px`, top: `${tooltipPosition.y}px`,
}" }"
> >
<div class="tooltip-content" v-html="tooltipContent"> <div class="tooltip-content">
{{ tooltipContent }}
</div> </div>
</div> </div>
</Teleport> </Teleport>
+7 -17
View File
@@ -4,10 +4,6 @@ import type { Task } from '../models/classes/Task'
import { TimelineScale } from '../models/types/TimelineScale' import { TimelineScale } from '../models/types/TimelineScale'
import TaskContextMenu from './TaskContextMenu.vue' import TaskContextMenu from './TaskContextMenu.vue'
import { useI18n } from '../composables/useI18n'
interface Props { interface Props {
task: Task task: Task
rowHeight: number rowHeight: number
@@ -35,12 +31,6 @@ interface Props {
const props = defineProps<Props>() const props = defineProps<Props>()
const { setLocale, getTranslation } = useI18n()
const t = (key: string): string => {
return getTranslation(key)
}
const emit = defineEmits([ const emit = defineEmits([
'update:task', 'update:task',
'bar-mounted', 'bar-mounted',
@@ -843,9 +833,9 @@ const handleBubbleMouseDown = (event: MouseEvent) => {
// 格式化日期显示 // 格式化日期显示
const formatDisplayDate = (dateStr: string | undefined): string => { const formatDisplayDate = (dateStr: string | undefined): string => {
if (!dateStr) return t('dateNotSet') if (!dateStr) return '未设置'
const date = createLocalDate(dateStr) const date = createLocalDate(dateStr)
if (!date) return t('dateNotSet') if (!date) return '未设置'
const year = date.getFullYear() const year = date.getFullYear()
const month = String(date.getMonth() + 1).padStart(2, '0') const month = String(date.getMonth() + 1).padStart(2, '0')
@@ -1130,23 +1120,23 @@ onUnmounted(() => {
<div class="tooltip-title">{{ task.name }}</div> <div class="tooltip-title">{{ task.name }}</div>
<div class="tooltip-content"> <div class="tooltip-content">
<div class="tooltip-row"> <div class="tooltip-row">
<span class="tooltip-label"> {{ t('startDate') }}:</span> <span class="tooltip-label">计划开始:</span>
<span class="tooltip-value">{{ formatDisplayDate(task.startDate) }}</span> <span class="tooltip-value">{{ formatDisplayDate(task.startDate) }}</span>
</div> </div>
<div class="tooltip-row"> <div class="tooltip-row">
<span class="tooltip-label">{{ t('endDate') }}:</span> <span class="tooltip-label">计划结束:</span>
<span class="tooltip-value">{{ formatDisplayDate(task.endDate) }}</span> <span class="tooltip-value">{{ formatDisplayDate(task.endDate) }}</span>
</div> </div>
<div class="tooltip-row"> <div class="tooltip-row">
<span class="tooltip-label">{{ t('estimatedHours') }}:</span> <span class="tooltip-label">计划工时:</span>
<span class="tooltip-value">{{ workHourInfo.total }}h</span> <span class="tooltip-value">{{ workHourInfo.total }}h</span>
</div> </div>
<div class="tooltip-row"> <div class="tooltip-row">
<span class="tooltip-label"> {{ t('actualHours') }}:</span> <span class="tooltip-label">已用工时:</span>
<span class="tooltip-value">{{ workHourInfo.used }}h</span> <span class="tooltip-value">{{ workHourInfo.used }}h</span>
</div> </div>
<div class="tooltip-row"> <div class="tooltip-row">
<span class="tooltip-label"> {{ t('progress') }}:</span> <span class="tooltip-label">完成率:</span>
<span class="tooltip-value">{{ task.progress || 0 }}%</span> <span class="tooltip-value">{{ task.progress || 0 }}%</span>
</div> </div>
</div> </div>
+4 -4
View File
@@ -713,15 +713,15 @@ function confirmTimer(desc: string) {
<span v-if="errors.type" class="error-text">{{ errors.type }}</span> <span v-if="errors.type" class="error-text">{{ errors.type }}</span>
</div> </div>
<div class="form-group"> <div class="form-group">
<label class="form-label" for="task-assignee">{{ t.assignee }}</label> <label class="form-label" for="task-assignee">{{ t.assignee }}</label>
<select id="task-assignee" v-model="formData.assignee" class="form-select"> <select id="task-assignee" v-model="formData.assignee" class="form-select">
<option value="">{{ t.selectAssignee }}</option> <option value="">{{ t.selectAssignee }}</option>
<!-- <option value="张三">张三</option> <option value="张三">张三</option>
<option value="李四">李四</option> <option value="李四">李四</option>
<option value="王五">王五</option> <option value="王五">王五</option>
<option value="赵六">赵六</option> <option value="赵六">赵六</option>
<option value="钱七">钱七</option>--> <option value="钱七">钱七</option>
</select> </select>
</div> </div>
+1 -1
View File
@@ -1620,7 +1620,7 @@ const handleAddSuccessor = (task: Task) => {
class="timeline-year" class="timeline-year"
:style="{ width: '719px' }" :style="{ width: '719px' }"
> >
<div class="year-label">{{ yearValue }}</div> <div class="year-label">{{ yearValue }}</div>
</div> </div>
</div> </div>
-37
View File
@@ -6,7 +6,6 @@ export type Locale = 'zh-CN' | 'en-US'
// 多语言配置 // 多语言配置
const messages = { const messages = {
'zh-CN': { 'zh-CN': {
dateNotSet: '未设置',
// TaskList Header // TaskList Header
taskName: '任务名称', taskName: '任务名称',
predecessor: '前置任务', predecessor: '前置任务',
@@ -39,26 +38,8 @@ const messages = {
// 月份格式 // 月份格式
monthFormat: (month: number) => `${month}`, monthFormat: (month: number) => `${month}`,
// 月份名称
monthNames: [
'一月',
'二月',
'三月',
'四月',
'五月',
'六月',
'七月',
'八月',
'九月',
'十月',
'十一月',
'十二月',
],
weekDays:['日', '一', '二', '三', '四', '五', '六'],
// 其他 // 其他
milestone: '里程碑', milestone: '里程碑',
targetDate: '目标日期',
today: '今天', today: '今天',
// 里程碑对话框 // 里程碑对话框
milestoneDetails: '里程碑详情', milestoneDetails: '里程碑详情',
@@ -188,7 +169,6 @@ const messages = {
timerConfirmPlaceholder: '请输入计时说明', timerConfirmPlaceholder: '请输入计时说明',
}, },
'en-US': { 'en-US': {
dateNotSet:'Not set',
// TaskList Header // TaskList Header
taskName: 'Task Name', taskName: 'Task Name',
predecessor: 'Predecessor', predecessor: 'Predecessor',
@@ -219,25 +199,8 @@ const messages = {
// 月份格式 // 月份格式
monthFormat: (month: number) => `M${String(month).padStart(2, '0')}`, monthFormat: (month: number) => `M${String(month).padStart(2, '0')}`,
// Month name
monthNames: [
'Jan',
'Feb',
'Mar',
'Apr',
'May',
'Jun',
'Jul',
'Aug',
'Sep',
'Oct',
'Nov',
'Dec',
],
weekDays:['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
// 其他 // 其他
milestone: 'Milestone', milestone: 'Milestone',
targetDate: 'Target Date',
today: 'Today', today: 'Today',
// 里程碑对话框 // 里程碑对话框
milestoneDetails: 'Milestone Details', milestoneDetails: 'Milestone Details',