I have just completed a translation for OpenCart 3.0.2.0 and found out that in the front-end, in the left-hand-side menu, the menu item "Wish List" contains a variable that is unnecessary and is hence displayed as "%s" instead of being replaced by an actual value. Screenshot of the English version is attached. I haven't been able to locate the string in the translation file to try deleting the variable. This is not the string found in catalog/language/en-gb/account/wishlist.php > row 8 > $_['text_wishlist'] = 'Wish List (%s)';
Attachments
wish_list_var.png (41.33 KiB) Viewed 6447 times
find:
Code: Select all
$data['wishlist'] = $this->url->link('account/wishlist');
Code: Select all
$data['text_wishlist_account'] = sprintf($this->language->get('text_wishlist_account'), (isset($this->session->data['wishlist']) ? count($this->session->data['wishlist']) : 0));
find:
Code: Select all
$_['text_wishlist'] =
Code: Select all
$_['text_wishlist_account'] = 'Wish List (%s)';
replace:
Code: Select all
{{ text_wishlist }}
Code: Select all
{{ text_wishlist_account }}
Dedication and passion goes to those who are able to push and merge a project.
Regards,
Straightlight
Programmer / Opencart Tester
When I add the lines you've written, a different text appears ("Modify your wish list"), which should not be displayed there – I suppose it should be displayed on the Account/Wishlist page or elsewhere.
What should display in the left-hand-side menu is "Wish List" – a plain link that does not contain a variable. I guess the easiest fix would be to find the actual text in the corresponding language file and remove the variable in brackets. But I don't know which language file to look in.
And, equally important – if this is an actual bug, it should be reported and fixed.
Dedication and passion goes to those who are able to push and merge a project.
Regards,
Straightlight
Programmer / Opencart Tester
Code: Select all
$data['wishlist'] = $this->url->link('account/wishlist');
Dedication and passion goes to those who are able to push and merge a project.
Regards,
Straightlight
Programmer / Opencart Tester
Dedication and passion goes to those who are able to push and merge a project.
Regards,
Straightlight
Programmer / Opencart Tester
Then I also cleared the cache via Dashboard > gear button to the right.
Still get the same "Wish List (%s)".
So, I have solved the problem as follows:
1. In catalog\controller\account\account.php, just above the line:
Code: Select all
$data['wishlist'] = $this->url->link('account/wishlist');
Code: Select all
$data['text_wishlist'] = $this->language->get('text_wishlist_account');
Code: Select all
$_['text_wishlist_account'] = 'Wish List';
Code: Select all
<li><a href="{{ wishlist }}">{{ text_wishlist }}</a></li>
The questions that remain unanswered are:
1. What is the text that's actually supposed to show in this menu group? Is it "Wish List", or "Wish List (%s)", or "Modify your wish list". I have not found the last of these three strings used anywhere on the front-end.
2. If this is an actual bug, isn't it too simple and obvious to miss? If a bug, should I report in in GitHub?
While examining the translations, I've also found out that there are other unused strings in catalog\language\en-gb\account\account.php, e.g.
Code: Select all
$_['text_newsletter'] = 'Subscribe / unsubscribe to newsletter';
$_['text_edit'] = 'Edit your account information';
$_['text_address'] = 'Modify your address book entries';
Overall, comparing the two files (catalog\controller\account\account.php) from 3.0.2.0 and 2.0.3.1, there are 14 lines that get the translations that are not present in this new version (3.0.2.0)... This looks like a huge omission to me.
These are the texts that make sense having, though. With some editing... "Your Reward points", "Your Transactions", "Downloads" should read something like "Check your reward points", "View your transactions", "View your downloads", etc. to be in the same format as the rest. Of course, it sounds awkward to have a menu group "My account" and included in it "Edit your account information"...
There are so many issues with the English texts, I can't believe no one has had a competent look as them...
As for the Edit your account information..... you will need this to change your email, phone number etc
So obviously just a minor mishap on your translations causing this
BTW are you using a 'language pack' for the translations or are you editing them manually ?
True that. But the problem is there isn't a consistent approach to the English texts. There are so many errors in the files.
Of course, it just sounds awkward to have "My Account" above it. If the developers decide to keep "My Account", the links below this should be stripped of the possessive pronouns, e.g. "Edit account information". Alternatively, the heading should be "Account" and the links below can keep the "your" pronouns.
If I understand your question correctly, I've created a new folder in ...\language\, gave it the correct name, and pasted the English files in it, then translated them. When translating for 2.0.3.1, I actually worked using a rich text editor (EditPlus), but now I created a project in Crowdin, so that I could reuse repeating strings already stored in the TM. Actually, it's working in Crowdin that made the numerous inconsistencies and mistakes obvious.
Where was that advised on my behalf after I did mentioned the codes were modified afterwards ... ?cheeseus wrote: ↑Sun Mar 04, 2018 11:41 pmI actually did do admin > extensions > modifications > refresh – but nothing changed, so I thought this only applies to modifications. Now I did it again.
Then I also cleared the cache via Dashboard > gear button to the right.
Still get the same "Wish List (%s)".
So, I have solved the problem as follows:
1. In catalog\controller\account\account.php, just above the line:I've added:Code: Select all
$data['wishlist'] = $this->url->link('account/wishlist');
2. As advised, I've added a new translation string in catalog\language\en-gb\account\account.php and in my language:Code: Select all
$data['text_wishlist'] = $this->language->get('text_wishlist_account');
3. I preferred to not modify the template file, so I've left it as it was:Code: Select all
$_['text_wishlist_account'] = 'Wish List';
Now, while these edits do solve the problem, they are a temporary solution that will only last until an update rolls out.Code: Select all
<li><a href="{{ wishlist }}">{{ text_wishlist }}</a></li>
The questions that remain unanswered are:
1. What is the text that's actually supposed to show in this menu group? Is it "Wish List", or "Wish List (%s)", or "Modify your wish list". I have not found the last of these three strings used anywhere on the front-end.
2. If this is an actual bug, isn't it too simple and obvious to miss? If a bug, should I report in in GitHub?
While examining the translations, I've also found out that there are other unused strings in catalog\language\en-gb\account\account.php, e.g.and others.Code: Select all
$_['text_newsletter'] = 'Subscribe / unsubscribe to newsletter'; $_['text_edit'] = 'Edit your account information'; $_['text_address'] = 'Modify your address book entries';
Overall, comparing the two files (catalog\controller\account\account.php) from 3.0.2.0 and 2.0.3.1, there are 14 lines that get the translations that are not present in this new version (3.0.2.0)... This looks like a huge omission to me.
Dedication and passion goes to those who are able to push and merge a project.
Regards,
Straightlight
Programmer / Opencart Tester
Dedication and passion goes to those who are able to push and merge a project.
Regards,
Straightlight
Programmer / Opencart Tester
Yes, they are not the exact steps. I have simplified them.straightlight wrote: ↑Mon Mar 05, 2018 8:29 amYour steps above are not the instructions I provided on the above ...
Instead of adding your code to catalog\controller\account\account.php, which was supposed to show the number of items in the wish list, if any – but didn't work – I've added the same code as found in 2.0.3.1 that gets the language string. Then, I've added a new language string ('text_wishlist_account') as per your suggestion but with a different content – again because the %s variable didn't work and because I find it pointless to include in that menu, even if it had worked. You said the language string should be added only to my language, but that is not a good idea as the site is bilingual – having the same string in both languages is required to avoid issues, which is why I also added it to the English language file. And then, not wanting to also edit the template file, I simply assign the 'text_wishlist_account' language string to the 'text_wishlist' variable – not best practice, I know, but this is just a test, waiting for the new build to roll out.
Meanwhile, I've had a look at the code in the new beta build (3.0.3.0b) – the code has been slightly modified but I need to install it to see if it solves the problem:
Code: Select all
$data['wishlist'] = $this->url->link('account/wishlist', 'language=' . $this->config->get('config_language'));
Code: Select all
$data['text_wishlist'] = $this->language->get('text_wishlist');
...
$data['wishlist'] = $this->url->link('account/wishlist');
I had to delete this installation, however, because the Admin is buggy. So, cleaned everything – files and database – and reinstalled 3.0.2.0... and the Account menu looks the way it should not, screenshot attached.
Attachments
account_menu_3.0.2.0.png (18.35 KiB) Viewed 6269 times
Dedication and passion goes to those who are able to push and merge a project.
Regards,
Straightlight
Programmer / Opencart Tester
Ah, thanks cheeseus. Quick and 'dirty' solution. And, personally, I don't mind editing these files again after a new update rolls out...
OpenCart 3.0.2.0. in English & Dutch
Extensions: Inverted Dark Opencart Theme // Dependent Options // PDF Invoice Pro // (2.x/3.x) New Returns E-mail // iSenseLabs GDPR // (2.x/3.x) Total-Based Shipping // PostNL Wereld OC3.x
Users browsing this forum: No registered users and 79 guests