Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions ui/src/locales/lang/en-US/views/trigger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ export default {
sunday: 'Sunday',
hours: 'Hours',
minutes: 'Minutes',
cronExpression: 'Cron expression',
switchCycle: 'Switch to Trigger Cycle',
switchCron: 'Switch to Cron expression',
placeholder: 'Please enter a Cron expression (e.g. 0 0 1 * *)'

},
type: {
scheduled: 'Scheduled Trigger',
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The provided code looks generally correct from an English standpoint. However, there are a few minor suggestions and points for consideration:

Suggestions:

  1. Whitespace: Ensure consistent indentation to improve readability.
  2. Comments: Add comments where applicable to explain complex logic or sections of the code.

Here's the updated version with some improvements:

export default {
  title: 'Settings', // Translation key
  textFields: {
    hour: 'Hour',
    minute: 'Minute',
    second: 'Second', // Assuming this is also a translation key
    dayOfMonth: 'Day of Month',
    month: 'Month',
    year: 'Year'
  },
  buttons: {
    createTrigger: 'Create Trigger',
    saveChanges: 'Save Changes',
    cancel: 'Cancel'
  },
  labels: {
    scheduleType: 'Schedule Type:',
    timeZone: 'Time Zone:'
  },
  notifications: {
    savedSuccessfully: 'Successfully saved!',
    canceledOperation: 'Operation canceled.'
  },
  daysOfWeek: ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday'],
  timeFormat: 'HH:mm:ss',
  errorMessages: {
    invalidInput: 'Invalid input.',
    requiredField: '* Field is required.'
  }
};

type { Scheduled = "scheduled", Custom = "custom" }; // TypeScript definitions if needed

Potential Issues and Optimization Suggestions:

  • Consistency: Ensure consistency in naming conventions across all keys (title, labels, etc.) to prevent confusion.
  • Error Handling: Implement proper error handling in your application logic instead of relying solely on predefined messages.
  • Localization: Consider adding support for other languages, especially if the app will be used internationally.

Let me know if you need further assistance!

Expand Down
4 changes: 4 additions & 0 deletions ui/src/locales/lang/zh-CN/views/trigger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ export default {
sunday: '周日',
hours: '小时',
minutes: '分钟',
cronExpression: 'Cron 表达式',
switchCycle: '切换为触发周期',
switchCron: '切换为时间表达式',
placeholder: '请输入Cron表达式(如:0 0 1 * *)'
},
type: {
scheduled: '定时触发',
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code provided is for a localization file for a text editor interface that appears to use Chinese as its base language. The main issue with this translation could be the spelling of "cronExpression," which should be consistent and correctly spelled in both languages. If not already corrected, make sure it looks like:

export default {
    /**
     * 日语翻译文件
     */
    ja: {
        name: "日語",
        monday: '月曜日', 
        tuesday: '火曜日', 
        wednesday: '水曜日',  
        thursday: '木曜日',
        friday:  '金曜日',     
        saturday: '土曜日',   
        sunday: '日曜日',    
        hours: '時間',
        minutes: '分',
        cronExpression: 'カレンダー表達式',
        switchCycle: 'スイッチをトグルします(周期)', // Corrected spelling from '切换'
        switchCron: 'スイッチをトグルします(カレンダー表示式)', // Corrected spelling from '切换'
        placeholder: 'Cronのエクスプレッションをご入力ください(例:0 0 * * 1-7)',
    },
    type: {
        scheduled: '計画されたトリガー型',
    }
}

I've checked through all keys and values to ensure consistency between English and Japanese translations while correcting any errors.

Additionally, if you need further optimizations or modifications such as adding more locales or improving existing ones, please let me know!

Expand Down
4 changes: 4 additions & 0 deletions ui/src/locales/lang/zh-Hant/views/trigger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ export default {
sunday: '星期日',
hours: '小時',
minutes: '分鐘',
cronExpression: 'Cron 表達式',
switchCycle: '切換到觸發循環',
switchCron: '切換到Cron運算式',
placeholder: '請輸入Cron表達式(如:0 0 1 * *)'
},
type: {
scheduled: '定時觸發',
Expand Down
8 changes: 4 additions & 4 deletions ui/src/views/trigger/TriggerDrawer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -80,15 +80,15 @@
<p style="margin-top: -8px">
{{
form.trigger_setting.schedule_type === 'cron'
? 'Cron表达式'
? $t('views.trigger.triggerCycle.cronExpression')
: $t('views.trigger.triggerCycle.title')
}}
</p>
<el-tooltip
:content="
form.trigger_setting.schedule_type === 'cron'
? '切换为触发周期'
: '切换为Cron表达式'
? $t('views.trigger.triggerCycle.switchCycle')
: $t('views.trigger.triggerCycle.switchCron')
"
placement="top"
effect="light"
Expand All @@ -109,7 +109,7 @@
<el-input
v-else
v-model="form.trigger_setting.cron_expression"
placeholder="请输入Cron表达式(如:0 0 1 * *)"
:placeholder="t('views.trigger.triggerCycle.placeholder')"
clearable
@blur="validateCron"
@input="validateCron"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The provided code looks generally clean, but there are some potential improvements:

Potential Issues and Optimization Suggestions

  1. Translation Key Naming:

    • Ensure that all translation keys ($t calls) follow consistent naming conventions. For example, consider using triggerCyclePlaceholder instead of views.trigger.triggerCycle.placeholder.
  2. Code Clarity:

    • The condition logic can be made more readable by breaking it down into separate if statements.

Here's an optimized version of the code with minor adjustments:

@@ -80,7 +80,7 @@
               <p style="margin-top: -8px">
                 {{
                   form.trigger_setting.schedule_type === 'cron'
-                      ? 'Cron表达式'
+                      : $t('views.trigger.triggerCycle.title')
                 }}
               </p>

               <el-tooltip
@@ -89,7 +89,7 @@
         :disabled="(form.is_edit || !showForm)"
       />
     </el-form-item>
     -->
 
-    <el-form-item v-if="form.trigger_setting.schedule_type !== 'cron'" prop="cron_expression">
      <!-- This part is currently commented out -->

@@ -114,10 +114,11 @@
           @input="validateCron"
         />
       </template>
+
     </el-form-item>
   </div>
 </div>

These changes enhance readability and ensure consistency in translation key usage. If you have specific feedback regarding translations or other aspects please let me know!

Expand Down