Skip to content

Commit

Permalink
Translation using l10n vscode api (#1178)
Browse files Browse the repository at this point in the history
* first iteration using l10n t

* rm locdictionary references

* fix bundle lint

* finish moving to i10n

* fix lint

* use rimraf

* move del code to clean script

* add missing translation strings

* update language contribution doc

* monitor cmd name update
  • Loading branch information
brianignacio5 authored May 13, 2024
1 parent 4eaaa5f commit a3291c6
Show file tree
Hide file tree
Showing 90 changed files with 2,313 additions and 4,159 deletions.
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ node_modules
.cache
.vscode-test/
*.vsix
!i18n/*/out
package.nls.*.json
testFiles/blink
!testFiles/dist
testFiles/tools
Expand Down
1 change: 0 additions & 1 deletion .vscodeignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ ci
esp/**
esp_idf_docs_index_lang_*.json
esp_idf_vsc_ext.log
gulpfile.js
media/screenshots
media/tutorials
node_modules
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ Install ESP-IDF and ESP-IDF Tools by following the [install tutorial](./docs/tut
- When you are ready, build your project by pressing <kbd>F1</kbd> and typing **ESP-IDF: Build your Project**.
- Flash to your device by pressing <kbd>F1</kbd> and typing **ESP-IDF: Select Flash Method and Flash** to select either UART or JTAG. You can also use the **ESP-IDF: Flash (UART) your Project** or **ESP-IDF: Flash (with JTag)** directly.
> **NOTE:** When using the **ESP-IDF: Select Flash Method and Flash** command, your choice will be saved in the `idf.flashType` configuration setting in the current workspace folder's settings.json.
- You can later start a monitor by pressing <kbd>F1</kbd> and typing **ESP-IDF: Monitor your Device** which will log the device activity in a Visual Studio Code terminal.
- You can later start a monitor by pressing <kbd>F1</kbd> and typing **ESP-IDF: Monitor Device** which will log the device activity in a Visual Studio Code terminal.
- To make sure you can debug your device, select the your board by pressing <kbd>F1</kbd> and typing **ESP-IDF: Select OpenOCD Board Configuration** or manually define the openOCD configuration files with `idf.openOcdConfigs` configuration in your settings.json.
- If you want to start a debug session, just press F5 (make sure you had at least build and flash once before so the debugger works correctly). Check the [Troubleshooting](./README.md#Troubleshooting) section if you have any issues.

Expand Down Expand Up @@ -135,7 +135,7 @@ Click <kbd>F1</kbd> to show Visual studio code actions, then type **ESP-IDF** to
| Launch IDF Monitor for CoreDump / GDB-Stub Mode | | |
| Launch QEMU Server | | |
| Launch QEMU Debug Session | | |
| Monitor your device | <kbd>⌘</kbd> <kbd>I</kbd> <kbd>M</kbd> | <kbd>Ctrl</kbd> <kbd>E</kbd> <kbd>M</kbd> |
| Monitor device | <kbd>⌘</kbd> <kbd>I</kbd> <kbd>M</kbd> | <kbd>Ctrl</kbd> <kbd>E</kbd> <kbd>M</kbd> |
| Monitor QEMU Device | | |
| New Project | <kbd>⌘</kbd> <kbd>I</kbd> <kbd>N</kbd> | <kbd>Ctrl</kbd> <kbd>E</kbd> <kbd>N</kbd> |
| Open ESP-IDF Terminal | <kbd>⌘</kbd> <kbd>I</kbd> <kbd>T</kbd> | <kbd>Ctrl</kbd> <kbd>E</kbd> <kbd>T</kbd> |
Expand Down
21 changes: 21 additions & 0 deletions clean.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
const del = require("del");

(async () => {
const pathsToDelete = [
"dist/**",
"out/**",
"*.vsix",
"report.json",
"report.txt",
"testing.results.log",
"esp_idf_vsc_ext.log",
"esp_idf_docs_*.json",
];

try {
await del(pathsToDelete);
console.log("Build files and directories cleaned successfully.");
} catch (error) {
console.error("Error while cleaning files:", error);
}
})();
4 changes: 2 additions & 2 deletions docs/FEATURES.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,9 @@ You can follow [this](./HEAP_TRACING.md) quick step-by-step guide for Heap Traci

## Monitor

**ESP-IDF: Monitor your Device** is provided by this extension to start `idf.py monitor` terminal program in Visual Studio Code. Please take a look at the [IDF Monitor Documentation](https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-guides/tools/idf-monitor.html?highlight=monitor).
**ESP-IDF: Monitor Device** is provided by this extension to start `idf.py monitor` terminal program in Visual Studio Code. Please take a look at the [IDF Monitor Documentation](https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-guides/tools/idf-monitor.html?highlight=monitor).

In Visual Studio Code, for **ESP-IDF: Monitor your Device** we use the shell executable given in `vscode.env.shell` which is override by `terminal.integrated.shell.*` in your Visual Studio Code Settings when using the `Terminal: Select Default Shell` command to update the shell or updating `terminal.integrated.shell.windows` for Windows, `terminal.integrated.shell.osx` for MacOS and `terminal.integrated.shell.linux` for Linux in VSCode Settings Preference menu (F1 -> Preferences: Open Settings (JSON)).
In Visual Studio Code, for **ESP-IDF: Monitor Device** we use the shell executable given in `vscode.env.shell` which is override by `terminal.integrated.shell.*` in your Visual Studio Code Settings when using the `Terminal: Select Default Shell` command to update the shell or updating `terminal.integrated.shell.windows` for Windows, `terminal.integrated.shell.osx` for MacOS and `terminal.integrated.shell.linux` for Linux in VSCode Settings Preference menu (F1 -> Preferences: Open Settings (JSON)).

## OpenOCD Server

Expand Down
19 changes: 4 additions & 15 deletions docs/LANG_CONTRIBUTE.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,18 @@

Make sure you install the source code version of this extension by following [Source Mode](./INSTALL.md#Build-from-Source-Code).

Inside i18n folder, create a sub-directory using the language code name as specified by [ISO 639-3](https://en.wikipedia.org/wiki/ISO_639-3) convention.
Inside `l10n` folder, create a `bundle.l10n.<lang>.json` file using the language code name as specified by [ISO 639-3](https://en.wikipedia.org/wiki/ISO_639-3) convention to replace `<lang>`.

For ease you could copy the `en` for English definitions. A language folder tree structure should look like:
In the root directory, also contribute a `package.nls.<lang>.json` for static language definitions such as command names and such.

```
<IS0 639-3 Language Code>/
+-- out/
+-- sub-directory/
+-- ...
+-- ...
+-- ...
+-- ...
+-- extension.i18n.json
+-- utils.i18n.json
+-- package.i18n.json
```
To generate the english definition, just run the `yarn genLocalizationBundle` command which will generate `l10n/bundle.l10n.json` english bundle file and copy the `package.nls.json`.

Each file has a key value structure such as:

```json
{
"espIdf.createFiles.title": "ESP-IDF: Create ESP-IDF Project from Extension Template",
"textID": "value"
"englishTextOrTextId": "translationInNewLanguage"
}
```

Expand Down
2 changes: 1 addition & 1 deletion docs/MANUAL_TESTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ _Steps:_

1. Press menu **View**, click on **Command Palette** and type **ESP-IDF: Select port to use** and select it.
2. Choose the serial port to connect and the workspace folder where to save the `idf.port` configuration setting.
3. Press menu **View**, click on **Command Palette** and type **ESP-IDF: Monitor your Device** and select it.
3. Press menu **View**, click on **Command Palette** and type **ESP-IDF: Monitor Device** and select it.
4. ESP-IDF Monitor should begin after.

_Expected Results:_
Expand Down
2 changes: 1 addition & 1 deletion docs/POSTMORTEM.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
The `ESP-IDF: Launch IDF Monitor for CoreDump / GDB-Stub Mode` command launches a ESP-IDF Monitor terminal listening for core-dump/gdbstub events on which will launch a debug session where you can send gdb commands to
the chip (without continue, pause or other debug steps).

> **NOTE:** The `ESP-IDF: Monitor your Device` command will not launch a debug session.
> **NOTE:** The `ESP-IDF: Monitor Device` command will not launch a debug session.
# Using Core Dump

Expand Down
2 changes: 1 addition & 1 deletion docs/tutorial/basic_use.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ The user will see a new terminal being launched with the flash output and a noti
<img src="../../media/tutorials/basic_use/flash.png" alt="Flashing" width="975">
</p>

10. Now to start monitoring your device, use the **ESP-IDF: Monitor your Device** command (<kbd>CTRL</kbd> <kbd>E</kbd> <kbd>M</kbd> keyboard shortcut). The user will see a new terminal being launched with the `idf.py monitor` output.
10. Now to start monitoring your device, use the **ESP-IDF: Monitor Device** command (<kbd>CTRL</kbd> <kbd>E</kbd> <kbd>M</kbd> keyboard shortcut). The user will see a new terminal being launched with the `idf.py monitor` output.

> **NOTE** The ESP-IDF Monitor baud rate value is taken from `idf.monitorBaudRate` with fallback on your project's SDKConfig `CONFIG_ESPTOOLPY_MONITOR_BAUD` (idf.py monitor' baud rate). This value can also be override by setting the environment variable `IDF_MONITOR_BAUD` or `MONITORBAUD` in your system environment variables or this extension's `idf.customExtraVars` configuration setting. Please review [ESP-IDF Settings](../SETTINGS.md)) to see how to modify `idf.customExtraVars`.
Expand Down
2 changes: 1 addition & 1 deletion docs/tutorial/code_coverage.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ The example will enable the following options by default:

> **NOTE:** For any project that you want to generate code coverage, you should enable these settings in your sdkconfig.
6. Now to build the project, flash your device and start the ESP-IDF Monitor you can use the **ESP-IDF: Build your Project**, **ESP-IDF: Flash your Project** and **ESP-IDF: Monitor your Device** commands as explained in the [Basic use tutorial](./basic_use.md). If everything is executed correctly, there will be a message in ESP-IDF Monitor saying `Ready to dump GCOV data...`
6. Now to build the project, flash your device and start the ESP-IDF Monitor you can use the **ESP-IDF: Build your Project**, **ESP-IDF: Flash your Project** and **ESP-IDF: Monitor Device** commands as explained in the [Basic use tutorial](./basic_use.md). If everything is executed correctly, there will be a message in ESP-IDF Monitor saying `Ready to dump GCOV data...`

> **NOTE:** There is also a **ESP-IDF: Build, Flash and Start a Monitor on your Device** command (<kbd>CTRL</kbd> <kbd>E</kbd> <kbd>D</kbd> keyboard shortcut).
Expand Down
121 changes: 0 additions & 121 deletions gulpfile.js

This file was deleted.

3 changes: 0 additions & 3 deletions i18n/en/out/build/buildCmd.i18n.json

This file was deleted.

11 changes: 0 additions & 11 deletions i18n/en/out/espIdf/menuconfig/MenuconfigPanel.i18n.json

This file was deleted.

3 changes: 0 additions & 3 deletions i18n/en/out/espIdf/monitor/command.i18n.json

This file was deleted.

6 changes: 0 additions & 6 deletions i18n/en/out/espIdf/serial/serialPort.i18n.json

This file was deleted.

8 changes: 0 additions & 8 deletions i18n/en/out/espIdf/size/idfSize.i18n.json

This file was deleted.

23 changes: 0 additions & 23 deletions i18n/en/out/extension.i18n.json

This file was deleted.

3 changes: 0 additions & 3 deletions i18n/en/out/flash/flashCmd.i18n.json

This file was deleted.

3 changes: 0 additions & 3 deletions i18n/en/out/idfComponentsDataProvider.i18n.json

This file was deleted.

3 changes: 0 additions & 3 deletions i18n/en/out/idfConfiguration.i18n.json

This file was deleted.

4 changes: 0 additions & 4 deletions i18n/en/out/utils.i18n.json

This file was deleted.

Loading

0 comments on commit a3291c6

Please sign in to comment.