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

LF-3787 The common name for a crop should be displayed on the Crop Detailed page once changes are made #3667

Open
wants to merge 1 commit into
base: integration
Choose a base branch
from
Open
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
2 changes: 1 addition & 1 deletion packages/webapp/src/components/Crop/CropHeader.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ function CropHeader({ variety, onBackClick }) {
<div className={styles.headerTitleContainer} onClick={onBackClick}>
<Back style={{ verticalAlign: 'text-bottom' }} />
<Title className={clsx(styles.headerTitle, styles.textOverFlowBehaviour)}>
{t(`crop:${crop_translation_key}`)}
{t(`crop:${crop_variety_name}`)}
Copy link
Collaborator

@kathyavini kathyavini Jan 28, 2025

Choose a reason for hiding this comment

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

This definitely works to implement the Jira-described solution! 👍

However, it's just slightly misleading. What it is doing, is calling the translation function t() and saying "look for the translation in the crop file that corresponds to the key {{crop_variety_name}}". Crop variety name is going to be a user-input string (or by default, a translated string corresponding to the crop key) so it definitely doesn't exist as a key in that file.

Instead, I recommend using here {crop_variety_name} directly, without the call to i18n.

Since i18n will anyway default to displaying the key if it doesn't exist, the end result in the UI will be the same, but it's clearer because it's not suggesting that we have a translation for crop:${crop_variety_name} when we don't.

</Title>
</div>
<div className={styles.headerAttributesContainer}>
Expand Down
Loading