mirror of
https://github.com/nix-community/home-manager
synced 2024-12-20 16:59:47 +01:00
home-manager: support i18n of install script
This commit is contained in:
parent
c1677de31a
commit
3d9eb1cecd
3 changed files with 60 additions and 27 deletions
|
@ -1,15 +1,25 @@
|
||||||
{ home-manager, runCommand }:
|
{ home-manager, gettext, runCommand, ncurses }:
|
||||||
|
|
||||||
runCommand "home-manager-install" {
|
let
|
||||||
propagatedBuildInputs = [ home-manager ];
|
|
||||||
|
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;
|
preferLocalBuild = true;
|
||||||
shellHookOnly = true;
|
shellHookOnly = true;
|
||||||
shellHook = ''
|
shellHook = ''
|
||||||
|
${hmBashLibInit}
|
||||||
|
|
||||||
confFile="''${XDG_CONFIG_HOME:-$HOME/.config}/nixpkgs/home.nix"
|
confFile="''${XDG_CONFIG_HOME:-$HOME/.config}/nixpkgs/home.nix"
|
||||||
|
|
||||||
if [[ ! -e $confFile ]]; then
|
if [[ ! -e $confFile ]]; then
|
||||||
echo
|
echo
|
||||||
echo "Creating initial Home Manager configuration..."
|
_i "Creating initial Home Manager configuration..."
|
||||||
|
|
||||||
nl=$'\n'
|
nl=$'\n'
|
||||||
xdgVars=""
|
xdgVars=""
|
||||||
|
@ -53,34 +63,23 @@ runCommand "home-manager-install" {
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo
|
echo
|
||||||
echo "Creating initial Home Manager generation..."
|
_i "Creating initial Home Manager generation..."
|
||||||
echo
|
echo
|
||||||
|
|
||||||
if home-manager switch; then
|
if home-manager switch ; then
|
||||||
cat <<EOF
|
# translators: The "%s" specifier will be replaced by a file path.
|
||||||
|
_i $'All done! The home-manager tool should now be installed and you can edit\n\n %s\n\nto configure Home Manager. Run \'man home-configuration.nix\' to\nsee all available options.' \
|
||||||
All done! The home-manager tool should now be installed and you
|
"$confFile"
|
||||||
can edit
|
|
||||||
|
|
||||||
$confFile
|
|
||||||
|
|
||||||
to configure Home Manager. Run 'man home-configuration.nix' to
|
|
||||||
see all available options.
|
|
||||||
EOF
|
|
||||||
exit 0
|
exit 0
|
||||||
else
|
else
|
||||||
cat <<EOF
|
# translators: The "%s" specifier will be replaced by a URL.
|
||||||
|
_i $'Uh oh, the installation failed! Please create an issue at\n\n %s\n\nif the error seems to be the fault of Home Manager.' \
|
||||||
Uh oh, the installation failed! Please create an issue at
|
"https://github.com/nix-community/home-manager/issues"
|
||||||
|
|
||||||
https://github.com/nix-community/home-manager/issues
|
|
||||||
|
|
||||||
if the error seems to be the fault of Home Manager.
|
|
||||||
EOF
|
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
'';
|
'';
|
||||||
} ''
|
} ''
|
||||||
echo This derivation is not buildable, instead run it using nix-shell.
|
${hmBashLibInit}
|
||||||
|
_iError 'This derivation is not buildable, please run it using nix-shell.'
|
||||||
exit 1
|
exit 1
|
||||||
''
|
''
|
||||||
|
|
|
@ -8,7 +8,7 @@ msgid ""
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"Project-Id-Version: Home Manager\n"
|
"Project-Id-Version: Home Manager\n"
|
||||||
"Report-Msgid-Bugs-To: https://github.com/nix-community/home-manager/issues\n"
|
"Report-Msgid-Bugs-To: https://github.com/nix-community/home-manager/issues\n"
|
||||||
"POT-Creation-Date: 2021-12-13 00:45+0100\n"
|
"POT-Creation-Date: 2021-12-14 18:53+0100\n"
|
||||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||||
|
@ -132,3 +132,36 @@ msgstr ""
|
||||||
#: home-manager/home-manager:702
|
#: home-manager/home-manager:702
|
||||||
msgid "Unknown command: %s"
|
msgid "Unknown command: %s"
|
||||||
msgstr ""
|
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 ""
|
||||||
|
|
3
xgettext
3
xgettext
|
@ -22,13 +22,14 @@ function run() {
|
||||||
-k_ipError:1,2 --flag=_ip:1:c-format --flag=_ip:2:c-format \
|
-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_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 \
|
-k_ipNote:1,2 --flag=_ip:1:c-format --flag=_ip:2:c-format \
|
||||||
|
--add-comments=translators: \
|
||||||
-o "$output" -d "$domain" "$@"
|
-o "$output" -d "$domain" "$@"
|
||||||
}
|
}
|
||||||
|
|
||||||
run 'Home Manager' \
|
run 'Home Manager' \
|
||||||
home-manager/po/home-manager.pot \
|
home-manager/po/home-manager.pot \
|
||||||
home-manager \
|
home-manager \
|
||||||
home-manager/home-manager
|
home-manager/home-manager home-manager/**/*.nix
|
||||||
|
|
||||||
run 'Home Manager Modules' \
|
run 'Home Manager Modules' \
|
||||||
modules/po/hm-modules.pot \
|
modules/po/hm-modules.pot \
|
||||||
|
|
Loading…
Reference in a new issue