From 3d9eb1cecd3f2d9f96c60bf9f78899fe54291e9f Mon Sep 17 00:00:00 2001 From: Robert Helgesson Date: Tue, 14 Dec 2021 18:44:47 +0100 Subject: [PATCH] home-manager: support i18n of install script --- home-manager/install.nix | 49 ++++++++++++++++---------------- home-manager/po/home-manager.pot | 35 ++++++++++++++++++++++- xgettext | 3 +- 3 files changed, 60 insertions(+), 27 deletions(-) diff --git a/home-manager/install.nix b/home-manager/install.nix index cf45f14dc..f69508a85 100644 --- a/home-manager/install.nix +++ b/home-manager/install.nix @@ -1,15 +1,25 @@ -{ home-manager, runCommand }: +{ home-manager, gettext, runCommand, ncurses }: -runCommand "home-manager-install" { - propagatedBuildInputs = [ home-manager ]; +let + + hmBashLibInit = '' + export TEXTDOMAIN=home-manager + export TEXTDOMAINDIR=${home-manager}/share/locale + source ${home-manager}/share/bash/home-manager.sh + ''; + +in runCommand "home-manager-install" { + propagatedBuildInputs = [ home-manager gettext ncurses ]; preferLocalBuild = true; shellHookOnly = true; shellHook = '' + ${hmBashLibInit} + confFile="''${XDG_CONFIG_HOME:-$HOME/.config}/nixpkgs/home.nix" if [[ ! -e $confFile ]]; then echo - echo "Creating initial Home Manager configuration..." + _i "Creating initial Home Manager configuration..." nl=$'\n' xdgVars="" @@ -53,34 +63,23 @@ runCommand "home-manager-install" { fi echo - echo "Creating initial Home Manager generation..." + _i "Creating initial Home Manager generation..." echo - if home-manager switch; then - cat <\n" "Language-Team: LANGUAGE \n" @@ -132,3 +132,36 @@ msgstr "" #: home-manager/home-manager:702 msgid "Unknown command: %s" msgstr "" + +#: home-manager/install.nix:22 +msgid "Creating initial Home Manager configuration..." +msgstr "" + +#: home-manager/install.nix:66 +msgid "Creating initial Home Manager generation..." +msgstr "" + +#. translators: The "%s" specifier will be replaced by a file path. +#: home-manager/install.nix:71 +msgid "" +"All done! The home-manager tool should now be installed and you can edit\n" +"\n" +" %s\n" +"\n" +"to configure Home Manager. Run 'man home-configuration.nix' to\n" +"see all available options." +msgstr "" + +#. translators: The "%s" specifier will be replaced by a URL. +#: home-manager/install.nix:76 +msgid "" +"Uh oh, the installation failed! Please create an issue at\n" +"\n" +" %s\n" +"\n" +"if the error seems to be the fault of Home Manager." +msgstr "" + +#: home-manager/install.nix:83 +msgid "This derivation is not buildable, please run it using nix-shell." +msgstr "" diff --git a/xgettext b/xgettext index c259e662a..8580a324f 100755 --- a/xgettext +++ b/xgettext @@ -22,13 +22,14 @@ function run() { -k_ipError:1,2 --flag=_ip:1:c-format --flag=_ip:2:c-format \ -k_ipWarn:1,2 --flag=_ip:1:c-format --flag=_ip:2:c-format \ -k_ipNote:1,2 --flag=_ip:1:c-format --flag=_ip:2:c-format \ + --add-comments=translators: \ -o "$output" -d "$domain" "$@" } run 'Home Manager' \ home-manager/po/home-manager.pot \ home-manager \ - home-manager/home-manager + home-manager/home-manager home-manager/**/*.nix run 'Home Manager Modules' \ modules/po/hm-modules.pot \