-
Notifications
You must be signed in to change notification settings - Fork 59
WIP: React intl ramp up #408
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
Conversation
| {itinerary.transfers > 1 | ||
| ? <FormattedMessage id='components.ItinerarySummary.transferPlural' /> | ||
| : <FormattedMessage id='components.ItinerarySummary.transfer' /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use <FormatterPlural> for this case, see https://formatjs.io/docs/react-intl/components#formattedplural
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be addressed as of 4bbbe49
| <FormattedNumber | ||
| value={minTotalFare / 100} | ||
| style='currency' | ||
| currencyDisplay='narrowSymbol' | ||
| currency={currency} | ||
| /> | ||
| {minTotalFare !== maxTotalFare && | ||
| <span> - | ||
| <FormattedNumber | ||
| value={maxTotalFare / 100} | ||
| style='currency' | ||
| currencyDisplay='narrowSymbol' | ||
| currency={currency} | ||
| /> | ||
| </span>} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a concat; it needs to be turned into a conditional message.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be addressed as of 4bbbe49
| {Math.round(caloriesBurned)} Cals | ||
| {Math.round(caloriesBurned)} <FormattedMessage id='components.ItinerarySummary.calories' /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I found multiple spellings for the Calories abbreviation:
- This component (used in mobile view of itinerary results) displays "Cals" (as in "100 Cals").
- The tabbed itinerary summary (in desktop view) displays "Cal" (as in "100 Cal").
I am in favor of merging the two and say, in English, "100 Cal".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have changed the components I touched to "Cal" as of 4bbbe49
| <Detail> | ||
| {coreUtils.time.formatTime(itinerary.startTime, timeOptions)} - {coreUtils.time.formatTime(itinerary.endTime, timeOptions)} | ||
| <FormattedTime | ||
| startTime={itinerary.startTime} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to pass a message id.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated as of 4bbbe49
i18n/en-US.yml
Outdated
| true {{minTotalFare} - {maxTotalFare}} | ||
| false {{minTotalFare}} | ||
| }}" | ||
| transfers: "{transfers} {transfers, plural, =0 {Transfer} other {Transfers}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be addressed in the latest commit (1fbee66)
…er/otp-react-redux into react-intl-ramp-up
…er/otp-react-redux into react-intl-ramp-up
| * component. The monitoredTrip param can be undefined. | ||
| */ | ||
| export default function baseRenderer (monitoredTrip) { | ||
| const intl = useIntl() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tricky: baseRenderer is not a component and not a functional component, so this call fails when rendering a trip detail page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This would hold for changes to active-trip-renderer as well:
Lines 12 to 17 in 09664bd
| export default function activeTripRenderer ({ | |
| monitoredTrip, | |
| onTimeThresholdSeconds, | |
| timeFormat | |
| }) { | |
| const intl = useIntl() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Both should be addressed in 6c54a1e
i18n/en-US.yml
Outdated
| BaseRenderer: | ||
| bodyDefault: Unknown Trip State | ||
| lastCheckedDefaultText: Last checked time unknown | ||
| LastCheckedText: "Last checked: {formattedDuration} ago" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be lastCheckedText (lower case l)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
addressed in 6c54a1e
i18n/en-US.yml
Outdated
| true {Unsnooze trip analysis} | ||
| other {Snooze for rest of today} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These should probably two separate messages.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Separated into tripIsNotSnoozed and tripIsSnoozed messages in 6c54a1e
i18n/en-US.yml
Outdated
| departure: DEPARTURE | ||
| status: STATUS |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@philip-cline These table headings should be first letter capitalized here. To render them all-caps, there should be some CSS for the corresponding elements in viewers.css.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO, departure and status should be under components.PatternRow, or is there a reason to place them under common?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Both of these addressed in 8a8cfae, I had put the messages under common in case they would be used in the future by another component.
| ) | ||
| // Add tall class to account for vertical centering if there is only | ||
| // one line in the label (default is 2). | ||
| const addClass = messages.label.match(/\n/) ? '' : ' tall' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the appropriate way to apply styles and formatting here? Right now we're relying on a multi line string in the i18n files
9cb3305 to
16ff909
Compare
…er/otp-react-redux into react-intl-ramp-up
|
🎉 This PR is included in version 3.8.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |


This PR adds localization support to OTP-RR.