Inlined Strings
Inlining is a way to write langauge string values right into the code. See Inlining for more instructions.
ILine key = LineRoot.Global.Section("Section").Key("Key")
.Text("Success")
.Inline("fi", "Onnistui")
.Inline("sv", "Det funkar");
Tool can also scan IStringLocalizer texts and convert them to localization files.
IStringLocalizer<Example> myLocalizer = null;
string str = myLocalizer["Hello World"];
Inlined language strings can be converted to localization files, which can then be used as templates for translations to other languages, and then loaded into the application or class library as implementation for one of the abstractions.
Command-Line Arguments
The lever -s searches for inlined strings from **.dll and **.exe files.
Lexical.Localization.Tool -s
Lever -s:<glob pattern> searches for files with a glob pattern; ? denotes one character, * any name under one directory, ** any filename and subdirectory. Pattern is matched against full rooted file paths. For matching purposes folder separator is converted to '/' in Windows.
Lexical.Localization.Tool -s:**/bin/release/*.dll
Lever -S:<glob pattern> adds exclude file pattern.
Lexical.Localization.Tool -s:**/bin/release/*.dll -S:**/exclude this dir/**
The tool automatically opens package types .zip, .7z, .rar, .tar, .gz, .bzip2, .z, .dll.
Lexical.Localization.Tool -s:**.zip/**.dll
This is sometimes unwanted behaviour. Exclude pattern -S can be used to not open specific file formats.
Lexical.Localization.Tool -s -S:**.zip/**
Some times inline scanner cannot infere the key completely. Such keys are dropped, unless lever -p is used, which sets option to add partially resolved keys to the result. These keys use section "_UNKNOWN_".
Lexical.Localization.Tool -p -s:**.dll
Configuration File
Scan can be configured from files as well.
Lexical.Localization.Tool -le scanconfig.json
Under section "ConvertJobs" there is "InlineScans" array, which that defines sections for jobs that scan inlined strings from .dll files (full configuration example). Example with all properties:
"InlineScans": [
{
"PackageExtensions": "dll exe zip bzip2 z tar 7z gzip gz rar",
"GlobPattern": "**.dll/**.resources",
"GlobPatterns": [],
"WildCardPattern": "",
"WildCardPatterns": [],
"FileName": "",
"FileNames": [],
"Exclude": "",
"Excludes": []
}
],
InlineScans Parameters:
Parameter | Description | Example Value |
---|---|---|
PackageExtensions | Extensions to open | dll exe zip bzip2 z tar 7z gzip gz rar |
FileName | Single file to scan | filename.ext |
FileNames | List of files to scan | filename1.ext, filename2.ext |
WildcardPattern | Pattern of files to scan | *.dll |
WildcardPatterns | Multiple patterns of files to scan | *.dll, *.exe |
GlobPattern | Glob pattern of files to scan | **.dll/**.resources |
GlobPatterns | Multiple glob patterns to scan | |
Exclude | One glob pattern of files to exclude | **.zip/** |
Excludes | Multiple glob patterns of files to exclude |
File Pattern
Atleast one file pattern parameter is needed (out of GlobPattern, GlobPatterns, WildCardPattern, WildCardPatterns, FileName, FileNames).