feat(localization): add and update translations for multiple languages
- Introduced new localization files for Albanian, German, Spanish, Portuguese, and Chinese, enhancing the application's multilingual support. - Added new keys and updated existing translations in project-view, task-list-table, and settings files to improve user experience across different languages. - Enhanced error handling and empty state messages in task management components to provide clearer feedback to users. - Updated tooltip texts and button labels for better clarity and consistency in the user interface.
This commit is contained in:
@@ -4,9 +4,56 @@ import { getLanguageFromLocalStorage } from './language-utils';
|
||||
export const currentDateString = (): string => {
|
||||
const date = dayjs();
|
||||
const localeString = getLanguageFromLocalStorage();
|
||||
const locale = localeString === 'en' ? 'en' : localeString === 'es' ? 'es' : 'pt';
|
||||
|
||||
// Map language codes to dayjs locales
|
||||
let locale = 'en'; // Default to English
|
||||
switch (localeString) {
|
||||
case 'en':
|
||||
locale = 'en';
|
||||
break;
|
||||
case 'es':
|
||||
locale = 'es';
|
||||
break;
|
||||
case 'pt':
|
||||
locale = 'pt';
|
||||
break;
|
||||
case 'de':
|
||||
locale = 'de';
|
||||
break;
|
||||
case 'zh_cn':
|
||||
locale = 'zh-cn';
|
||||
break;
|
||||
case 'alb':
|
||||
locale = 'sq'; // Albanian locale code for dayjs
|
||||
break;
|
||||
default:
|
||||
locale = 'en';
|
||||
}
|
||||
|
||||
// Get localized "Today is" text
|
||||
let todayText = 'Today is'; // Default English
|
||||
switch (localeString) {
|
||||
case 'en':
|
||||
todayText = 'Today is';
|
||||
break;
|
||||
case 'es':
|
||||
todayText = 'Hoy es';
|
||||
break;
|
||||
case 'pt':
|
||||
todayText = 'Hoje é';
|
||||
break;
|
||||
case 'de':
|
||||
todayText = 'Heute ist';
|
||||
break;
|
||||
case 'zh_cn':
|
||||
todayText = '今天是';
|
||||
break;
|
||||
case 'alb':
|
||||
todayText = 'Sot është';
|
||||
break;
|
||||
default:
|
||||
todayText = 'Today is';
|
||||
}
|
||||
|
||||
const todayText =
|
||||
localeString === 'en' ? 'Today is' : localeString === 'es' ? 'Hoy es' : 'Hoje é';
|
||||
return `${todayText} ${date.locale(locale).format('dddd, MMMM DD, YYYY')}`;
|
||||
};
|
||||
|
||||
@@ -49,5 +49,16 @@ export const greetingString = (name: string): string => {
|
||||
evening = '晚上好';
|
||||
}
|
||||
|
||||
return `${greetingPrefix} ${name}, ${greetingSuffix} ${greet}!`;
|
||||
// Get the localized time period based on the current time
|
||||
let localizedTimePeriod;
|
||||
if (greet === 'morning') localizedTimePeriod = morning;
|
||||
else if (greet === 'afternoon') localizedTimePeriod = afternoon;
|
||||
else localizedTimePeriod = evening;
|
||||
|
||||
// Handle Chinese language which has different structure
|
||||
if (language === 'zh_cn') {
|
||||
return `${greetingPrefix} ${name}, ${localizedTimePeriod}!`;
|
||||
}
|
||||
|
||||
return `${greetingPrefix} ${name}, ${greetingSuffix} ${localizedTimePeriod}!`;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user