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

Add 'edit_languages' command #2576

Merged
merged 5 commits into from
Oct 26, 2020
Merged

Add 'edit_languages' command #2576

merged 5 commits into from
Oct 26, 2020

Conversation

AndiPersti
Copy link
Contributor

This PR adds a command to change the language of many sentences from the command line. This should help in moving all Kurdish sentences to Northern Kurdish (see #2570, point 2) and for splitting other macro languages in the future.

Since I wanted to use SentencesTable::editSentence for the updating part, I've also refactored that method to make it more reusable. As a side-effect I've also fixed #1678. 😃

When the client sent the data to the server, it combined the sentence id
and language into a single string. The probable reason for this is the
default configuration of the `jeditable` library which uses the id of the
surrounding `div` element for the `id` key of the POST data.

But it's also possible to format the POST data that is sent and we
should take advantage of it. This simplifies the code on the server (and
for the new design) and also makes `editSentence` easier to reuse.
Instead of always providing both the text and the language of a
sentence, it's now possible to provide only one of them.
After refactoring SentencesTable::editSentence in 35b0954 and
77642da, we don't need to send the language to the server any more
when editing the text in the old design.
This command allows admins to change the language of many sentences
from the command line.
@jiru
Copy link
Member

jiru commented Oct 21, 2020

I didn’t try to run it but the code looks good. 👍

I suggest removing the underscored id attribute from the old design template (look for the infamous "HACK SPOTTED" comment 😉).

@AndiPersti
Copy link
Contributor Author

Thanks for the review. I will remove the id attribute.

@AndiPersti AndiPersti added this to the 2020-10-25 milestone Oct 26, 2020
@AndiPersti AndiPersti merged commit 6a1dcfe into Tatoeba:dev Oct 26, 2020
@AndiPersti AndiPersti deleted the edit-language-command branch October 26, 2020 07:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Language of sentence reverts back if it's changed while editing the sentence
2 participants