Skip to content
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

Adding Translation #46

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 1 addition & 23 deletions config.json
Original file line number Diff line number Diff line change
Expand Up @@ -91,33 +91,11 @@
"defaultValue": true
}
},
"alipay_title": {
"type": "inputText",
"required": false,
"label": "Config.alipayTitleLabel",
"options": {
"defaultValue": "Alipay"
}
},
"alipay_description": {
"type": "inputText",
"required": false,
"label": "Config.alipayDescriptionLabel",
"options": {}
},
"alipay_fee": {
"type": "inputText",
"required": false,
"label": "Config.alipayFeeLabel",
"options": {}
},
"alipay_icon_url": {
"type": "inputText",
"required": false,
"label": "Config.alipayIconUrlLabel",
"options": {
"defaultValue": ""
}
}
}
},
Expand Down Expand Up @@ -1147,4 +1125,4 @@
}
}
}
}
}
3 changes: 3 additions & 0 deletions resources/lang/de/AliPay.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
AliPayTitle="Title"
AliPayDescription = "Description"
AliPayIconUrl ="Icon URL"
13 changes: 9 additions & 4 deletions src/Methods/AlipayPaymentMethod.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,10 @@ public function isActive(): bool
*/
public function getName(): string
{
$title = $this->configRepo->get('wallee.alipay_title');
/** @var Translator $translator */
$translator = pluginApp(Translator::class)

$title = $translator->trans('wallee::AliPay.AliPayTitle');
if (! empty($title)) {
return $title;
} else {
Expand Down Expand Up @@ -58,7 +61,8 @@ public function getFee(): float
*/
public function getDescription(): string
{
$title = $this->configRepo->get('wallee.alipay_description');
$translator = pluginApp(Translator::class)
$title = $translator->trans('wallee::AliPay.AliPayDescription');
if (! empty($title)) {
return $title;
} else {
Expand All @@ -73,11 +77,12 @@ public function getDescription(): string
*/
public function getIcon(): string
{
$iconUrl = $this->configRepo->get('wallee.alipay_icon_url');
$translator = pluginApp(Translator::class)
$iconUrl = $translator->trans('wallee::AliPay.AliPayIconUrl');
if (!empty($iconUrl)) {
return $iconUrl;
} else {
return $this->getImagePath('alipay.svg');
}
}
}
}
7 changes: 7 additions & 0 deletions translation.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"sections":[],
"ignoredTranslationFiles":
[
"Config.properties"
]
}