@@ -15,11 +15,15 @@ module.exports = function (context, options) {
15
15
* Generates the markdown files for all components in a given version.
16
16
* @param {* } version The version, e.g.: v6
17
17
* @param {* } npmTag The npm tag, e.g.: 6 or next
18
+ * @param {* } lang The language, e.g.: en or ja
18
19
* @param {* } isCurrentVersion Whether or not this is the current version of the docs
19
20
*/
20
- const generateMarkdownForVersion = async ( version , npmTag , isCurrentVersion ) => {
21
+ const generateMarkdownForVersion = async ( version , npmTag , lang , isCurrentVersion ) => {
21
22
let COMPONENT_LINK_REGEXP ;
22
- const response = await fetch ( `https://unpkg.com/@ionic/docs@${ npmTag } /core.json` ) ;
23
+ const response =
24
+ isCurrentVersion && lang === 'ja'
25
+ ? await fetch ( `https://raw.githubusercontent.com/ionic-jp/ionic-docs/main/scripts/data/translated-api.json` )
26
+ : await fetch ( `https://unpkg.com/@ionic/docs@${ npmTag } /core.json` ) ;
23
27
const { components } = await response . json ( ) ;
24
28
25
29
const names = components . map ( ( component ) => component . tag . slice ( 4 ) ) ;
@@ -47,7 +51,7 @@ module.exports = function (context, options) {
47
51
for ( const version of options . versions ) {
48
52
const npmTag = version . slice ( 1 ) ;
49
53
50
- await generateMarkdownForVersion ( version , npmTag , false ) ;
54
+ await generateMarkdownForVersion ( version , npmTag , context . i18n . currentLocale , false ) ;
51
55
}
52
56
53
57
let npmTag = 'latest' ;
@@ -57,7 +61,12 @@ module.exports = function (context, options) {
57
61
npmTag = currentVersion . path . slice ( 1 ) ;
58
62
}
59
63
// Latest version
60
- await generateMarkdownForVersion ( currentVersion . path || currentVersion . label , npmTag , true ) ;
64
+ await generateMarkdownForVersion (
65
+ currentVersion . path || currentVersion . label ,
66
+ npmTag ,
67
+ context . i18n . currentLocale ,
68
+ true
69
+ ) ;
61
70
62
71
return data ;
63
72
} ,
@@ -83,6 +92,7 @@ module.exports = function (context, options) {
83
92
84
93
await Promise . all ( promises ) ;
85
94
} ,
95
+
86
96
configureWebpack ( config , isServer , utils ) {
87
97
/**
88
98
* Adds a custom import alias to the webpack configuration, so that the markdown files
0 commit comments