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

[DO NOT MERGE] changes to accept i18Nlabels as input #397

Open
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

RAJESH-GN
Copy link
Collaborator

No description provided.

@RAJESH-GN RAJESH-GN requested a review from tcorral January 29, 2025 16:13
@tcorral
Copy link
Collaborator

tcorral commented Jan 31, 2025

@RAJESH-GN Fix the build, please.

@RAJESH-GN
Copy link
Collaborator Author

RAJESH-GN commented Jan 31, 2025

@tcorral fixed the tests. Can u please validate it once u have some time.

Copy link
Collaborator

@tcorral tcorral left a comment

Choose a reason for hiding this comment

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

We have to discuss it further as I see many different things that we should align across implementations.

>
Skip to Content
{{ this.translations['app.skipToContent'] }}
Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't think the 'this.' is needed here as it's not needed in line '16'.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Where the 'app.skipToContent' comes from? I have checked out the branch and I cannot find it, just the usage?
Also in my case I kept the original custom id and in this change it's changed to use camel case instead of using snake-case? Can you get it aligned, please?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
{{ this.translations['app.skipToContent'] }}
{{ this.translations['skip-to-content'] }}

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

done

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

thanks was my bad

accessibility feature to quickly navigate to the main content section.
This aria-label is located in the topbar area of the
layout.@@move-focus-to-beginning-of-content"
[attr.aria-label]="translations['move-focus-to-beginning-of-content']"
Copy link
Collaborator

Choose a reason for hiding this comment

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

After the discussion on my PR about using [attr.aria-label] I investigated a bit more and in this case using [ariaLabel] is allowed because this property actually exist in the button tag and Angular transforms it properly to 'aria-label' property in the HTML. Can you get it aligned, please?

Suggested change
[attr.aria-label]="translations['move-focus-to-beginning-of-content']"
[ariaLabel]="translations['move-focus-to-beginning-of-content']"

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

done

as an accessibility feature to indicate the button's function. This
aria-label is located in the topbar area of the
layout.@@bb-layout.sidebar_toggler"
[attr.aria-label]="translations['bb-layout.sidebar_toggler']"
Copy link
Collaborator

Choose a reason for hiding this comment

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

After the discussion on my PR about using [attr.aria-label] I investigated a bit more and in this case using [ariaLabel] is allowed because this property actually exist in the button tag and Angular transforms it properly to 'aria-label' property in the HTML. Can you get it aligned, please?

Suggested change
[attr.aria-label]="translations['bb-layout.sidebar_toggler']"
[ariaLabel]="translations['bb-layout.sidebar_toggler']"

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

done

as an accessibility feature to indicate the button's function. This
aria-label is located in the topbar area of the
layout.@@bb-layout.sidebar_toggler"
[attr.aria-label]="translations['bb-layout.sidebar_toggler']"
[attr.aria-expanded]="layoutService.navigationExpanded$ | async"
Copy link
Collaborator

Choose a reason for hiding this comment

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

After the discussion on my PR about using [attr.aria-label] I investigated a bit more and in this case using [ariaExpanded] is allowed because this property actually exist in the button tag and Angular transforms it properly to 'aria-label' property in the HTML. Can you get it aligned, please?

Suggested change
[attr.aria-expanded]="layoutService.navigationExpanded$ | async"
[ariaExpanded]="layoutService.navigationExpanded$ | async"

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

done thomas thanks

@@ -8,6 +8,10 @@ import {
} from '@backbase/foundation-ang/observability';
import { environment } from '../environments/environment';

export interface Translations {
Copy link
Collaborator

Choose a reason for hiding this comment

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

In my code and after a few iterations I have found that having a catalog with the translations might be more easy to debug and find changes but I also noticed that using Translations every where will be a mess because in order for the developers to overwrite the translations for each journey or component we will need to export the translations and it has more sense to have it's own name like I have in the suggestion.

Suggested change
export interface Translations {
export interface AppTranslations {

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

done

import { ActivatedRoute, Router, RouterModule } from '@angular/router';
import { PERMISSIONS } from '@backbase-gsa/ach-positive-pay-journey/internal/shared-data';
import { HeadingModule } from '@backbase/ui-ang/heading';

export interface Translations {
[key: string]: string;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Same reason that for my previous similar comments.

Suggested change
[key: string]: string;
'ach-positive-pay-journey.heading.title': string;
'ach-positive-pay-journey.heading.new-blocker.button': string;
[key: string]: string;

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

applied the change

@@ -11,11 +15,31 @@ import { HeadingModule } from '@backbase/ui-ang/heading';
})
export class AchPositivePayJourneyComponent {
permissions = PERMISSIONS;
@Input()
public readonly translations: Translations = {};
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
public readonly translations: Translations = {};
public readonly translations: AchPositivePayJourneyTranslations = {};

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

updated

@Input()
public readonly translations: Translations = {};

public readonly defaultTranslations: Translations = {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
public readonly defaultTranslations: Translations = {
public readonly defaultTranslations: AchPositivePayJourneyTranslations = {

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

changed

@@ -17,6 +21,74 @@ export class AppComponent {
triplets = triplets;
isAuthenticated = false;

public readonly translations: Translations = {
Copy link
Collaborator

Choose a reason for hiding this comment

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

As we don't know if the user would like to override one or more or all of them we have to use Partial<>

Suggested change
public readonly translations: Translations = {
public readonly translations: Partial<AchPositivePayJourneyTranslations> = {

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

we dont need to use partials now i have made a new commit to address this issue please check

) {
this.translations = {
...this.defaultTranslations,
...this.translations,
Copy link
Collaborator

Choose a reason for hiding this comment

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

I am not sure if this might work after using Partial<> after setting a more strict interface can you test?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Sure tomas i will try different approach

>
Skip to Content
{{ appTranslations['skipToContent'] }}
</button>

<!-- Hamburger -->
<button
Copy link
Collaborator

Choose a reason for hiding this comment

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

It's a problem with this button because on running the accesibility linter it asks to have a text for the button. In my case I added the following code after the line 29.

<span class="sr-only">{{
        translations['bb-layout.sidebar_toggler']
      }}</span>

In your code it should be something like:

<span class="sr-only">{{
        appTranslations['bb-layout.sidebar_toggler']
      }}</span>

For this to work you also will need to add a class on the scss file:

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

If you don't do this, the e2e tests will fail

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.

2 participants