https://github.com/rhino-linux/nu_plugin_nutext
https://github.com/rhino-linux/nu_plugin_nutext
Last synced: about 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/rhino-linux/nu_plugin_nutext
- Owner: rhino-linux
- License: gpl-2.0
- Created: 2024-12-06T00:12:18.000Z (6 months ago)
- Default Branch: master
- Last Pushed: 2025-03-30T20:52:20.000Z (about 2 months ago)
- Last Synced: 2025-03-30T21:28:06.415Z (about 2 months ago)
- Language: Rust
- Size: 187 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# nutext
A library that brings gettext support to Nushell!## Usage
There are three commands, `tregister`, `_`, and `tprint`. First you must register your path and program name with `tregister` like so:```bash
tregister /usr/share/locale/ my-program
```Then you can start using `tprint` like so:
```bash
tprint "Hello World! I am {name}. I am {years} years old" { name: "Elsie", years: 19 }
```Or if you need to get the translated string alone:
```bash
let my_var = (_ "Hello {world}" { world: "World" })
```I also have provided the tool `xnutext`, not too disimilar to `xgettext`, which will extract all translatable strings from your nu programs. There are two catches to using this:
1. Nutext must be installed and functional.
2. Your program must be syntactically correct according to Nu: `xnutext` will not extract text if the program cannot be ran. This is because `xnutext` relies on Nu's AST capabilities to accurately know where commands are being run (as opposed to say, a string that contains `_`).After you have verified these, you should run:
```bash
xnutext list of files -o po/program.pot
```