@@ -15,11 +15,14 @@ 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 = isCurrentVersion && lang === 'ja'
24
+ ? await fetch ( `https://raw.githubusercontent.com/ionic-jp/ionic-docs/main/scripts/data/translated-api.json` )
25
+ : await fetch ( `https://unpkg.com/@ionic/docs@${ npmTag } /core.json` ) ;
23
26
const { components } = await response . json ( ) ;
24
27
25
28
const names = components . map ( ( component ) => component . tag . slice ( 4 ) ) ;
@@ -47,7 +50,7 @@ module.exports = function (context, options) {
47
50
for ( const version of options . versions ) {
48
51
const npmTag = version . slice ( 1 ) ;
49
52
50
- await generateMarkdownForVersion ( version , npmTag , false ) ;
53
+ await generateMarkdownForVersion ( version , npmTag , context . i18n . currentLocale , false ) ;
51
54
}
52
55
53
56
let npmTag = 'latest' ;
@@ -57,7 +60,7 @@ module.exports = function (context, options) {
57
60
npmTag = currentVersion . path . slice ( 1 ) ;
58
61
}
59
62
// Latest version
60
- await generateMarkdownForVersion ( currentVersion . path || currentVersion . label , npmTag , true ) ;
63
+ await generateMarkdownForVersion ( currentVersion . path || currentVersion . label , npmTag , context . i18n . currentLocale , true ) ;
61
64
62
65
return data ;
63
66
} ,
@@ -83,6 +86,7 @@ module.exports = function (context, options) {
83
86
84
87
await Promise . all ( promises ) ;
85
88
} ,
89
+
86
90
configureWebpack ( config , isServer , utils ) {
87
91
/**
88
92
* Adds a custom import alias to the webpack configuration, so that the markdown files
0 commit comments