-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from daithihearn/spanish_translations
Adding Spanish translations
- Loading branch information
Showing
7 changed files
with
106 additions
and
24 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,35 @@ | ||
|
||
import os | ||
from services.SmsService import send_sms | ||
from services.PriceService import get_current_price, get_max_price, get_min_price | ||
import i18n | ||
from dotenv import load_dotenv | ||
|
||
load_dotenv() | ||
|
||
TWILIO_RECIPIENTS = os.getenv('TWILIO_RECIPIENTS') | ||
|
||
curr_price = get_current_price() | ||
min_price = get_min_price() | ||
max_price = get_max_price() | ||
|
||
if curr_price.value == min_price.value: | ||
send_sms('Put the washing machine on!!\n - Min: ' + | ||
min_price.value_euro + '@' + min_price.hour + '\n - Max: ' + max_price.value_euro + '@' + max_price.hour + | ||
'\n - Current: ' + curr_price.value_euro + '@' + curr_price.hour) | ||
i18n.load_path.append('i18n') | ||
messageEn = i18n.t('text.cheap_price', | ||
min_price=str(min_price.value_euro+'@'+min_price.hour), | ||
max_price=str(max_price.value_euro+'@'+max_price.hour), | ||
cur_price=str(curr_price.value_euro+'@'+curr_price.hour)) | ||
|
||
i18n.set('locale', 'es') | ||
messageEs = i18n.t('text.cheap_price', | ||
min_price=str(min_price.value_euro+'@'+min_price.hour), | ||
max_price=str(max_price.value_euro+'@'+max_price.hour), | ||
cur_price=str(curr_price.value_euro+'@'+curr_price.hour)) | ||
|
||
for recipient in TWILIO_RECIPIENTS.split(","): | ||
if recipient.startswith('+34'): | ||
send_sms(messageEs, recipient) | ||
else: | ||
send_sms(messageEn, recipient) | ||
else: | ||
print('No need to put the washing machine on. Min price is ' + | ||
min_price.value_euro+', max price is' + max_price.value_euro+', current price is '+curr_price.value_euro+'.') | ||
min_price.value_euro+', max price is ' + max_price.value_euro+', current price is '+curr_price.value_euro+'.') |
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 |
---|---|---|
@@ -1,14 +1,27 @@ | ||
|
||
import os | ||
from services.SmsService import send_sms | ||
from services.PriceService import get_max_price, get_min_price | ||
import i18n | ||
from dotenv import load_dotenv | ||
|
||
load_dotenv() | ||
|
||
TWILIO_RECIPIENTS = os.getenv('TWILIO_RECIPIENTS') | ||
|
||
i18n.load_path.append('i18n') | ||
|
||
min_price = get_min_price() | ||
max_price = get_max_price() | ||
|
||
message = 'Prices today:\n - Min: '+min_price.value_euro + '@' + \ | ||
min_price.hour + '\n - Max: ' + \ | ||
max_price.value_euro + '@' + max_price.hour | ||
messageEn = i18n.t('text.daily_price', min_price=str(min_price.value_euro + | ||
'@'+min_price.hour), max_price=str(max_price.value_euro+'@'+max_price.hour)) | ||
|
||
print(message) | ||
i18n.set('locale', 'es') | ||
messageEs = i18n.t('text.daily_price', min_price=str(min_price.value_euro + | ||
'@'+min_price.hour), max_price=str(max_price.value_euro+'@'+max_price.hour)) | ||
|
||
send_sms(message) | ||
for recipient in TWILIO_RECIPIENTS.split(","): | ||
if recipient.startswith('+34'): | ||
send_sms(messageEs, recipient) | ||
else: | ||
send_sms(messageEn, recipient) |
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 |
---|---|---|
@@ -1,15 +1,35 @@ | ||
|
||
import os | ||
from services.SmsService import send_sms | ||
from services.PriceService import get_current_price, get_max_price, get_min_price | ||
import i18n | ||
from dotenv import load_dotenv | ||
|
||
load_dotenv() | ||
|
||
TWILIO_RECIPIENTS = os.getenv('TWILIO_RECIPIENTS') | ||
|
||
curr_price = get_current_price() | ||
min_price = get_min_price() | ||
max_price = get_max_price() | ||
|
||
if curr_price.value == max_price.value: | ||
send_sms('Turn everything off!!\n - Min: ' + | ||
min_price.value_euro + '@' + min_price.hour + '\n - Max: ' + max_price.value_euro + '@' + max_price.hour + | ||
'\n - Current: ' + curr_price.value_euro + '@' + curr_price.hour) | ||
i18n.load_path.append('i18n') | ||
messageEn = i18n.t('text.expensive_price', | ||
min_price=str(min_price.value_euro+'@'+min_price.hour), | ||
max_price=str(max_price.value_euro+'@'+max_price.hour), | ||
cur_price=str(curr_price.value_euro+'@'+curr_price.hour)) | ||
|
||
i18n.set('locale', 'es') | ||
messageEs = i18n.t('text.expensive_price', | ||
min_price=str(min_price.value_euro+'@'+min_price.hour), | ||
max_price=str(max_price.value_euro+'@'+max_price.hour), | ||
cur_price=str(curr_price.value_euro+'@'+curr_price.hour)) | ||
|
||
for recipient in TWILIO_RECIPIENTS.split(","): | ||
if recipient.startswith('+34'): | ||
send_sms(messageEs, recipient) | ||
else: | ||
send_sms(messageEn, recipient) | ||
else: | ||
print('No need to warn about the price. Min price is ' + | ||
min_price.value_euro+', max price is' + max_price.value_euro+', current price is '+curr_price.value_euro+'.') |
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,15 @@ | ||
en: | ||
daily_price: | | ||
Prices today: | ||
- Min: %{min_price} | ||
- Max: %{max_price} | ||
expensive_price: | | ||
Turn everything off!! | ||
- Min: %{min_price} | ||
- Max: %{max_price} | ||
- Current: %{cur_price} | ||
cheap_price: | | ||
Put the washing machine on!! | ||
- Min: %{min_price} | ||
- Max: %{max_price} | ||
- Current: %{cur_price} |
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,15 @@ | ||
es: | ||
daily_price: | | ||
Precios hoy: | ||
- Min: %{min_price} | ||
- Max: %{max_price} | ||
expensive_price: | | ||
Apaga todo!! | ||
- Min: %{min_price} | ||
- Max: %{max_price} | ||
- Actual: %{cur_price} | ||
cheap_price: | | ||
Enciende la lavadora!! | ||
- Min: %{min_price} | ||
- Max: %{max_price} | ||
- Actual: %{cur_price} |
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 |
---|---|---|
|
@@ -3,3 +3,4 @@ python-dotenv | |
twilio | ||
asyncio | ||
meross_iot==0.4.5.9 | ||
python-i18n[YAML] |
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