poe

Уређивач .po фајлова
git clone https://git.sr.ht/~strahinja/poe
Дневник | Датотеке | Референце | ПРОЧИТАЈМЕ | ЛИЦЕНЦА

чување da3643103de832533eef3c4fd8d8c066ad727511
родитељ 114d05467b35818063605a26a18bb0c1aca4f2ff
Аутор: Страхиња Радић <contact@strahinja.org>
Датум:   Mon, 29 Apr 2024 16:19:02 +0200

poe.1.in: Convert to mdoc(7); poe.c(main): Also print copyright with -V

Signed-off-by: Страхиња Радић <contact@strahinja.org>

Diffstat:
Mpoe.1.in | 355++++++++++++++++++++++++++++++++++---------------------------------------------
Mpoe.c | 7+++++++
измењених датотека: 2, додавања: 158(+), брисања: 204(-)

diff --git a/poe.1.in b/poe.1.in @@ -1,236 +1,183 @@ -'\" t -.\" Manpage for poe(1) -.\" vim: set filetype=groff: -. -.mso an-ext.tmac -.de CDS -.EX -.RS \\$1 -.sp 1 -.. -.de CDE -.sp 1 -.RE -.EE -.. -.de RDS -.RS \\$1 -.sp 1 -.. -.de RDE -.sp 1 -.RE -.. -. -.TH POE "1" "%DATE%" "poe %VERSION%" "General Commands Manual" -.SH NAME -poe \- .po file editor -. -.SH SYNOPSIS -. -.SY poe -.OP "\-h \fR|\fP \-\-help" -.YS -. -.SY poe -.OP "\-V \fR|\fP \-\-full\-version" -.YS -. -.SY poe -.OP "\-v \fR|\fP \-\-version" -.YS -. -.SY poe -.RI [ filename.po ] -.YS -. -.SH COPYRIGHT -. -.LP -poe Copyright \(co 2021\-2024 Strahinya Radich. -.br -This program is licensed under GNU GPL v3 or later. -See the file -.I LICENSE -in the poe repository for details. -File \fItermbox.h\fR is based on termbox2 TUI library, (c) 2021 termbox -developers, which is released under the terms of Expat license, see the file -.IR LICENSE.termbox . -. -.SH DESCRIPTION -. -.LP -.B poe +.\" This program is licensed under the terms of GNU GPL v3 or (at your option) +.\" any later version. Copyright (C) 2021-2024 Страхиња Радић. +.\" See the file LICENSE for exact copyright and license details. +.Dd %DATE% +.Dt POE 1 +.Os +.Sh NAME +.Nm poe +.Nd .po file editor +.Sh SYNOPSIS +.Nm +.Fl h | \-help | Fl V | \-full\-version | Fl v | \-version | +.Ar filename.po +.Sh DESCRIPTION is a .po (GNU gettext) file editor with a terminal UI. -.SH "KEY BINDINGS" -. -.LP +.Bl -tag -width Ds +.It Fl h | \-help +Show option summary. +.It Fl V | \-full\-version +Show full version information: like +.Fl v , +followed by copyright notice and defines set in +.Pa config.h . +.It Fl v | \-version +Show version information: program version and source git repository commit date. +.El +.Ss "KEY BINDINGS" Main window key bindings are as follows: -. .TS box tab(@); l l. \fBKey\fR@\fBAction\fR _ -\fCEsc\fR@Close dialog or clear error -\fCEnter\fR@Edit entry -\fCH\fR or \fCF1\fR@Show help dialog -\fC/\fR or \fCF7\fR@Incremental search (end input with Enter) -\fCn\fR or \fCF3\fR@Find next -\fCN\fR or \fCF4\fR@Find previous -\fCu\fR or \fCF8\fR@Go to next untranslated entry -\fCf\fR or \fCF9\fR@Go to next fuzzy entry -\fCw\fR or \fCC-S\fR@Save file (with backup) -\fCg\fR or \fCHome\fR@Go to first entry -\fCC-B\fR or \fCPgUp\fR@Go to previous page -\fCk\fR or \fC\[ua]\fR@Go to previous entry -\fCj\fR or \fC\[da]\fR@Go to next entry -\fCC-F\fR or \fCPgDn\fR@Go to next page -\fCG\fR or \fCEnd\fR@Go to last entry -\fCz\fR or \fCC-Z\fR@Toggle fuzzy flag -\fCq\fR or \fCC-Q\fR@Quit +\f[CR]Esc\fR@Close dialog or clear error +\f[CR]Enter\fR@Edit entry +\f[CR]H\fR or \f[CR]F1\fR@Show help dialog +\f[CR]/\fR or \f[CR]F7\fR@Incremental search (end input with Enter) +\f[CR]n\fR or \f[CR]F3\fR@Find next +\f[CR]N\fR or \f[CR]F4\fR@Find previous +\f[CR]u\fR or \f[CR]F8\fR@Go to next untranslated entry +\f[CR]f\fR or \f[CR]F9\fR@Go to next fuzzy entry +\f[CR]w\fR or \f[CR]C-S\fR@Save file (with backup) +\f[CR]g\fR or \f[CR]Home\fR@Go to first entry +\f[CR]C-B\fR or \f[CR]PgUp\fR@Go to previous page +\f[CR]k\fR or \f[CR]\[ua]\fR@Go to previous entry +\f[CR]j\fR or \f[CR]\[da]\fR@Go to next entry +\f[CR]C-F\fR or \f[CR]PgDn\fR@Go to next page +\f[CR]G\fR or \f[CR]End\fR@Go to last entry +\f[CR]z\fR or \f[CR]C-Z\fR@Toggle fuzzy flag +\f[CR]q\fR or \f[CR]C-Q\fR@Quit .TE -. .sp 1 -. -.LP +.Pp Edit dialog key bindings are as follows: -. .TS box tab(@); l l. \fBKey\fR@\fBAction\fR _ -\fCC-S\fR@Update entry and close dialog -\fCC-B\fR or \fCPgUp\fR@Update entry and edit previous entry -\fCC-F\fR or \fCPgDn\fR@Update entry and edit next entry -\fCC-P\fR@Show previous plural form of msgstr -\fCC-N\fR@Show next plural form of msgstr -\fCEscape\fR@Cancel changes and close dialog -\fCC-C\fR@Yank (copy) current msgstr to paste buffer -\fCC-V\fR@Paste the contents of paste buffer into current msgstr -\fCF8\fR@Go to next untranslated entry -\fCF9\fR@Go to next fuzzy entry -\fCF5\fR@Copy msgid to edit box as current msgstr -\fCF6\fR@Toggle focus between info box and edit box -\fCC-Z\fR@Toggle fuzzy flag -\fCC-A\fR or \fCHome\fR@Go to start of line -\fCC-E\fR or \fCEnd\fR@Go to end of line -\fCC-U\fR@Erase to start of line -\fCC-K\fR@Erase to end of line -\fCC-R\fR@Go to previous word -\fCC-T\fR@Go to next word -\fCC-W\fR@Erase previous word -\fC\[ua]\fR@Go to previous line -\fC\[<-]\fR@Go to previous character -\fC\[->]\fR@Go to next character -\fC\[da]\fR@Go to next line +\f[CR]C-S\fR@Update entry and close dialog +\f[CR]C-B\fR or \f[CR]PgUp\fR@Update entry and edit previous entry +\f[CR]C-F\fR or \f[CR]PgDn\fR@Update entry and edit next entry +\f[CR]C-P\fR@Show previous plural form of msgstr +\f[CR]C-N\fR@Show next plural form of msgstr +\f[CR]Escape\fR@Cancel changes and close dialog +\f[CR]C-C\fR@Yank (copy) current msgstr to paste buffer +\f[CR]C-V\fR@Paste the contents of paste buffer into current msgstr +\f[CR]F8\fR@Go to next untranslated entry +\f[CR]F9\fR@Go to next fuzzy entry +\f[CR]F5\fR@Copy msgid to edit box as current msgstr +\f[CR]F6\fR@Toggle focus between info box and edit box +\f[CR]C-Z\fR@Toggle fuzzy flag +\f[CR]C-A\fR or \f[CR]Home\fR@Go to start of line +\f[CR]C-E\fR or \f[CR]End\fR@Go to end of line +\f[CR]C-U\fR@Erase to start of line +\f[CR]C-K\fR@Erase to end of line +\f[CR]C-R\fR@Go to previous word +\f[CR]C-T\fR@Go to next word +\f[CR]C-W\fR@Erase previous word +\f[CR]Up\fR@Go to previous line +\f[CR]Left\fR@Go to previous character +\f[CR]Right\fR@Go to next character +\f[CR]Down\fR@Go to next line .TE -. .sp 1 -. -.LP +.Pp In the table above, "current msgstr" refers to the situation when there are -multiple msgstrs, representing different plural forms. Only the currently shown -plural form is affected. -. -.LP -When the info box is focused, arrow keys, \fCC-B\fR/\fCC-F\fR -(\fCPgUp\fR/\fCPgDn\fR) and \fCC-A\fR/\fCC-E\fR (\fCHome\fR/\fCEnd\fR) keys -scroll the info box. -. -.LP +multiple msgstrs, representing different plural forms. +Only the currently shown plural form is affected. +.Pp +When the info box is focused, arrow keys, \f[CR]C-B\fR/\f[CR]C-F\fR +(\f[CR]PgUp\fR/\f[CR]PgDn\fR) and \f[CR]C-A\fR/\f[CR]C-E\fR +(\f[CR]Home\fR/\f[CR]End\fR) keys scroll the info box. +.Pp When the search box is open, relevant text editing and movement commands from -the edit box also apply. For example, \fCC-R\fR moves one word backwards, and -\fCC-W\fR deletes one word backwards. -. -.SH "STATUS LINE" -. -.LP -Status line is comprised of a number of segments, by default three. The central -segment displays the current message number, the total messages count, then in -parentheses: number of untranslated messages, number of fuzzy messages and the -number of obsolete messages. Obsolete messages are messages whose msgid doesn't -match any msgid in the message catalog anymore, and are commented out in the .po -file using \fC#~\fR comments. -. -.SH "MESSAGE FLAGS" -. -.LP +the edit box also apply. +For example, \f[CR]C-R\fR moves one word backwards, and \f[CR]C-W\fR deletes one +word backwards. +. +.Ss "STATUS LINE" +Status line is comprised of a number of segments, by default three. +The central segment displays the current message number, the total messages +count, then in parentheses: number of untranslated messages, number of fuzzy +messages and the number of obsolete messages. +Obsolete messages are messages whose msgid doesn't match any msgid in the +message catalog anymore, and are commented out in the .po file using \f[CR]#~\fR +comments. +. +.Ss "MESSAGE FLAGS" Message flags are shown to the left of the msgid in the main window and the -statusbar of the edit box. They mean the following: -. +statusbar of the edit box. +They mean the following: .TS box tab(@); l l. \fBCharacter\fR@\fBMeaning\fR _ -\fCC\fR@\fCc-format\fR flag -\fCF\fR@\fCfuzzy\fR flag -\fCP\fR@Message has plural forms -\fCN\fR@\fCno-c-format\fR flag +\f[CR]C\fR@\f[CR]c-format\fR flag +\f[CR]F\fR@\f[CR]fuzzy\fR flag +\f[CR]P\fR@Message has plural forms +\f[CR]N\fR@\f[CR]no-c-format\fR flag .TE . -.sp 1 -. -.SH "ERROR CHECKING" -. -.LP -.B poe -has some rudimentary checks of the translated messages built in. First, when -saving changes in the edit box, if the msgid has a newline character -(\fC\\n\fR), a dot (\fC.\fR) or a space (\fC\~\fR) at the end, and the +.Ss "ERROR CHECKING" +.Nm +has some rudimentary checks of the translated messages built in. +First, when saving changes in the edit box, if the msgid has a newline character +(\f[CR]\\n\fR), a dot (\f[CR].\fR) or a space (\f[CR]\~\fR) at the end, and the corresponding msgstr doesn't, msgstr being saved will have its ending character -made to match the one from the msgid. This feature can be disabled by commenting -out the \fCMATCH_MSGSTR_ENDING\fR feature flag. -. -.PP -Second, if the numbers of newline characters (\fC\\n\fR), or, additionally, dots -when \fCWARN_COUNT_DOTS\fR is set, in msgid and msgstr don't match, msgstr will -be shown in a different color on the main screen. If the number of newlines was -intended, you can simply ignore this warning. Otherwise, it can be useful to -detect unwanted discrepancies in formatting between the original message and the -translation. -. -.SH AUTHOR -. -Strahinya Radich, -.UR https://\:strahinja.org -.UE -. -.SH "KNOWN LIMITATIONS" +made to match the one from the msgid. +This feature can be disabled by commenting out the +.Dv MATCH_MSGSTR_ENDING +feature flag. +. +.Pp +Second, if the numbers of newline characters (\f[CR]\\n\fR), or, additionally, +dots when +.Dv WARN_COUNT_DOTS +is set, in msgid and msgstr don't match, msgstr will be shown in a different +color on the main screen. +If the number of newlines was intended, you can simply ignore this warning. +Otherwise, it can be useful to detect unwanted discrepancies in formatting +between the original message and the translation. +. +.Sh AUTHORS +.An "Strahinya Radich" Aq contact@strahinja.org , +2021\-2024 +. +.Sh BUGS +Bugs can be reported using the ticket tracker at: +.Lk https://\:todo.sr.ht/\:~strahinja/\:poe . -.IP \(bu 4 +.Ss "KNOWN LIMITATIONS" +.Bl -bullet -width 1m +.It UTF-8 character set is assumed. -. -.IP \(bu -CJK characters are unsupported/problematic. This is a limitation of termbox -library. See -. -.IP "" 4 -.UR https://\:github.com/\:nsf/\:termbox -.UE -. -.IP +.It +CJK characters are unsupported/problematic. +This is a limitation of termbox library. +See +.Lk https://\:github.com/\:nsf/\:termbox for more details. -. -.IP \(bu +.It Only one file can be edited at a time, and no additional files can be loaded at -runtime. This is a design decision. -. -.IP \(bu -Unless the define \fCCREATE_BACKUPS\fR is commented out before compilation, the -directory of the edited file must be writable by the user in order to write the -changes to the file. This is due to creating backups in order to avoid the -potential data loss under specific circumstances (loss of power during write). -. -.IP \(bu -Only the flags \fIfuzzy\fR, \fIc-format\fR and \fIno-c-format\fR are supported. -Other flags will be stripped on save. This is a design decision. -. -.SH BUGS -. -.LP -Bugs can be reported using the ticket tracker at: -.UR https://\:todo.sr.ht/\:~strahinja/\:poe -.UE +runtime. +This is a design decision. +.It +Unless the define +.Dv CREATE_BACKUPS +is commented out before compilation, the directory of the edited file must be +writable by the user in order to write the changes to the file. +This is due to creating backups in order to avoid the potential data loss under +specific circumstances (loss of power during write). +.It +Only the flags +.Dv fuzzy , +.Dv c\-format +and +.Dv no\-c\-format +are supported. +Other flags will be stripped on save. +This is a design decision. +.El diff --git a/poe.c b/poe.c @@ -15,6 +15,12 @@ #define TB_OPT_V1_COMPAT #define TB_IMPL +#define COPYRIGHT \ + (" This program is licensed under the terms of GNU GPL v3" \ + " or (at your option)\n" \ + " any later version. Copyright (C) 2021-2024 Strahinya Radich.\n" \ + " See the file LICENSE for exact copyright and license " \ + "details.\n") #define POE_C_GLOBALS #include "version.h" @@ -2163,6 +2169,7 @@ main(int argc, char** argv) else if (!strcmp(argv[1], "-V") || !strcmp(argv[1], "--full-version")) { printf("%s %s, committed on %s\n", PROGRAMNAME, VERSION, DATE); + puts(COPYRIGHT); printf("Features set in config.h:\n"); #ifdef CREATE_BACKUPS printf(" CREATE_BACKUPS:\tset\n");