Skip to content

Commit 077c21e

Browse files
committed
locale changes removed
1 parent 31e6497 commit 077c21e

File tree

2 files changed

+26
-54
lines changed

2 files changed

+26
-54
lines changed

Inliner.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ def __labels(self, line, code):
4040
"""Rplaces a label by a line number or a value.\n
4141
'line' is line number and 'code' the BASIC statements the\n
4242
Key/Value of 'self.basic' dictionary.\n
43-
Returns a string with all labels translated.
43+
Returns a string with all labels translated.\n
4444
"""
4545
for i in range(len(code)):
4646

@@ -70,7 +70,7 @@ def __labels(self, line, code):
7070
else:
7171
# exist if found a undefined label
7272
logger.error(
73-
_("Undefined label '{}' in '{}'").format(
73+
"Undefined label '{}' in '{}'".format(
7474
label, code[i]))
7575
sys_exit(2)
7676
else:
@@ -110,7 +110,7 @@ def __parse(self, program):
110110
elif self.line_numbered.search(line):
111111
# BAD: a line that begins with a number!
112112
logger.warning(
113-
_('Numbered line: {}').format(line[0:64]))
113+
'Numbered line: {}'.format(line[0:64]))
114114

115115
elif line[0] is "\'":
116116
# looks like a comment...
@@ -145,7 +145,7 @@ def __parse(self, program):
145145
else:
146146
# syntax didn't match, show it
147147
logger.error(
148-
_("Invalid label syntax '{}' in line {}.").format(
148+
"Invalid label syntax '{}' in line {}.".format(
149149
line, counter)
150150
)
151151

@@ -198,7 +198,7 @@ def list(self, uppercase, linefeed='\n'):
198198

199199
if len(current) > 255:
200200
logger.warning(
201-
_("More than 255 characters in line {}.").format(line))
201+
"More than 255 characters in line {}.".format(line))
202202

203203
output += current
204204

inliner

+21-49
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,24 @@
11
#!/usr/bin/env python3
2-
import gettext
3-
import locale
2+
"""
3+
Inliner 1.1
4+
A tool that converts indented BASIC programs into line numbered style.
5+
6+
Copyright (C) 2017-2018 by Giovanni Nunes <[email protected]>
7+
8+
This program is free software: you can redistribute it and/or modify
9+
it under the terms of the GNU General Public License as published by
10+
the Free Software Foundation; either version 3 of the License, or (at
11+
your option) any later version.
12+
13+
Usage:
14+
inliner <filename> [ --start=<line> --step=<value> --upper --rem ]
15+
inliner --help
16+
17+
Options:
18+
--help Show this screen.
19+
--rem Use the REM statement istead of the apostrophe.
20+
--upper Put all BASIC statements in uppercase.
21+
"""
422
import logging
523
from os import path
624
from docopt import docopt
@@ -11,28 +29,6 @@ START = 10
1129
STEP = 10
1230

1331

14-
def init_locale():
15-
"""Initalize localization support. Checks the current system's locale
16-
and tries to load it if exists. Otherwise uses the default locale.
17-
"""
18-
locale.setlocale(locale.LC_ALL, '')
19-
(loc, enc) = locale.getlocale()
20-
21-
filename = path.join(
22-
'lang', '{}.{}', 'LC_MESSAGES/messages.mo').format(loc, enc)
23-
24-
try:
25-
logging.debug(
26-
"Opening message file '%s' for locale '%s'", filename, loc)
27-
trans = gettext.GNUTranslations(open(filename, "rb"))
28-
29-
except IOError:
30-
logging.debug("Locale not found. Using default messages")
31-
trans = gettext.NullTranslations()
32-
33-
trans.install()
34-
35-
3632
def main():
3733

3834
# fist line and increment between lines
@@ -62,31 +58,7 @@ def main():
6258

6359

6460
if __name__ == '__main__':
65-
66-
# initiaize localization support
67-
init_locale()
68-
69-
arguments = docopt(_("""
70-
Inliner 1.1
71-
A tool that converts indented BASIC programs into line numbered style.
72-
73-
Copyright (C) 2017-2018 by Giovanni Nunes <[email protected]>
74-
75-
This program is free software: you can redistribute it and/or modify
76-
it under the terms of the GNU General Public License as published by
77-
the Free Software Foundation; either version 3 of the License, or (at
78-
your option) any later version.
79-
80-
Usage:
81-
inliner <filename> [ --start=<line> --step=<value> --upper --rem ]
82-
inliner --help
83-
84-
Options:
85-
--help Show this screen.
86-
--rem Use the REM statement istead of the apostrophe.
87-
--upper Put all BASIC statements in uppercase.
88-
"""))
89-
61+
arguments = docopt(__doc__)
9062
main()
9163

9264
# vim: set fileencoding=utf-8

0 commit comments

Comments
 (0)