Skip to content

Commit

Permalink
fix(tree): add translatable strings for selected/unselected node (#1575)
Browse files Browse the repository at this point in the history
## PR Checklist

Please check if your PR fulfills the following requirements:

- [ ] Tests for the changes have been added (for bug fixes / features)
- [ ] Docs have been added / updated (for bug fixes / features)
- [ ] If applicable, have a visual design approval

## PR Type

What kind of change does this PR introduce?

<!-- Please check the one that applies to this PR using "x". -->

- [x] Bugfix
- [ ] Feature
- [ ] Code style update (formatting, local variables)
- [ ] Refactoring (no functional changes, no api changes)
- [ ] Build related changes
- [ ] CI related changes
- [ ] Documentation content changes
- [ ] Other... Please describe:

## What is the current behavior?

<!-- Please describe the current behavior that you are modifying, or
link to a relevant issue. -->

Issue Number: CDE-2311

## What is the new behavior?
Easier translation of "selected" and "unselected" strings in tree node

## Does this PR introduce a breaking change?

- [ ] Yes
- [x] No

<!-- If this PR contains a breaking change, please describe the impact
and migration path for existing applications below. -->

## Other information

---------

Co-authored-by: Valentin Mladenov <[email protected]>
  • Loading branch information
mivaylo and valentin-mladenov authored Oct 1, 2024
1 parent 44a8918 commit 3a4926c
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 2 deletions.
4 changes: 4 additions & 0 deletions projects/angular/clarity.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -1017,6 +1017,8 @@ export interface ClrCommonStrings {
select: string;
selectAll: string;
selectedRows: string;
// (undocumented)
selectedTreeNode: string;
show: string;
showColumns: string;
showColumnsMenuDescription: string;
Expand All @@ -1043,6 +1045,8 @@ export interface ClrCommonStrings {
totalPages: string;
unknown: string;
// (undocumented)
unselectedTreeNode: string;
// (undocumented)
verticalNavToggle: string;
warning: string;
wizardStepError: string;
Expand Down
3 changes: 1 addition & 2 deletions projects/angular/src/data/tree-view/tree-node.html
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,7 @@
<ng-template #treenodeContent>
<ng-content></ng-content>
<div class="clr-sr-only" *ngIf="featuresService.selectable || ariaSelected">
<span *ngIf="ariaSelected"> selected</span>
<span *ngIf="!ariaSelected"> unselected</span>
<span> {{ariaSelected ? commonStrings.keys.selectedTreeNode : commonStrings.keys.unselectedTreeNode}}</span>
</div>
</ng-template>
</div>
Expand Down
4 changes: 4 additions & 0 deletions projects/angular/src/utils/i18n/common-strings.default.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,4 +126,8 @@ export const commonStringsDefault: ClrCommonStrings = {
fileCount: '{COUNT} files',
clearFile: 'Clear {FILE}',
clearFiles: 'Clear {COUNT} files',

// Tree
selectedTreeNode: 'selected',
unselectedTreeNode: 'unselected',
};
4 changes: 4 additions & 0 deletions projects/angular/src/utils/i18n/common-strings.interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -301,4 +301,8 @@ export interface ClrCommonStrings {
fileCount: string;
clearFile: string;
clearFiles: string;

// Tree
selectedTreeNode: string;
unselectedTreeNode: string;
}

0 comments on commit 3a4926c

Please sign in to comment.