תרגום שדה Datepicker של Fluent Forms #
באפשרותך לתרגם את שדות בחירת התאריך על ידי הוספת קוד מותאם לקובץ functions.php של התיבה שלך. כדי לערוך את קובץ functions.php, היכנס ללוח הבקרה ב-WordPress שלך והמשך אל Appearance ➜ Theme Editor (עורך התיבה ← מראה ← WordPress) כפי שמוצג כאן.

- כדי לשנות את שמות החודשים של ה-datepicker, פשוט הוסף את הקוד למטה לקובץ functions.php של התיבה שלך. מומלץ להשתמש בתיבה ילדה ולהוסיף את הקוד לקובץ functions.php של תיבת הילדה. באפשרותך להדביק את הקוד בסוף.
add_filter('fluentform/date_i18n', function ($strings) {
$strings = array(
'months' => [
'shorthand' => [
__('Jan', 'fluentform'),
__('Feb', 'fluentform'),
__('Mar', 'fluentform'),
__('Apr', 'fluentform'),
__('May', 'fluentform'),
__('Jun', 'fluentform'),
__('Jul', 'fluentform'),
__('Aug', 'fluentform'),
__('Sep', 'fluentform'),
__('Oct', 'fluentform'),
__('Nov', 'fluentform'),
__('Dec', 'fluentform')
],
'longhand' => [
__('January', 'fluentform'),
__('February', 'fluentform'),
__('March', 'fluentform'),
__('April', 'fluentform'),
__('May', 'fluentform'),
__('June', 'fluentform'),
__('July', 'fluentform'),
__('August', 'fluentform'),
__('September', 'fluentform'),
__('October', 'fluentform'),
__('November', 'fluentform'),
__('December', 'fluentform')
]
],
);
return $strings;
});
- שנה את שניהם shorthand (קיצור) ו-longhand (מלא) של החודשים לפי הצורך. לדוגמה, אם אתה רוצה לתרגם זאת לגרמנית, אתה כנראה תרצה לשנות “October” ל-“Oktober” עבור ה-longhand ו-“Oct” ל-“Okt” עבור ה-shorthand.
- בואו נתרגם את צורות shorthand ו-longhand של ימי השבוע. זה זהה מאוד לשינוי החודשים למעלה. הוסף את הקוד למטה לקובץ function.php של תיבת הילדה שלך ושנה את ההודעות לשפתך.
add_filter('fluentform/date_i18n', function ($strings) {
$strings = array(
'weekdays' => [
'longhand' => array(
__('Sunday', 'fluentform'),
__('Monday', 'fluentform'),
__('Tuesday', 'fluentform'),
__('Wednesday', 'fluentform'),
__('Thursday', 'fluentform'),
__('Friday', 'fluentform'),
__('Saturday', 'fluentform')
),
'shorthand' => array(
__('Sun', 'fluentform'),
__('Mon', 'fluentform'),
__('Tue', 'fluentform'),
__('Wed', 'fluentform'),
__('Thu', 'fluentform'),
__('Fri', 'fluentform'),
__('Sat', 'fluentform')
)
],
);
return $strings;
});
- שנה את shorthand ו-longhand בימי השבוע לפי הצורך. אז אם אתה רוצה לתרגם את זה לגרמנית, אתה כנראה תרצה לשנות “Thursday” ל-“Donnerstag” עבור ה-longhand ו-“Sun” כ-“Don” עבור ה-shorthand.
- בואו נסתכל על תרגומי AM ו-PM. זה גם זהה לתרגום החודשים וימי השבוע המתוארים קודם לכן. הוסף את הקוד למטה לקובץ functions.php של תיבת הילדה שלך ושמור אותו.
add_filter('fluentform/date_i18n', function ($strings) {
$strings = array(
'amPM' => [
__('AM', 'fluentform'),
__('PM', 'fluentform')
],
);
return $strings;
});
- שנה את AM ו-PM לשפתך לפי הצורך. במקרה של תרגום לגרמנית, אתה כנראה תרצה לשנות “AM” ל-“Uhr morgens” ו-“PM” ל-“Uhr.”
- באפשרותך להשתמש בקוד למטה פעם אחת כדי לתרגם את כל החודשים, השבועות ו-AM-PM ללא שימוש בקוד בנפרד.
add_filter('fluentform/date_i18n', function ($strings) {
$strings = array(
'months' => [
'shorthand' => [
__('Jan', 'fluentform'),
__('Feb', 'fluentform'),
__('Mar', 'fluentform'),
__('Apr', 'fluentform'),
__('May', 'fluentform'),
__('Jun', 'fluentform'),
__('Jul', 'fluentform'),
__('Aug', 'fluentform'),
__('Sep', 'fluentform'),
__('Oct', 'fluentform'),
__('Nov', 'fluentform'),
__('Dec', 'fluentform')
],
'longhand' => [
__('January', 'fluentform'),
__('February', 'fluentform'),
__('March', 'fluentform'),
__('April', 'fluentform'),
__('May', 'fluentform'),
__('June', 'fluentform'),
__('July', 'fluentform'),
__('August', 'fluentform'),
__('September', 'fluentform'),
__('October', 'fluentform'),
__('November', 'fluentform'),
__('December', 'fluentform')
]
],
'weekdays' => [
'longhand' => array(
__('Sunday', 'fluentform'),
__('Monday', 'fluentform'),
__('Tuesday', 'fluentform'),
__('Wednesday', 'fluentform'),
__('Thursday', 'fluentform'),
__('Friday', 'fluentform'),
__('Saturday', 'fluentform')
),
'shorthand' => array(
__('Sun', 'fluentform'),
__('Mon', 'fluentform'),
__('Tue', 'fluentform'),
__('Wed', 'fluentform'),
__('Thu', 'fluentform'),
__('Fri', 'fluentform'),
__('Sat', 'fluentform')
)
],
'amPM' => [
__('AM', 'fluentform'),
__('PM', 'fluentform')
],
);
return $strings;
});
- בעת שימוש בקוד משולב, אתה לא צריך לכתוב כמה פונקציות add_filter והצהרות return.