diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 5d8185b7..32349b40 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -64,6 +64,13 @@ jobs: path: netbeans ref: 22 + - name: Checkout NetBeans l10n + uses: actions/checkout@v4 + with: + repository: apache/netbeans-l10n + path: netbeans-l10n + ref: ece00239dc7a208fba60703c2256ffd818da1646 + - name: Apply NetBeans patches run: ant apply-patches diff --git a/BUILD.md b/BUILD.md index 579ab882..15ef8b37 100644 --- a/BUILD.md +++ b/BUILD.md @@ -41,6 +41,10 @@ $ git clone https://github.com/apache/netbeans.git $ cd netbeans/ $ git checkout 22 $ cd .. +$ git clone https://github.com/apache/netbeans-l10n.git +$ cd netbeans-l10n +$ git checkout ece00239dc7a208fba60703c2256ffd818da1646 # head commit in master +$ cd .. # the following target requires git executable to be on PATH: $ ant apply-patches $ ant build-netbeans diff --git a/build.xml b/build.xml index 52e8ad3c..4139436a 100644 --- a/build.xml +++ b/build.xml @@ -31,6 +31,16 @@ + + + patches/l10n/patch.diff + + + + + + + patches/6330.diff @@ -70,6 +80,10 @@ + + + + @@ -103,7 +117,7 @@ - + @@ -123,6 +137,52 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -214,16 +274,30 @@ - - ${patches} + + + ${git-patches-list} - + - + + + + + + + + + + + + + + diff --git a/patches/l10n/patch.diff b/patches/l10n/patch.diff new file mode 100644 index 00000000..63738400 --- /dev/null +++ b/patches/l10n/patch.diff @@ -0,0 +1,563 @@ +diff --git a/.gitignore b/.gitignore +index 6f0f29522..f19cedae2 100644 +--- a/.gitignore ++++ b/.gitignore +@@ -9,3 +9,4 @@ + /l10nantext/dist/ + /l10nantext/nbproject/private/ + /l10nantext/nbproject/genfiles.properties ++.idea +diff --git a/locale_ja/build.xml b/locale_ja/build.xml +new file mode 100644 +index 000000000..9fb26158d +--- /dev/null ++++ b/locale_ja/build.xml +@@ -0,0 +1,57 @@ ++ ++ ++ ++ Builds, tests, and runs the project org.apache.netbeans.l10n.ja. ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ +diff --git a/locale_ja/manifest.mf b/locale_ja/manifest.mf +new file mode 100644 +index 000000000..3eaceaebe +--- /dev/null ++++ b/locale_ja/manifest.mf +@@ -0,0 +1,6 @@ ++Manifest-Version: 1.0 ++AutoUpdate-Show-In-Client: true ++OpenIDE-Module: org.apache.netbeans.l10n.ja ++OpenIDE-Module-Localizing-Bundle: org/apache/netbeans/l10n/ja/Bundle.properties ++OpenIDE-Module-Specification-Version: 0.0.1 ++ +diff --git a/locale_ja/nbproject/build-impl.xml b/locale_ja/nbproject/build-impl.xml +new file mode 100644 +index 000000000..8e084c16d +--- /dev/null ++++ b/locale_ja/nbproject/build-impl.xml +@@ -0,0 +1,41 @@ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ +diff --git a/locale_ja/nbproject/platform.properties b/locale_ja/nbproject/platform.properties +new file mode 100644 +index 000000000..f94a32027 +--- /dev/null ++++ b/locale_ja/nbproject/platform.properties +@@ -0,0 +1,33 @@ ++# Licensed to the Apache Software Foundation (ASF) under one ++# or more contributor license agreements. See the NOTICE file ++# distributed with this work for additional information ++# regarding copyright ownership. The ASF licenses this file ++# to you under the Apache License, Version 2.0 (the ++# "License"); you may not use this file except in compliance ++# with the License. You may obtain a copy of the License at ++# ++# http://www.apache.org/licenses/LICENSE-2.0 ++# ++# Unless required by applicable law or agreed to in writing, ++# software distributed under the License is distributed on an ++# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY ++# KIND, either express or implied. See the License for the ++# specific language governing permissions and limitations ++# under the License. ++cluster.path=\ ++ ${nbplatform.active.dir}/groovy:\ ++ ${nbplatform.active.dir}/ide:\ ++ ${nbplatform.active.dir}/java:\ ++ ${nbplatform.active.dir}/enterprise:\ ++ ${nbplatform.active.dir}/websvccommon:\ ++ ${nbplatform.active.dir}/javafx:\ ++ ${nbplatform.active.dir}/profiler:\ ++ ${nbplatform.active.dir}/nb:\ ++ ${nbplatform.active.dir}/php:\ ++ ${nbplatform.active.dir}/platform:\ ++ ${nbplatform.active.dir}/harness:\ ++ ${nbplatform.active.dir}/apisupport:\ ++ ${nbplatform.active.dir}/webcommon:\ ++ ${nbplatform.active.dir}/extide:\ ++ ${nbplatform.active.dir}/ergonomics ++nbplatform.active=default +\ No newline at end of file +diff --git a/locale_ja/nbproject/project.properties b/locale_ja/nbproject/project.properties +new file mode 100644 +index 000000000..4cdfb33e0 +--- /dev/null ++++ b/locale_ja/nbproject/project.properties +@@ -0,0 +1,18 @@ ++# Licensed to the Apache Software Foundation (ASF) under one ++# or more contributor license agreements. See the NOTICE file ++# distributed with this work for additional information ++# regarding copyright ownership. The ASF licenses this file ++# to you under the Apache License, Version 2.0 (the ++# "License"); you may not use this file except in compliance ++# with the License. You may obtain a copy of the License at ++# ++# http://www.apache.org/licenses/LICENSE-2.0 ++# ++# Unless required by applicable law or agreed to in writing, ++# software distributed under the License is distributed on an ++# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY ++# KIND, either express or implied. See the License for the ++# specific language governing permissions and limitations ++# under the License. ++javac.source=1.8 ++javac.compilerargs=-Xlint -Xlint:-serial +\ No newline at end of file +diff --git a/locale_ja/nbproject/project.xml b/locale_ja/nbproject/project.xml +new file mode 100644 +index 000000000..4e1eb911f +--- /dev/null ++++ b/locale_ja/nbproject/project.xml +@@ -0,0 +1,32 @@ ++ ++ ++ ++ org.netbeans.modules.apisupport.project ++ ++ ++ org.apache.netbeans.l10n.ja ++ ++ ++ ++ ++ ++ +diff --git a/locale_ja/src/org/apache/netbeans/l10n/ja/Bundle.properties b/locale_ja/src/org/apache/netbeans/l10n/ja/Bundle.properties +new file mode 100644 +index 000000000..b18b59a1c +--- /dev/null ++++ b/locale_ja/src/org/apache/netbeans/l10n/ja/Bundle.properties +@@ -0,0 +1,17 @@ ++# Licensed to the Apache Software Foundation (ASF) under one ++# or more contributor license agreements. See the NOTICE file ++# distributed with this work for additional information ++# regarding copyright ownership. The ASF licenses this file ++# to you under the Apache License, Version 2.0 (the ++# "License"); you may not use this file except in compliance ++# with the License. You may obtain a copy of the License at ++# ++# http://www.apache.org/licenses/LICENSE-2.0 ++# ++# Unless required by applicable law or agreed to in writing, ++# software distributed under the License is distributed on an ++# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY ++# KIND, either express or implied. See the License for the ++# specific language governing permissions and limitations ++# under the License. ++OpenIDE-Module-Name=Japanese +diff --git a/locale_zh_CN/build.xml b/locale_zh_CN/build.xml +new file mode 100644 +index 000000000..3b5bec0e7 +--- /dev/null ++++ b/locale_zh_CN/build.xml +@@ -0,0 +1,57 @@ ++ ++ ++ ++ Builds, tests, and runs the project org.apache.netbeans.l10n.zh_CN. ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ +diff --git a/locale_zh_CN/manifest.mf b/locale_zh_CN/manifest.mf +new file mode 100644 +index 000000000..e705996ba +--- /dev/null ++++ b/locale_zh_CN/manifest.mf +@@ -0,0 +1,6 @@ ++Manifest-Version: 1.0 ++AutoUpdate-Show-In-Client: true ++OpenIDE-Module: org.apache.netbeans.l10n.zh_CN ++OpenIDE-Module-Localizing-Bundle: org/apache/netbeans/l10n/zh_CN/Bundle.properties ++OpenIDE-Module-Specification-Version: 0.0.1 ++ +diff --git a/locale_zh_CN/nbproject/build-impl.xml b/locale_zh_CN/nbproject/build-impl.xml +new file mode 100644 +index 000000000..dc542d5bf +--- /dev/null ++++ b/locale_zh_CN/nbproject/build-impl.xml +@@ -0,0 +1,41 @@ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ +diff --git a/locale_zh_CN/nbproject/platform.properties b/locale_zh_CN/nbproject/platform.properties +new file mode 100644 +index 000000000..f94a32027 +--- /dev/null ++++ b/locale_zh_CN/nbproject/platform.properties +@@ -0,0 +1,33 @@ ++# Licensed to the Apache Software Foundation (ASF) under one ++# or more contributor license agreements. See the NOTICE file ++# distributed with this work for additional information ++# regarding copyright ownership. The ASF licenses this file ++# to you under the Apache License, Version 2.0 (the ++# "License"); you may not use this file except in compliance ++# with the License. You may obtain a copy of the License at ++# ++# http://www.apache.org/licenses/LICENSE-2.0 ++# ++# Unless required by applicable law or agreed to in writing, ++# software distributed under the License is distributed on an ++# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY ++# KIND, either express or implied. See the License for the ++# specific language governing permissions and limitations ++# under the License. ++cluster.path=\ ++ ${nbplatform.active.dir}/groovy:\ ++ ${nbplatform.active.dir}/ide:\ ++ ${nbplatform.active.dir}/java:\ ++ ${nbplatform.active.dir}/enterprise:\ ++ ${nbplatform.active.dir}/websvccommon:\ ++ ${nbplatform.active.dir}/javafx:\ ++ ${nbplatform.active.dir}/profiler:\ ++ ${nbplatform.active.dir}/nb:\ ++ ${nbplatform.active.dir}/php:\ ++ ${nbplatform.active.dir}/platform:\ ++ ${nbplatform.active.dir}/harness:\ ++ ${nbplatform.active.dir}/apisupport:\ ++ ${nbplatform.active.dir}/webcommon:\ ++ ${nbplatform.active.dir}/extide:\ ++ ${nbplatform.active.dir}/ergonomics ++nbplatform.active=default +\ No newline at end of file +diff --git a/locale_zh_CN/nbproject/project.properties b/locale_zh_CN/nbproject/project.properties +new file mode 100644 +index 000000000..4cdfb33e0 +--- /dev/null ++++ b/locale_zh_CN/nbproject/project.properties +@@ -0,0 +1,18 @@ ++# Licensed to the Apache Software Foundation (ASF) under one ++# or more contributor license agreements. See the NOTICE file ++# distributed with this work for additional information ++# regarding copyright ownership. The ASF licenses this file ++# to you under the Apache License, Version 2.0 (the ++# "License"); you may not use this file except in compliance ++# with the License. You may obtain a copy of the License at ++# ++# http://www.apache.org/licenses/LICENSE-2.0 ++# ++# Unless required by applicable law or agreed to in writing, ++# software distributed under the License is distributed on an ++# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY ++# KIND, either express or implied. See the License for the ++# specific language governing permissions and limitations ++# under the License. ++javac.source=1.8 ++javac.compilerargs=-Xlint -Xlint:-serial +\ No newline at end of file +diff --git a/locale_zh_CN/nbproject/project.xml b/locale_zh_CN/nbproject/project.xml +new file mode 100644 +index 000000000..eec7b3954 +--- /dev/null ++++ b/locale_zh_CN/nbproject/project.xml +@@ -0,0 +1,32 @@ ++ ++ ++ ++ org.netbeans.modules.apisupport.project ++ ++ ++ org.apache.netbeans.l10n.zh_CN ++ ++ ++ ++ ++ ++ +diff --git a/locale_zh_CN/src/org/apache/netbeans/l10n/zh_CN/Bundle.properties b/locale_zh_CN/src/org/apache/netbeans/l10n/zh_CN/Bundle.properties +new file mode 100644 +index 000000000..744e7e91e +--- /dev/null ++++ b/locale_zh_CN/src/org/apache/netbeans/l10n/zh_CN/Bundle.properties +@@ -0,0 +1,17 @@ ++# Licensed to the Apache Software Foundation (ASF) under one ++# or more contributor license agreements. See the NOTICE file ++# distributed with this work for additional information ++# regarding copyright ownership. The ASF licenses this file ++# to you under the Apache License, Version 2.0 (the ++# "License"); you may not use this file except in compliance ++# with the License. You may obtain a copy of the License at ++# ++# http://www.apache.org/licenses/LICENSE-2.0 ++# ++# Unless required by applicable law or agreed to in writing, ++# software distributed under the License is distributed on an ++# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY ++# KIND, either express or implied. See the License for the ++# specific language governing permissions and limitations ++# under the License. ++OpenIDE-Module-Name=Simplified Chinese +diff --git a/netbeans-l10n-zip/src/ja/java/java-lsp-server/java-lsp-server/org/netbeans/modules/java/lsp/server/protocol/Bundle_ja.properties b/netbeans-l10n-zip/src/ja/java/java-lsp-server/java-lsp-server/org/netbeans/modules/java/lsp/server/protocol/Bundle_ja.properties +new file mode 100755 +index 000000000..659bdac4a +--- /dev/null ++++ b/netbeans-l10n-zip/src/ja/java/java-lsp-server/java-lsp-server/org/netbeans/modules/java/lsp/server/protocol/Bundle_ja.properties +@@ -0,0 +1,22 @@ ++# Licensed to the Apache Software Foundation (ASF) under one ++# or more contributor license agreements. See the NOTICE file ++# distributed with this work for additional information ++# regarding copyright ownership. The ASF licenses this file ++# to you under the Apache License, Version 2.0 (the ++# "License"); you may not use this file except in compliance ++# with the License. You may obtain a copy of the License at ++# ++# http://www.apache.org/licenses/LICENSE-2.0 ++# ++# Unless required by applicable law or agreed to in writing, ++# software distributed under the License is distributed on an ++# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY ++# KIND, either express or implied. See the License for the ++# specific language governing permissions and limitations ++# under the License. ++OpenIDE-Module-Name=Java LSP Server ++OpenIDE-Module-Display-Category=Java ++OpenIDE-Module-Short-Description=Java LSP Server ++ ++LBL_Run=\u8d70\u308b {0} ++LBL_Debug=\u30c7\u30d0\u30c3\u30b0 {0} +\ No newline at end of file +diff --git a/netbeans-l10n-zip/src/zh_CN/java/java-lsp-server/java-lsp-server/org/netbeans/modules/java/lsp/server/protocol/Bundle_zh_CN.properties b/netbeans-l10n-zip/src/zh_CN/java/java-lsp-server/java-lsp-server/org/netbeans/modules/java/lsp/server/protocol/Bundle_zh_CN.properties +new file mode 100755 +index 000000000..adf86548f +--- /dev/null ++++ b/netbeans-l10n-zip/src/zh_CN/java/java-lsp-server/java-lsp-server/org/netbeans/modules/java/lsp/server/protocol/Bundle_zh_CN.properties +@@ -0,0 +1,22 @@ ++# Licensed to the Apache Software Foundation (ASF) under one ++# or more contributor license agreements. See the NOTICE file ++# distributed with this work for additional information ++# regarding copyright ownership. The ASF licenses this file ++# to you under the Apache License, Version 2.0 (the ++# "License"); you may not use this file except in compliance ++# with the License. You may obtain a copy of the License at ++# ++# http://www.apache.org/licenses/LICENSE-2.0 ++# ++# Unless required by applicable law or agreed to in writing, ++# software distributed under the License is distributed on an ++# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY ++# KIND, either express or implied. See the License for the ++# specific language governing permissions and limitations ++# under the License. ++OpenIDE-Module-Name=Java LSP Server ++OpenIDE-Module-Display-Category=Java ++OpenIDE-Module-Short-Description=Java LSP Server ++ ++LBL_Run=\u8dd1\u6b65 {0} ++LBL_Debug=\u8c03\u8bd5 {0} +\ No newline at end of file diff --git a/vscode/src/extension.ts b/vscode/src/extension.ts index c81648f2..edb2c3ef 100644 --- a/vscode/src/extension.ts +++ b/vscode/src/extension.ts @@ -332,6 +332,7 @@ class InitialPromise extends Promise { } export function activate(context: ExtensionContext): VSNetBeansAPI { + deactivated=false; let log = vscode.window.createOutputChannel(SERVER_NAME); var clientResolve : (x : NbLanguageClient) => void; @@ -544,6 +545,7 @@ export function activate(context: ExtensionContext): VSNetBeansAPI { vscode.window.showErrorMessage(l10n.value("jdk.extension.cache.message.noUserDir")); } })); + context.subscriptions.push(vscode.commands.registerCommand(COMMAND_PREFIX + ".download.jdk", async () => { const jdkDownloaderView = new JdkDownloaderView(log); @@ -984,7 +986,7 @@ function doActivateWithJDK(specifiedJDK: string | null, context: ExtensionContex stdOut = null; } } - let extras : string[] = ["--modules", "--list", "-J-XX:PerfMaxStringConstLength=10240"]; + let extras : string[] = ["--modules", "--list", "-J-XX:PerfMaxStringConstLength=10240","--locale",l10n.nbLocaleCode()]; if (isDarkColorTheme()) { extras.push('--laf', 'com.formdev.flatlaf.FlatDarkLaf'); } diff --git a/vscode/src/localiser.ts b/vscode/src/localiser.ts index 6dd26ae8..15ddd761 100644 --- a/vscode/src/localiser.ts +++ b/vscode/src/localiser.ts @@ -6,16 +6,24 @@ import * as l10nLib from '@vscode/l10n' import * as vscode from 'vscode'; import { ORACLE_VSCODE_EXTENSION_ID } from './constants'; -const DEFAULT_BUNDLE_FILE = 'l10n/bundle.l10n.en.json'; +const DEFAULT_LANGAUGE = "en"; +const DEFAULT_BUNDLE_FILE = `l10n/bundle.l10n.${DEFAULT_LANGAUGE}.json`; type TranslatorFn = typeof vscode.l10n.t export interface l10n { value(key: string, placeholderMap?: Record): string + nbLocaleCode():string } +const vcodeToNbLocaleCodes:{[key:string]:string} = { + "ja":"ja", + "zh-cn":"zh:CN" +}; + class l10Wrapper implements l10n { private defaultTranslation: TranslatorFn; + constructor(extensionId: string, defaultBundlePath: string) { let defaultBundleAbsoluteFsPath = vscode.Uri.file(`${vscode.extensions.getExtension(extensionId)?.extensionPath}/${defaultBundlePath}`).fsPath l10nLib.config({ @@ -29,6 +37,10 @@ class l10Wrapper implements l10n { const isPresentInBundle = valueFromBundle !== key; return isPresentInBundle ? valueFromBundle : this.defaultTranslation(key, placeholderMap); } + nbLocaleCode(){ + const supportedLanguage = vcodeToNbLocaleCodes[vscode.env.language]; + return supportedLanguage?supportedLanguage:DEFAULT_LANGAUGE; + } }