-
Notifications
You must be signed in to change notification settings - Fork 0
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
Translated menu to english #5
Open
adriah
wants to merge
3
commits into
master
Choose a base branch
from
translation
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+57
−27
Open
Changes from 1 commit
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,7 +27,7 @@ def setup(): | |
for lcd in bar_lcd, customer_lcd: | ||
lcd.tick_off() | ||
lcd.clean() | ||
lcd.write("Laster systemet!") | ||
lcd.write("Loading system!") | ||
|
||
# Get the config | ||
config = configparser.ConfigParser() | ||
|
@@ -51,7 +51,7 @@ def setup(): | |
|
||
|
||
def get_card_id(): | ||
write((bar_lcd, customer_lcd), "Venter pa kort") | ||
write((bar_lcd, customer_lcd), "Waiting for card") | ||
|
||
return main.getid() | ||
|
||
|
@@ -61,26 +61,26 @@ def register_customer(card_uid): | |
user_id = "" | ||
is_intern = False | ||
|
||
choice = ChoiceMenu((bar_lcd,), "Er personen intern?", ("Ja", "Nei")).menu() | ||
if choice is "Ja": | ||
choice = ChoiceMenu((bar_lcd,), "Is the person an intern?", ("Yes", "No")).menu() | ||
if choice is "Yes": | ||
is_intern = True | ||
while not user_id: | ||
username = KeyboardMenu((bar_lcd, customer_lcd), "Brukernavn").menu() | ||
username = KeyboardMenu((bar_lcd, customer_lcd), "Username").menu() | ||
if not username: | ||
return (None, None) # Empty username means cancel | ||
|
||
user = api.get_user(username) | ||
if "detail" in user: # If there is a detail, it means that we didn't get a match. | ||
write((bar_lcd, customer_lcd), "Brukeren finnes ikke") | ||
write((bar_lcd, customer_lcd), "User not found") | ||
time.sleep(2) # Give user some time to read | ||
else: | ||
user_id = user["id"] | ||
elif choice is None: | ||
return (None, None) | ||
|
||
write((bar_lcd, customer_lcd), "Registerer kort") | ||
write((bar_lcd, customer_lcd), "Registrating card") | ||
if api.register_card(card_uid, user_id, is_intern): | ||
write((bar_lcd, customer_lcd), "Kort registrert!") | ||
write((bar_lcd, customer_lcd), "Card registerd!") | ||
time.sleep(2) # Give the user some time to read | ||
|
||
return (username, is_intern) | ||
|
@@ -91,9 +91,9 @@ def get_customer(card_uid): | |
|
||
# The card is not in the database | ||
if username is None: | ||
write((customer_lcd,), "Ikke gjenkjent") | ||
choice = ChoiceMenu((bar_lcd,), "Kort ikke gjenkjent", ("Register", "Avbryt")).menu() | ||
if choice is "Avbryt" or choice is None: | ||
write((customer_lcd,), "Not accepted") | ||
choice = ChoiceMenu((bar_lcd,), "Unknown card", ("Register", "Cancle")).menu() | ||
if choice is "Cancle" or choice is None: | ||
return None | ||
|
||
username, is_intern = register_customer(card_uid) | ||
|
@@ -114,8 +114,8 @@ def display_info(customer): | |
|
||
if customer.intern: | ||
output += "Name: %s\n" % customer.username | ||
output += "Bonger: %2d\n" % customer.vouchers | ||
output += "Kaffe: %2d" % customer.coffee_vouchers | ||
output += "Vouchers: %2d\n" % customer.vouchers | ||
output += "Coffee: %2d" % customer.coffee_vouchers | ||
|
||
write((bar_lcd,), output) | ||
# We don't want to display the username on the customer screen | ||
|
@@ -125,21 +125,21 @@ def display_info(customer): | |
|
||
|
||
def register_use(identifier, amount, api_method): | ||
write((bar_lcd, customer_lcd), "Trekker %d bonger" % amount) | ||
write((bar_lcd, customer_lcd), "Witdrawing %d vouchers" % amount) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Withdrawing |
||
|
||
if api_method(identifier, amount): | ||
write((bar_lcd, customer_lcd), "%d bonger trukket" % amount) | ||
write((bar_lcd, customer_lcd), "%d vouchers withdrawn" % amount) | ||
else: | ||
write((bar_lcd, customer_lcd), "Ikke nok bonger") | ||
write((bar_lcd, customer_lcd), "Not enough vouchers") | ||
|
||
|
||
def register_vouchers(card_uid, amount): | ||
write((bar_lcd, customer_lcd), "Legger til %d bonger" % amount) | ||
write((bar_lcd, customer_lcd), "Adding %d vouchers" % amount) | ||
|
||
if api.register_coffee_vouchers(card_uid, amount): | ||
write((bar_lcd, customer_lcd), "%d bonger lagt til" % amount) | ||
write((bar_lcd, customer_lcd), "%d vouchers added" % amount) | ||
else: | ||
write((bar_lcd, customer_lcd), "Feil D:") | ||
write((bar_lcd, customer_lcd), "Wrong D:") | ||
|
||
|
||
def buy_action(): | ||
|
@@ -153,15 +153,15 @@ def buy_action(): | |
display_info(customer) | ||
|
||
# Get amount of bongs to remove | ||
amount = AmountMenu((bar_lcd,), "Antall a fjerne", clean=False, position=3).menu() | ||
amount = AmountMenu((bar_lcd,), "Amount to withdraw", clean=False, position=3).menu() | ||
if not amount: | ||
return | ||
|
||
# Remove x amount of bongs from customer | ||
voucher_type = None | ||
if customer.intern: | ||
voucher_type = ChoiceMenu((bar_lcd,), "Hva slags bong?", ("Internbong", "Kaffebong")).menu() | ||
if voucher_type is "Internbong": | ||
voucher_type = ChoiceMenu((bar_lcd,), "What type?", ("Internvoucher", "Coffeevoucher")).menu() | ||
if voucher_type is "Internvoucher": | ||
register_use(customer.username, amount, api.use_vouchers) | ||
else: | ||
register_use(card_uid, amount, api.use_coffee_vouchers) | ||
|
@@ -188,11 +188,11 @@ def register_action(): | |
while True: | ||
choice = ChoiceMenu( | ||
(bar_lcd,), | ||
"Hva vil du gjore?", | ||
("Uttak", "Kjop kaffebonger") | ||
"What do you want to do?", | ||
("Withdraw", "Buy coffee vouchers") | ||
).menu() | ||
|
||
if choice is "Uttak": | ||
if choice is "Withdraw": | ||
buy_action() | ||
elif choice is "Kjop kaffebonger": | ||
elif choice is "Buy coffee vouchers": | ||
register_action() |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cancel