Skip to content

Commit

Permalink
SHIBUI-814 migrating translations
Browse files Browse the repository at this point in the history
  • Loading branch information
rmathis committed Sep 18, 2018
1 parent 5961451 commit 162568d
Show file tree
Hide file tree
Showing 46 changed files with 618 additions and 368 deletions.
297 changes: 275 additions & 22 deletions backend/src/main/resources/i18n/messages_en.properties

Large diffs are not rendered by default.

27 changes: 14 additions & 13 deletions ui/src/app/app.brand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,42 +3,43 @@ import { Brand } from './core/model/brand';

export const brand: Brand = {
header: {
title: 'Source Management'
title: 'brand.header.title'
},
logo: {
default: '/assets/shibboleth_logowordmark_color.png',
small: '/assets/shibboleth_icon_color_130x130.png',
large: '/assets/shibboleth_logowordmark_color.png',
alt: 'Shibboleth Logo - Click to be directed to www.shibboleth.net',
alt: 'brand.logo-alt',
link: {
label: 'Shibboleth',
url: 'https://www.shibboleth.net/'
label: 'brand.logo-link-label', // shibboleth
url: 'https://www.shibboleth.net/',
description: 'brand.logo.link-description'
}
},
footer: {
links: [
{
label: 'Home Page',
label: 'brand.footer.links-label-1',
url: 'https://www.shibboleth.net/',
description: 'Shibboleth.net open-source community home page'
description: 'brand.footer.links-desc-1'
},
{
label: 'Wiki',
label: 'brand.footer.links-label-2',
url: 'https://wiki.shibboleth.net/',
description: 'Shibboleth.net open-source community wiki'
description: 'brand.footer.links-desc-2'
},
{
label: 'Issue Tracker',
label: 'brand.footer.links-label-3',
url: 'https://issues.shibboleth.net/',
description: 'Shibboleth.net open-source community issue tracker'
description: 'brand.footer.links-desc-3'
},
{
label: 'Mailing List',
label: 'brand.footer.links-label-4',
url: 'https://www.shibboleth.net/community/lists/',
description: 'Shibboleth.net open-source community mailing list'
description: 'brand.footer.links-desc-4'
}
],
text: 'Links to Shibboleth resources:'
text: 'brand.footer.text'
},
...customBrand
};
30 changes: 15 additions & 15 deletions ui/src/app/app.component.html
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<nav class="navbar navbar-expand-md fixed-top">
<a class="navbar-brand" [href]="brand.logo.link.url" target="_blank" [title]="brand.logo.link.description">
<a class="navbar-brand" [href]="brand.logo.link.url" target="_blank" [title]="brand.logo.link.description | translate">
<img [src]="brand.logo.small" width="30" height="30" class="d-inline-block align-top" [alt]="brand.logo.alt">
<span class="d-lg-inline d-none">{{ brand.logo.link.label }}</span>
<span class="d-lg-inline d-none" [translate]="brand.logo.link.label">{{ brand.logo.link.label }}</span>
</a>
<span class="navbar-text">{{ brand.header.title }}</span>
<span class="navbar-text" [translate]="brand.header.title">{{ brand.header.title }}</span>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbar" aria-controls="navbar"
aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
Expand All @@ -19,39 +19,39 @@
aria-expanded="false"
ngbDropdownToggle>
<i class="fa fa-plus-circle fa-fw" aria-hidden="true"></i>
<translate key="action.add-new">Add</translate>
<translate-i18n key="action.add-new">Add New</translate-i18n>
</button>
<div ngbDropdownMenu aria-labelledby="addNewDropdown">
<a class="nav-link"
routerLink="/metadata/resolver/new"
routerLinkActive="active"
aria-label="Add a new metadata provider"
[attr.aria-label]="'action.add-new-source' | translate"
role="button">
<i class="fa fa-cube fa-fw" aria-hidden="true"></i>
&nbsp;
<translate key="label.metadata-source">Metadata Source</translate>
<translate-i18n key="label.metadata-source">Metadata Source</translate-i18n>
</a>
<a class="nav-link"
routerLink="/metadata/provider/wizard"
routerLinkActive="active"
aria-label="Add a new metadata resolver"
[attr.aria-label]="'action.add-new-provider' | translate"
role="button">
<i class="fa fa-cubes fa-fw" aria-hidden="true"></i>
&nbsp;
<translate key="label.metadata-provider">Metadata Provider</translate>
<translate-i18n key="label.metadata-provider">Metadata Provider</translate-i18n>
</a>
</div>
</li>
<li class="nav-item">
<a class="nav-link" routerLink="/metadata" routerLinkActive="active" aria-label="Metadata Dashboard">
<i class="fa fa-th fa-fw" aria-hidden="true"></i>
<translate key="action.dashboard">Dashboard</translate>
<translate-i18n key="action.dashboard">Dashboard</translate-i18n>
</a>
</li>
<li>
<a class="nav-link" href="/logout" target="_self" aria-label="Log out of Shibboleth UI">
<a class="nav-link" href="/logout" target="_self" [attr.aria-label]="'action.logout' | translate">
<i class="fa fa-sign-out fa-fw" aria-hidden="true"></i>
<translate key="action.logout">Logout</translate>
<translate-i18n key="action.logout">Logout</translate-i18n>
</a>
</li>
</ul>
Expand All @@ -65,10 +65,10 @@
<div class="row">
<div class="col-md-8 copyright">
<ul class="list-inline">
<li class="list-inline-item">{{ brand.footer.text }}</li>
<li class="list-inline-item" *ngFor="let link of brand.footer.links">
<li class="list-inline-item" [translate]="brand.footer.text">{{ brand.footer.text }}</li>
<li class="list-inline-item" *ngFor="let link of brand.footer.links; let i = index;">
<a [href]="link.url" target="_blank" [attr.aria-label]="link.description" [title]="link.description">
{{ link.label }}
<translate-i18n [key]="link.label">{{ link.label }}</translate-i18n>
</a>
</li>
</ul>
Expand All @@ -77,7 +77,7 @@
{{ formatted$ | async }}
&nbsp;|&nbsp;
</ng-container>
<translate key="label.copyright" [params]="{ year: year }">Copyright &copy; Internet2</translate>
<translate-i18n key="label.copyright" [params]="{ year: year }">Copyright &copy; Internet2</translate-i18n>
</p>
</div>
<div class="col-md-4 logo">
Expand Down
2 changes: 1 addition & 1 deletion ui/src/app/i18n/component/translate.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { MockI18nService, MockI18nModule } from '../../../testing/i18n.stub';

@Component({
template: `
<translate [key]="foo">Word</translate>
<translate-i18n [key]="foo">Word</translate-i18n>
`
})
class TestHostComponent {
Expand Down
2 changes: 1 addition & 1 deletion ui/src/app/i18n/component/translate.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { Messages } from '../model/Messages';
/*tslint:disable:component-selector */

@Component({
selector: 'translate',
selector: 'translate-i18n',
template: `<ng-content></ng-content>`
})
export class TranslateComponent implements OnDestroy {
Expand Down
2 changes: 1 addition & 1 deletion ui/src/app/i18n/service/i18n.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export class I18nService {

translate(value: string, interpolated: any, messages: Messages): string {
interpolated = interpolated || {};
let val = messages.hasOwnProperty(value) ? messages[value] : '';
let val = messages.hasOwnProperty(value) ? messages[value] : value;
return this.interpolate(val, interpolated);
}

Expand Down
Loading

0 comments on commit 162568d

Please sign in to comment.