Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Chinese Translate #1

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion DEBIAN/control
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ Version: 1.0
Architecture: all
Essential: no
Priority: optional
Depends: deepin-editor, dde-file-manager, dde-file-manager-menu-oem
Depends: deepin-editor, dde-file-manager, dde-file-manager-menu-oem, zenity
Maintainer: <deepinenespanol.org> Dziban
Description: Extención OEM para crear archivos .desktop para archivos appimage u otros ejecutables, desde el menu contextual del click derecho.
10 changes: 8 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,16 @@

Start a .desktop file wizard from the right-click menu, to automatically create icon launchers for your executables (appimages, shell scripts, binaries etc).

**NOTE:** This app is intended for DeepinOS v20 and up. For now, it only supports english and spanish environments.
**NOTE:** This app is intended for DeepinOS v20 and up. For now, it only supports Chinese, English and Spanish environments.

## [ES]

Inicializa un asistente para la creación de archivos .desktop de tus ejecutables (appimages, shell scripts, binarios etc) para ser integrados al lanzador de aplicaciones de forma automatica; desde el menu de click derecho.

**NOTA:** Esta app esta hecha para correr en DeepinOS v20 en adelante. Por ahora, solo soporta entornos en ingles y español.
**NOTA:** Esta app esta hecha para correr en DeepinOS v20 en adelante. Por ahora, solo soporta entornos en chino, ingles y español.

## [zh_CN]

  通过右键菜单启动 .desktop 创建向导。

  **提示:**此软件适用与深度操作系统20版。
101 changes: 76 additions & 25 deletions usr/bin/appknitter.sh
Original file line number Diff line number Diff line change
@@ -1,24 +1,29 @@
#!/bin/bash
#GETTING SYSTEM LANGUAGE
LANG=$(locale | grep LANGUAGE | cut -d= -f2 | cut -d_ -f1)
#TRANSLATION VARIABLES
#Titles
#---Name Request Window
readonly NAME_REQUEST_TIL_en="New .desktop File's Name"
readonly NAME_REQUEST_TIL_en="New .desktop File Name"
readonly NAME_REQUEST_TIL_es="Nombre Para .desktop Nuevo"
readonly NAME_REQUEST_TIL_zh_CN=".desktop 文件名"
readonly EXEC_REQUEST_TIL_en="Select Executable File"
readonly EXEC_REQUEST_TIL_es="Selecciona Un Archivo Ejecutable"
readonly ICON_REQUEST_TIL_en="Select Icon File (.svg)"
readonly ICON_REQUEST_TIL_es="Selecciona Archivo para Icono (.svg)"
readonly EXEC_REQUEST_TIL_zh_CN="选择执行文件"
readonly ICON_REQUEST_TIL_en="Select Icon File (.svg) (.png)"
readonly ICON_REQUEST_TIL_es="Selecciona Archivo para Icono (.svg) (.png)"
readonly ICON_REQUEST_TIL_zh_CN="选择图标(.svg)(.png)"
readonly CATEG_REQUEST_TIL_en="Select Launcher Catergory"
readonly CATEG_REQUEST_TIL_es="Selecciona un Catergoria Para El Lanzador"
readonly CATEG_REQUEST_TIL_zh_CN="选择分类"
readonly KEYW_REQUEST_TIL_en="Write Keywords"
readonly KEYW_REQUEST_TIL_es="Escribe Palabras Clave"
readonly KEYW_REQUEST_TIL_zh_CN="输入关键词"
#Dialosgs
readonly NAME_REQUEST_DLG_en="Choose a name for your '.desktop' file.
Press cancel to quit."
readonly NAME_REQUEST_DLG_es="Escribe un nombre para el archivo '.desktop'.
Presiona Cancelar para salir."
readonly NAME_REQUEST_DLG_zh_CN="请给 .desktop 文件起个名。
点击取消将退出。"
readonly NAME_REQUEST2_DLG_en="The name entry must not be empty!
Please, choose a name for your '.desktop' file.

Expand All @@ -27,52 +32,97 @@ readonly NAME_REQUEST2_DLG_es="La entrada no puede ser vacía!
Porfavor, selecciona un nombre para el arhivo '.desktop'.

O Presiona Cancelar para salir."
readonly NAME_REQUEST2_DLG_zh_CN="没有输入有效内容。
请给 .desktop 文件起个名

或者点击取消以退出。"

readonly CATEG_REQUEST_DLG_en="Launcher Category"
readonly CATEG_REQUEST_DLG_es="Categoria del lanzador"
readonly CATEG_REQUEST_DLG_zh_CN="分类"
readonly CATEG_REQUEST_DLG2_en="Choose one option"
readonly CATEG_REQUEST_DLG2_es="Elige Una Opción"
readonly CATEG_REQUEST_COMBO_en="Internet|Chat|Music|Video|Graphics|Office|Development|System|Others"
readonly CATEG_REQUEST_COMBO_es="Internet|Chat|Music|Video|Graphics|Office|Development|System|Others"
readonly CATEG_REQUEST_DLG2_zh_CN="选择一个分类"
readonly CATEG_REQUEST_COMBO_en="Internet|Chat|Music|Video|Graphics|Office|Literature|Development|System|Other"
readonly CATEG_REQUEST_COMBO_es="Internet|Mensajería|Música|Vídeo|Gráficos|Ofimática|Lectura|Desarrollo|Sistema|Otro"
readonly CATEG_REQUEST_COMBO_zh_CN="网络应用|社交沟通|音乐欣赏|视频播放|图形图像|办公学习|阅读|编程开发|系统管理|其他应用"
readonly KEYW_REQUEST_DLG_en="Write 'keywords' for the application."
readonly KEYW_REQUEST_DLG_es="Escribe 'palabras clave' para la aplicación."
readonly KEYW_REQUEST_DLG_zh_CN="填写关键词"
readonly KEYW_REQUEST_DLG2_en="example;of;how;to;type;keywords;here"
readonly KEYW_REQUEST_DLG2_es="ejemplo;de;como;escribir;las;palabras;clave"
readonly KEYW_REQUEST_DLG2_zh_CN="这里;是;示例;type;keywords"
#Button Labels
readonly BTN_OK_en="OK"
readonly BTN_CANCEL_en="Cancel"
readonly BTN_OPEN_en="Open"
readonly BTN_OK_es="Aceptar"
readonly BTN_CANCEL_es="Cancelar"
readonly BTN_OPEN_es="Abrir"
readonly BTN_OK_zh_CN="确定"
readonly BTN_CANCEL_zh_CN="取消"
readonly BTN_OPEN_zh_CN="打开"
###############################################################
declare -r -A CATEG_en=( [Internet]=Internet [Chat]=Chat [Video]=Video [Music]=Music [Graphics]=Graphics [Office]=Office [Development]=Development [System]=System [Other]=Others )
declare -r -A CATEG_es=( [Internet]=Internet [Mensajería]=Chat [Música]=Music [Vídeo]=Video [Gráficos]=Graphics [Ofimática]=Office [Desarollo]=Development [Lectura]=Literature [Sistema]=System [Otro]=Others )
declare -r -A CATEG_zh_CN=( [网络应用]=Internet [社交沟通]=Chat [音乐欣赏]=Music [视频播放]=Video [图形图像]=Graphics [办公学习]=Office [阅读]=Literature [编程开发]=Development [系统管理]=System [其他应用]=Others )
###############################################################
#GETTING SYSTEM LANGUAGE
GET_LANG=$(locale | grep LANGUAGE= | cut -d= -f2)
if [ ! -n "${GET_LANG}" ]; then
GET_LANG=$(locale | grep LANG= | cut -d= -f2 | cut -d. -f1)
fi
if [ ! -n "${GET_LANG}" ]; then
GET_LANG=$(locale | grep LC_ALL= | cut -d= -f2 | cut -d. -f1)
fi
if [ ! -n "${GET_LANG}" ]; then
GET_LANG=en
fi
eval "title=\$NAME_REQUEST_TIL_${GET_LANG}"
if [ ! -n "$title" ]; then
GET_LANG=$(echo $GET_LANG | cut -d_ -f1)
eval "title=\$NAME_REQUEST_TIL_${GET_LANG}"
fi
#----NAME
eval "title=\$NAME_REQUEST_TIL_${LANG}"
eval "text=\$NAME_REQUEST_DLG_${LANG}"
eval "text2=\$NAME_REQUEST2_DLG_${LANG}"
eval "text=\$NAME_REQUEST_DLG_${GET_LANG}"
eval "text2=\$NAME_REQUEST2_DLG_${GET_LANG}"
#---BUTTONS
eval "btn_ok=\$BTN_OK_${GET_LANG}"
eval "btn_cancel=\$BTN_CANCEL_${GET_LANG}"
eval "btn_open=\$BTN_OPEN_${GET_LANG}"
###############################################################
get_name(){
zenity --entry --width=300 --title="$title" --text="$text"
zenity --entry --width=300 --title="$title" --text="$text" --ok-label="$btn_ok" --cancel-label="$btn_cancel"
}
name=$(get_name) || exit
while [ "$(expr match "$name" '.')" -lt "1" ]; do
zenity --entry --width=300 --title="$title" --text="$text2"
zenity --entry --width=300 --title="$title" --text="$text2" --ok-label="$btn_ok" --cancel-label="$btn_cancel"
name=$(get_name) || exit
done
#----EXEC
eval "title=\$EXEC_REQUEST_TIL_${LANG}"
eval "title=\$EXEC_REQUEST_TIL_${GET_LANG}"
exec=$(zenity --title="$title" --file-selection)
#----ICON
eval "title=\$ICON_REQUEST_TIL_${LANG}"
eval "title=\$ICON_REQUEST_TIL_${GET_LANG}"
icon=$(zenity --title="$title" --file-selection)
#----CATEG
eval "title=\$CATEG_REQUEST_TIL_${LANG}"
eval "text=\$CATEG_REQUEST_DLG_${LANG}"
eval "text2=\$CATEG_REQUEST_DLG2_${LANG}"
eval "combo=\$CATEG_REQUEST_COMBO_${LANG}"
eval "title=\$CATEG_REQUEST_TIL_${GET_LANG}"
eval "text=\$CATEG_REQUEST_DLG_${GET_LANG}"
eval "text2=\$CATEG_REQUEST_DLG2_${GET_LANG}"
eval "combo=\$CATEG_REQUEST_COMBO_${GET_LANG}"
categ=$(zenity --forms --width=350 --title="$title" --text="$text" --add-combo="$text2" --combo-values="$combo")
#----KEYW
eval "title=\$KEYW_REQUEST_TIL_${LANG}"
eval "text=\$KEYW_REQUEST_DLG_${LANG}"
eval "text2=\$KEYW_REQUEST_DLG2_${LANG}"
keyw=$(zenity --entry --width=350 --title="$title" --entry-text="$text2" --text="$text")
eval "title=\$KEYW_REQUEST_TIL_${GET_LANG}"
eval "text=\$KEYW_REQUEST_DLG_${GET_LANG}"
eval "text2=\$KEYW_REQUEST_DLG2_${GET_LANG}"
keyw=$(zenity --entry --width=350 --title="$title" --entry-text="$text2" --text="$text" --ok-label="$btn_ok" --cancel-label="$btn_cancel")
#
if [ ! -d "$HOME/.local/share/applications" ]
then
mkdir ~/.local/share/applications
fi
CATEGORY=CATEG_${GET_LANG}
KEY_CAT=${CATEGORY}[${categ}]
cat > ~/.local/share/applications/${name}.desktop<<EOT
[Desktop Entry]
Version=1.0
Expand All @@ -81,11 +131,12 @@ Type=Application
Name=$name
Exec=$exec
Icon=$icon
Categories=${categ};
Categories=${!KEY_CAT};
Keywords=${keyw};
EOT
cat /var/run/myProcess.pid | sudo xargs kill -9
chmod +x ~/.local/share/applications/${name}.desktop
chmod +x $exec
dedit ~/.local/share/applications/${name}.desktop

if which dedit >/dev/null; then
dedit -w ~/.local/share/applications/${name}.desktop
fi
2 changes: 2 additions & 0 deletions usr/share/deepin/dde-file-manager/oem-menuextensions/newdesktopfile.desktop
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@ Exec=/usr/bin/appknitter.sh
Name=Create new .desktop file
Name[es]=Crear nuevo ejecutable .desktop
Name[en]=Create new .desktop file
Name[zh_CN]=创建新的 .desktop 文件
GenericName[es]=Crear nuevo ejecutable .desktop
GenericName[en]=Create new .desktop file
GenericName[zh_CN]=创建新的 .desktop 文件
Terminal=false
Type=Application
MimeType=application/octet-stream
Expand Down