Problem/Motivation
Currently, TMGMT only supports translations from the item source language.
Sometimes, a translator doesn't support translating into language C from language A. Instead, a translation needs to be done through an intermediate language B.
Proposed resolution
This feature only works in the cart where we are still much more flexible with treating items.
Stick with using the source language for creating regular jobs.
But add a checkbox (possibly only a collabsed fieldset) to force the job source language to a certain language.
Offer a Dropdown to pick a forced language.
When requesting a job, tmgmt tries to consider that language as item source language.
If an item doesn't support this language, it is skipped (and stays in cart).
Add a warning that the intermediate language should be reviewed by a native and be of very high quality.
The UI might automatically apply a class to change color / add a warning icon to lines that don't work with a chosen language. The checkbox should not be automatically modified.
Remaining tasks
User interface changes
API changes
Comment | File | Size | Author |
---|---|---|---|
#35 | translate_from_a-2257375-35-interdiff.txt | 747 bytes | sasanikolic |
#35 | translate_from_a-2257375-35.patch | 16.42 KB | sasanikolic |
#31 | translate_from_a-2257375-31-interdiff.txt | 516 bytes | sasanikolic |
#31 | translate_from_a-2257375-31.patch | 16.41 KB | sasanikolic |
#29 | translate_from_a-2257375-29-interdiff.txt | 6.83 KB | sasanikolic |
Comments
Comment #1
blueminds CreditAttribution: blueminds commentedprovided tests
Comment #2
BerdirTests looks ok so far, a few remarks:
- We should submit and load the job/item to verify that the items were added correctly and the correct data has been pulled
- Because I'm pretty sure that the node_source and possibly other sources as well will not support this correctly in their getData() implementation, tmgmt_node for example simply loads the node it has, but it will need to look if it's the right language and if not, load the corresponding translation instead. locale and i18n are likely similar, tmgmt_entity might work because it loads the values based on the source language from the single entity.
- Which means that we do not only need to test the UI, we should also add API tests for the other sources by saving a source + translation, create a job with source language of that translation and then request data for it. Should not be very complicated, but we should cover all sources, even the one I suspect works (tmgmt_entity)
Comment #3
blueminds CreditAttribution: blueminds commentedextended the tests
Comment #4
BerdirComment #7
blueminds CreditAttribution: blueminds commentedYeah, it looks like I got too much used to php 5.4...
Here's initial patch with translation loading for i18n and node sources. It also contains basic UI to enforce source language at the cart. Basic workflow should work, needs handling of special cases + test coverage for them.
Comment #9
BerdirThis is not correct, the i18n source language is the site default language or the configurable override, see elsewhere in that file.
You should do a break then to make it clear that we're done processing the array.
The translations should be keyed by language, so you could get the array and then access it directly.
Not sure if we want to care about non-existing translations, possibly throw an exception but then we should do it everywhere...
source item's language => item's source language.
Possibly extend this with a sentence that says if one is selected then it will take the translation of the source item in that language and ignore it if it is not present.
Comment #10
blueminds CreditAttribution: blueminds commentedThe patch is not yet complete, but ready for review.
Implemented:
- the exception in case there is no translation. This exception is then used also by UI to display a message to the user.
- comments above except the message
Missing:
- throwing an exception in the entity source. Here not sure how to determine if it is translated or not as it the fallback there to the original content is by default
- tests for the exceptions.
Comment #11
blueminds CreditAttribution: blueminds commentedcompleted. Let's see if testbot agrees.
Comment #12
miro_dietikerNice, generally seems to work.
If i choose a forced source language and items doesn't apply, there should not be a single message per item. Also it's no error.
There should be a warning like "N items skipped because language XY not applicable for...". Not even sure if the titles should be output.
Originally, skipped items are skipped silently.
Possibly too silently, and might be a separate issue:
If i chose the same target language as source language, nothing happens, not even a message why.
If i force source language to some intermediate, and chose the target to be the same, also nothing happens with no message at all.
Also, the form reloads and the selection is dropped. Sad.
These cases should be validation errors and not submit processing without any effect.
A good solution would be to make the UX consistent about skipping / processing hints, possibly as part of this issue.
Comment #13
blueminds CreditAttribution: blueminds commentedThe problem with forced language and items that do not apply is that we just receive an exception that something went wrong, not really knowing what - that is the reason for the error message. What would help here is to introduce something like $job_item->hasSource($language). This would also solve the problem that we learn about missing source for the given language after an item is added to a job, from which it is possible to retrieve the source language.
Comment #14
miro_dietikerOK discussed this with Berdir.
The exception thing is not what we want to rely on here. The source has a method to check if a source item supports a certain source language. Use this and properly skip and increment skip counter. Exception thus should not happen at all.
Two small changes on hints / messages:
- In case no job was created, show an error message. Fine for now quickly in submit handler, a user might lose his selection, but we can live with that.
- For items that are skipped (because they are not available in source language), just count them and add a summary warning. Not an error. And not separate messages per item.
Comment #15
blueminds CreditAttribution: blueminds commentedplease see the patch.
Comment #17
blueminds CreditAttribution: blueminds commentedeh..
Comment #18
BerdirCommitted with the attached changes.
Spent way too much time discussing the UI messages and descriptions with Miro. It still isn't perfect but we both think it's much better. The warning after creating the job has been removed as there was nothing useful in there, instead, we made the descriptions on cart form explain the quality problem (saying that on the job checkout page doesn't help at the time... you already created the job and it's not yet time to review it).
Comment #20
miro_dietikerAwesome to have this feature in! Thank you all for pushing.
Comment #21
BerdirActually...
Comment #22
miro_dietikerComment #23
miro_dietikerComment #24
sasanikolic CreditAttribution: sasanikolic commentedFirst part of the patch/port. Needs to be worked on.
Comment #25
Berdirthe exception message actually said locale id, not job item id, so lets return that (getItemId() I think)
That's.. weird ;)
Both the new and existing @file definition are wrong, and there shouldn't be two. Compare with other files how it should look like.
Strange indendation on comments, and 4 instead of 2 in the code.
Comment #26
sasanikolic CreditAttribution: sasanikolic commentedAdded the second part of the patch, and fixed the issues commented above.
Comment #27
sasanikolic CreditAttribution: sasanikolic commentedComment #28
BerdirAs discussed, let's move this to a new TmgmtCartTest.
Looks good otherwise!
Comment #29
sasanikolic CreditAttribution: sasanikolic commentedMoved the function to the new file.
Comment #31
sasanikolic CreditAttribution: sasanikolic commentedDeleted too much...
Comment #32
sasanikolic CreditAttribution: sasanikolic commentedComment #35
sasanikolic CreditAttribution: sasanikolic commentedFixed the test.
Comment #36
sasanikolic CreditAttribution: sasanikolic commentedComment #38
BerdirGreat, committed.