Skip to content

Commit 2f02da1

Browse files
committed
config: automatic translation key migration (apache#370)
The new convention used: - All lower keys - Most keys start with `label.` prefix - All spaces and underscores replaced with `.` Quick ugly hack and similar for config `title`: > IFS=$'\n' > git grep -l "\$t('" | grep -v -e "\$t('label\." -e "\$t('message" -e "\$t('error" > ftr > for f in $(cat ftr); do echo $f; for w in $(grep -Po '\$t\(\K[^)]*' $f | grep "^'" | grep -v -e ^\'message -e ^\'error -e ^\'label); do echo WORD IS $w; nw=$(echo $w | sed "s/$w/'label\.\L&/g" | sed "s/label\.'/label\./g" | sed "s/ /\./g" | sed "s/_/\./g"); echo $w = $nw; sed -i "s/\$t($w/\$t($nw/g" $f; done; done Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
1 parent a04c8db commit 2f02da1

121 files changed

Lines changed: 1260 additions & 1254 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

ui/src/components/header/ProjectMenu.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929

3030
<a-tooltip placement="bottom" slot="suffixIcon">
3131
<template slot="title">
32-
<span>{{ $t('projects') }}</span>
32+
<span>{{ $t('label.projects') }}</span>
3333
</template>
3434
<a-icon style="font-size: 20px; color: #999; margin-top: -5px" type="project" />
3535
</a-tooltip>

ui/src/components/view/DedicateData.vue

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,15 @@
1919
<a-list-item v-if="dedicatedDomainId">
2020
<div>
2121
<div style="margin-bottom: 10px;">
22-
<strong>{{ $t('dedicated') }}</strong>
22+
<strong>{{ $t('label.dedicated') }}</strong>
2323
<div>Yes</div>
2424
</div>
2525
<p>
26-
<strong>{{ $t('domainid') }}</strong><br/>
26+
<strong>{{ $t('label.domainid') }}</strong><br/>
2727
<router-link :to="{ path: '/domain/' + dedicatedDomainId }">{{ dedicatedDomainId }}</router-link>
2828
</p>
2929
<p v-if="dedicatedAccountId">
30-
<strong>{{ $t('account') }}</strong><br/>
30+
<strong>{{ $t('label.account') }}</strong><br/>
3131
<router-link :to="{ path: '/account/' + dedicatedAccountId }">{{ dedicatedAccountId }}</router-link>
3232
</p>
3333
<a-button style="margin-top: 10px; margin-bottom: 10px;" type="danger" @click="handleRelease">
@@ -37,7 +37,7 @@
3737
</a-list-item>
3838
<a-list-item v-else>
3939
<div>
40-
<strong>{{ $t('dedicated') }}</strong>
40+
<strong>{{ $t('label.dedicated') }}</strong>
4141
<div>No</div>
4242
<a-button type="primary" style="margin-top: 10px; margin-bottom: 10px;" @click="modalActive = true">
4343
{{ dedicatedButtonLabel }}

ui/src/components/view/DedicateDomain.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919
<div class="form">
2020
<div class="form__item" :class="{'error': domainError}">
2121
<a-spin :spinning="domainsLoading">
22-
<p class="form__label">{{ $t('domain') }}<span class="required">*</span></p>
23-
<p class="required required-label">{{ $t('required') }}</p>
22+
<p class="form__label">{{ $t('label.domain') }}<span class="required">*</span></p>
23+
<p class="required required-label">{{ $t('label.required') }}</p>
2424
<a-select style="width: 100%" @change="handleChangeDomain" v-model="domainId">
2525
<a-select-option v-for="(domain, index) in domainsList" :value="domain.id" :key="index">
2626
{{ domain.name }}

ui/src/components/view/DetailsTab.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
:dataSource="$route.meta.details">
2222
<a-list-item slot="renderItem" slot-scope="item" v-if="item in resource">
2323
<div>
24-
<strong>{{ item === 'service' ? $t('supportedservices') : $t(item) }}</strong>
24+
<strong>{{ item === 'service' ? $t('label.supportedservices') : $t('label.' + item) }}</strong>
2525
<br/>
2626
<div v-if="Array.isArray(resource[item]) && item === 'service'">
2727
<div v-for="(service, idx) in resource[item]" :key="idx">

ui/src/components/view/InfoCard.vue

Lines changed: 53 additions & 53 deletions
Large diffs are not rendered by default.

ui/src/components/view/ResourceLimitTab.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
v-if="!($route.meta.name === 'domain' && resource.level === 0)"
4141
:loading="formLoading"
4242
type="primary"
43-
@click="handleSubmit">{{ $t('submit') }}</a-button>
43+
@click="handleSubmit">{{ $t('label.submit') }}</a-button>
4444
</div>
4545
</a-form>
4646
</a-spin>

ui/src/components/view/ResourceView.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
@change="onTabChange" >
4242
<a-tab-pane
4343
v-for="tab in tabs"
44-
:tab="$t(tab.name)"
44+
:tab="$t('label.' + tab.name)"
4545
:key="tab.name"
4646
v-if="showHideTab(tab)">
4747
<component :is="tab.component" :resource="resource" :loading="loading" :tab="activeTab" />

ui/src/components/view/TreeView.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
@change="onTabChange" >
6060
<a-tab-pane
6161
v-for="tab in tabs"
62-
:tab="$t(tab.name)"
62+
:tab="$t('label.' + tab.name)"
6363
:key="tab.name"
6464
v-if="checkShowTabDetail(tab)">
6565
<component

ui/src/components/view/VmwareData.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,15 @@
1919
<a-list-item v-if="vmwaredc">
2020
<div>
2121
<div style="margin-bottom: 10px;">
22-
<div><strong>{{ $t('vmwaredcName') }}</strong></div>
22+
<div><strong>{{ $t('label.vmwaredcname') }}</strong></div>
2323
<div>{{ vmwaredc.name }}</div>
2424
</div>
2525
<div style="margin-bottom: 10px;">
26-
<div><strong>{{ $t('vmwaredcVcenter') }}</strong></div>
26+
<div><strong>{{ $t('label.vmwaredcvcenter') }}</strong></div>
2727
<div>{{ vmwaredc.vcenter }}</div>
2828
</div>
2929
<div style="margin-bottom: 10px;">
30-
<div><strong>{{ $t('vmwaredcId') }}</strong></div>
30+
<div><strong>{{ $t('label.vmwaredcid') }}</strong></div>
3131
<div>{{ vmwaredc.id }}</div>
3232
</div>
3333
</div>

ui/src/config/section/account.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,14 @@
1717

1818
export default {
1919
name: 'account',
20-
title: 'Accounts',
20+
title: 'label.accounts',
2121
icon: 'team',
2222
permission: ['listAccounts'],
2323
columns: ['name', 'state', 'rolename', 'roletype', 'domain'],
2424
details: ['name', 'id', 'rolename', 'roletype', 'domain', 'networkdomain', 'iptotal', 'vmtotal', 'volumetotal', 'receivedbytes', 'sentbytes', 'vmlimit', 'iplimit', 'volumelimit', 'snapshotlimit', 'templatelimit', 'vpclimit', 'cpulimit', 'memorylimit', 'networklimit', 'primarystoragelimit', 'secondarystoragelimit'],
2525
related: [{
2626
name: 'accountuser',
27-
title: 'Users',
27+
title: 'label.users',
2828
param: 'account'
2929
}],
3030
tabs: [
@@ -42,7 +42,7 @@ export default {
4242
component: () => import('@/components/view/ResourceLimitTab.vue')
4343
},
4444
{
45-
name: 'Settings',
45+
name: 'settings',
4646
component: () => import('@/components/view/SettingsTab.vue'),
4747
show: (record, route, user) => { return ['Admin'].includes(user.roletype) }
4848
}

0 commit comments

Comments
 (0)