Skip to content

Commit bd1c194

Browse files
committed
[rdar://102139999] feat: add hardcoded strings
1 parent 99dd170 commit bd1c194

File tree

154 files changed

+1165
-453
lines changed

Some content is hidden

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

154 files changed

+1165
-453
lines changed

app/main.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,19 @@
1010

1111
import '../webpack-asset-path';
1212
import Vue from 'vue';
13+
import VueI18n from 'vue-i18n';
1314
import Router from 'vue-router';
1415
import App from '@/App.vue';
1516
import SwiftDocCRenderPlugin from '@/setup-utils/SwiftDocCRenderPlugin';
1617
import SwiftDocCRenderRouter from '@/setup-utils/SwiftDocCRenderRouter';
18+
import SwiftDocCRenderi18n from '@/setup-utils/SwiftDocCRenderi18n';
1719

1820
Vue.use(SwiftDocCRenderPlugin);
1921
Vue.use(Router);
22+
Vue.use(VueI18n);
2023

2124
new Vue({
2225
router: SwiftDocCRenderRouter(),
2326
render: h => h(App),
27+
i18n: SwiftDocCRenderi18n(),
2428
}).$mount('#app');

bin/check-source

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ here="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
1818

1919
function replace_acceptable_years() {
2020
# this needs to replace all acceptable forms with 'YEARS'
21-
sed -e 's/20[12][78901]-20[12][89012]/YEARS/' -e 's/20[12][89012]/YEARS/'
21+
sed -e 's/20[12][78901]-20[123][890123]/YEARS/' -e 's/20[12][890123]/YEARS/'
2222
}
2323

2424
printf "=> Checking license headers… "

jest.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,5 @@ module.exports = {
1616
'^theme/(.*)$': '<rootDir>/src/$1',
1717
},
1818
testEnvironment: 'jest-environment-jsdom',
19+
setupFiles: ['./tests/unit/config.js'],
1920
};

package-lock.json

Lines changed: 45 additions & 69 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
"highlight.js": "^11.3.1",
2727
"intersection-observer": "0.12.0",
2828
"portal-vue": "2.1.7",
29+
"vue-i18n": "^8.28.2",
2930
"vue-virtual-scroller": "^1.0.10",
3031
"webpack-theme-resolver-plugin": "3.0.0"
3132
},

src/App.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
:class="{ fromkeyboard: fromKeyboard, hascustomheader: hasCustomHeader }"
1515
>
1616
<div :id="AppTopID" />
17-
<a href="#main" id="skip-nav">Skip Navigation</a>
17+
<a href="#main" id="skip-nav">{{ $t('accessibility.skip-navigation') }}</a>
1818
<InitialLoadingPlaceholder />
1919
<slot name="header" :isTargetIDE="isTargetIDE">
2020
<!-- Render the custom header by default, if there is no content in the `header` slot -->
@@ -75,7 +75,7 @@ export default {
7575
// preference to determine if "Light" or "Dark" colors should be used.
7676
// Otherwise, if "Light" or "Dark" has been explicitly chosen, that choice
7777
// should be used directly.
78-
objectToCustomProperties(themeSettings.theme, (preferredColorScheme === ColorScheme.auto.value
78+
objectToCustomProperties(themeSettings.theme, (preferredColorScheme === ColorScheme.auto
7979
? currentColorScheme
8080
: preferredColorScheme
8181
))
@@ -170,7 +170,7 @@ export default {
170170
},
171171
onColorSchemePreferenceChange({ matches }) {
172172
const scheme = matches ? ColorScheme.dark : ColorScheme.light;
173-
AppStore.setSystemColorScheme(scheme.value);
173+
AppStore.setSystemColorScheme(scheme);
174174
},
175175
attachStylesToRoot(CSSCustomProperties) {
176176
const root = document.body;

src/components/Badge.vue

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

1111
<template>
1212
<span class="badge" :class="{ [`badge-${variant}`]: variant }" role="presentation">
13-
<slot>{{ text }}</slot>
13+
<slot>{{ $t(text) }}</slot>
1414
</span>
1515
</template>
1616

1717
<script>
1818
const VARIANT_TEXT = {
19-
beta: 'Beta',
20-
deprecated: 'Deprecated',
19+
beta: 'kind.beta',
20+
deprecated: 'change-type.deprecated',
2121
};
2222
2323
export default {

src/components/ColorSchemeToggle.vue

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,21 +10,21 @@
1010

1111
<template>
1212
<div
13-
aria-label="Select a color scheme preference"
13+
:aria-label="$t('color-scheme.select')"
1414
class="color-scheme-toggle"
1515
role="radiogroup"
1616
>
1717
<label
1818
v-for="option in options"
19-
:key="option.value"
19+
:key="option"
2020
>
2121
<input
2222
type="radio"
2323
@input="setPreferredColorScheme"
24-
:checked="option.value == preferredColorScheme"
25-
:value="option.value"
24+
:checked="option == preferredColorScheme"
25+
:value="option"
2626
/>
27-
<div class="text">{{option.label}}</div>
27+
<div class="text">{{ $t(`color-scheme.${option}`) }}</div>
2828
</label>
2929
</div>
3030
</template>

src/components/ContentNode/Aside.vue

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
<template>
1212
<aside :class="kind" :aria-label="kind">
13-
<p class="label">{{ label }}</p>
13+
<p class="label">{{ $t(label) }}</p>
1414
<slot />
1515
</aside>
1616
</template>
@@ -40,12 +40,12 @@ export default {
4040
},
4141
computed: {
4242
label: ({ kind, name }) => name || ({
43-
[Kind.deprecated]: 'Deprecated',
44-
[Kind.experiment]: 'Experiment',
45-
[Kind.important]: 'Important',
46-
[Kind.note]: 'Note',
47-
[Kind.tip]: 'Tip',
48-
[Kind.warning]: 'Warning',
43+
[Kind.deprecated]: 'change-type.deprecated',
44+
[Kind.experiment]: 'kind.experiment',
45+
[Kind.important]: 'kind.important',
46+
[Kind.note]: 'kind.note',
47+
[Kind.tip]: 'kind.tip',
48+
[Kind.warning]: 'kind.warning',
4949
}[kind]),
5050
},
5151
};

src/components/ContentNode/EndpointExample.vue

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
<Column class="example-code">
1414
<slot />
1515
<Tabnav v-model="currentTab">
16-
<TabnavItem :value="Tab.request">{{ Tab.request }}</TabnavItem>
17-
<TabnavItem :value="Tab.response">{{ Tab.response }}</TabnavItem>
16+
<TabnavItem :value="Tab.request">{{ $t('tab.request') }}</TabnavItem>
17+
<TabnavItem :value="Tab.response">{{ $t('tab.response') }}</TabnavItem>
1818
</Tabnav>
1919
<div class="output">
2020
<div v-if="isCurrent(Tab.request)" class="code">
@@ -35,11 +35,11 @@
3535
<div class="controls" v-if="isCollapsible">
3636
<a v-if="isCollapsed" href="#" class="toggle" @click.prevent="showMore">
3737
<InlinePlusCircleSolidIcon class="control-icon icon-inline" />
38-
More
38+
{{ $t('more') }}
3939
</a>
4040
<a v-else href="#" class="toggle" @click.prevent="showLess">
4141
<InlineMinusCircleSolidIcon class="control-icon icon-inline" />
42-
Less
42+
{{ $t('less') }}
4343
</a>
4444
</div>
4545
</Column>

0 commit comments

Comments
 (0)