Multi-lingual for Product Description - virtocommerce

In a Product page of the front-end Demo Store, under the Description and Additional Information tabs are still in English even if I have changed the site language to Japanese. The same goes to the name of the Categories (Audio & MP3, Computers & Tablets, Cameras, etc).
Can I provide my own translation of Japanese for these areas?

Translating Additional Information:
Open catalog and add Japanese language to it (catalog guide);
Open concrete product, navigate to Properties, change displayed properties language to
Japanese (by clicking language filter in top left corner);
Fill in the properties and save;
In order to see the changes in website, rebuild the search index (settings guide).
The Description (Editorial Review) doesn't support localization at the moment. There are several workarounds but they all include programming.

Yes, you can provide your own content. Some of the text simply wasn't translated to the Japanese. You can translate everything from category names to labels using Commerce Manager console. For categories, simply go to the category edit page and set a translating for display name property to Japanese.

Related

Custom shipping method admin form issues

I've created a custom shipping integration (based on this guide) that calculates the shipping price based on a percentage of the subtotal. This percentage is set in the shipping method settings.
Everything works fine on the frontend part, the shipping price is calculated correctly.
The problems I have lies in the admin backoffice, in the shipping method settings page. The first problem that I have is that the text box to set the percentage is preceded by the currency, which will confuse the user as it is expecting not a flat rate price, but a percentage of the order's subtotal.
I have the same problem on the list of added shipping methods, the value I set is preceded by the currency, and this is not good.
There is a "add a template" section in the guide which I followed, but the template doesn't seem to affect anything. I tried putting bogus letters in the template and clearing the cache, but they did not appear anywhere on the settings page.
What I would like to do here is either remove the currency indicator completely, or to replace it with a %.
The second problem I have is that the language isn't taken into account. I have created a messages.en.yml file and a messages.fr.yml file. Both follow the same structure of course, and all strings are translated. But if I set OroCommerce in French, I don't get my translated strings, but the english ones.
Here's a screenshot that shows both my problems :
(Strings like "Price percentage" should be translated)
Do you have an idea on how I could fix these issues? Thanks.
Currency is added in shipping-rule-method-view.js. You can override this JS view with the map section in jsmodules.yml configuration file.
Based on Andrey's answer, I managed to have something that works. I'll add a few more details for anyone that had the same issue.
For the issue with the translation, it seems that renaming the file by adding the locale messages.fr_FR.yml fixed the issue.
Concerning the currency part on the admin menu, you have to create a jsmodules.yml file in the Resources/config folder of your bundle, NOT Resources/config/oro, which is why none of my configs were taken into account.
When writing your jsmodules file, when using map, if you're overriding a JS file, you have to omit the file extension. When you're overriding something else, say an HTML file, you have to put the file extension.
This is how my file is written :
map:
"*":
oroshipping/js/app/views/shipping-rule-method-view: gdmshipping/js/shipping-rule-method-view
There is one caveat, though. This will replace the display for all shipping integrations, so the currency symbol will be replaced/removed for all other shipping types, such as Flat Rate, so keep this in mind.

Orchard CMS Customer Module

My case is that we want to build a customizing Lab Module (show Basic Science Research) which provides a template to show each lab pages in consistent style. This module will also allow each lab's manager(non-developer) to update their own lab pages with some textbox, checkbox, upload file or image, TinyMce plain input elements(not html/css) after they login Orchard (or Developer directly provides them some links to update page infos without login, best not in Admin Dashboard). Each lab page will show Research, Project, Members, Publication, News Sections in front-end. My current plan is creating ResearchLab type (ResearchLabPart/ResearchLabRecord includes lab title, research_topic, research_image, research_protocol etc), Project type (ProjectPart/ProjectRecord includes title, start_date, foreign key researchLab_Id etc), Member type(MemberPart/MemberRecord include name, title, Linkedin links, foreign key researchLab_Id etc), Publication Type(Member/MemberRecord include name, title, Linkedin links, foreign key researchLab_Id and project_Id etc) etc. The foreign key is that once a researchlab id is chosen and based on this value, corresponding project, publication and news for specific lab could be queried as well right away. When lab manager updates the Researchlab part page, he/she wants to upload some research_image or protocol pdf, doc files. For ResearchLabPart (having lab_title, research_topic, research_image, research_protocol properties etc) and I could easily attach ImageField (assuming name ResearchLabImage) as OfType("MediaPickerField") or fileField(some external module) into ResearchLabPart in Migration.cs after enabling these two external modules. In the ResearchLabController of my custom module, Edit Action will view link to a return model=_contentManager.BuildEditor(ResearchLab) which will go to EditorTemplates--Parts--ResearchLab.cshtml. I want to assign the url (or file/image's name values, using ((dynamic)Model.ContentItem).ResearchLab.ResearchLabImage ) into research_image, research_protocol properties of ResearchLabPart. It looks like I need to implement assigning values in Eitor method of LabMemberDriver, not sure? My target is to let file or image fields to save files and images in some folders under my module directory and save the files or images's name or url path into photo, cv properties of LabMemberPart. Am I going to right direction? How to connect and exchange image/file fields to the properties of ResearchLab part in source code part? Any thoughts or comments are welcome. Thanks.

Piranha CMS customisation

A few questions on customisation with Piranha CMS.
Is there a way to create additional custom site-wide items similar to those from the site helper? http://piranhacms.org/docs/api-reference/site-helper
e.g. to be able to set a phone number used throughout the site but still editable in the settings section of the manager.
Is is possible to create additional custom items for a page, e.g. page subtitle, and for those to appear in the Information section of page editing? Creating a region for say a page subtitle seems overkill.
Is it possible to create a custom page type with a region that is a collection of HtmlRegions or similar? e.g. for the purpose of managing a set of FAQs or similar enumerated content?
Is is possible to define custom settings properties for a page type?
Yes, you can add regions to your site in the same way as with page types under Settings > Sites. You then add content for them under Content > Pages > Edit Site.
You can add simple text properties on the page type. They will be shown as single line text inputs under Properties when editing the page.
No native support, however the region body can be anything that can be serialized to JSON so you have to handle this in the edit view for your region.
There is no support for injecting fields into the page settings, however if it's important you can override the whole edit view for pages and do anything you like by placing a copy of the view in the manager area in your local project. You can find the views in the github repo in the 2.2.5 branch.
Regards
HÃ¥kan

How to search category and fill site parameters automatically

I have seen some sites where you search (in Google) for a particular item category and when you click the link found in Google it automatically goes to the site clicked with the search criteria filled in displaying the categorised products.
Hypothetical Example
Go into Google type in Sony TV , click to search.
Results are displayed.
Clicking one of the links takes me to a website which shows all the Sony TV models beginning with AA.
Looking at the search options on the page some fields have been automatically filled in (in other words if you did this search manually the site would prompt you to enter some search criteria) - Not sure if this is relevant but thought to mention.
How is this done? Do i need to setup something in our Google account to get the same results?
It's fairly simple. You pass parameters in your URLs that identify the product, and then you just read the URL parameters when pre-populating the search form on the page. When building your site / sitemap / internal & external links you use those page URLs and Google will naturally pick them up.
In your example, you search for Sony TV. One of the results may be
example.com/index.php?product=sony-tv
The website has the variable sony-tv, which it gets from the URL and pre-populates on the search form.
The important part to note is that the site will have built its URL structure in this method typically and the page you're presented with just happens to look like the site dynamically searched based on your query (it hasn't).

Getting full language support with Twitter buttons isn't possible

I'm trying to work out how to do full language control with Twitter because I have most of it, but I don't think it's possible in full. This isn't a newbe question, I think there's a big problem with Twitter.
So imagine I'm trying to set the French language and using this:
View Profile
I have done this:
(1) Set the language in the document
<html lang="fr" />
(2) Added the ?lang=fr parameter so that if JavaScript is off then the fallback (just a text link) opens the profile with the correct language:
View Profile
(3) Added the data-lang="fr" attribute as well:
View Profile
--
So the questions:
(1) Everything works except if JavaScript runs and you click to open a page on twitter.com it never uses the language. So, basically you could have a French website with French language, French Twitter buttons, but when you click a button it always uses English language on twitter.com (unless you turn off JavaScript).
Is it not possible for links to open twitter.com?lang=fr
(2) Is there not an easy way to do this all in one place? In Facebook you just call the API script by selecting the language you want, but that doesn't seem possible with Twitter and it seems very time consuming appending all the extras just to get a different language.
Twitter will determine the language for it's own website when no language is specified (as you'd expect!). If you want to force a language on twitter you need to set the lang attribute in the url such as: http://www.twitter.com/Username?lang=fr
You can only use URL or data attributes to specify a language. Facebook will detect the language settings of the website its widget is embedded in, twitter won't. I don't know how the facebook button works, but on face value, i think twitter is right with this one. If a Spanish person was viewing my English website, I'd prefer twitter to be Spanish still even though my site is English. If i really want to force a specific language i can do, but i wouldn't normally want to force my viewers to a specific language unless it's out of my reasonable control.
If it really annoys you, and your tags aren't rendered dynamically (i.e. the element isnt loaded after DOM ready), you could just run a piece of javascript to detect twitter buttons and append your chosen language to the URLs/data attributes.