udic 1.1.0
dotnet tool install --global udic --version 1.1.0
dotnet new tool-manifest
dotnet tool install --local udic --version 1.1.0
#tool dotnet:?package=udic&version=1.1.0
nuke :add-package udic --version 1.1.0
uDic - Umbraco (uSync) Dictionary CLI tool
Mess with Umbraco translation dictionaries by manipulating uSync files.
uDic assumes (and enforces) a hierarchical dictionary setup delimited by dots (.)
For example:
- Login
- Login.Username
- Login.Password
- Register
- Register.Username
- Register.Email
- Register.Email.Example
- Register.Password
This is very flaky. Ensure you have backed up uSync before running your commands and that you can restore a database before importing changes.
There is no file-naming logic, its therefore very important you run a clean export after importing modified files.
Installation
This is a dotnet tool.
You can either install it globally like so:
dotnet tool install -g udic
Or locally to your Umbraco project:
dotnet tool install udic
You can also execute it without installing by using:
dnx udic <commands>
Local development
Build the tool with the dotnet pack command.
Then you can install it globally by specifying the path:
dotnet tool install -g udic --source /path/to/udic/source/npkg/.
You can also run the tool with dotnet run {command} -- {arguments}
e.g. dotnet run add item New.Alias "Value goes here" -- -c en-GB
Commands
Run udic --help or udic <command> --help for in-app guidance.
treeEnforces a tree structure in the dictionary with.as the separator. It will create any missing parent nodes. e.g. ifLoginandLogin.Usernamewere both in the root,Login.Usernamewould be moved to nest underLogin.add itemAdds a new key in the correct place in the dictionary, passing an optional value and culture to populate. e.g.
udic add item New.Alias "Value goes here" -c en-GBto add a new key in the correct place in the dictionary, passing an optional value and culture to populate. Options:-c|--culture- The culture to add, defaults to your current language
add scanScans Razor (cshtml) files for dictionary keys and adds any missing ones to the dictionary, passing an optional filepath to search and culture to populate. e.g.
udic add scan -c en-GBto scan all files in the project Options:-f|--path- The directory or file to search for keys, defaults to the whole project
copyCopies dictionary items/a whole tree into a new location. Pass the--emptyflag to clear existing translations when copying e.g.udic copy Login* Register --emptywill copyLogin,Login.UsernameandLogin.PasswordtoRegister,Register.UsernameandRegister.PasswordmoveMoves (or renames) dictionary items/a whole tree. e.g.udic move Login* MembersArea.Loginwill moveLogin,Login.UsernameandLogin.PasswordtoMembersArea.Login,MembersArea.Login.UsernameandMembersArea.Login.PasswordseedPopulates the specified culture with dummy data based on a format string to test internationalization logic without real translation data. e.gudic seed "[{culture}] {value:en-GB} ({alias})" -n * -c dawould populate all (*matches all) values in thedaculture with a calculated value such as[da] Username (Login.Username)
Yet to implement:
add many <filePath> -c en-GBwhich accepts a JSON file of dictionary items to add, with their value. The culture to populate is passed as an argument.
Global Arguments
You can always pass the following arguments:
-por--projectA path to the Umbraco project if not the current directory
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
This package has no dependencies.