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

feature/80-i18next-implementation #84

Closed
wants to merge 35 commits into from

Conversation

JanJaroszczak
Copy link
Contributor

@JanJaroszczak JanJaroszczak commented Jan 29, 2024

Implementation of i18next

  • Strings in JSX (in this case called 'translations') are now managed by react-i18next library
  • All English translations are located in en.ts file (src/translations/locales/en.ts) and they are arranged alphabetically

related issue

  • My changes generate no new warnings
  • My code follows the style guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the changelog
  • I have added tests that prove my fix is effective or that my feature works

adgud and others added 30 commits December 19, 2023 07:23
Multiple app windows wallet fixes
…nsate-for-node-and-db-sync-repository-url-changes

update urls to docker images, update repo owner condition
`cardano-db-sync` got a new version `sancho-3-0-0` which brings some breaking changes. This commit updates the SQL queries where needed.
…-bump

chore: bumped cardano node and db-sync versions
…or-db-sync-sancho-3-0-0

[57] Update SQL queries for sancho-3-0-0
…twork/metrics endpoint

Before there was no easy way to check current voting power of alwaysAbstain and noConfidence dreps. Now they are available in the network/metrics endpoint
…d-noconfidence-dreps-voting-power-to-the-networkmetrics

[64] feat: add alwaysAbstain and noConfidence voting powers to the ne…
Tool to recreate Cardano node/db/db-sync
#27 add basic auth for dev/test environments
Votes were counted in a wrong way, especially when it came to NoConfidence GAs and AlwaysNoConfidence DRep. The SQL query was modified and the problem is fixed
…oting-power

[59] Fixed vote counting problem
@JanJaroszczak JanJaroszczak linked an issue Jan 29, 2024 that may be closed by this pull request
Copy link
Contributor

@MSzalowski MSzalowski left a comment

Choose a reason for hiding this comment

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

This type of changes - from strings to variables is almost impossible to review due to its size.

And here - perfect fit would be snapshot testing to just check via snapshots what has changed - if anything changes.

Just a suggestion - wdyt of integrating the snapshots testing to your testing pr?

@MSzalowski MSzalowski mentioned this pull request Jan 29, 2024
@Ryun1
Copy link
Member

Ryun1 commented Jan 29, 2024

Please use the PR template 🙏

@MSzalowski MSzalowski force-pushed the 80-i18next-implementation branch from 722ec46 to 6c7a57a Compare January 30, 2024 11:03
@MSzalowski
Copy link
Contributor

@JanJaroszczak TODO:

  1. Change PR description to follow the template
  2. Remove usei18n hook in favor of useTranslation due to changes delivered with 6c7a57a0e64a3dde3c8cf82af09ccab648e42f5a
  3. Remove any types related code as they are no longer required.

And additionally as I made an export of useTranslation from hooks, could you please also update an import in src/vva-fe/src/components/atoms/CopyButton.tsx to import useTranslation from hooks instead of react-i18next?
I should have done it, but I missed that 😅

@JanJaroszczak JanJaroszczak requested a review from Ryun1 as a code owner January 30, 2024 12:40
@@ -284,16 +285,16 @@ export const DashboardCards = () => {
delegateTransaction?.transactionHash
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
delegateTransaction?.transactionHash
t(delegateTransaction?.transactionHash ? "dashboard.delegation.changeDelegation" : "delegate")

Copy link
Contributor Author

Choose a reason for hiding this comment

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

won't we miss the variant with empty string from line 286?

Copy link
Contributor

Choose a reason for hiding this comment

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

Right, it should be based on currentDelegation

@@ -237,7 +237,9 @@ export const GovernanceActionCard: FC<ActionTypeProps> = ({ ...props }) => {
}}
data-testid={`govaction-${govActionId}-view-detail`}
>
{inProgress ? "See transaction" : "View proposal details"}
{inProgress
? t("seeTransaction")
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
? t("seeTransaction")
? t(inProgress ? "seeTransaction" : "govActions.viewProposalDetails")

@@ -119,7 +119,7 @@ export const GovernanceVotedOnCard = ({ votedProposal, inProgress }: Props) => {
</Box>
<Box mt={5}>
<Typography color={"#8E908E"} variant="caption">
Governance Action ID:
{t("govActions.id")}
Copy link
Contributor

Choose a reason for hiding this comment

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

I would call that keys:

...
"govActions": {
   ...,
   "governanceActionType": "Governance Action Type:",
   "governanceActionId": "Governance Action ID:",
   ...,
   },
...

Looks a bit more clear to me

@@ -201,15 +204,15 @@ export const VoteActionForm = ({
dataTestId="url-input"
errorMessage={errors.url?.message}
formFieldName="url"
placeholder="Your URL with with your context"
placeholder={t("forms.urlWithContextPlaceholder")}
width={"100%"}
Copy link
Contributor

Choose a reason for hiding this comment

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

Additionally remove curly braces around string prop here and below. For the consistency & code cleanup 💅

: "If you want to directly participate in voting and have other ada holders delegate their voting power to you."
}
description={t(
`dashboard.registration.${
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we go with a switch/case statement instead of a ternary? Those nested ternaries are almost unreadable

@@ -26,13 +27,15 @@ export function ExternalLinkModal() {
style={{ height: "84px", margin: "0 auto", width: "84px" }}
/>
<ModalHeader sx={{ marginTop: "34px" }}>
{isMobile ? "External Link Safety" : "Be Careful!"}
{isMobile
? t("modals.externalLink.safety")
Copy link
Contributor

Choose a reason for hiding this comment

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

Put ternary inside function parameter

@@ -79,7 +80,7 @@ export function ExternalLinkModal() {
}}
variant="contained"
>
{isMobile ? "Continue" : "Continue to external link"}
{isMobile ? t("continue") : t("modals.externalLink.continueTo")}
Copy link
Contributor

Choose a reason for hiding this comment

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

Same as above

: registerTransaction.type === "registration"
? "Registration transaction failed"
: "Update DRep metadata transaction failed"
? t("alerts.registration.failed")
Copy link
Contributor

Choose a reason for hiding this comment

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

ternary inside parameter

console.log(
"Warning, no registered stake keys, using unregistered stake keys"
);
console.log(t("warnings.usingUnregisteredStakeKeys"));
Copy link
Contributor

Choose a reason for hiding this comment

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

if warning shouldn't it be console.warn?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I can change it here, but if so - should we then change each similar case in the code from log to warn?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yep

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Then I guess it would be better to put this action into a separate task

@MSzalowski
Copy link
Contributor

@JanJaroszczak Can you rebase that branch to develop?

Based on development process instruction.

@MSzalowski MSzalowski changed the base branch from main to develop February 1, 2024 10:20
@MSzalowski
Copy link
Contributor

Closed in favor of #102

@MSzalowski MSzalowski closed this Feb 2, 2024
@MSzalowski MSzalowski deleted the 80-i18next-implementation branch February 16, 2024 12:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implementing i18next
6 participants