mirror of
https://github.com/nix-community/home-manager
synced 2024-11-19 09:39:45 +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" {
|
||||
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 <<EOF
|
||||
|
||||
All done! The home-manager tool should now be installed and you
|
||||
can edit
|
||||
|
||||
$confFile
|
||||
|
||||
to configure Home Manager. Run 'man home-configuration.nix' to
|
||||
see all available options.
|
||||
EOF
|
||||
if home-manager switch ; then
|
||||
# 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.' \
|
||||
"$confFile"
|
||||
exit 0
|
||||
else
|
||||
cat <<EOF
|
||||
|
||||
Uh oh, the installation failed! Please create an issue at
|
||||
|
||||
https://github.com/nix-community/home-manager/issues
|
||||
|
||||
if the error seems to be the fault of Home Manager.
|
||||
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.' \
|
||||
"https://github.com/nix-community/home-manager/issues"
|
||||
exit 1
|
||||
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
|
||||
''
|
||||
|
|
|
@ -8,7 +8,7 @@ msgid ""
|
|||
msgstr ""
|
||||
"Project-Id-Version: Home Manager\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"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\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 ""
|
||||
|
|
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_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 \
|
||||
|
|
Loading…
Reference in a new issue