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

Can not translate homographs #1661

Closed
dmitrii-fediuk opened this issue Aug 12, 2015 · 9 comments
Closed

Can not translate homographs #1661

dmitrii-fediuk opened this issue Aug 12, 2015 · 9 comments
Labels
bug report Fixed in 2.2.x The issue has been fixed in 2.2 release line Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Issue: Format is not valid Gate 1 Failed. Automatic verification of issue format is failed Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development

Comments

@dmitrii-fediuk
Copy link

Magento 1.x has the possibility to use multiple translations for the same phrase in different module contexts.
For example:
Module_A.csv: "State","Состояние"
Module_B.csv: "State","Область"
It allows to translate the words that are homographs in English but are not homographs in the target translation language.
The possibility is absent/broken/removed in the current Magento 2 version.

@nja78
Copy link

nja78 commented Aug 13, 2015

Same as #1561

@vkorotun
Copy link
Contributor

Hey @dfediuk and @nja78, thank you for the feedback!
We've already started digging into this issue and consider now various options how to implement (or restore) this functionality.
Splitting by modules is not that good, since there is a high possibility of use case when you may require to use homographs within the same module.
So, you are welcome to share more of your ideas here.

@pronto2000
Copy link

I wanted to complain about the same thing, but @dfediuk beat by reporting it first. Good work! I already run into several time; for example in Estonian language we don't use catchall words such as "item". Sure, there are equivalents, but they are awkward at best and whenever possible I'd like to use "product", "message", "order", "record" or something like that instead.

There's another thing I noticed from Magento 1 I suspect have been carried over to Magento 2 and it's concatenation. Instead of using sprintf %s (or %d, %f or whatever; i.e. "First string %s another string") Magento sometimes uses something like that instead in templates: $this->__('First string ') . $i . $this->__(' another string'). This is no good!

What to do about it? One possibility is to avoid context sensitive words such as "item" which my mean anything. Actually it's good idea not to use them even if we have better solution in place. Another is to use manual overrides, such as "String","Translation",["File",["Occurrence"]]. It's not a nice solution by long shot, but provides a way to get things done.

@piotrekkaminski
Copy link
Contributor

We are working on improving it (or restoring lost functionality). It will allow per module translations which should solve most of the use cases
Internal issue id: MAGETWO-43683

@dmitrii-fediuk
Copy link
Author

In my experience (I have translated Magento 1.x to Russian and am translating Magento 2 to Russian now) a per module context is not sufficient.
It would much better to have per request action context at least (I have already implemented it for myself as my custom module but it would be great to see such feature in the core).

@piotrekkaminski
Copy link
Contributor

@dfediuk do you have this custom module available for Magento 2?

@dmitrii-fediuk
Copy link
Author

Yes, but I have no plans to distribute it now.
My dictionary format sample is below (with fallback to the standard core dictionary):

<module name='Magento_Sales'>
    <controller action='sales_order_*'>
        <term><en_US>Complete</en_US><ru_RU>Выполнен</ru_RU></term>
        <term><en_US>Purchase Date</en_US><ru_RU>Время</ru_RU></term>
    </controller>
    <controller action='sales_order_invoice_view'>
        <term><en_US>Account Information</en_US><ru_RU>Покупатель</ru_RU></term>
        <term><en_US>Comment Text</en_US><ru_RU>Новый комментарий</ru_RU></term>
    </controller>
    <controller action='sales_order_status_*'>
        <term><en_US>Order Status</en_US><ru_RU>Перечень состояний заказов</ru_RU></term>
        <term><en_US>records found</en_US><ru_RU>состояний</ru_RU></term>
        <term><en_US>Status Code</en_US><ru_RU>Код</ru_RU></term>
    </controller>
    <controller action='sales_order_view'>      
        <term><en_US>Backordered</en_US><ru_RU>Невыполнимо</ru_RU></term>
        <term><en_US>Price</en_US><ru_RU>Цена товара для заказа</ru_RU></term>
    </controller>
    <controller action='sales_transactions_*'>
        <term><en_US>capture</en_US><ru_RU>зачисление средств</ru_RU></term>
        <term><en_US>Сapture</en_US><ru_RU>Зачисление средств</ru_RU></term>
    </controller>
</module>

Actually it is more complex, because my extension supports an individual translation not only for request actions but also for blocks, components, eav attributes, forms and so on.
In my exprerience, for 90% cases transation per request action is sufficient and it is the basic and primary feature of my extension.
Another important feature is a proper caching because the dictionaries are more complex than the standard CSV key-value.

@duhon duhon added the Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development label Jun 7, 2016
@peec
Copy link

peec commented Aug 26, 2016

We are currently translating magento2 from en-US.

Is it so that Magento 2 as of 2.1 does not currently support Context ? So basically when creating a language pack - it choses a random occurrence of "Hello". So one needs to be sure that all "Hello" is translated ?

@magento-engcom-team magento-engcom-team added Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development bug report Issue: Format is not valid Gate 1 Failed. Automatic verification of issue format is failed TECH labels Sep 11, 2017
@magento-engcom-team
Copy link
Contributor

MAGETWO-43683 has been fixed and delivered

@magento-engcom-team magento-engcom-team added Fixed in 2.2.x The issue has been fixed in 2.2 release line Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed labels Sep 12, 2017
okorshenko pushed a commit that referenced this issue Nov 3, 2017
Public Pull Requests

#11960 [Backport 2.1] #11898 - Change NL PostCode Pattern by @osrecio
#11920 [BACKPORT 2.1] [TASK] Add resetPassword call to the webapi by @lewisvoncken
#11890 Save background color correctly in images. [backport 2.1] by @raumatbel

Fixed Public Issues

#11898 Zip code Netherlands should allow zipcode without space
#8799 Image brackground
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug report Fixed in 2.2.x The issue has been fixed in 2.2 release line Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Issue: Format is not valid Gate 1 Failed. Automatic verification of issue format is failed Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development
Projects
None yet
Development

No branches or pull requests

10 participants