@@ -15,11 +15,15 @@ module.exports = function (context, options) {
1515 * Generates the markdown files for all components in a given version.
1616 * @param {* } version The version, e.g.: v6
1717 * @param {* } npmTag The npm tag, e.g.: 6 or next
18+ * @param {* } lang The language, e.g.: en or ja
1819 * @param {* } isCurrentVersion Whether or not this is the current version of the docs
1920 */
20- const generateMarkdownForVersion = async ( version , npmTag , isCurrentVersion ) => {
21+ const generateMarkdownForVersion = async ( version , npmTag , lang , isCurrentVersion ) => {
2122 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` ) ;
2327 const { components } = await response . json ( ) ;
2428
2529 const names = components . map ( ( component ) => component . tag . slice ( 4 ) ) ;
@@ -47,7 +51,7 @@ module.exports = function (context, options) {
4751 for ( const version of options . versions ) {
4852 const npmTag = version . slice ( 1 ) ;
4953
50- await generateMarkdownForVersion ( version , npmTag , false ) ;
54+ await generateMarkdownForVersion ( version , npmTag , context . i18n . currentLocale , false ) ;
5155 }
5256
5357 let npmTag = 'latest' ;
@@ -57,7 +61,12 @@ module.exports = function (context, options) {
5761 npmTag = currentVersion . path . slice ( 1 ) ;
5862 }
5963 // 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+ ) ;
6170
6271 return data ;
6372 } ,
@@ -83,6 +92,7 @@ module.exports = function (context, options) {
8392
8493 await Promise . all ( promises ) ;
8594 } ,
95+
8696 configureWebpack ( config , isServer , utils ) {
8797 /**
8898 * Adds a custom import alias to the webpack configuration, so that the markdown files
0 commit comments