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

fix: Implement sentence case formatting for logo label, excluding German. #2274

Merged
Show file tree
Hide file tree
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
3 changes: 3 additions & 0 deletions src/app/cdk/platform-info/platform-info.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ export class PlatformInfoService {
reactivation: false,
reactivationCode: '',
summaryScreen: false,
locale: 'en',
}
platformSubject = new BehaviorSubject<PlatformInfo>(this.platform)

Expand All @@ -50,6 +51,7 @@ export class PlatformInfoService {
_platform: Platform,
@Inject(WINDOW) private window: Window
) {
this.platform.locale = locale
this.platform.rtl = locale === 'ar' ? true : false
this.platform.ltr = !this.platform.rtl
this.platform.screenDirection = this.platform.rtl ? 'rtl' : 'ltr'
Expand Down Expand Up @@ -235,6 +237,7 @@ export class PlatformInfoService {
0,
reactivationCode: this.getReactivationCode(),
summaryScreen: this.window.location.pathname.endsWith('/summary'),
locale: this.locale,
}
this.platformSubject.next(this.platform)
return this.platformSubject.asObservable()
Expand Down
1 change: 1 addition & 0 deletions src/app/cdk/platform-info/platform-info.type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,5 @@ export interface PlatformInfo {
reactivation: boolean
reactivationCode: string
summaryScreen: boolean
locale: string
}
3 changes: 1 addition & 2 deletions src/app/layout/header/header.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,8 @@
role="link"
class="orc-font-body-small"
*ngIf="platform.columns12"
i18n="@@confirm-oauth-access.connectingresearchandresearchers"
>
Connecting research and researchers
{{ labelLogo }}
</div>
</a>
<div class="col no-gutters" role="navigation">
Expand Down
6 changes: 5 additions & 1 deletion src/app/layout/header/header.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import { Config } from 'src/app/types/togglz.endpoint'
import { environment } from '../../../environments/environment'
import { ApplicationRoutes, ORCID_REGEXP } from '../../constants'
import { menu } from './menu'
import { RecordUtil } from 'src/app/shared/utils/record.util'

@Component({
selector: 'app-header',
Expand All @@ -38,7 +39,7 @@ export class HeaderComponent implements OnInit {
user: UserInfo
togglz: Config
signinRegisterButton = true
labelLogo = $localize`:@@layout.ariaLabelConnectingResearchers:Connecting research and researchers`
labelLogo = $localize`:@@confirm-oauth-access.connectingresearchandresearchers:Connecting research and researchers`
labelMenu = $localize`:@@layout.ariaLabelMenu:main menu`

constructor(
Expand All @@ -59,6 +60,9 @@ export class HeaderComponent implements OnInit {

_platform.get().subscribe((data) => {
this.platform = data
if (this.platform.locale !== 'de') {
this.labelLogo = RecordUtil.sentenceCase(this.labelLogo)
}
})
_userInfo.getUserSession().subscribe((data) => {
this.user = data.userInfo
Expand Down
4 changes: 4 additions & 0 deletions src/app/shared/utils/record.util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,4 +121,8 @@ export class RecordUtil {
static appendOpensInNewTab(ariaLabel: string): string {
return `${ariaLabel} ${$localize`:@@shared.opensInNewTab:(opens in a new tab)`}`
}

static sentenceCase(label: string): string {
return label.charAt(0).toUpperCase() + label.slice(1)
}
}
Loading