mirror of
				https://github.com/louislam/uptime-kuma.git
				synced 2025-11-04 21:56:12 +08:00 
			
		
		
		
	Add localeDirection method to i18n.js
Add dir to html tag based on localeDirection Add Farsi to the languages
This commit is contained in:
		
							
								
								
									
										22
									
								
								src/App.vue
									
									
									
									
									
								
							
							
						
						
									
										22
									
								
								src/App.vue
									
									
									
									
									
								
							@@ -3,5 +3,25 @@
 | 
				
			|||||||
</template>
 | 
					</template>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
<script>
 | 
					<script>
 | 
				
			||||||
export default {}
 | 
					
 | 
				
			||||||
 | 
					import { i18n, localeDirection } from "./i18n";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					export default {
 | 
				
			||||||
 | 
					    created() {
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
 | 
					    this.setPageLocale();
 | 
				
			||||||
 | 
					  },
 | 
				
			||||||
 | 
					  methods: {
 | 
				
			||||||
 | 
					      setPageLocale() {
 | 
				
			||||||
 | 
					        const html = document.documentElement 
 | 
				
			||||||
 | 
					        html.setAttribute('lang', this.$i18n.locale )
 | 
				
			||||||
 | 
					        html.setAttribute('dir', localeDirection() )
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					  },
 | 
				
			||||||
 | 
					  watch: {
 | 
				
			||||||
 | 
					        "$i18n.locale"() {
 | 
				
			||||||
 | 
					            this.setPageLocale();
 | 
				
			||||||
 | 
					        },
 | 
				
			||||||
 | 
					    },
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
</script>
 | 
					</script>
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										13
									
								
								src/i18n.js
									
									
									
									
									
								
							
							
						
						
									
										13
									
								
								src/i18n.js
									
									
									
									
									
								
							@@ -2,6 +2,7 @@ import { createI18n } from "vue-i18n";
 | 
				
			|||||||
import daDK from "./languages/da-DK";
 | 
					import daDK from "./languages/da-DK";
 | 
				
			||||||
import deDE from "./languages/de-DE";
 | 
					import deDE from "./languages/de-DE";
 | 
				
			||||||
import en from "./languages/en";
 | 
					import en from "./languages/en";
 | 
				
			||||||
 | 
					import fa from "./languages/fa";
 | 
				
			||||||
import esEs from "./languages/es-ES";
 | 
					import esEs from "./languages/es-ES";
 | 
				
			||||||
import etEE from "./languages/et-EE";
 | 
					import etEE from "./languages/et-EE";
 | 
				
			||||||
import frFR from "./languages/fr-FR";
 | 
					import frFR from "./languages/fr-FR";
 | 
				
			||||||
@@ -24,6 +25,7 @@ const languageList = {
 | 
				
			|||||||
    "de-DE": deDE,
 | 
					    "de-DE": deDE,
 | 
				
			||||||
    "nl-NL": nlNL,
 | 
					    "nl-NL": nlNL,
 | 
				
			||||||
    "es-ES": esEs,
 | 
					    "es-ES": esEs,
 | 
				
			||||||
 | 
					    "fa": fa,
 | 
				
			||||||
    "fr-FR": frFR,
 | 
					    "fr-FR": frFR,
 | 
				
			||||||
    "it-IT": itIT,
 | 
					    "it-IT": itIT,
 | 
				
			||||||
    "ja": ja,
 | 
					    "ja": ja,
 | 
				
			||||||
@@ -39,10 +41,17 @@ const languageList = {
 | 
				
			|||||||
    "et-EE": etEE,
 | 
					    "et-EE": etEE,
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					const rtlLangs = ["fa"];
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
 | 
					const currentLocale = () => localStorage.locale || "en";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					export const localeDirection = () => {
 | 
				
			||||||
 | 
					    return rtlLangs.includes(currentLocale()) ? "rtl" : "ltr"
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
export const i18n = createI18n({
 | 
					export const i18n = createI18n({
 | 
				
			||||||
    locale: localStorage.locale || "en",
 | 
					    locale: currentLocale(),
 | 
				
			||||||
    fallbackLocale: "en",
 | 
					    fallbackLocale: "en",
 | 
				
			||||||
    silentFallbackWarn: true,
 | 
					    silentFallbackWarn: true,
 | 
				
			||||||
    silentTranslationWarn: false,
 | 
					    silentTranslationWarn: false,
 | 
				
			||||||
    messages: languageList,
 | 
					    messages: languageList
 | 
				
			||||||
});
 | 
					});
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										172
									
								
								src/languages/fa.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										172
									
								
								src/languages/fa.js
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,172 @@
 | 
				
			|||||||
 | 
					export default {
 | 
				
			||||||
 | 
					    languageName: "Farsi",
 | 
				
			||||||
 | 
					    checkEverySecond: "بررسی هر {0} ثانیه.",
 | 
				
			||||||
 | 
					    retryCheckEverySecond: "تکرار مجدد هر {0} ثانیه.",
 | 
				
			||||||
 | 
					    retriesDescription: "حداکثر تعداد تکرار پیش از علامت گذاری وبسایت بعنوان خارج از دسترس و ارسال اطلاعرسانی.",
 | 
				
			||||||
 | 
					    ignoreTLSError: "بیخیال ارور TLS/SSL برای سایتهای HTTPS",
 | 
				
			||||||
 | 
					    upsideDownModeDescription: "Flip the status upside down. If the service is reachable, it is DOWN.",
 | 
				
			||||||
 | 
					    maxRedirectDescription: "Maximum number of redirects to follow. Set to 0 to disable redirects.",
 | 
				
			||||||
 | 
					    acceptedStatusCodesDescription: "Select status codes which are considered as a successful response.",
 | 
				
			||||||
 | 
					    passwordNotMatchMsg: "The repeat password does not match.",
 | 
				
			||||||
 | 
					    notificationDescription: "Please assign a notification to monitor(s) to get it to work.",
 | 
				
			||||||
 | 
					    keywordDescription: "Search keyword in plain html or JSON response and it is case-sensitive",
 | 
				
			||||||
 | 
					    pauseDashboardHome: "متوقف شده",
 | 
				
			||||||
 | 
					    deleteMonitorMsg: "Are you sure want to delete this monitor?",
 | 
				
			||||||
 | 
					    deleteNotificationMsg: "Are you sure want to delete this notification for all monitors?",
 | 
				
			||||||
 | 
					    resoverserverDescription: "Cloudflare is the default server, you can change the resolver server anytime.",
 | 
				
			||||||
 | 
					    rrtypeDescription: "Select the RR-Type you want to monitor",
 | 
				
			||||||
 | 
					    pauseMonitorMsg: "Are you sure want to pause?",
 | 
				
			||||||
 | 
					    enableDefaultNotificationDescription: "For every new monitor this notification will be enabled by default. You can still disable the notification separately for each monitor.",
 | 
				
			||||||
 | 
					    clearEventsMsg: "Are you sure want to delete all events for this monitor?",
 | 
				
			||||||
 | 
					    clearHeartbeatsMsg: "Are you sure want to delete all heartbeats for this monitor?",
 | 
				
			||||||
 | 
					    confirmClearStatisticsMsg: "Are you sure want to delete ALL statistics?",
 | 
				
			||||||
 | 
					    importHandleDescription: "Choose 'Skip existing' if you want to skip every monitor or notification with the same name. 'Overwrite' will delete every existing monitor and notification.",
 | 
				
			||||||
 | 
					    confirmImportMsg: "Are you sure to import the backup? Please make sure you've selected the right import option.",
 | 
				
			||||||
 | 
					    twoFAVerifyLabel: "Please type in your token to verify that 2FA is working",
 | 
				
			||||||
 | 
					    tokenValidSettingsMsg: "Token is valid! You can now save the 2FA settings.",
 | 
				
			||||||
 | 
					    confirmEnableTwoFAMsg: "Are you sure you want to enable 2FA?",
 | 
				
			||||||
 | 
					    confirmDisableTwoFAMsg: "Are you sure you want to disable 2FA?",
 | 
				
			||||||
 | 
					    Settings: "تنظیمات",
 | 
				
			||||||
 | 
					    Dashboard: "پیشخوان",
 | 
				
			||||||
 | 
					    "New Update": "بروزرسانی جدید!",
 | 
				
			||||||
 | 
					    Language: "زبان",
 | 
				
			||||||
 | 
					    Appearance: "ظاهر",
 | 
				
			||||||
 | 
					    Theme: "پوسته",
 | 
				
			||||||
 | 
					    General: "عمومی",
 | 
				
			||||||
 | 
					    Version: "نسخه",
 | 
				
			||||||
 | 
					    "Check Update On GitHub": "بررسی بروز رسانی بر روی گیتهاب",
 | 
				
			||||||
 | 
					    List: "لیست",
 | 
				
			||||||
 | 
					    Add: "اضافه",
 | 
				
			||||||
 | 
					    "Add New Monitor": "اضافه کردن مانیتور جدید",
 | 
				
			||||||
 | 
					    "Quick Stats": "خلاصه وضعیت",
 | 
				
			||||||
 | 
					    Up: "فعال",
 | 
				
			||||||
 | 
					    Down: "غیرفعال",
 | 
				
			||||||
 | 
					    Pending: "در انتظار تایید",
 | 
				
			||||||
 | 
					    Unknown: "نامشخص",
 | 
				
			||||||
 | 
					    Pause: "توقف",
 | 
				
			||||||
 | 
					    Name: "نام",
 | 
				
			||||||
 | 
					    Status: "وضعیت",
 | 
				
			||||||
 | 
					    DateTime: "تاریخ و زمان",
 | 
				
			||||||
 | 
					    Message: "پیام",
 | 
				
			||||||
 | 
					    "No important events": "رخداد جدید نیست.",
 | 
				
			||||||
 | 
					    Resume: "ادامه",
 | 
				
			||||||
 | 
					    Edit: "ویرایش",
 | 
				
			||||||
 | 
					    Delete: "حذف",
 | 
				
			||||||
 | 
					    Current: "فعلی",
 | 
				
			||||||
 | 
					    Uptime: "آپتایم",
 | 
				
			||||||
 | 
					    "Cert Exp.": "تاریخ انقضای SSL",
 | 
				
			||||||
 | 
					    days: "روز",
 | 
				
			||||||
 | 
					    day: "روز",
 | 
				
			||||||
 | 
					    "-day": "-روز",
 | 
				
			||||||
 | 
					    hour: "ساعت",
 | 
				
			||||||
 | 
					    "-hour": "-ساعت",
 | 
				
			||||||
 | 
					    Response: "پاسخ",
 | 
				
			||||||
 | 
					    Ping: "Ping",
 | 
				
			||||||
 | 
					    "Monitor Type": "نوع مانیتور",
 | 
				
			||||||
 | 
					    Keyword: "کلمه کلیدی",
 | 
				
			||||||
 | 
					    "Friendly Name": "عنوان",
 | 
				
			||||||
 | 
					    URL: "URL",
 | 
				
			||||||
 | 
					    Hostname: "نام میزبان (Hostname)",
 | 
				
			||||||
 | 
					    Port: "پورت",
 | 
				
			||||||
 | 
					    "Heartbeat Interval": "فاصله هر Heartbeat",
 | 
				
			||||||
 | 
					    Retries: "تلاش مجدد",
 | 
				
			||||||
 | 
					    "Heartbeat Retry Interval": "فاصله تلاش مجدد برایHeartbeat",
 | 
				
			||||||
 | 
					    Advanced: "پیشرفته",
 | 
				
			||||||
 | 
					    "Upside Down Mode": "حالت بر عکس",
 | 
				
			||||||
 | 
					    "Max. Redirects": "حداکثر تعداد ریدایرکت",
 | 
				
			||||||
 | 
					    "Accepted Status Codes": "وضعیتهای (Status Code) های قابل قبول",
 | 
				
			||||||
 | 
					    Save: "ذخیره",
 | 
				
			||||||
 | 
					    Notifications: "اطلاعرسانیها",
 | 
				
			||||||
 | 
					    "Not available, please setup.": "هیچ موردی موجود نیست، اولین مورد را راه اندازی کنید!",
 | 
				
			||||||
 | 
					    "Setup Notification": "راه اندازی اطلاعرسانی",
 | 
				
			||||||
 | 
					    Light: "روشن",
 | 
				
			||||||
 | 
					    Dark: "تاریک",
 | 
				
			||||||
 | 
					    Auto: "اتوماتیک",
 | 
				
			||||||
 | 
					    "Theme - Heartbeat Bar": "Theme - Heartbeat Bar",
 | 
				
			||||||
 | 
					    Normal: "Normal",
 | 
				
			||||||
 | 
					    Bottom: "Bottom",
 | 
				
			||||||
 | 
					    None: "None",
 | 
				
			||||||
 | 
					    Timezone: "موقعیت زمانی",
 | 
				
			||||||
 | 
					    "Search Engine Visibility": "Search Engine Visibility",
 | 
				
			||||||
 | 
					    "Allow indexing": "Allow indexing",
 | 
				
			||||||
 | 
					    "Discourage search engines from indexing site": "Discourage search engines from indexing site",
 | 
				
			||||||
 | 
					    "Change Password": "Change Password",
 | 
				
			||||||
 | 
					    "Current Password": "Current Password",
 | 
				
			||||||
 | 
					    "New Password": "New Password",
 | 
				
			||||||
 | 
					    "Repeat New Password": "Repeat New Password",
 | 
				
			||||||
 | 
					    "Update Password": "Update Password",
 | 
				
			||||||
 | 
					    "Disable Auth": "Disable Auth",
 | 
				
			||||||
 | 
					    "Enable Auth": "Enable Auth",
 | 
				
			||||||
 | 
					    Logout: "خروج",
 | 
				
			||||||
 | 
					    Leave: "Leave",
 | 
				
			||||||
 | 
					    "I understand, please disable": "متوجه هست»، لطفا غیرفعال کنید!",
 | 
				
			||||||
 | 
					    Confirm: "تایید",
 | 
				
			||||||
 | 
					    Yes: "بلی",
 | 
				
			||||||
 | 
					    No: "خیر",
 | 
				
			||||||
 | 
					    Username: "نام کاربری",
 | 
				
			||||||
 | 
					    Password: "کلمه عبور",
 | 
				
			||||||
 | 
					    "Remember me": "مراب هب خاطر بسپار",
 | 
				
			||||||
 | 
					    Login: "ورود",
 | 
				
			||||||
 | 
					    "No Monitors, please": "No Monitors, please",
 | 
				
			||||||
 | 
					    "add one": "add one",
 | 
				
			||||||
 | 
					    "Notification Type": "Notification Type",
 | 
				
			||||||
 | 
					    Email: "Email",
 | 
				
			||||||
 | 
					    Test: "Test",
 | 
				
			||||||
 | 
					    "Certificate Info": "Certificate Info",
 | 
				
			||||||
 | 
					    "Resolver Server": "Resolver Server",
 | 
				
			||||||
 | 
					    "Resource Record Type": "Resource Record Type",
 | 
				
			||||||
 | 
					    "Last Result": "Last Result",
 | 
				
			||||||
 | 
					    "Create your admin account": "Create your admin account",
 | 
				
			||||||
 | 
					    "Repeat Password": "Repeat Password",
 | 
				
			||||||
 | 
					    "Import Backup": "Import Backup",
 | 
				
			||||||
 | 
					    "Export Backup": "Export Backup",
 | 
				
			||||||
 | 
					    Export: "Export",
 | 
				
			||||||
 | 
					    Import: "Import",
 | 
				
			||||||
 | 
					    respTime: "Resp. Time (ms)",
 | 
				
			||||||
 | 
					    notAvailableShort: "N/A",
 | 
				
			||||||
 | 
					    "Default enabled": "Default enabled",
 | 
				
			||||||
 | 
					    "Apply on all existing monitors": "Apply on all existing monitors",
 | 
				
			||||||
 | 
					    Create: "Create",
 | 
				
			||||||
 | 
					    "Clear Data": "Clear Data",
 | 
				
			||||||
 | 
					    Events: "Events",
 | 
				
			||||||
 | 
					    Heartbeats: "Heartbeats",
 | 
				
			||||||
 | 
					    "Auto Get": "Auto Get",
 | 
				
			||||||
 | 
					    backupDescription: "You can backup all monitors and all notifications into a JSON file.",
 | 
				
			||||||
 | 
					    backupDescription2: "PS: History and event data is not included.",
 | 
				
			||||||
 | 
					    backupDescription3: "Sensitive data such as notification tokens is included in the export file, please keep it carefully.",
 | 
				
			||||||
 | 
					    alertNoFile: "Please select a file to import.",
 | 
				
			||||||
 | 
					    alertWrongFileType: "Please select a JSON file.",
 | 
				
			||||||
 | 
					    "Clear all statistics": "Clear all Statistics",
 | 
				
			||||||
 | 
					    "Skip existing": "Skip existing",
 | 
				
			||||||
 | 
					    Overwrite: "Overwrite",
 | 
				
			||||||
 | 
					    Options: "Options",
 | 
				
			||||||
 | 
					    "Keep both": "Keep both",
 | 
				
			||||||
 | 
					    "Verify Token": "Verify Token",
 | 
				
			||||||
 | 
					    "Setup 2FA": "Setup 2FA",
 | 
				
			||||||
 | 
					    "Enable 2FA": "Enable 2FA",
 | 
				
			||||||
 | 
					    "Disable 2FA": "Disable 2FA",
 | 
				
			||||||
 | 
					    "2FA Settings": "2FA Settings",
 | 
				
			||||||
 | 
					    "Two Factor Authentication": "Two Factor Authentication",
 | 
				
			||||||
 | 
					    Active: "Active",
 | 
				
			||||||
 | 
					    Inactive: "Inactive",
 | 
				
			||||||
 | 
					    Token: "Token",
 | 
				
			||||||
 | 
					    "Show URI": "Show URI",
 | 
				
			||||||
 | 
					    Tags: "Tags",
 | 
				
			||||||
 | 
					    "Add New below or Select...": "Add New below or Select...",
 | 
				
			||||||
 | 
					    "Tag with this name already exist.": "Tag with this name already exist.",
 | 
				
			||||||
 | 
					    "Tag with this value already exist.": "Tag with this value already exist.",
 | 
				
			||||||
 | 
					    color: "color",
 | 
				
			||||||
 | 
					    "value (optional)": "value (optional)",
 | 
				
			||||||
 | 
					    Gray: "Gray",
 | 
				
			||||||
 | 
					    Red: "Red",
 | 
				
			||||||
 | 
					    Orange: "Orange",
 | 
				
			||||||
 | 
					    Green: "Green",
 | 
				
			||||||
 | 
					    Blue: "Blue",
 | 
				
			||||||
 | 
					    Indigo: "Indigo",
 | 
				
			||||||
 | 
					    Purple: "Purple",
 | 
				
			||||||
 | 
					    Pink: "Pink",
 | 
				
			||||||
 | 
					    "Search...": "Search...",
 | 
				
			||||||
 | 
					    "Avg. Ping": "Avg. Ping",
 | 
				
			||||||
 | 
					    "Avg. Response": "Avg. Response",
 | 
				
			||||||
 | 
					    "Uptime Kuma": "آپتایم کوما"
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
		Reference in New Issue
	
	Block a user