Skip to content

Commit

Permalink
Fixed import errors and updated README
Browse files Browse the repository at this point in the history
  • Loading branch information
xtonousou committed Jun 26, 2017
1 parent 338430f commit 8466fa4
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 12 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ All notable changes to this project will be documented in this file.

## [1.0.2] - 2017-06-26
### Added
* Exceptions to handle import errors and different Operating Systems
* WINDOWS_INSTALLATION.md

### Changed
Expand Down
33 changes: 29 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
`grklsh` is a small script written in **Python 2** that translates any text into Greeklish. It reads from stdin or from the arguments and prints on stdout or writes to files.

<a href="https://en.wikipedia.org/wiki/Greeklish">
<img src="/imgs/banner.jpg" alt="grklsh logo"
<img src="/imgs/board.png" alt="grklsh logo"
title="Greeklish Banner" align="right"
width="42%"/>
width="40%"/>
</a>

#### Features
Expand All @@ -35,6 +35,13 @@ You can read this [guide]

### Usage

#### Table Of Contents

* [Greek &#10141; Greeklish]
* [Any language &#10141; Greeklish]
* [Files containing Greek &#10141; New files in Greeklish]
* [Files containing Greek &#10141; New files in Greeklish (PARTIALLY)]

##### Greek &#10141; Greeklish

You just have to type,
Expand Down Expand Up @@ -84,6 +91,10 @@ $ grklsh.py -w file1 file2 -w file3 -w file4

This will print on stdout the translated text of the file `file2` but it will also generate three files: `file1.grklsh`, `file3.grklsh` and `file4.grklsh` which contain the translated text of each file

### Credits

* [nfldb] by BurntSushi for his awesome wiki

### Changelog

All notable changes to this project will be documented in [this] file
Expand All @@ -94,11 +105,25 @@ Copyright (c) **2017** by **Sotirios M. Roussis**. Some rights reserved.

`grklsh` is under the terms of the MIT License, following all clarifications stated in the [license] file


<!--- Links -->

[banner]: /imgs/banner.jpg
[here]: https://www.python.org/downloads/windows/
[nfldb]: https://github.com/BurntSushi/nfldb

<!--- Anchors -->

[Greek &#10141; Greeklish]: #greek--greeklish
[Any language &#10141; Greeklish]: #any-language--greeklish
[Files containing Greek &#10141; New files in Greeklish]: #files-containing-greek--new-files-in-greeklish
[Files containing Greek &#10141; New files in Greeklish (PARTIALLY)]: #files-containing-greek--new-files-in-greeklish-partially

<!--- Images -->

[banner]: /imgs/flag.jpg
[board]: /imgs/board.png

<!--- MDs -->

[guide]: WINDOWS_INSTALLATION.md
[this]: CHANGELOG.md
[license]: LICENSE.md
2 changes: 1 addition & 1 deletion WINDOWS_INSTALLATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Installation of Python itself should be fairly straight-forward

* It would be nice to be able to run Python from any location without having to constantly reference the full installation path name. This can by done by adding the Python installation path to Windows' `PATH` `ENVIRONMENT VARIABLE`

* In **Windows 7, 8, 8.1 and 10**, simply searching for "environment variables" will present the option to `Edit the system environment variables`. This will open the `System Properties / Advanced` tab
* In Windows 7, 8, 8.1 and 10, simply searching for "environment variables" will present the option to `Edit the system environment variables`. This will open the `System Properties / Advanced` tab

* In Windows XP, right click on `My Computer->Properties` to open `System Properties` and click on the `Advanced` tab.

Expand Down
24 changes: 17 additions & 7 deletions grklsh.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,24 @@
# Author ......: Sotirios M. Roussis aka. xtonousou <xtonousou@gmail.com>
# Date ........: 20170626

import sys
import codecs as cs
try:
from googletrans import Translator
except: # different msgs for different OSes
print 'You must run \'sudo python2 -m pip install -r requirements.txt\' first'
import sys
import codecs as cs
try:
from googletrans import Translator
except ImportError: # different msgs for different OSes
if platform == "linux" or platform == "linux2":
print 'You must run \'sudo python2 -m pip install -r requirements.txt\' first'
elif platform == "darwin":
print 'You must run \'sudo pip install -r requirements.txt\' first'
elif platform == "win32":
print 'You must run \'pip install -r requirements.txt\' first'
sys.exit()
except KeyboardInterrupt:
print '\nexit'
sys.exit()


py_script_name = sys.argv[0].strip('.')[::-1].strip('.')[3:][::-1]
py_script_version = '1.0.2'

Expand Down Expand Up @@ -188,7 +198,7 @@ def cat(lang):
newData, isTranlated = toGreeklish(list(text))
print ''.join(newData)
except KeyboardInterrupt:
print 'exit'
print '\nexit'
sys.exit()
else:
translator = Translator()
Expand All @@ -202,7 +212,7 @@ def cat(lang):
newData, isTranlated = toGreeklish(list(translatedText))
print ''.join(newData)
except KeyboardInterrupt:
print 'exit'
print '\nexit'
sys.exit()


Expand Down
Binary file added imgs/board.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes

0 comments on commit 8466fa4

Please sign in to comment.