Skip to content

Commit 7f11ed9

Browse files
authored
Add i18n string from TopicsLinkCardGridItem (#621)
* [rdar://108050564] Topic Links Card strings
1 parent 5c27df2 commit 7f11ed9

File tree

3 files changed

+17
-9
lines changed

3 files changed

+17
-9
lines changed

src/components/DocumentationTopic/TopicsLinkCardGridItem.vue

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
:title="item.title"
1717
floating-style
1818
:size="cardSize"
19-
:link-text="linkText"
19+
:link-text="compact ? '' : $t(linkText)"
2020
>
2121
<template v-if="!imageReferences.card" #cover="{ classes }">
2222
<div :class="classes" class="reference-card-grid-item__image">
@@ -39,11 +39,11 @@ import CardSize from 'docc-render/constants/CardSize';
3939
import referencesProvider from 'docc-render/mixins/referencesProvider';
4040
4141
export const ROLE_LINK_TEXT = {
42-
[TopicRole.article]: 'Read article',
43-
[TopicRole.overview]: 'Start tutorial',
44-
[TopicRole.collection]: 'View API collection',
45-
[TopicRole.symbol]: 'View symbol',
46-
[TopicRole.sampleCode]: 'View sample code',
42+
[TopicRole.article]: 'documentation.card.read-article',
43+
[TopicRole.overview]: 'documentation.card.start-tutorial',
44+
[TopicRole.collection]: 'documentation.card.view-api',
45+
[TopicRole.symbol]: 'documentation.card.view-symbol',
46+
[TopicRole.sampleCode]: 'documentation.card.view-sample-code',
4747
};
4848
4949
export default {
@@ -70,7 +70,7 @@ export default {
7070
all[current.type] = current.identifier;
7171
return all;
7272
}, { icon: null, card: null }),
73-
linkText: ({ compact, item }) => (compact ? '' : (ROLE_LINK_TEXT[item.role] || 'Learn more')),
73+
linkText: ({ item }) => (ROLE_LINK_TEXT[item.role] || 'documentation.card.learn-more'),
7474
cardSize: ({ compact }) => (compact ? undefined : CardSize.large),
7575
},
7676
};

src/lang/locales/en-US.json

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,15 @@
5656
"open-menu": "Open Menu",
5757
"close-menu": "Close Menu"
5858
},
59-
"current-page": "Current page is {title}"
59+
"current-page": "Current page is {title}",
60+
"card": {
61+
"learn-more": "Learn More",
62+
"read-article": "Read article",
63+
"start-tutorial": "Start tutorial",
64+
"view-api": "View API collection",
65+
"view-symbol": "View symbol",
66+
"view-sample-code": "View sample code"
67+
}
6068
},
6169
"aside-kind": {
6270
"beta": "Beta",

tests/unit/components/DocumentationTopic/TopicsLinkCardGridItem.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,6 @@ describe('TopicsLinkCardGridItem', () => {
169169
expect(card.props('linkText')).toBe(ROLE_LINK_TEXT[TopicRole.sampleCode]);
170170
// other
171171
wrapper.setProps({ item: { ...defaultProps.item, role: TopicRole.link } });
172-
expect(card.props('linkText')).toBe('Learn more');
172+
expect(card.props('linkText')).toBe('documentation.card.learn-more');
173173
});
174174
});

0 commit comments

Comments
 (0)