-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for exporting english CSVs
This resolves issue English translation #2
- Loading branch information
1 parent
2d2e568
commit 87c2305
Showing
12 changed files
with
1,482 additions
and
27 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
Empty file.
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,8 @@ | ||
# these are taken from file portfolio/name.abuchen.portfolio.ui/src/name/abuchen/portfolio/ui/messages_de.properties | ||
ColumnSecurity = Wertpapier | ||
ColumnAmount = Betrag | ||
ColumnNetValue = Gesamtpreis | ||
ColumnSource = Quelle | ||
|
||
Balance = Saldo | ||
ColumnPerShare = pro Aktie |
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,8 @@ | ||
# these are taken from file portfolio/name.abuchen.portfolio.ui/src/name/abuchen/portfolio/ui/messages.properties | ||
ColumnSecurity = Security | ||
ColumnAmount = Amount | ||
ColumnNetValue = Net Transaction Value | ||
ColumnSource = Source | ||
|
||
Balance = Balance | ||
ColumnPerShare = per share |
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,75 @@ | ||
class I18n: | ||
|
||
CSV_DEPOT_COLUMNS = [ | ||
'CSVColumn_Date', | ||
'CSVColumn_Time', | ||
'CSVColumn_Type', | ||
'LabelSecurity', | ||
'CSVColumn_Shares', | ||
'CSVColumn_Quote', | ||
'ColumnAmount', | ||
'CSVColumn_Fees', | ||
'CSVColumn_Taxes', | ||
'ColumnNetValue', | ||
'CSVColumn_AccountName', | ||
'CSVColumn_AccountName2nd', | ||
'CSVColumn_Note', | ||
'ColumnSource' | ||
] | ||
|
||
CSV_ACCOUNT_COLUMNS = [ | ||
'CSVColumn_Date', | ||
'CSVColumn_Time', | ||
'CSVColumn_Type', | ||
'ColumnAmount', | ||
'Balance', | ||
'ColumnSecurity', | ||
'CSVColumn_Shares', | ||
'ColumnPerShare', | ||
'CSVColumn_AccountName2nd', | ||
'CSVColumn_Note', | ||
'ColumnSource' | ||
] | ||
|
||
def __init__(self, language): | ||
self._constants = self.load_language(language) | ||
|
||
self._constants['DEPOT_COLUMNS'] = self.translate_array(self.CSV_DEPOT_COLUMNS) | ||
self._constants['ACCOUNT_COLUMNS'] = self.translate_array(self.CSV_ACCOUNT_COLUMNS) | ||
|
||
def get(self, key): | ||
return self._constants.get(key, key) | ||
|
||
def load_language(self, language): | ||
result = {} | ||
|
||
prefix = "src/i18n" | ||
files = [ | ||
f"{prefix}/labels_{language}.properties", # original file taken from original portfolio performance | ||
f"{prefix}/messages_{language}.properties", # original file taken from original portfolio performance | ||
f"{prefix}/extra_{language}.properties", # this file includes missing translations from other files | ||
] | ||
for f in files: | ||
result.update(self.load_from_file(f)) | ||
|
||
return result | ||
|
||
def load_from_file(self, filename): | ||
result = {} | ||
try: | ||
with open(filename, encoding='utf-8') as f: | ||
rows = f.readlines() | ||
for row in rows: | ||
if row.strip() and not row.startswith("#"): | ||
row = row.encode('utf-8').decode('unicode-escape') | ||
key, value = row.split(" = ") | ||
result[key.strip()] = value.strip() | ||
except Exception as e: | ||
print(f"Error loading file {filename}: {e}") | ||
return result | ||
|
||
def translate_array(self, array): | ||
result = [] | ||
for item in array: | ||
result.append(self.get(item)) | ||
return result |
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,25 @@ | ||
|
||
account.BUY = Kauf | ||
account.DEPOSIT = Einlage | ||
account.DIVIDENDS = Dividende | ||
account.FEES = Geb\u00FChren | ||
account.FEES_REFUND = Geb\u00FChrenerstattung | ||
account.INTEREST = Zinsen | ||
account.INTEREST_CHARGE = Zinsbelastung | ||
account.REMOVAL = Entnahme | ||
account.SELL = Verkauf | ||
account.TAXES = Steuern | ||
account.TAX_REFUND = Steuerr\u00FCckerstattung | ||
account.TRANSFER_IN = Umbuchung (Eingang) | ||
account.TRANSFER_OUT = Umbuchung (Ausgang) | ||
|
||
event.DIVIDEND_PAYMENT = Dividendenzahlung | ||
event.NOTE = Notiz | ||
event.STOCK_SPLIT = Aktiensplit | ||
|
||
portfolio.BUY = Kauf | ||
portfolio.DELIVERY_INBOUND = Einlieferung | ||
portfolio.DELIVERY_OUTBOUND = Auslieferung | ||
portfolio.SELL = Verkauf | ||
portfolio.TRANSFER_IN = Umbuchung (Eingang) | ||
portfolio.TRANSFER_OUT = Umbuchung (Ausgang) |
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,25 @@ | ||
|
||
account.BUY = Buy | ||
account.DEPOSIT = Deposit | ||
account.DIVIDENDS = Dividend | ||
account.FEES = Fees | ||
account.FEES_REFUND = Fees Refund | ||
account.INTEREST = Interest | ||
account.INTEREST_CHARGE = Interest Charge | ||
account.REMOVAL = Removal | ||
account.SELL = Sell | ||
account.TAXES = Taxes | ||
account.TAX_REFUND = Tax Refund | ||
account.TRANSFER_IN = Transfer (Inbound) | ||
account.TRANSFER_OUT = Transfer (Outbound) | ||
|
||
event.DIVIDEND_PAYMENT = Dividend Payment | ||
event.NOTE = Note | ||
event.STOCK_SPLIT = Stock Split | ||
|
||
portfolio.BUY = Buy | ||
portfolio.DELIVERY_INBOUND = Delivery (Inbound) | ||
portfolio.DELIVERY_OUTBOUND = Delivery (Outbound) | ||
portfolio.SELL = Sell | ||
portfolio.TRANSFER_IN = Transfer (Inbound) | ||
portfolio.TRANSFER_OUT = Transfer (Outbound) |
Oops, something went wrong.