Skip to content

Commit

Permalink
Add translations for side-nav
Browse files Browse the repository at this point in the history
  • Loading branch information
wenincode committed Oct 27, 2023
1 parent 4e64a79 commit 47f4fd3
Show file tree
Hide file tree
Showing 10 changed files with 94 additions and 41 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@

{{#let @list as |SNL|}}
{{#if (can "use acls")}}
<SNL.Title>Access Controls</SNL.Title>
<SNL.Title>{{t "components.hashicorp-consul.side-nav.acls.title"}}</SNL.Title>
{{else}}
<SNL.Title {{tooltip "ACLs are not currently enabled in this cluster"}}>
Access Controls
<SNL.Title {{tooltip (t "components.hashicorp-consul.side-nav.acls.tooltip")}}>
{{t "components.hashicorp-consul.side-nav.acls.title"}}
</SNL.Title>
{{/if}}

<SNL.Link
@text="Tokens"
@text={{t "components.hashicorp-consul.side-nav.acls.tokens"}}
@href={{href-to "dc.acls.tokens" @dc.Name}}
@isHrefExternal={{false}}
@isActive={{is-href "dc.acls.tokens" @dc.Name}}
Expand All @@ -22,29 +22,35 @@

{{#if (can "read acls")}}
<SNL.Link
@text="Policies"
@text={{t "components.hashicorp-consul.side-nav.acls.policies"}}
@href={{href-to "dc.acls.policies" @dc.Name}}
@isHrefExternal={{false}}
@isActive={{is-href "dc.acls.policies" @dc.Name}}
data-test-main-nav-policies
/>
<SNL.Link
@text="Roles"
@text={{t "components.hashicorp-consul.side-nav.acls.roles"}}
@href={{href-to "dc.acls.roles" @dc.Name}}
@isHrefExternal={{false}}
@isActive={{is-href "dc.acls.roles" @dc.Name}}
data-test-main-nav-roles
/>
<SNL.Link
@text="Auth Methods"
@text={{t "components.hashicorp-consul.side-nav.acls.auth-methods"}}
@href={{href-to "dc.acls.auth-methods" @dc.Name}}
@isHrefExternal={{false}}
@isActive={{is-href "dc.acls.auth-methods" @dc.Name}}
data-test-main-nav-auth-methods
/>
{{else if (not (can "use acls"))}}
<SNL.Item class="consul-disabled-nav" data-test-main-nav-policies>Policies</SNL.Item>
<SNL.Item class="consul-disabled-nav" data-test-main-nav-roles>Roles</SNL.Item>
<SNL.Item class="consul-disabled-nav" data-test-main-nav-auth-methods>Auth Methods</SNL.Item>
<SNL.Item class="consul-disabled-nav" data-test-main-nav-policies>
{{t "components.hashicorp-consul.side-nav.acls.policies"}}
</SNL.Item>
<SNL.Item class="consul-disabled-nav" data-test-main-nav-roles>
{{t "components.hashicorp-consul.side-nav.acls.roles"}}
</SNL.Item>
<SNL.Item class="consul-disabled-nav" data-test-main-nav-auth-methods>
{{t "components.hashicorp-consul.side-nav.acls.auth-methods"}}
</SNL.Item>
{{/if}}
{{/let}}
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,11 @@
"settings"
params=(hash nspace=undefined partition=undefined)
}}
@text="Settings"
@text={{t "components.hashicorp-consul.side-nav.user-menu.settings"}}
@isHrefExternal={{false}}
/>
<dd.Interactive
@text="Log in"
@text={{t "components.hashicorp-consul.side-nav.user-menu.log-in"}}
data-test-auth-menu-login
{{on "click" (optional this.modal.open)}}
/>
Expand Down Expand Up @@ -137,11 +137,11 @@
"settings"
params=(hash nspace=undefined partition=undefined)
}}
@text="Settings"
@text={{t "components.hashicorp-consul.side-nav.user-menu.settings"}}
@isHrefExternal={{false}}
/>
<dd.Interactive
@text="Log out"
@text={{t "components.hashicorp-consul.side-nav.user-menu.log-out"}}
data-test-auth-menu-logout
{{on "click" (optional authDialog.logout)}}
/>
Expand All @@ -157,7 +157,7 @@
"settings"
params=(hash nspace=undefined partition=undefined)
}}
@text="Settings"
@text={{t "components.hashicorp-consul.side-nav.user-menu.settings"}}
@isHrefExternal={{false}}
/>
</Hds::Dropdown>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

{{#let @list as |SNL|}}
<SNL.BackLink
@text="Back to HCP"
@text={{t "components.hashicorp-consul.side-nav.hcp"}}
@href={{env "CONSUL_HCP_URL"}}
@isHrefExternal={{true}}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,16 @@
(is-href "dc.nspaces" @dc.Name)
as |SNL nspace isManaging|
}}
<SNL.Title class="consul-side-nav__selector-title">Namespace</SNL.Title>
<SNL.Title class="consul-side-nav__selector-title">{{t "components.hashicorp-consul.side-nav.nspaces.title"}}</SNL.Title>
<NavSelector
@list={{@list}}
@items={{sort-by "Name:asc" (reject-by "DeletedAt" @nspaces)}}
@item={{nspace}}
@key="Name"
@icon="folder"
@placeholder="Search namespaces"
@placeholder={{t "components.hashicorp-consul.side-nav.nspaces.placeholder"}}
@footerLink={{href-to "dc.nspaces" @dc.Name}}
@footerLinkText="View all namespaces"
@footerLinkText={{t "components.hashicorp-consul.side-nav.nspaces.footer"}}
data-test-nspace-menu
as |Dropdown item|
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,16 @@
@src={{uri "/*/*/${dc}/partitions" (hash dc=@dc.Name)}}
@onchange={{fn (optional @onchange)}}
/>
<SNL.Title class="consul-side-nav__selector-title">Admin partition</SNL.Title>
<SNL.Title class="consul-side-nav__selector-title">{{t "components.hashicorp-consul.side-nav.partitions.title"}}</SNL.Title>
<NavSelector
@list={{@list}}
@items={{sort-by "Name:asc" (reject-by "DeletedAt" @partitions)}}
@item={{partition}}
@key="Name"
@icon="users"
@placeholder="Search partitions"
@placeholder={{t "components.hashicorp-consul.side-nav.partitions.placeholder"}}
@footerLink={{href-to "dc.partitions" @dc.Name}}
@footerLinkText="View all partitions"
@footerLinkText={{t "components.hashicorp-consul.side-nav.partitions.footer"}}
@disabled={{not canChoose}}
data-test-datacenter-disclosure-menu
as |Dropdown item|
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
}}

{{#let @list as |SNL|}}
<SNL.Title ...attributes>Organization</SNL.Title>
<SNL.Title ...attributes>{{t "components.hashicorp-consul.side-nav.organization.title"}}</SNL.Title>
<SNL.Link
@text="Peers"
@text={{t "components.hashicorp-consul.side-nav.organization.peers"}}
@route="dc.peers"
@models={{array @dc.Name}}
@query={{hash peer=undefined}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@

{{#let @list as |SNL|}}
{{#if (gt @dcs.length 1)}}
<SNL.Title class='consul-side-nav__selector-title'>Datacenter</SNL.Title>
<SNL.Title class='consul-side-nav__selector-title'>{{t "components.hashicorp-consul.side-nav.datacenters.title"}}</SNL.Title>
<NavSelector
@list={{SNL}}
@items={{sort-by 'Primary:desc' 'Local:desc' 'Name:asc' @dcs}}
@item={{@dc}}
@key='Name'
@icon='server-cluster'
@placeholder='Search datacenters'
@description="WAN federated datacenters"
@placeholder={{t "components.hashicorp-consul.side-nav.datacenters.placeholder"}}
@description={{t "components.hashicorp-consul.side-nav.datacenters.description"}}
class='consul-datacenter-selector'
data-test-datacenter-menu
as |Dropdown item|
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@
}}

{{#let @dropdown as |DD|}}
<DD.Interactive @href={{href-to "docs"}} @isHrefExternal={{true}} @text="Eng docs" />
<DD.Interactive @href={{href-to "docs"}} @isHrefExternal={{true}} @text={{t "components.hashicorp-consul.side-nav.support-menu.eng-docs" }} />
{{/let}}
26 changes: 13 additions & 13 deletions ui/packages/consul-ui/app/components/hashicorp-consul/index.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@
<T.Description>
{{#if (eq type 'logout')}}
{{#if (eq status 'success')}}
You are now logged out.
{{t "components.hashicorp-consul.notifications.logged-out"}}
{{else}}
There was an error logging out.
{{t "components.hashicorp-consul.notifications.logged-out-error"}}
{{/if}}
{{else if (eq type 'authorize')}}
{{#if (eq status 'success')}}
You are now logged in.
{{t "components.hashicorp-consul.notifications.logged-in"}}
{{else}}
There was an error, please check your SecretID/Token
{{t "components.hashicorp-consul.notifications.logged-in-error"}}
{{/if}}
{{else}}
{{#if (or (eq type 'use') (eq flash.model 'token'))}}
Expand Down Expand Up @@ -91,17 +91,17 @@
<dd.Interactive
@href={{env 'CONSUL_DOCS_URL'}}
@isHrefExternal={{true}}
@text='Documentation'
@text={{t "components.hashicorp-consul.side-nav.support-menu.docs"}}
/>
<dd.Interactive
@href={{concat (env 'CONSUL_DOCS_LEARN_URL') '/consul'}}
@isHrefExternal={{true}}
@text='Tutorials'
@text={{t "components.hashicorp-consul.side-nav.support-menu.tutorials"}}
/>
<dd.Interactive
@href={{env 'CONSUL_REPO_ISSUES_URL'}}
@isHrefExternal={{true}}
@text='Give feedback'
@text={{t "components.hashicorp-consul.side-nav.support-menu.feedback"}}
/>
</Hds::Dropdown>

Expand Down Expand Up @@ -151,7 +151,7 @@
<Hds::SideNav::List class='hds-side-nav-hide-when-minimized' as |SNL|>
{{#if (can 'access overview')}}
<SNL.Link
@text='Overview'
@text={{t "components.hashicorp-consul.side-nav.overview"}}
@route='dc.show'
@models={{array @dc.Name}}
@query={{hash peer=undefined}}
Expand All @@ -161,7 +161,7 @@
{{/if}}
{{#if (can 'read services')}}
<SNL.Link
@text='Services'
@text={{t "components.hashicorp-consul.side-nav.services"}}
@href={{href-to 'dc.services' @dc.Name params=(hash peer=undefined)}}
@isHrefExternal={{false}}
@isActive={{is-href 'dc.services' @dc.Name}}
Expand All @@ -170,7 +170,7 @@
{{/if}}
{{#if (can 'read nodes')}}
<SNL.Link
@text='Nodes'
@text={{t "components.hashicorp-consul.side-nav.nodes"}}
@href={{href-to 'dc.nodes' @dc.Name params=(hash peer=undefined)}}
@isHrefExternal={{false}}
@isActive={{is-href 'dc.nodes' @dc.Name}}
Expand All @@ -179,7 +179,7 @@
{{/if}}
{{#if (can 'read kv')}}
<SNL.Link
@text='Key/Value'
@text={{t "components.hashicorp-consul.side-nav.kv"}}
@href={{href-to 'dc.kv' @dc.Name params=(hash peer=undefined)}}
@isHrefExternal={{false}}
@isActive={{is-href 'dc.kv' @dc.Name}}
Expand All @@ -188,7 +188,7 @@
{{/if}}
{{#if (can 'read intentions')}}
<SNL.Link
@text='Intentions'
@text={{t "components.hashicorp-consul.side-nav.intentions"}}
@href={{href-to 'dc.intentions' @dc.Name params=(hash peer=undefined)}}
@isHrefExternal={{false}}
@isActive={{is-href 'dc.intentions' @dc.Name}}
Expand Down Expand Up @@ -217,7 +217,7 @@
@size='100'
@color='disabled'
>
Consul v{{env 'CONSUL_VERSION'}}
{{t "components.hashicorp-consul.side-nav.footer" version=(env 'CONSUL_VERSION')}}
</Hds::Text::Display>
{{{concat '<!-- ' (env 'CONSUL_GIT_SHA') '-->'}}}
</footer>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: BUSL-1.1

notifications:
logged-out: You are now logged out.
logged-out-error: There was an error logging out.
logged-in: You are now logged in.
logged-in-error: There was an error, please check your SecretID/Token
side-nav:
support-menu:
eng-docs: Eng docs
docs: Documentation
tutorials: Tutorials
feedback: Give feedback
user-menu:
settings: Settings
log-in: Log in
Log out: Log out
hcp: Back to HCP
datacenters:
title: Datacenter
placeholder: Search datacenters
description: WAN federated datacenters
partitions:
title: Admin partition
placeholder: Search partitions
footer: View all partitions
nspaces:
title: Namespace
placeholder: Search namespaces
footer: View all namespaces
overview: Overview
services: Services
nodes: Nodes
kv: Key/Value
intentions: Intentions
acls:
title: Access Controls
tooltip: ACLs are not currently enabled in this cluster
tokens: Tokens
policies: Policies
roles: Roles
auth-methods: Auth Methods
organization:
title: Organization
peers: Peers
footer: Consul v{version}

0 comments on commit 47f4fd3

Please sign in to comment.