Skip to content

Commit

Permalink
Added better internal comments to en message file
Browse files Browse the repository at this point in the history
These comments help describe how each section of the text version of
the message files works. Also, better management of logging for message
generation, so we only print something if we are generating a new file.
  • Loading branch information
tucats committed Dec 18, 2023
1 parent fb8531d commit 177c996
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 3 deletions.
31 changes: 31 additions & 0 deletions i18n/languages/messages_en.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Messages for language "en"

# The "ego" section contains subcommand descriptions used by the --help option
# used with CLI commands. In general, the first term of the key is the primary
# command verb, followed by a period and the optional subcommand names.

[ego]
config=Manage the configuration
config.delete=Delete a key from the configuration
Expand Down Expand Up @@ -58,6 +62,12 @@ table.update=Update rows to a table
test=Run a test suite
version=Display command line version number


# The "error" section contains error message codes. In general, the key is a
# descriptive text of the functional area or language component where the error
# occurred. There is no distinction between messages generated by the compiler
# versus runtime errors.

[error]
arg.count=incorrect function argument count
arg.list=internal error: invalid local function argument list
Expand Down Expand Up @@ -268,6 +278,10 @@ var.args=invalid variable-argument operation
var.type=invalid type for this variable
version.parse=Unable to process version number {{v}; count={{c}}, err={{err}


# The "help" section contains help text used within the internal Ego debugger.
# These are generated when the "help" command is issued within the debugger.

[help]
break.at=Halt execution at a given line number
break.clear=Remove breakpoint for line number
Expand All @@ -290,6 +304,10 @@ step=Execute the next line of the program
step.over=Step over a function call to the next line in this program
step.return=Execute until the next return operation

# The "label" section contains the text used to label various output fields
# in a language-specific way. This most often refers to the output of built-in
# commands when generating text output (as opposed to json output).

[label]
Active=Active
Columns=Columns
Expand Down Expand Up @@ -335,6 +353,10 @@ symbols=symbols
username.prompt=Username:
version=version


# The "msg" section contains messages used by the CLI commands. These are non-error
# messages that are used to provide feedback to the user.

[msg]
config.deleted=Configuration {{name}} deleted
config.written=Configuration key {{key}} written
Expand Down Expand Up @@ -390,6 +412,11 @@ user.deleted=User {{user}} deleted
user.show=User "{{user}}" {{action}}
user.show.noperms=User "{{user}}" has no permissions


# The "opt" section contains option descriptions used by the --help option
# used with CLI commands. In general, the first term of the key is the primary
# subcommand.

[opt]
address.port=Specify address (and optionally port) of server
cache.list.assets=List only HTML assets in cache
Expand Down Expand Up @@ -490,6 +517,10 @@ table.update.filter=Filter for rows to update. If not specified, all rows are up
trace=Display trace of bytecode execution
username=Username for logon


# The "parm" section contains parameter descriptions used by the --help option to
# describe command line parameters that can be added to a command or subcommand.

[parm]
address.port=address:port
config.key.value=key=value
Expand Down
2 changes: 1 addition & 1 deletion tools/buildver.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.4-939
1.4-940
7 changes: 5 additions & 2 deletions tools/lang/compile.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ func compile(path, source, digest string) {
}

if doWrite {
source, _ = filepath.Abs(source)
fmt.Println("Generating " + source)

// Create the source file.
Expand Down Expand Up @@ -133,9 +134,11 @@ func compile(path, source, digest string) {
func compileFile(filename, language string, messages map[string]map[string]string) {
var prefix string

// Read the file into a buffer and split into lines separated by '\n'.
//fmt.Printf("Compiling %s\n", filename)
if logging {
fmt.Printf("Compiling %s\n", filename)
}

// Read the file into a buffer and split into lines separated by '\n'.
b, err := os.ReadFile(filename)
if err != nil {
panic(err)
Expand Down
7 changes: 7 additions & 0 deletions tools/lang/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ const (
compileOp = iota
)

var (
logging = false
)

func main() {
operation := compileOp

Expand All @@ -18,6 +22,9 @@ func main() {
for argc := 1; argc < len(os.Args); argc++ {
arg := os.Args[argc]
switch arg {
case "-l", "--logging":
logging = true

case "-c", "--compile":
operation = compileOp

Expand Down

0 comments on commit 177c996

Please sign in to comment.