Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(time-picker,input-time-picker): add built-in translations support #5416

Merged
Show file tree
Hide file tree
Changes from 76 commits
Commits
Show all changes
77 commits
Select commit Hold shift + click to select a range
096f757
feat: add built-in translations
jcfranco Jul 18, 2022
daf9def
add bundles
jcfranco Aug 2, 2022
d284ef4
remove obsolete folder
jcfranco Aug 2, 2022
62fd6ee
add type generator
anveshmekala Aug 5, 2022
e798c7d
rename type's file
anveshmekala Aug 15, 2022
d00849d
delete non-t9n file
jcfranco Aug 16, 2022
5e37ae3
commit lock file
jcfranco Aug 16, 2022
2320e1f
rename type generating script and tidy up
jcfranco Aug 16, 2022
a8fd161
regenerate interface files
jcfranco Aug 16, 2022
472e6a1
update color-picker file
jcfranco Aug 16, 2022
cb7fb56
add missing value-list entries
jcfranco Aug 16, 2022
79a79e0
inline common strings until we have common bundle wired up
jcfranco Aug 16, 2022
64bd8dc
revert unnecessary tsconfig changes
jcfranco Aug 16, 2022
c66c420
update interface files
jcfranco Aug 16, 2022
14e2bc2
Merge branch 'master' into jcfranco/4961-add-built-in-localization-to…
anveshmekala Aug 19, 2022
48a584c
add util to fetchbundles and supported locale
anveshmekala Aug 19, 2022
bd0d359
feedback changes
anveshmekala Aug 19, 2022
b983d2d
more cleanup
anveshmekala Aug 19, 2022
9fd8305
remove intl default value validation in e2e
anveshmekala Aug 22, 2022
78d2987
sync en.json with en-US.json bundle
anveshmekala Aug 24, 2022
06252c7
rename script
anveshmekala Aug 24, 2022
b78dd81
refactor script file
anveshmekala Aug 24, 2022
fd58f43
remove console.log
anveshmekala Aug 24, 2022
500fe85
refactor & add back types to intl props in colorpicker
anveshmekala Aug 30, 2022
7f7d567
add util method for string over rides
anveshmekala Sep 1, 2022
9ae38ac
Merge branch 'master' into jcfranco/4961-add-built-in-localization-to…
anveshmekala Sep 2, 2022
3b113c0
tidy up
jcfranco Sep 4, 2022
335f397
simplify t9n pattern
jcfranco Sep 4, 2022
36a4a6e
fix issue caused by type + interface TS shape confusion
jcfranco Sep 4, 2022
3e3aa3b
support nb&no for norwegian locale
anveshmekala Sep 6, 2022
3a61c52
add cache for stringBundle fetch
anveshmekala Sep 7, 2022
94b8122
tidy up
jcfranco Sep 7, 2022
8cd1c5c
drop intl from string bundle keys
jcfranco Sep 7, 2022
1f31505
update scripts to use messages as string bundle name
jcfranco Sep 7, 2022
19c2458
rename bundles
jcfranco Sep 7, 2022
50059df
rename interface props
jcfranco Sep 8, 2022
1c575c9
add t9ntest util methods
anveshmekala Sep 9, 2022
8782977
Merge branch 'master' into jcfranco/4961-add-built-in-localization-to…
anveshmekala Sep 12, 2022
24f19e5
Merge branch 'master' into jcfranco/4961-add-built-in-localization-to…
benelan Sep 13, 2022
e327282
restore intlProp watching to pattern
jcfranco Sep 9, 2022
159de44
use extended mutation observer to simplify unobserving
jcfranco Sep 9, 2022
45f909c
add intl prop watcher doc
jcfranco Sep 16, 2022
0cd2f82
add support for cascading lang
jcfranco Sep 16, 2022
7517e84
Merge branch 'master' into jcfranco/4961-add-built-in-localization-to…
jcfranco Sep 16, 2022
99f9132
tidy up
jcfranco Sep 16, 2022
36fb1f1
update conventions doc with pattern info
jcfranco Sep 16, 2022
2c3aa53
update doc
jcfranco Sep 16, 2022
a1d3060
merge master
jcfranco Sep 17, 2022
9b8d75c
drop and ignore generated d.ts files and tweak messages type names
jcfranco Sep 17, 2022
8daebbe
wire up interface generation before build
jcfranco Sep 17, 2022
bed440d
merge w other
jcfranco Sep 17, 2022
60a6316
refactor localized components pattern
jcfranco Sep 17, 2022
42433af
refactor t9n pattern to work w/ localized component
jcfranco Sep 17, 2022
ce299db
tidy up
jcfranco Sep 21, 2022
b041d48
fix utils depending on defined locale and not placeholder one
jcfranco Sep 21, 2022
d7757ea
consolidate t9n tests and make intl prop merging happen at run time
jcfranco Sep 21, 2022
f43f4b3
Updated Pseudo i18n - @jian9413
jona7150 Sep 23, 2022
4cb67fe
feat(time-picker,input-time-picker): add built-in translations support
anveshmekala Oct 5, 2022
700a805
ensure connectLocale happens before code that depends on locale
jcfranco Oct 5, 2022
9b52cc7
merge master
jcfranco Oct 5, 2022
03d9081
convert effectiveLocale to internla prop
anveshmekala Oct 6, 2022
9354553
cherry pick lang inheritance changes
jcfranco Oct 6, 2022
443e414
update doc
jcfranco Oct 6, 2022
b41788e
tidy up
anveshmekala Oct 7, 2022
64ff33b
make lang lookup more robust
jcfranco Oct 7, 2022
6c8f499
update doc
jcfranco Oct 7, 2022
a053057
Merge branch 'jcfranco/4961-add-built-in-localization-to-components' …
anveshmekala Oct 7, 2022
4941f88
Merge branch 'master' into anveshmekala/4961-time-picker-add-built-in…
anveshmekala Oct 11, 2022
455b30d
tidy up
anveshmekala Oct 11, 2022
fdf1a5a
fix test errors
anveshmekala Oct 12, 2022
45b9559
Merge branch 'master' into anveshmekala/4961-time-picker-add-built-in…
anveshmekala Oct 13, 2022
93b48be
Merge branch 'master' into anveshmekala/4961-time-picker-add-built-in…
anveshmekala Oct 13, 2022
f65ac69
add comments
anveshmekala Oct 13, 2022
50428d1
remove intl resources
anveshmekala Oct 14, 2022
4379f81
fix typo
anveshmekala Oct 19, 2022
2ebd33f
clean up
anveshmekala Oct 19, 2022
76fc725
forward intlProps
anveshmekala Oct 19, 2022
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
2 changes: 1 addition & 1 deletion src/components/color-picker/color-picker.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ describe("calcite-color-picker", () => {
};

function assertUnsupportedValueMessage(value: string | object | null, format: string): void {
expect(consoleSpy).toBeCalledTimes(1);
expect(consoleSpy).toHaveBeenCalledTimes(1);
expect(consoleSpy).toHaveBeenCalledWith(
expect.stringMatching(
new RegExp(
Expand Down
93 changes: 69 additions & 24 deletions src/components/input-time-picker/input-time-picker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import {
numberStringFormatter,
updateEffectiveLocale
} from "../../utils/locale";
import { Messages } from "../time-picker/assets/time-picker/t9n";
import { numberKeys } from "../../utils/key";

@Component({
Expand Down Expand Up @@ -107,42 +108,97 @@ export class InputTimePicker
}
}

/** Accessible name for the component's hour input. */
/**
* Accessible name for the component's hour input.
*
* @deprecated - translations are now built-in, if you need to override a string, please use `messageOverrides`
*/
@Prop() intlHour?: string;

/** Accessible name for the component's hour down button. */
/**
* Accessible name for the component's hour down button.
*
* @deprecated - translations are now built-in, if you need to override a string, please use `messageOverrides`
*/
@Prop() intlHourDown?: string;

/** Accessible name for the component's hour up button. */
/**
* Accessible name for the component's hour up button.
*
* @deprecated - translations are now built-in, if you need to override a string, please use `messageOverrides`
*/
@Prop() intlHourUp?: string;

/** Accessible name for the component's meridiem (am/pm) input. */
/**
* Accessible name for the component's meridiem (am/pm) input.
*
* @deprecated - translations are now built-in, if you need to override a string, please use `messageOverrides`
*/
@Prop() intlMeridiem?: string;

/** Accessible name for the component's meridiem (am/pm) down button. */
/**
* Accessible name for the component's meridiem (am/pm) down button.
*
* @deprecated - translations are now built-in, if you need to override a string, please use `messageOverrides`
*/
@Prop() intlMeridiemDown?: string;

/** Accessible name for the component's meridiem (am/pm) up button. */
/**
* Accessible name for the component's meridiem (am/pm) up button.
*
* @deprecated - translations are now built-in, if you need to override a string, please use `messageOverrides`
*/
@Prop() intlMeridiemUp?: string;

/** Accessible name for the component's minute input. */
/**
* Accessible name for the component's minute input.
*
* @deprecated - translations are now built-in, if you need to override a string, please use `messageOverrides`
*/
@Prop() intlMinute?: string;

/** Accessible name for the component's minute down button. */
/**
* Accessible name for the component's minute down button.
*
* @deprecated - translations are now built-in, if you need to override a string, please use `messageOverrides`
*/
@Prop() intlMinuteDown?: string;

/** Accessible name for the component's minute up button. */
/**
* Accessible name for the component's minute up button.
*
* @deprecated - translations are now built-in, if you need to override a string, please use `messageOverrides`
*/
@Prop() intlMinuteUp?: string;

/** Accessible name for the component's second input. */
/**
* Accessible name for the component's second input.
*
* @deprecated - translations are now built-in, if you need to override a string, please use `messageOverrides`
*/
@Prop() intlSecond?: string;

/** Accessible name for the component's second down button. */
/**
* Accessible name for the component's second down button.
*
* @deprecated - translations are now built-in, if you need to override a string, please use `messageOverrides`
*/
@Prop() intlSecondDown?: string;

/** Accessible name for the component's second up button. */
/**
* Accessible name for the component's second up button.
*
* @deprecated - translations are now built-in, if you need to override a string, please use `messageOverrides`
*/
@Prop() intlSecondUp?: string;

/**
* Use this property to override individual strings used by the component.
*
* @deprecated - translations are now built-in, if you need to override a string, please use `messageOverrides`
*/
@Prop() messagesOverrides: Partial<Messages>;

/**
* BCP 47 language tag for desired language and country format.
*
Expand Down Expand Up @@ -562,19 +618,8 @@ export class InputTimePicker
triggerDisabled={true}
>
<calcite-time-picker
intlHour={this.intlHour}
intlHourDown={this.intlHourDown}
intlHourUp={this.intlHourUp}
intlMeridiem={this.intlMeridiem}
intlMeridiemDown={this.intlMeridiemDown}
intlMeridiemUp={this.intlMeridiemUp}
intlMinute={this.intlMinute}
intlMinuteDown={this.intlMinuteDown}
intlMinuteUp={this.intlMinuteUp}
intlSecond={this.intlSecond}
intlSecondDown={this.intlSecondDown}
intlSecondUp={this.intlSecondUp}
lang={this.effectiveLocale}
messageOverrides={this.messagesOverrides}
numberingSystem={this.numberingSystem}
onCalciteInternalTimePickerChange={this.timePickerChangeHandler}
ref={this.setCalciteTimePickerEl}
Expand Down
15 changes: 0 additions & 15 deletions src/components/time-picker/resources.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,3 @@ export const CSS = {
timePicker: "time-picker",
meridiemStart: "meridiem--start"
};

export const TEXT = {
hour: "Hour",
hourDown: "Decrease hour",
hourUp: "Increase hour",
meridiem: "AM/PM",
meridiemDown: "Decrease AM/PM",
meridiemUp: "Increase AM/PM",
minute: "Minute",
minuteDown: "Decrease minute",
minuteUp: "Increase minute",
second: "Second",
secondDown: "Decrease second",
secondUp: "Increase second"
};
4 changes: 3 additions & 1 deletion src/components/time-picker/time-picker.e2e.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { newE2EPage } from "@stencil/core/testing";
import { accessible, defaults, focusable, renders, hidden } from "../../tests/commonTests";
import { accessible, defaults, focusable, renders, hidden, t9n } from "../../tests/commonTests";
import { formatTimePart } from "../../utils/time";
import { CSS } from "./resources";

Expand Down Expand Up @@ -1053,4 +1053,6 @@ describe("calcite-time-picker", () => {
expect(meridiemStart).toBeTruthy();
});
});

it("suuports translation", () => t9n("<calcite-time-picker></calcite-time-picker>"));
Copy link
Member

Choose a reason for hiding this comment

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

This can be simplified by passing the tag.

});
Loading