@nuxtjp/localized-site 0.0.0-stage → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (69) hide show
  1. package/LICENSE +202 -0
  2. package/LICENSE-ASSETS +35 -0
  3. package/LICENSE-PREVIOUS +21 -0
  4. package/NOTICE +4 -0
  5. package/README.ja.md +66 -0
  6. package/README.md +65 -2
  7. package/bin/nuxtjp-localized-site.mjs +7 -0
  8. package/dist/module.d.mts +62 -0
  9. package/dist/module.json +12 -0
  10. package/dist/module.mjs +74 -0
  11. package/dist/runtime/app/assets/localized-site.css +1 -0
  12. package/dist/runtime/app/components/LocalizedDocument.d.vue.ts +7 -0
  13. package/dist/runtime/app/components/LocalizedDocument.vue +23 -0
  14. package/dist/runtime/app/components/LocalizedDocument.vue.d.ts +7 -0
  15. package/dist/runtime/app/components/LocalizedLanding.d.vue.ts +3 -0
  16. package/dist/runtime/app/components/LocalizedLanding.vue +25 -0
  17. package/dist/runtime/app/components/LocalizedLanding.vue.d.ts +3 -0
  18. package/dist/runtime/app/components/LocalizedLanguageSwitcher.d.vue.ts +3 -0
  19. package/dist/runtime/app/components/LocalizedLanguageSwitcher.vue +21 -0
  20. package/dist/runtime/app/components/LocalizedLanguageSwitcher.vue.d.ts +3 -0
  21. package/dist/runtime/app/components/PublicMaintenanceNotice.d.vue.ts +3 -0
  22. package/dist/runtime/app/components/PublicMaintenanceNotice.vue +29 -0
  23. package/dist/runtime/app/components/PublicMaintenanceNotice.vue.d.ts +3 -0
  24. package/dist/runtime/app/composables/useLocalizedMessages.d.ts +10 -0
  25. package/dist/runtime/app/composables/useLocalizedMessages.js +14 -0
  26. package/dist/runtime/app/composables/useLocalizedSite.d.ts +9 -0
  27. package/dist/runtime/app/composables/useLocalizedSite.js +25 -0
  28. package/dist/runtime/app/layouts/localized-site.d.vue.ts +13 -0
  29. package/dist/runtime/app/layouts/localized-site.vue +37 -0
  30. package/dist/runtime/app/layouts/localized-site.vue.d.ts +13 -0
  31. package/dist/runtime/app/pages/LocalizedContentPage.d.vue.ts +3 -0
  32. package/dist/runtime/app/pages/LocalizedContentPage.vue +13 -0
  33. package/dist/runtime/app/pages/LocalizedContentPage.vue.d.ts +3 -0
  34. package/dist/runtime/app/plugins/localized-head.d.ts +2 -0
  35. package/dist/runtime/app/plugins/localized-head.js +7 -0
  36. package/dist/runtime/core/index.d.ts +8 -0
  37. package/dist/runtime/core/index.js +14 -0
  38. package/dist/runtime/core/maintenance.d.ts +25 -0
  39. package/dist/runtime/core/maintenance.js +51 -0
  40. package/dist/runtime/core/messages.d.ts +13 -0
  41. package/dist/runtime/core/messages.js +11 -0
  42. package/dist/runtime/core/path.d.ts +6 -0
  43. package/dist/runtime/core/path.js +43 -0
  44. package/dist/runtime/core/seo.d.ts +20 -0
  45. package/dist/runtime/core/seo.js +52 -0
  46. package/dist/runtime/shared/nuxt-imports.d.ts +18 -0
  47. package/dist/types.d.mts +3 -0
  48. package/examples/content/site.config.json +90 -0
  49. package/package.json +75 -3
  50. package/schemas/localized-site-v1.schema.json +139 -0
  51. package/schemas/public-maintenance-state-v1.schema.json +50 -0
  52. package/validator/content/cli.d.ts +5 -0
  53. package/validator/content/cli.js +31 -0
  54. package/validator/content/errors.d.ts +4 -0
  55. package/validator/content/errors.js +8 -0
  56. package/validator/content/index.d.ts +4 -0
  57. package/validator/content/index.js +3 -0
  58. package/validator/content/load.d.ts +2 -0
  59. package/validator/content/load.js +25 -0
  60. package/validator/content/validation/completeness.d.ts +2 -0
  61. package/validator/content/validation/completeness.js +21 -0
  62. package/validator/content/validation/locale-content.d.ts +2 -0
  63. package/validator/content/validation/locale-content.js +86 -0
  64. package/validator/content/validation/primitives.d.ts +9 -0
  65. package/validator/content/validation/primitives.js +48 -0
  66. package/validator/content/validation/site-config.d.ts +3 -0
  67. package/validator/content/validation/site-config.js +88 -0
  68. package/validator/contracts/types.d.ts +53 -0
  69. package/validator/contracts/types.js +3 -0
package/LICENSE ADDED
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
package/LICENSE-ASSETS ADDED
@@ -0,0 +1,35 @@
1
+ # 株式会社HAT ブランド・コンテンツ利用条件 1.0
2
+ 許諾者:株式会社HAT(権利を保有する部分のみ)
3
+
4
+ ## 許諾
5
+ 公開された文章・画像・ロゴ等は通常の閲覧を認めます。素材の転載・改変・再配布、広告・商品への利用、商標使用、HATによる承認を示唆する利用には、個別の書面による許可が必要です。引用その他法令上認められる行為を制限しません。
6
+ 顧客提供素材・第三者素材はそれぞれの権利者による条件に従い、本条件では許諾しません。公開されていても、肖像・プライバシーその他の権利が別に存在し得ます。汎用サイトコードには別途ソフトウェアライセンスを適用してください。
7
+
8
+ ## 共通条件
9
+ 適用対象は株式会社HATが権利を保有し、または許諾権限を持つ部分に限ります。第三者コード・素材はその個別条件に従います。商標、ロゴ、顧客素材、個人情報、認証情報、登録データの利用権は本条件から付与されません。
10
+ 公開・非公開は別途指定されます。Public指定であっても、以下に明示した範囲を超える許諾はありません。GitHub等の公開ホスティングサービス上の閲覧・forkその他利用規約上必要な権利を妨げません。
11
+ 本条件はOSSライセンスではありません。適用する版と対象を配布物に明示し、過去に付与したOSS許諾や第三者の権利を遡及的に取り消すものではありません。
12
+ 強行法規に反しない範囲で、個別契約に保証を定めない限り現状有姿で提供します。故意・重過失その他法令上免責できない責任を除き、保証・責任範囲は個別契約で定めます。準拠法は日本法とし、裁判管轄は個別契約で指定します。
13
+ 本書は2026-10-01作成の正本です。各リポジトリへの適用を明示するまで利用許諾の開始を意味しません。適用時に契約条件と権利帰属を確認してください。
14
+
15
+ ## 言語
16
+ 日本語と英語は同じ条件を記述します。解釈に相違がある場合、適用法令で認められる範囲で日本語を優先します。
17
+
18
+ ---
19
+
20
+ # HAT Brand and Content Terms 1.0
21
+ Licensor: HAT Inc. (only for portions it owns)
22
+
23
+ ## Permissions
24
+ Ordinary viewing of published text, images, logos, and other materials is permitted. Reproduction, modification, redistribution, advertising or product use, trademark use, and uses suggesting HAT Inc. endorsement require separate written permission. These terms do not restrict quotation or other acts permitted by law.
25
+ Customer-supplied and third-party materials remain subject to their respective rights holders' terms and are not licensed here. Publication does not eliminate separate likeness, privacy, or other rights. Generic website code must be covered by a separate software license.
26
+
27
+ ## Common terms
28
+ These terms apply only to portions owned by HAT Inc. or for which HAT Inc. has licensing authority. Third-party code and materials remain subject to their respective terms. These terms grant no rights to trademarks, logos, customer materials, personal information, credentials, or registration data.
29
+ Public or private visibility is specified separately. Public visibility does not grant permissions beyond those expressly stated. These terms do not restrict viewing, forking, or other rights required by the terms of a public hosting service such as GitHub.
30
+ These terms are not an open-source license. Distributions must identify the applicable version and covered materials. These terms do not retroactively revoke previously granted open-source permissions or third-party rights.
31
+ To the extent permitted by mandatory law, the materials are provided as is unless an individual agreement provides warranties. Warranty and liability provisions are specified in the individual agreement, excluding intentional misconduct, gross negligence, and other liabilities that cannot legally be excluded. Japanese law governs; jurisdiction is specified in the individual agreement.
32
+ This is the canonical text established on 2026-10-01. It does not commence a license grant until its application to the relevant repository or materials is expressly identified. Contract terms and ownership must be verified when applying it.
33
+
34
+ ## Language
35
+ The Japanese and English texts describe the same terms. If their interpretations differ, the Japanese text prevails to the extent permitted by applicable law.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 NuxtJP contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/NOTICE ADDED
@@ -0,0 +1,4 @@
1
+
2
+ nuxt-localized-site
3
+ Copyright 2026 HAT Inc.
4
+ See LICENSE for the selected terms. Prior grants and third-party licenses retain their respective terms.
package/README.ja.md ADDED
@@ -0,0 +1,66 @@
1
+ # @nuxtjp/localized-site
2
+
3
+ [English](README.md)
4
+
5
+ 日本語・英語の紹介サイトを、1つの検証済み設定から構成します。`/`、`/docs`、`/docs/getting-started`、`/docs/security`と各英語ページを生成し、言語切替とSEOを適用します。
6
+
7
+ ## 導入と設定
8
+
9
+ `0.1.0`はnpmで公開済みです。Node.js 22.19以降または24.11以降、Nuxt 4.5.1以降の4系、Vue `^3.5.40`を使用してください。
10
+
11
+ ```sh
12
+ pnpm add --save-exact @nuxtjp/localized-site@0.1.0 nuxt@4.5.1 vue@3.5.43
13
+ ```
14
+
15
+ ```ts
16
+ export default defineNuxtConfig({
17
+ modules: [['@nuxtjp/localized-site', { contentRoot: '.' }]]
18
+ })
19
+ ```
20
+
21
+ `contentRoot`を明示します。[汎用設定サンプル](examples/content/site.config.json)を、そのディレクトリに`site.config.json`として置き、サイト固有の内容に置き換えてください。
22
+ `siteId`、`serviceId`、`origin`、`audienceScope`、完全なja/enコンテンツ、ちょうど3つのfeatures、導入・セキュリティ文書、privacy/contact説明、`externalActions: false`が必須です。
23
+
24
+ ```sh
25
+ pnpm exec nuxtjp-localized-site validate --content-root .
26
+ pnpm exec nuxt build
27
+ ```
28
+
29
+ ## 動作と制約
30
+
31
+ privacy/contactは説明文として表示し、未設定のリンクや操作を生成しません。
32
+ メンテナンス表示は、ブラウザから同一originの`/maintenance.json`を読みます。取得・形式・期限の検証に失敗した場合は表示せず、サイト本文と言語切替は利用できます。
33
+ 配布物だけを試す場合は、registry版の代わりに承認された正確なTGZを導入してください。この手順はサイトの公開やregistry設定を行いません。
34
+
35
+ ## 型付きメッセージ
36
+
37
+ ```ts
38
+ const messages = defineLocalizedMessages({
39
+ ja: { save: '保存', cancel: 'キャンセル' },
40
+ en: { save: 'Save', cancel: 'Cancel' }
41
+ })
42
+ const { t } = useLocalizedMessages(messages)
43
+ t('save')
44
+ ```
45
+
46
+ 英語のキーは日本語と一致させます。空のメッセージは`fallbackLocale`、次に`defaultLocale`へfallbackします。
47
+
48
+ ## 開発
49
+
50
+ ```sh
51
+ pnpm install --frozen-lockfile
52
+ pnpm test
53
+ pnpm typecheck
54
+ pnpm build
55
+ pnpm validate:example
56
+ pnpm pack
57
+ ```
58
+
59
+ `prepack`はテスト、型検査、build、サンプル検証を実行します。リリース前に、実際のarchiveを別hostで確認してください。
60
+
61
+ ## 文書とライセンス
62
+
63
+ [使い方](https://github.com/nuxtjp/nuxt-localized-site/blob/main/docs/getting-started.md) · [Schema](schemas/localized-site-v1.schema.json) · [テスト](https://github.com/nuxtjp/nuxt-localized-site/tree/main/test) · [セキュリティ報告](https://github.com/nuxtjp/nuxt-localized-site/blob/main/SECURITY.md)
64
+
65
+ コードは[Apache-2.0](LICENSE)です。[LICENSE-PREVIOUS](LICENSE-PREVIOUS)に以前の許諾、[NOTICE](NOTICE)に帰属表示を保持します。
66
+ [LICENSE-ASSETS](LICENSE-ASSETS)は対象となるブランド・コンテンツ素材の別条件を保持します。コードのライセンスを変更せず、第三者やサイト所有者のコンテンツの権利を追加で許諾するものでもありません。
package/README.md CHANGED
@@ -1,3 +1,66 @@
1
- # Temporary Holding Version
1
+ # @nuxtjp/localized-site
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ [日本語](README.ja.md)
4
+
5
+ Generate a Japanese/English introduction site from one validated configuration. The module supplies `/`, `/docs`, `/docs/getting-started`, `/docs/security` and their English counterparts, locale links and SEO metadata.
6
+
7
+ ## Install and configure
8
+
9
+ Version `0.1.0` is published on npm. Use Node.js 22.19+ or 24.11+, Nuxt 4.5.1+ in major 4, and Vue `^3.5.40`.
10
+
11
+ ```sh
12
+ pnpm add --save-exact @nuxtjp/localized-site@0.1.0 nuxt@4.5.1 vue@3.5.43
13
+ ```
14
+
15
+ ```ts
16
+ export default defineNuxtConfig({
17
+ modules: [['@nuxtjp/localized-site', { contentRoot: '.' }]]
18
+ })
19
+ ```
20
+
21
+ Set `contentRoot` explicitly. Copy the [generic configuration](examples/content/site.config.json) there as `site.config.json`, and replace it with the site's own content.
22
+ The configuration requires `siteId`, `serviceId`, `origin`, `audienceScope`, complete ja/en content, exactly three features, getting-started and security documents, privacy/contact notices, and `externalActions: false`.
23
+
24
+ ```sh
25
+ pnpm exec nuxtjp-localized-site validate --content-root .
26
+ pnpm exec nuxt build
27
+ ```
28
+
29
+ ## Behavior and limits
30
+
31
+ Privacy/contact notices are text. The module creates no unset links or actions.
32
+ In the browser, the optional maintenance notice reads same-origin `/maintenance.json`. Failed retrieval, invalid data or expired data hides that notice; the site and locale switching remain usable.
33
+ For archive testing, install the exact reviewed TGZ instead of the registry version. These commands do not publish a website or configure registry access.
34
+
35
+ ## Typed messages
36
+
37
+ ```ts
38
+ const messages = defineLocalizedMessages({
39
+ ja: { save: '保存', cancel: 'キャンセル' },
40
+ en: { save: 'Save', cancel: 'Cancel' }
41
+ })
42
+ const { t } = useLocalizedMessages(messages)
43
+ t('save')
44
+ ```
45
+
46
+ English keys must match Japanese keys. Empty messages fall back to `fallbackLocale`, then `defaultLocale`.
47
+
48
+ ## Development
49
+
50
+ ```sh
51
+ pnpm install --frozen-lockfile
52
+ pnpm test
53
+ pnpm typecheck
54
+ pnpm build
55
+ pnpm validate:example
56
+ pnpm pack
57
+ ```
58
+
59
+ `prepack` runs tests, typecheck, build and example validation. Verify the actual archive in a separate host before a release.
60
+
61
+ ## Documentation and license
62
+
63
+ [Usage guide](https://github.com/nuxtjp/nuxt-localized-site/blob/main/docs/getting-started.md) · [Schema](schemas/localized-site-v1.schema.json) · [Tests](https://github.com/nuxtjp/nuxt-localized-site/tree/main/test) · [Security reporting](https://github.com/nuxtjp/nuxt-localized-site/blob/main/SECURITY.md)
64
+
65
+ Code: [Apache-2.0](LICENSE). [LICENSE-PREVIOUS](LICENSE-PREVIOUS) retains prior grants, and [NOTICE](NOTICE) preserves attribution.
66
+ [LICENSE-ASSETS](LICENSE-ASSETS) retains separate terms for covered brand/content assets. It does not change the code license or grant rights to third-party or site-owned content.
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env node
2
+ import { runValidatorCli } from '../validator/content/cli.js'
3
+
4
+ process.exitCode = await runValidatorCli(process.argv.slice(2), {
5
+ out: value => process.stdout.write(`${value}\n`),
6
+ error: value => process.stderr.write(`${value}\n`)
7
+ })
@@ -0,0 +1,62 @@
1
+ import { NuxtModule } from '@nuxt/schema';
2
+
3
+ declare const SITE_CONFIG_SCHEMA = "nuxtjp://localized-site/site-config/v1";
4
+ declare const SUPPORTED_LOCALES: readonly ["ja", "en"];
5
+ declare const DOCUMENT_IDS: readonly ["overview", "gettingStarted", "security"];
6
+ type SupportedLocale = typeof SUPPORTED_LOCALES[number];
7
+ type DocumentId = typeof DOCUMENT_IDS[number];
8
+ type AudienceScope = 'japan' | 'global';
9
+ interface FeatureContent {
10
+ id: string;
11
+ title: string;
12
+ summary: string;
13
+ }
14
+ interface DocumentSection {
15
+ id: string;
16
+ title: string;
17
+ body: string[];
18
+ }
19
+ interface DocumentContent {
20
+ slug: string;
21
+ title: string;
22
+ summary: string;
23
+ sections: DocumentSection[];
24
+ }
25
+ interface NoticeContent {
26
+ label: string;
27
+ summary: string;
28
+ }
29
+ interface LocaleContent {
30
+ brand: string;
31
+ tagline: string;
32
+ summary: string;
33
+ features: FeatureContent[];
34
+ docs: Record<DocumentId, DocumentContent>;
35
+ privacy: NoticeContent;
36
+ contact: NoticeContent;
37
+ }
38
+ interface SiteConfig {
39
+ schema: typeof SITE_CONFIG_SCHEMA;
40
+ siteId: string;
41
+ serviceId: string;
42
+ origin: string;
43
+ audienceScope: AudienceScope;
44
+ defaultLocale: SupportedLocale;
45
+ fallbackLocale?: SupportedLocale;
46
+ prefixDefaultLocale?: boolean;
47
+ locales: ['ja', 'en'];
48
+ externalActions: false;
49
+ content: Record<SupportedLocale, LocaleContent>;
50
+ }
51
+ interface ResolvedSiteConfig extends Omit<SiteConfig, 'fallbackLocale' | 'prefixDefaultLocale'> {
52
+ fallbackLocale: SupportedLocale;
53
+ prefixDefaultLocale: boolean;
54
+ }
55
+
56
+ interface ModuleOptions {
57
+ contentRoot?: string;
58
+ }
59
+ declare const localizedSiteModule: NuxtModule<ModuleOptions>;
60
+
61
+ export { localizedSiteModule as default };
62
+ export type { ModuleOptions, ResolvedSiteConfig, SiteConfig, SupportedLocale };
@@ -0,0 +1,12 @@
1
+ {
2
+ "name": "@nuxtjp/localized-site",
3
+ "configKey": "nuxtJpLocalizedSite",
4
+ "compatibility": {
5
+ "nuxt": "^4.5.1"
6
+ },
7
+ "version": "0.1.1",
8
+ "builder": {
9
+ "@nuxt/module-builder": "1.0.2",
10
+ "unbuild": "unknown"
11
+ }
12
+ }
@@ -0,0 +1,74 @@
1
+ import { resolve } from 'node:path';
2
+ import { defineNuxtModule, createResolver, addLayout, addComponent, addPlugin, addImports, extendPages, addPrerenderRoutes } from '@nuxt/kit';
3
+ import { siteRoutes } from '../dist/runtime/core/path.js';
4
+
5
+ async function loadValidator() {
6
+ const validatorUrl = new URL("../validator/content/index.js", import.meta.url);
7
+ return await import(validatorUrl.href);
8
+ }
9
+ const localizedSiteModule = defineNuxtModule({
10
+ meta: {
11
+ name: "@nuxtjp/localized-site",
12
+ configKey: "nuxtJpLocalizedSite",
13
+ compatibility: { nuxt: "^4.5.1" }
14
+ },
15
+ defaults: {},
16
+ async setup(options, nuxt) {
17
+ if (!options.contentRoot) {
18
+ throw new Error("nuxtJpLocalizedSite.contentRoot must be declared explicitly");
19
+ }
20
+ const { loadSiteConfig } = await loadValidator();
21
+ const config = loadSiteConfig(resolve(nuxt.options.rootDir, options.contentRoot));
22
+ const resolver = createResolver(import.meta.url);
23
+ const pageFile = resolver.resolve("./runtime/app/pages/LocalizedContentPage.vue");
24
+ const routes = siteRoutes(config);
25
+ nuxt.options.runtimeConfig.public.nuxtJpLocalizedSite = config;
26
+ addLayout(resolver.resolve("./runtime/app/layouts/localized-site.vue"), "localized-site");
27
+ addComponent({
28
+ name: "NuxtJpLocalizedLanguageSwitcher",
29
+ filePath: resolver.resolve(
30
+ "./runtime/app/components/LocalizedLanguageSwitcher.vue"
31
+ )
32
+ });
33
+ addComponent({
34
+ name: "NuxtJpPublicMaintenanceNotice",
35
+ filePath: resolver.resolve(
36
+ "./runtime/app/components/PublicMaintenanceNotice.vue"
37
+ )
38
+ });
39
+ addPlugin(resolver.resolve("./runtime/app/plugins/localized-head"));
40
+ addImports([
41
+ {
42
+ name: "useLocalizedSite",
43
+ from: resolver.resolve("./runtime/app/composables/useLocalizedSite")
44
+ },
45
+ {
46
+ name: "useLocalizedMessages",
47
+ from: resolver.resolve("./runtime/app/composables/useLocalizedMessages")
48
+ },
49
+ {
50
+ name: "defineLocalizedMessages",
51
+ from: resolver.resolve("./runtime/core/messages")
52
+ }
53
+ ]);
54
+ extendPages((pages) => {
55
+ const occupied = new Set(pages.map((page) => page.path));
56
+ for (const [index, path] of routes.entries()) {
57
+ if (occupied.has(path)) {
58
+ throw new Error(`@nuxtjp/localized-site route conflicts with consumer page: ${path}`);
59
+ }
60
+ pages.push({
61
+ name: `nuxtjp-localized-site-${index}`,
62
+ path,
63
+ file: pageFile,
64
+ meta: { layout: "localized-site" }
65
+ });
66
+ }
67
+ });
68
+ addPrerenderRoutes(routes);
69
+ const stylesheet = resolver.resolve("./runtime/app/assets/localized-site.css");
70
+ if (!nuxt.options.css.includes(stylesheet)) nuxt.options.css.push(stylesheet);
71
+ }
72
+ });
73
+
74
+ export { localizedSiteModule as default };
@@ -0,0 +1 @@
1
+ :root{background:#f6f7f9;color:#18202a;color-scheme:light;font-family:Inter,Noto Sans JP,system-ui,sans-serif}body{margin:0}.nls-shell{display:grid;grid-template-rows:auto 1fr auto;min-height:100vh}.nls-footer,.nls-header,.nls-main{margin-inline:auto;width:min(72rem,calc(100% - 2rem))}.nls-header{align-items:center;display:flex;flex-wrap:wrap;gap:1.25rem;padding-block:1.25rem}.nls-header nav,.nls-language-switcher{display:flex;gap:.75rem}.nls-language-switcher{margin-inline-start:auto}.nls-main{padding-block:4rem}.nls-maintenance{background:#fff2c7;border:1px solid #d9aa28;border-radius:.75rem;color:#3f2b00;display:grid;gap:.25rem;margin-inline:auto;padding:1rem;width:min(72rem,calc(100% - 2rem))}.nls-document,.nls-landing{max-width:52rem}.nls-document h1,.nls-landing h1{font-size:clamp(2.2rem,7vw,4.8rem);line-height:1.05;margin-block:.5rem 1rem}.nls-tagline{font-size:1.25rem;line-height:1.6}.nls-eyebrow{color:#516170;letter-spacing:.08em;text-transform:uppercase}.nls-features{display:grid;gap:1rem;grid-template-columns:repeat(auto-fit,minmax(13rem,1fr));margin-block:2.5rem}.nls-document section,.nls-features article{background:#fff;border:1px solid #dce1e7;border-radius:.75rem;padding:1.25rem}.nls-document section{margin-block:1rem}.nls-primary-link{background:#174d75;border-radius:.5rem;color:#fff;display:inline-block;padding:.75rem 1rem}.nls-footer{border-top:1px solid #dce1e7;display:grid;gap:1rem;grid-template-columns:repeat(auto-fit,minmax(16rem,1fr));padding-block:2rem}a{color:#174d75;text-underline-offset:.2em}
@@ -0,0 +1,7 @@
1
+ import type { DocumentId } from '../../../contracts/types.js';
2
+ type __VLS_Props = {
3
+ documentId: DocumentId;
4
+ };
5
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
6
+ declare const _default: typeof __VLS_export;
7
+ export default _default;
@@ -0,0 +1,23 @@
1
+ <script setup>
2
+ import { computed } from "vue";
3
+ import { useLocalizedSite } from "../composables/useLocalizedSite";
4
+ const props = defineProps({
5
+ documentId: { type: null, required: true }
6
+ });
7
+ const site = useLocalizedSite();
8
+ const document = computed(() => site.content.value.docs[props.documentId]);
9
+ </script>
10
+
11
+ <template>
12
+ <article class="nls-document">
13
+ <p class="nls-eyebrow">{{ site.content.value.brand }}</p>
14
+ <h1>{{ document.title }}</h1>
15
+ <p class="nls-tagline">{{ document.summary }}</p>
16
+ <section v-for="section in document.sections" :key="section.id">
17
+ <h2>{{ section.title }}</h2>
18
+ <p v-for="paragraph in section.body" :key="paragraph">
19
+ {{ paragraph }}
20
+ </p>
21
+ </section>
22
+ </article>
23
+ </template>
@@ -0,0 +1,7 @@
1
+ import type { DocumentId } from '../../../contracts/types.js';
2
+ type __VLS_Props = {
3
+ documentId: DocumentId;
4
+ };
5
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
6
+ declare const _default: typeof __VLS_export;
7
+ export default _default;
@@ -0,0 +1,3 @@
1
+ declare const __VLS_export: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
2
+ declare const _default: typeof __VLS_export;
3
+ export default _default;
@@ -0,0 +1,25 @@
1
+ <script setup>
2
+ import { useLocalizedSite } from "../composables/useLocalizedSite";
3
+ const site = useLocalizedSite();
4
+ </script>
5
+
6
+ <template>
7
+ <article class="nls-landing">
8
+ <p class="nls-eyebrow">{{ site.config.serviceId }}</p>
9
+ <h1>{{ site.content.value.brand }}</h1>
10
+ <p class="nls-tagline">{{ site.content.value.tagline }}</p>
11
+ <p>{{ site.content.value.summary }}</p>
12
+ <section class="nls-features" :aria-label="site.content.value.tagline">
13
+ <article v-for="feature in site.content.value.features" :key="feature.id">
14
+ <h2>{{ feature.title }}</h2>
15
+ <p>{{ feature.summary }}</p>
16
+ </article>
17
+ </section>
18
+ <NuxtLink
19
+ class="nls-primary-link"
20
+ :to="site.localePath(site.locale.value, '/docs')"
21
+ >
22
+ {{ site.content.value.docs.overview.title }}
23
+ </NuxtLink>
24
+ </article>
25
+ </template>
@@ -0,0 +1,3 @@
1
+ declare const __VLS_export: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
2
+ declare const _default: typeof __VLS_export;
3
+ export default _default;
@@ -0,0 +1,3 @@
1
+ declare const __VLS_export: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
2
+ declare const _default: typeof __VLS_export;
3
+ export default _default;