keithmarshall pushed a commit to branch dev-gropdf-boxes in repository groff.
commit 4a639b37fc6ce331f4ca4d12cf320ec4c20cd783 Author: G. Branden Robinson <g.branden.robin...@gmail.com> AuthorDate: Mon Jan 4 17:53:05 2021 +1100 tmac/troffrc: Derive groff locale from system. Determine the groff locale (default input language) using the system locale. Use the environment if possible. Try LC_ALL first, then LANG. "C" means English (en). Otherwise, only the first two characters of the locale name are used. Unrecognized locales (those without a supporting xx.tmac file) are ignored, and groff falls back to English. Those who want groff's default locale to differ from LC_ALL/LANG should edit this troffrc to source the appropriate groff locale macro file (cs.tmac, de.tmac, den.tmac, fr.tmac, ja.tmac, sv.tmac, zh.tmac). --- tmac/troffrc | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/tmac/troffrc b/tmac/troffrc index d0d54b8..3ab545f 100644 --- a/tmac/troffrc +++ b/tmac/troffrc @@ -54,12 +54,29 @@ troffrc!html .el \ . do tr \[char65]\~ . -.\" Set the hyphenation language to English. -.do hla en . -.\" Load hyphenation patterns and exceptions. -.do hpf hyphen.en -.do hpfa hyphenex.en +.\" Determine the groff locale from the environment if possible. Try +.\" LC_ALL first, then LANG. "C" means English (en). Otherwise, only +.\" the first two characters of the locale name are used. +.do ds troffrc!language \V[LC_ALL] +.do if '\*[troffrc!language]'' \{\ +. do ds troffrc!language \V[LANG] +. do if '\*[troffrc!language]'' \ +. do ds troffrc!language C +.\} +.do if '\*[troffrc!language]'C' \ +. do ds troffrc!language en +.do length troffrc!lang_length \*[troffrc!language] +.do if (\n[troffrc!lang_length] > 2) \ +. do substring troffrc!language 0 1 +.do msoquiet \*[troffrc!language].tmac +.do rm troffrc!language +.do rr troffrc!lang_length +.\" If the configured system locale has no groff localization, fall back +.\" to English. +.do if !d locale \ +. do mso en.tmac +. . .\" Handle paper formats. .do mso papersize.tmac _______________________________________________ Groff-commit mailing list Groff-commit@gnu.org https://lists.gnu.org/mailman/listinfo/groff-commit