Skip to content
This repository has been archived by the owner on Sep 21, 2024. It is now read-only.

Localization #23

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 8 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
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
*.csproj
.vs/
bin/
obj/
*.DotSettings.user

# misc
/.sass-cache
Expand All @@ -33,6 +38,7 @@ npm-debug.log
yarn-error.log
testem.log
/typings
*.orig

# System Files
.DS_Store
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
"@types/jasmine": "~3.3.0",
"@types/jasminewd2": "~2.0.3",
"@types/node": "~10.12.11",
"bootstrap": "~3.3.7",
"bootstrap": "^4.3.1",
"codelyzer": "~4.5.0",
"jasmine-core": "~3.3.0",
"jasmine-spec-reporter": "~4.2.1",
Expand Down
103 changes: 85 additions & 18 deletions projects/cron-editor/src/lib/CronOptions.ts
Original file line number Diff line number Diff line change
@@ -1,26 +1,93 @@
export interface CronOptions {
formInputClass: string;
formSelectClass: string;
formRadioClass: string;
formCheckboxClass: string;

defaultTime: string;
use24HourTime: boolean;

hideMinutesTab: boolean;
hideHourlyTab: boolean;
hideDailyTab: boolean;
hideWeeklyTab: boolean;
hideMonthlyTab: boolean;
hideYearlyTab: boolean;
hideAdvancedTab: boolean;
formInputClass?: string;
formSelectClass?: string;
formRadioClass?: string;
formCheckboxClass?: string;

defaultTime?: string;
use24HourTime?: boolean;

hideMinutesTab?: boolean;
hideHourlyTab?: boolean;
hideDailyTab?: boolean;
hideWeeklyTab?: boolean;
hideMonthlyTab?: boolean;
hideYearlyTab?: boolean;
hideAdvancedTab?: boolean;

/** hides the Seconds UI form element */
hideSeconds: boolean;
hideSeconds?: boolean;

/** removes Seconds from the Cron expression */
removeSeconds: boolean;
removeSeconds?: boolean;

/** removes Years from the Cron expression */
removeYears: boolean;
removeYears?: boolean;

/** Set values to change localizations **/
localizations?: Localization;
}

export interface Localization {
minutely?: string;
hourly?: string;
daily?: string;
weekly?: string;
monthly?: string;
yearly?: string;
advanced?: string;

monday?: string;
tuesday?: string;
wednesday?: string;
thursday?: string;
friday?: string;
saturday?: string;
sunday?: string;

every?: string;
minutes?: string;
onSecond?: string;
hoursOnMinute?: string;
andSecond?: string;
daysAt?: string;
everyWorkingDayAt?: string;
at?: string;
onThe?: string;
ofEvery?: string;
monthsAt?: string;
duringTheNearestWeekday?: string;
monthsStartingIn?: string;
of?: string;
cronExpression?: string;

lastDay?: string;
lastWeekday?: string;
firstWeekday?: string;
day?: string;

january?: string;
february?: string;
march?: string;
april?: string;
may?: string;
june?: string;
july?: string;
august?: string;
september?: string;
october?: string;
november?: string;
december?: string;

first?: string;
second?: string;
third?: string;
fourth?: string;
fifth?: string;
last?: string;

cronExpressionCannotBeNull?: string;
invalidCronExpression?: string;

ordinalSuffix?(value: string): string;
}
146 changes: 146 additions & 0 deletions projects/cron-editor/src/lib/Localizations.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
// @dynamic
import { Localization } from './CronOptions';

export class Localizations {
static English: Localization = {
minutely: 'Minutes',
hourly: 'Hourly',
daily: 'Daily',
weekly: 'Weekly',
monthly: 'Monthly',
yearly: 'Yearly',
advanced: 'Advanced',
monday: 'Monday',
tuesday: 'Tuesday',
wednesday: 'Wednesday',
thursday: 'Thursday',
friday: 'Friday',
saturday: 'Saturday',
sunday: 'Sunday',
every: 'Every',
minutes: 'minute(s)',
onSecond: 'on second',
hoursOnMinute: 'hour(s) on minute',
andSecond: 'and second',
daysAt: 'day(s) at',
everyWorkingDayAt: 'Every working day at',
at: 'at',
onThe: 'on the',
ofEvery: 'of every',
monthsAt: 'month(s) at',
duringTheNearestWeekday: 'during the nearest weekday',
monthsStartingIn: 'month(s) starting in',
of: 'of',
cronExpression: 'Cron expression',
cronExpressionCannotBeNull: 'Cron expression cannot be null',
invalidCronExpression: 'Invalid cron expression, there must be {expected} segments',
lastDay: 'last day',
lastWeekday: 'last weekday',
firstWeekday: 'first weekday',
day: 'day',
january: 'January',
february: 'February',
march: 'March',
april: 'April',
may: 'May',
june: 'June',
july: 'July',
august: 'August',
september: 'September',
october: 'October',
november: 'November',
december: 'December',
first: 'first',
second: 'second',
third: 'third',
fourth: 'fourth',
fifth: 'fifth',
last: 'last',
ordinalSuffix(value: string) {
if (value.length > 1) {
const secondToLastDigit = value.charAt(value.length - 2);
if (secondToLastDigit === '1') {
return 'th';
}
}

const lastDigit = value.charAt(value.length - 1);
switch (lastDigit) {
case '1':
return 'st';
case '2':
return 'nd';
case '3':
return 'rd';
default:
return 'th';
}
}
};

static Swedish: Localization = {
minutely: 'Minuter',
hourly: 'Timvis',
daily: 'Dagligen',
weekly: 'Veckovis',
monthly: 'Månadsvis',
yearly: 'Årligen',
advanced: 'Avancerat',
monday: 'Måndag',
tuesday: 'Tisdag',
wednesday: 'Onsdag',
thursday: 'Torsdag',
friday: 'Fredag',
saturday: 'Lördag',
sunday: 'Söndag',
every: 'Varje',
minutes: 'minut',
onSecond: 'på sekund',
hoursOnMinute: 'timmar på minut',
andSecond: 'och sekund',
daysAt: 'dagar på',
everyWorkingDayAt: 'Varje arbetsdag kl',
at: 'kl',
onThe: 'på den',
ofEvery: 'varje',
monthsAt: 'månader på',
duringTheNearestWeekday: 'på närmaste veckodag',
monthsStartingIn: 'månader med början i',
of: 'i',
cronExpression: 'Cron-uttryck',
cronExpressionCannotBeNull: 'Cron-uttryck kan inte vara tomt',
invalidCronExpression: 'Ogiltigt cron-uttryck, det måste innehålla {expected} segment',
lastDay: 'sista dagen',
lastWeekday: 'sista arbetsdagen',
firstWeekday: 'första arbetsdagen',
day: 'dagen',
january: 'Januari',
february: 'Februari',
march: 'Mars',
april: 'April',
may: 'Maj',
june: 'Juni',
july: 'Juli',
august: 'Augusti',
september: 'September',
october: 'Oktober',
november: 'November',
december: 'December',
first: 'första',
second: 'andra',
third: 'tredje',
fourth: 'fjärde',
fifth: 'femte',
last: 'sista',
ordinalSuffix(value: string) {
switch (value) {
case '1':
return 'a';
case '2':
return 'a';
default:
return 'e';
}
}
};
}
74 changes: 14 additions & 60 deletions projects/cron-editor/src/lib/cron-editor.component.css
Original file line number Diff line number Diff line change
@@ -1,69 +1,23 @@
.cron-editor-container {
margin-top: 10px;
tab-pane .well,
dennisholmer marked this conversation as resolved.
Show resolved Hide resolved
.tab-pane .card {
margin-top: 10px;
}

.cron-editor-container .cron-editor-radio {
width: 20px;
display: inline-block;
.form-inline .form-group {
margin-right: 5px;
}

.cron-editor-container .cron-editor-select,
.cron-editor-container .cron-editor-input,
.cron-editor-container .cron-editor-checkbox {
display: inline-block;
}

.cron-editor-container .well-time-wrapper {
padding-left: 20px;
}

.cron-editor-container .inline-block {
display: inline-block;
}

.cron-editor-container .minutes,
.cron-editor-container .hours,
.cron-editor-container .days,
.cron-editor-container .seconds {
width: 70px;
}

.cron-editor-container .months {
width: 120px;
}

.cron-editor-container .month-days {
width: 130px;
}

.cron-editor-container .months-small {
width: 60px;
}

.cron-editor-container .day-order-in-month {
width: 95px;
}

.cron-editor-container .week-days {
width: 120px;
}

.cron-editor-container .advanced-cron-editor-input {
width: 200px;
}

.cron-editor-container .hour-types {
width: 70px;
}

.cron-editor-container .advanced-cron-editor-label {
font-weight: 200;
.form-inline .form-group input[type=checkbox],
.form-inline .form-group input[type=radio] {
position: relative;
top: 1px;
}

.nav-tabs li a {
cursor: pointer;
cursor: pointer;
}

.form-control {
height: auto;
}
.tab-pane label {
display: inline;
font-weight: inherit;
}
Loading