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

EZP-27539: Translation support in content edit #182

Merged
merged 2 commits into from
Dec 4, 2017

Conversation

webhdx
Copy link
Contributor

@webhdx webhdx commented Dec 1, 2017

JIRA: https://jira.ez.no/browse/EZP-27539

Description

Translation support was never implemented in repository-forms. Now there is a need for that in new AdminUI. This PR makes fieldtypes "language" aware which is helpful for developers theming content edit page. It also fixes the issue of nontranslated labels of fieldtypes as this feature is there but never implemented in Admin UI or Platform UI.

Copy link
Member

@bdunogier bdunogier left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me besides a few comments.

@@ -103,7 +103,7 @@ public function createWithoutDraftAction($contentTypeIdentifier, $language, $par

return new ContentCreateView(null, [
'form' => $form->createView(),
'languageCode' => $language,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might not be critical, but maybe I'd try to keep some BC here: add language, and comment languageCode as deprecated ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure. 2.0 will change a lot actually, I'd love to make it as clean as possible in 2.0 so that we aren't left with a lot of deprecations till 3.0. I believe it's just a matter of writing a descriptive doc on what is not backwards compatible.

@@ -153,7 +156,12 @@ public function processCreateDraft(FormActionEvent $event)
*/
private function saveDraft(ContentStruct $data, $languageCode)
{
$mainLanuageCode = $this->resolveMainLanguageCode($data);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo on $mainLanguageCode.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Argh, happens to me on word language constantly ;)

*/
private function resolveMainLanguageCode($data): string
{
return $data->isNew()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we be a tiny bit protective and test the type of $data, since we don't have typehinting here ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea. Fixed.

@webhdx webhdx force-pushed the translation_support branch 2 times, most recently from 5ea6a2a to 673bcbd Compare December 4, 2017 12:05
@ezsystems ezsystems deleted a comment from ezrobot Dec 4, 2017
@webhdx webhdx force-pushed the translation_support branch from 673bcbd to 62e2800 Compare December 4, 2017 12:08
@lserwatka lserwatka merged commit bcc37e9 into ezsystems:master Dec 4, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

3 participants