Created asort_es-ES.py and etc.

Created file with appropriate translations, also minor changes in the README for asort.py, and minor grammar across the board.
This commit is contained in:
Unknown 2017-10-13 08:34:33 -07:00
parent b117d00ae0
commit 544a64796e
3 changed files with 88 additions and 5 deletions

View File

@ -1,4 +1,4 @@
# El Increíble Software de Linux
# Increíbles Softwares de Linux
[![Awesome](https://cdn.rawgit.com/sindresorhus/awesome/d7305f38d29fed78fa85652e3a63e154dd8e8829/media/badge.svg)](https://awesome.re/)
@ -944,7 +944,7 @@
### Bodhi
- [What is Bodhi](https://es.wikipedia.org/wiki/Bodhi_Linux)
- [¿Qué es Bodhi?](https://es.wikipedia.org/wiki/Bodhi_Linux)
- [Where to download Bodhi (Inglés)](http://www.bodhilinux.com/download/)
- [How do I install Bodhi (Inglés)](http://www.bodhilinux.com/w/installation-instructions/)
@ -959,7 +959,7 @@
### openSUSE
- [¿Qué es OpenSUSE? (Inglés)](https://es.wikipedia.org/wiki/OpenSUSE)
- [¿Qué es OpenSUSE?](https://es.wikipedia.org/wiki/OpenSUSE)
- [Reasons to try openSUSE (Inglés)](http://www.pcworld.com/article/222065/5_reasons_to_try_opensuse_114.html)
- [Preguntas frecuentes](https://es.opensuse.org/openSUSE:Preguntas_frecuentes)
- [Cómo instalar OpenSUSE](https://es.opensuse.org/Portal:Instalaci%C3%B3n)

View File

@ -22,6 +22,8 @@ This script only sorts items in the following topics for now (items between topi
## Note
`asort_zh.py` works for the file [README_zh-CN.md](https://github.com/VoLuong/Awesome-Linux-Software/blob/master/README_zh-CN.md), the Chinese version of this list.
`asort_pt-BR.py` works for the Brasilian Portuguese version of the file [README_pt-BR](https://github.com/VoLuong/Awesome-Linux-Software/blob/master/README_pt-BR.md)
`asort_zh.py` works for the Spanish version of the file [README_es-ES](https://github.com/VoLuong/Awesome-Linux-Software/blob/master/README_es-ES.md)
# License
MIT License.
@ -76,7 +78,7 @@ Licença MIT.
---------------------------------------------
# Español
'asot.py' es un es un simple script para garantizar los elementos del archivo README del repositorio [Awesome-Linux-Software](https://github.com/VoLuong/Awesome-Linux-Software) se ordenan alfabéticamente.
`asort.py` es un es un simple script para garantizar los elementos del archivo README del repositorio [Awesome-Linux-Software](https://github.com/VoLuong/Awesome-Linux-Software) se ordenan alfabéticamente.
Este script sólo puede ordenar elementos en estas secciones por ahora (Los elementos son las secciones entre aplicaciones y Configuración)
- Aplicaciones
@ -93,7 +95,11 @@ Este script sólo puede ordenar elementos en estas secciones por ahora (Los elem
![Una captura de pantalla de prueba](./test.png)
#Notas
`asort.py` es compatible con la versión en inglés de la lista [README](https://github.com/VoLuong/Awesome-Linux-Software/blob/master/README.md)
`asort_zh.py` es compatible con la versión china de la lista [README_zh-CN.md](https://github.com/VoLuong/Awesome-Linux-Software/blob/master/README_zh-CN.md)
`asort_pt-BR.py` es compatible con la versión portuguesa brasileña de la lista [README_pt-BR](https://github.com/VoLuong/Awesome-Linux-Software/blob/master/README_pt-BR.md)
`asort_es-ES.py` es compatible con la versión español de la lista [README_es-ES](https://github.com/VoLuong/Awesome-Linux-Software/blob/master/README_es-ES.md)
# Licencia
Licencia MIT

77
auto_sort/asort_es-ES.py Normal file
View File

@ -0,0 +1,77 @@
#!/usr/bin/env python3
# -*-coding: utf-8-*-
# Author : Christopher L
# Blog : http://blog.chriscabin.com
# GitHub : https://www.github.com/chrisleegit
# File : asort.py
# Date : 2016/08/22 11:12
# Version: 0.1
# Description: A very simple python script that can sort items alphabetically.
from __future__ import print_function
import os
import shutil
README_FILE = '../README_es-ES.md'
TEMP_FILE = 'temp_es-ES.md'
# only works for those items between BEGIN and END.
BEGIN = '## Aplicaciones'
END = '## Configurar'
def main():
global README_FILE
# make sure the script can find file: README.md
README_FILE = os.path.abspath(README_FILE)
if not os.path.exists(README_FILE):
print('Error: archivo o directorio no existe: {}'.format(README_FILE))
exit(1)
sort_enable = False
items = list()
print('cargando archivo: {}'.format(README_FILE))
# read file: README.md
with open(README_FILE) as infile, open(TEMP_FILE, 'w') as outfile:
# process each line
for line in infile:
if not sort_enable and BEGIN in line:
sort_enable = True
# if sort_enable and END in line:
# sort_enable = False
if sort_enable:
line = line.strip()
# each item starts with a character '-' (maybe '*' and '+')
if line.startswith(('-', '*', '+')):
items.append(line)
elif line.startswith('#'):
sort_enable = False if END in line else True
# when we meet the next header, we should stop adding new item to the list.
for item in sorted(items, key=lambda x: x.upper()):
# write the ordered list to the temporary file.
print(item, file=outfile)
print('', file=outfile)
items.clear()
# remember to put the next header in the temporary file.
print(line, file=outfile)
else:
print(line, end='', file=outfile)
else:
print(line, end='', file=outfile)
print('reemplazar el archivo original: README_es-ES.md')
shutil.move(TEMP_FILE, README_FILE)
if __name__ == '__main__':
main()