Skip to content

Commit ac6eec4

Browse files
committed
Merge branch 'main' into translation/jp-20251122
# Conflicts: # static/code/stackblitz/v7/react/package-lock.json # static/code/stackblitz/v7/vue/package-lock.json # static/code/stackblitz/v8/react/package-lock.json # static/code/stackblitz/v8/vue/package-lock.json
2 parents a13f359 + 88cbac2 commit ac6eec4

File tree

7 files changed

+98
-80
lines changed

7 files changed

+98
-80
lines changed

package-lock.json

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

plugins/docusaurus-plugin-ionic-component-api/index.js

Lines changed: 16 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -15,28 +15,17 @@ 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 components = await (async () => {
23-
if (isCurrentVersion) {
24-
const { components } = require(process.cwd() + `/scripts/data/translated-api.json`);
25-
return components;
26-
} else {
27-
const response = isCurrentVersion
28-
? await fetch(
29-
`https://raw.githubusercontent.com/ionic-jp/ionic-docs/main/scripts/data/translated-api.json`
30-
)
31-
: await fetch(`https://unpkg.com/@ionic/docs@${npmTag}/core.json`);
32-
const { components } = await response.json();
33-
return components;
34-
}
35-
})();
36-
// const response = isCurrentVersion
37-
// ? await fetch(`https://raw.githubusercontent.com/ionic-jp/ionic-docs/main/scripts/data/translated-api.json`)
38-
// : await fetch(`https://unpkg.com/@ionic/docs@${npmTag}/core.json`);
39-
// const { components } = await response.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`);
27+
const { components } = await response.json();
28+
4029
const names = components.map((component) => component.tag.slice(4));
4130
// matches all relative markdown links to a component, e.g. (../button)
4231
COMPONENT_LINK_REGEXP = new RegExp(`\\(../(${names.join('|')})/?(#[^)]+)?\\)`, 'g');
@@ -61,7 +50,7 @@ module.exports = function (context, options) {
6150
for (const version of options.versions) {
6251
const npmTag = version.slice(1);
6352

64-
await generateMarkdownForVersion(version, npmTag, false);
53+
await generateMarkdownForVersion(version, npmTag, context.i18n.currentLocale, false);
6554
}
6655

6756
let npmTag = 'latest';
@@ -71,7 +60,12 @@ module.exports = function (context, options) {
7160
npmTag = currentVersion.path.slice(1);
7261
}
7362
// Latest version
74-
await generateMarkdownForVersion(currentVersion.path || currentVersion.label, npmTag, true);
63+
await generateMarkdownForVersion(
64+
currentVersion.path || currentVersion.label,
65+
npmTag,
66+
context.i18n.currentLocale,
67+
true
68+
);
7569

7670
return data;
7771
},
@@ -97,6 +91,7 @@ module.exports = function (context, options) {
9791

9892
await Promise.all(promises);
9993
},
94+
10095
configureWebpack(config, isServer, utils) {
10196
/**
10297
* Adds a custom import alias to the webpack configuration, so that the markdown files
File renamed without changes.

scripts/i18n.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ set -o nounset
55
mkdir -p i18n/ja/docusaurus-plugin-content-docs/current/
66
curl -fsSL https://github.com/ionic-team/ionic-docs/archive/refs/heads/translation/jp.tar.gz |
77
tar -zxf - -C i18n/ja/docusaurus-plugin-content-docs/current/ --strip-components 2 ionic-docs-translation-jp/docs
8-
node scripts/api-ja.mjs
8+
# node scripts/api-ja.mjs

0 commit comments

Comments
 (0)