forked from mprat/Terminus
-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
Showing
11 changed files
with
133 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#!/usr/bin/env python | ||
import re | ||
import sys | ||
import polib | ||
|
||
LANG = sys.argv[1] | ||
APP_NAME = 'terminus' | ||
ORIG = ('./src/lang/%s.%s.po' % (APP_NAME, LANG)) | ||
TGT = ('./src/lang/%s.pot' % APP_NAME) | ||
|
||
po = polib.pofile(ORIG) | ||
if not po: | ||
exit(1) | ||
|
||
pot = polib.POFile() | ||
pot.metadata = po.metadata | ||
for entry in po: | ||
if not entry.comment: | ||
com = entry.msgstr | ||
if len(com.split("\n")) > 2 and not re.match(r".*({{|%s)", com): | ||
com = "\n".join(com.split("\n")[0:2]) + " ..." | ||
entry.comment = '[%s] "%s"' % (LANG, | ||
com.replace("\n",'\\n').replace('"','\\"')) | ||
entry.msgstr = '' | ||
pot.append(entry) | ||
|
||
pot.save(TGT) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# TRANSLATOR GUIDE | ||
|
||
If your are a new translator, just read next lines. | ||
|
||
There is 2 way to submit corrections and translations : | ||
|
||
## the lazy one | ||
|
||
* PROS : fast | ||
* CONS : you will not see the change before a moment | ||
|
||
Edit directly terminus.LANG.po in the git Web interface | ||
|
||
Saving will create a pull request to the repository owner who | ||
will have to compile. | ||
|
||
|
||
## the hard one | ||
|
||
* PROS : you can test the modification | ||
* CONS : you'll have to install python3 with polib | ||
|
||
Clone the git repository. | ||
|
||
If you need to add a language file, | ||
you can do `make pot`(or `make pot _LANG=fr`) | ||
and copy terminus.pot to terminus.LANG.pox. | ||
|
||
Edit terminus.LANG.po | ||
|
||
Then do `make po`. | ||
|
||
In order to test, without installing nodejs, | ||
you can open `testlang.html` in a browser adding `?LANG`. | ||
|
||
URL exemple : file:///home/user/terminus/src/testlang.html?en | ||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<!DOCTYPE HTML> | ||
<html> | ||
<head id='head'> | ||
<meta charset="utf-8" /> | ||
<script> | ||
var __xhr = new XMLHttpRequest() | ||
__xhr.open("GET","index.html") | ||
__xhr.setRequestHeader('Content-type', | ||
'application/x-www-form-urlencoded; charset=utf-8;') | ||
|
||
__xhr.onreadystatechange = function(){ | ||
if (__xhr.readyState == 4 && __xhr.status == 200) { | ||
var content = | ||
document.open() | ||
document.write(__xhr.responseText) | ||
document.close() | ||
var __lang=window.location.search.substr(1) | ||
if (__lang){ | ||
let node = document.createElement('script') | ||
node.type = "text/javascript" | ||
node.setAttribute('src', './js/_build/terminus.dialog.'+__lang+'.js') | ||
document.body.appendChild(node) | ||
} | ||
} | ||
} | ||
__xhr.send() | ||
</script> | ||
</head> | ||
</html> |