From 9201602af83b586e52acb023ac4f8d613221a2a8 Mon Sep 17 00:00:00 2001 From: mikolaj Date: Wed, 10 May 2023 15:06:47 +0200 Subject: [PATCH] Fixed translation configuration --- .../IbexaCoreExtension.php | 4 +- .../translations/content_fields.en.xlf | 4 +- .../translations/fielddefinition.en.xlf | 115 ++------ .../{forms.en.xliff => forms.en.xlf} | 126 ++++----- .../Resources/translations/messages.en.xlf | 8 +- .../translations/repository_exceptions.en.xlf | 262 ++++++------------ .../ContentTypeValidationException.php | 4 +- .../Exceptions/ContentValidationException.php | 4 +- .../ArrayTranslatorFieldsGroupsList.php | 2 + .../Twig/Extension/FileSizeExtension.php | 5 +- .../ExceptionMessageTemplateFileVisitor.php | 50 ++++ 11 files changed, 227 insertions(+), 357 deletions(-) rename src/bundle/Core/Resources/translations/{forms.en.xliff => forms.en.xlf} (80%) diff --git a/src/bundle/Core/DependencyInjection/IbexaCoreExtension.php b/src/bundle/Core/DependencyInjection/IbexaCoreExtension.php index 1529c9f580..af250d764f 100644 --- a/src/bundle/Core/DependencyInjection/IbexaCoreExtension.php +++ b/src/bundle/Core/DependencyInjection/IbexaCoreExtension.php @@ -1024,10 +1024,10 @@ private function prependJMSTranslation(ContainerBuilder $container): void 'configs' => [ 'ibexa_core' => [ 'dirs' => [ - __DIR__ . '/../', + __DIR__ . '/../../../', ], 'output_dir' => __DIR__ . '/../Resources/translations/', - 'output_format' => 'xliff', + 'output_format' => 'xlf', 'excluded_dirs' => ['Behat', 'Tests', 'node_modules', 'Features'], ], ], diff --git a/src/bundle/Core/Resources/translations/content_fields.en.xlf b/src/bundle/Core/Resources/translations/content_fields.en.xlf index 696fb92681..38a1439791 100644 --- a/src/bundle/Core/Resources/translations/content_fields.en.xlf +++ b/src/bundle/Core/Resources/translations/content_fields.en.xlf @@ -8,12 +8,12 @@ Not set - Not set + Not set key: content-field.latitude.not_set Not set - Not set + Not set key: content-field.longitude.not_set diff --git a/src/bundle/Core/Resources/translations/fielddefinition.en.xlf b/src/bundle/Core/Resources/translations/fielddefinition.en.xlf index 8f38518d8e..9e67f3842c 100644 --- a/src/bundle/Core/Resources/translations/fielddefinition.en.xlf +++ b/src/bundle/Core/Resources/translations/fielddefinition.en.xlf @@ -1,6 +1,6 @@ - +
The source node in most cases contains the sample message as written by the developer. If it looks like a dot-delimitted string such as "form.label.firstname", then the developer has not provided a default message. @@ -10,388 +10,311 @@ Any Any key: fielddefinition.allowed-content-types.any - src/bundle/Core/Resources/views/fielddefinition_settings.html.twig Allowed content types: Allowed content types: key: fielddefinition.allowed-content-types.label - src/bundle/Core/Resources/views/fielddefinition_settings.html.twig - - - Default layout: - Default layout: - key: fielddefinition.default-layout.label - src/bundle/Core/Resources/views/fielddefinition_settings.html.twig - - - None - None - key: fielddefinition.default-layout.none - src/bundle/Core/Resources/views/fielddefinition_settings.html.twig Checked Checked key: fielddefinition.default-value.checked - src/bundle/Core/Resources/views/fielddefinition_settings.html.twig + + + Current User + Current User + key: fielddefinition.default-value.current_author Current date Current date key: fielddefinition.default-value.current_date - src/bundle/Core/Resources/views/fielddefinition_settings.html.twig Current datetime Current datetime key: fielddefinition.default-value.current_datetime - src/bundle/Core/Resources/views/fielddefinition_settings.html.twig Current datetime adjusted by Current datetime adjusted by key: fielddefinition.default-value.current_datetime_adjust_by - src/bundle/Core/Resources/views/fielddefinition_settings.html.twig Current time Current time key: fielddefinition.default-value.current_time - src/bundle/Core/Resources/views/fielddefinition_settings.html.twig Empty Empty key: fielddefinition.default-value.empty - src/bundle/Core/Resources/views/fielddefinition_settings.html.twig - src/bundle/Core/Resources/views/fielddefinition_settings.html.twig - src/bundle/Core/Resources/views/fielddefinition_settings.html.twig Default value: Default value: key: fielddefinition.default-value.label - src/bundle/Core/Resources/views/fielddefinition_settings.html.twig - src/bundle/Core/Resources/views/fielddefinition_settings.html.twig Unchecked Unchecked key: fielddefinition.default-value.unchecked - src/bundle/Core/Resources/views/fielddefinition_settings.html.twig No default value No default value key: fielddefinition.default-value.undefined - src/bundle/Core/Resources/views/fielddefinition_settings.html.twig %default% %day% day(s) %default% %day% day(s) key: fielddefinition.interval.day - src/bundle/Core/Resources/views/fielddefinition_settings.html.twig %default% %hour% hour(s) %default% %hour% hour(s) key: fielddefinition.interval.hour - src/bundle/Core/Resources/views/fielddefinition_settings.html.twig %default% %minute% minute(s) %default% %minute% minute(s) key: fielddefinition.interval.minute - src/bundle/Core/Resources/views/fielddefinition_settings.html.twig %default% %month% month(s) %default% %month% month(s) key: fielddefinition.interval.month - src/bundle/Core/Resources/views/fielddefinition_settings.html.twig %default% %second% second(s) %default% %second% second(s) key: fielddefinition.interval.second - src/bundle/Core/Resources/views/fielddefinition_settings.html.twig %default% %year% year(s) %default% %year% year(s) key: fielddefinition.interval.year - src/bundle/Core/Resources/views/fielddefinition_settings.html.twig Selected ISBN format: Selected ISBN format: key: fielddefinition.isbn.label - src/bundle/Core/Resources/views/fielddefinition_settings.html.twig Max string length: Max string length: key: fielddefinition.max-length.label - src/bundle/Core/Resources/views/fielddefinition_settings.html.twig No defined maximum string length No defined maximum string length key: fielddefinition.max-length.undefined - src/bundle/Core/Resources/views/fielddefinition_settings.html.twig %max% characters %max% characters key: fielddefinition.max-length.value - src/bundle/Core/Resources/views/fielddefinition_settings.html.twig Maximum value: Maximum value: key: fielddefinition.max-value.label - src/bundle/Core/Resources/views/fielddefinition_settings.html.twig No defined maximum value No defined maximum value key: fielddefinition.max-value.undefined - src/bundle/Core/Resources/views/fielddefinition_settings.html.twig Maximum file size: Maximum file size: key: fielddefinition.maximum-file-size.label - src/bundle/Core/Resources/views/fielddefinition_settings.html.twig No defined maximum size No defined maximum size key: fielddefinition.maximum-file-size.undefined - src/bundle/Core/Resources/views/fielddefinition_settings.html.twig %max% MB %max% MB key: fielddefinition.maximum-file-size.value - src/bundle/Core/Resources/views/fielddefinition_settings.html.twig Flash Flash key: fielddefinition.media-player-type.flash - src/bundle/Core/Resources/views/fielddefinition_settings.html.twig HTML5 Audio HTML5 Audio key: fielddefinition.media-player-type.html5_audio - src/bundle/Core/Resources/views/fielddefinition_settings.html.twig HTML5 Video HTML5 Video key: fielddefinition.media-player-type.html5_video - src/bundle/Core/Resources/views/fielddefinition_settings.html.twig Media player type: Media player type: key: fielddefinition.media-player-type.label - src/bundle/Core/Resources/views/fielddefinition_settings.html.twig Quicktime Quicktime key: fielddefinition.media-player-type.quick_time - src/bundle/Core/Resources/views/fielddefinition_settings.html.twig Real Player Real Player key: fielddefinition.media-player-type.real_player - src/bundle/Core/Resources/views/fielddefinition_settings.html.twig Silverlight Silverlight key: fielddefinition.media-player-type.silverlight - src/bundle/Core/Resources/views/fielddefinition_settings.html.twig No defined value No defined value key: fielddefinition.media-player-type.undefined - src/bundle/Core/Resources/views/fielddefinition_settings.html.twig Window Media Player Window Media Player key: fielddefinition.media-player-type.windows_media_player - src/bundle/Core/Resources/views/fielddefinition_settings.html.twig Min string length: - Min string length: + Min string length: key: fielddefinition.min-length.label - src/bundle/Core/Resources/views/fielddefinition_settings.html.twig No defined minimum string length - No defined minimum string length + No defined minimum string length key: fielddefinition.min-length.undefined - src/bundle/Core/Resources/views/fielddefinition_settings.html.twig %min% characters - %min% characters + %min% characters key: fielddefinition.min-length.value - src/bundle/Core/Resources/views/fielddefinition_settings.html.twig Minimum value: Minimum value: key: fielddefinition.min-value.label - src/bundle/Core/Resources/views/fielddefinition_settings.html.twig No defined minimum value No defined minimum value key: fielddefinition.min-value.undefined - src/bundle/Core/Resources/views/fielddefinition_settings.html.twig Allow multiple choices: Allow multiple choices: key: fielddefinition.multiple.label - src/bundle/Core/Resources/views/fielddefinition_settings.html.twig - - - Yes - Yes - key: fielddefinition.multiple.yes - src/bundle/Core/Resources/views/fielddefinition_settings.html.twig No No key: fielddefinition.multiple.no - src/bundle/Core/Resources/views/fielddefinition_settings.html.twig + + + Yes + Yes + key: fielddefinition.multiple.yes Defined options Defined options key: fielddefinition.options.label - src/bundle/Core/Resources/views/fielddefinition_settings.html.twig Preferred number of rows: Preferred number of rows: key: fielddefinition.preferred-rows-number.label - src/bundle/Core/Resources/views/fielddefinition_settings.html.twig No preferred number of rows No preferred number of rows key: fielddefinition.preferred-rows-number.undefined - src/bundle/Core/Resources/views/fielddefinition_settings.html.twig %rows% rows %rows% rows key: fielddefinition.preferred-rows-number.value - src/bundle/Core/Resources/views/fielddefinition_settings.html.twig Browse Browse key: fielddefinition.selection-method.browse - src/bundle/Core/Resources/views/fielddefinition_settings.html.twig - src/bundle/Core/Resources/views/fielddefinition_settings.html.twig List with checkboxes List with checkboxes key: fielddefinition.selection-method.checkbox - src/bundle/Core/Resources/views/fielddefinition_settings.html.twig Selection method: Selection method: key: fielddefinition.selection-method.label - src/bundle/Core/Resources/views/fielddefinition_settings.html.twig - src/bundle/Core/Resources/views/fielddefinition_settings.html.twig Drop-down list Drop-down list key: fielddefinition.selection-method.list - src/bundle/Core/Resources/views/fielddefinition_settings.html.twig - src/bundle/Core/Resources/views/fielddefinition_settings.html.twig Template based, multi Template based, multi key: fielddefinition.selection-method.multi_template - src/bundle/Core/Resources/views/fielddefinition_settings.html.twig Multiple selection list Multiple selection list key: fielddefinition.selection-method.multiple_list - src/bundle/Core/Resources/views/fielddefinition_settings.html.twig List with radio buttons List with radio buttons key: fielddefinition.selection-method.radio - src/bundle/Core/Resources/views/fielddefinition_settings.html.twig Template based, single Template based, single key: fielddefinition.selection-method.single_template - src/bundle/Core/Resources/views/fielddefinition_settings.html.twig Drop-down tree Drop-down tree key: fielddefinition.selection-method.tree - src/bundle/Core/Resources/views/fielddefinition_settings.html.twig Selection root: Selection root: key: fielddefinition.selection-root.label - src/bundle/Core/Resources/views/fielddefinition_settings.html.twig No defined root No defined root key: fielddefinition.selection-root.undefined - src/bundle/Core/Resources/views/fielddefinition_settings.html.twig Use seconds: Use seconds: key: fielddefinition.use-seconds.label - src/bundle/Core/Resources/views/fielddefinition_settings.html.twig - src/bundle/Core/Resources/views/fielddefinition_settings.html.twig - - - Yes - Yes - key: fielddefinition.use-seconds.yes - src/bundle/Core/Resources/views/fielddefinition_settings.html.twig - src/bundle/Core/Resources/views/fielddefinition_settings.html.twig No No key: fielddefinition.use-seconds.no - src/bundle/Core/Resources/views/fielddefinition_settings.html.twig - src/bundle/Core/Resources/views/fielddefinition_settings.html.twig + + + Yes + Yes + key: fielddefinition.use-seconds.yes diff --git a/src/bundle/Core/Resources/translations/forms.en.xliff b/src/bundle/Core/Resources/translations/forms.en.xlf similarity index 80% rename from src/bundle/Core/Resources/translations/forms.en.xliff rename to src/bundle/Core/Resources/translations/forms.en.xlf index 58e583244e..c34bc01cef 100644 --- a/src/bundle/Core/Resources/translations/forms.en.xliff +++ b/src/bundle/Core/Resources/translations/forms.en.xlf @@ -8,317 +8,317 @@ Content Type - Content Type + Content Type key: role.policy.class Content Type / All functions - Content Type / All functions + Content Type / All functions key: role.policy.class.all_functions Content Type / Create - Content Type / Create + Content Type / Create key: role.policy.class.create Content Type / Delete - Content Type / Delete + Content Type / Delete key: role.policy.class.delete Content Type / Update - Content Type / Update + Content Type / Update key: role.policy.class.update Content - Content + Content key: role.policy.content Content / All functions - Content / All functions + Content / All functions key: role.policy.content.all_functions Content / Cleantrash - Content / Cleantrash + Content / Cleantrash key: role.policy.content.cleantrash Content / Create - Content / Create + Content / Create key: role.policy.content.create Content / Diff - Content / Diff + Content / Diff key: role.policy.content.diff Content / Edit - Content / Edit + Content / Edit key: role.policy.content.edit Content / Hide - Content / Hide + Content / Hide key: role.policy.content.hide Content / Manage locations - Content / Manage locations + Content / Manage locations key: role.policy.content.manage_locations Content / Pendinglist - Content / Pendinglist + Content / Pendinglist key: role.policy.content.pendinglist Content / Publish - Content / Publish + Content / Publish key: role.policy.content.publish Content / Read - Content / Read + Content / Read key: role.policy.content.read Content / Remove - Content / Remove + Content / Remove key: role.policy.content.remove Content / Restore - Content / Restore + Content / Restore key: role.policy.content.restore Content / Reverserelatedlist - Content / Reverserelatedlist + Content / Reverserelatedlist key: role.policy.content.reverserelatedlist Content / Translate - Content / Translate + Content / Translate key: role.policy.content.translate Content / Translations - Content / Translations + Content / Translations key: role.policy.content.translations Content / Unlock - Content / Unlock + Content / Unlock key: role.policy.content.unlock Content / Urltranslator - Content / Urltranslator + Content / Urltranslator key: role.policy.content.urltranslator Content / Versionread - Content / Versionread + Content / Versionread key: role.policy.content.versionread Content / Versionremove - Content / Versionremove + Content / Versionremove key: role.policy.content.versionremove Role - Role + Role key: role.policy.role Role / All functions - Role / All functions + Role / All functions key: role.policy.role.all_functions Role / Assign - Role / Assign + Role / Assign key: role.policy.role.assign Role / Create - Role / Create + Role / Create key: role.policy.role.create Role / Delete - Role / Delete + Role / Delete key: role.policy.role.delete Role / Read - Role / Read + Role / Read key: role.policy.role.read Role / Update - Role / Update + Role / Update key: role.policy.role.update Section - Section + Section key: role.policy.section Section / All functions - Section / All functions + Section / All functions key: role.policy.section.all_functions Section / Assign - Section / Assign + Section / Assign key: role.policy.section.assign Section / Edit - Section / Edit + Section / Edit key: role.policy.section.edit Section / View - Section / View + Section / View key: role.policy.section.view Setting - Setting + Setting key: role.policy.setting Setting / All functions - Setting / All functions + Setting / All functions key: role.policy.setting.all_functions Setting / Create - Setting / Create + Setting / Create key: role.policy.setting.create Setting / Remove - Setting / Remove + Setting / Remove key: role.policy.setting.remove Setting / Update - Setting / Update + Setting / Update key: role.policy.setting.update Setup - Setup + Setup key: role.policy.setup Setup / Administrate - Setup / Administrate + Setup / Administrate key: role.policy.setup.administrate Setup / All functions - Setup / All functions + Setup / All functions key: role.policy.setup.all_functions Setup / Install - Setup / Install + Setup / Install key: role.policy.setup.install Setup / Setup - Setup / Setup + Setup / Setup key: role.policy.setup.setup Setup / System info - Setup / System info + Setup / System info key: role.policy.setup.system_info State - State + State key: role.policy.state State / Administrate - State / Administrate + State / Administrate key: role.policy.state.administrate State / All functions - State / All functions + State / All functions key: role.policy.state.all_functions State / Assign - State / Assign + State / Assign key: role.policy.state.assign User - User + User key: role.policy.user User / Activation - User / Activation + User / Activation key: role.policy.user.activation User / All functions - User / All functions + User / All functions key: role.policy.user.all_functions User / Invite - User / Invite + User / Invite key: role.policy.user.invite User / Login - User / Login + User / Login key: role.policy.user.login User / Password - User / Password + User / Password key: role.policy.user.password User / Preferences - User / Preferences + User / Preferences key: role.policy.user.preferences User / Register - User / Register + User / Register key: role.policy.user.register User / Selfedit - User / Selfedit + User / Selfedit key: role.policy.user.selfedit User / Update - User / Update + User / Update key: role.policy.user.update User / View - User / View + User / View key: role.policy.user.view diff --git a/src/bundle/Core/Resources/translations/messages.en.xlf b/src/bundle/Core/Resources/translations/messages.en.xlf index 1398248eef..2dfd2528cd 100644 --- a/src/bundle/Core/Resources/translations/messages.en.xlf +++ b/src/bundle/Core/Resources/translations/messages.en.xlf @@ -1,6 +1,6 @@ - +
The source node in most cases contains the sample message as written by the developer. If it looks like a dot-delimitted string such as "form.label.firstname", then the developer has not provided a default message. @@ -10,32 +10,26 @@ Enter login or email Enter login or email key: Enter login or email - src/bundle/Core/Resources/views/Security/login.html.twig Enter password Enter password key: Enter password - src/bundle/Core/Resources/views/Security/login.html.twig Login Login key: Login - src/bundle/Core/Resources/views/Security/login.html.twig - src/bundle/Core/Resources/views/Security/login.html.twig Password: Password: key: Password: - src/bundle/Core/Resources/views/Security/login.html.twig Username: Username: key: Username: - src/bundle/Core/Resources/views/Security/login.html.twig diff --git a/src/bundle/Core/Resources/translations/repository_exceptions.en.xlf b/src/bundle/Core/Resources/translations/repository_exceptions.en.xlf index 68b62c7ae2..0d96172ba6 100644 --- a/src/bundle/Core/Resources/translations/repository_exceptions.en.xlf +++ b/src/bundle/Core/Resources/translations/repository_exceptions.en.xlf @@ -1,242 +1,140 @@ - +
The source node in most cases contains the sample message as written by the developer. If it looks like a dot-delimitted string such as "form.label.firstname", then the developer has not provided a default message.
- - '%actualValue%' is wrong value - '%actualValue%' is wrong value - key: '%actualValue%' is wrong value - src/lib/Base/Exceptions/InvalidArgumentValue.php - - - '%actualValue%' is wrong value in class '%className%' - '%actualValue%' is wrong value in class '%className%' - key: '%actualValue%' is wrong value in class '%className%' - src/lib/Base/Exceptions/InvalidArgumentValue.php - - - A value is set for non translatable field definition '%identifier%' with language '%languageCode%' - A value is set for non translatable field definition '%identifier%' with language '%languageCode%' - key: A value is set for non translatable field definition '%identifier%' with language '%languageCode%' - src/lib/Repository/ContentService.php - src/lib/Repository/ContentService.php + + '%actualValue%' is incorrect value + '%actualValue%' is incorrect value + key: '%actualValue%' is incorrect value + + + '%actualValue%' is incorrect value in class '%className%' + '%actualValue%' is incorrect value in class '%className%' + key: '%actualValue%' is incorrect value in class '%className%' Argument '%argumentName%' has a bad state: %whatIsWrong% Argument '%argumentName%' has a bad state: %whatIsWrong% key: Argument '%argumentName%' has a bad state: %whatIsWrong% - src/lib/Base/Exceptions/BadStateException.php Argument '%argumentName%' is invalid: %whatIsWrong% Argument '%argumentName%' is invalid: %whatIsWrong% key: Argument '%argumentName%' is invalid: %whatIsWrong% - src/lib/Base/Exceptions/InvalidArgumentException.php - - Argument '%argumentName%' is invalid: expected value to be of type '%expectedType%' - Argument '%argumentName%' is invalid: expected value to be of type '%expectedType%' - key: Argument '%argumentName%' is invalid: expected value to be of type '%expectedType%' - src/lib/Base/Exceptions/InvalidArgumentType.php + + Argument '%argumentName%' is invalid: value must be of type '%expectedType%' + Argument '%argumentName%' is invalid: value must be of type '%expectedType%' + key: Argument '%argumentName%' is invalid: value must be of type '%expectedType%' - - Argument '%argumentName%' is invalid: expected value to be of type '%expectedType%', got '%actualType%' - Argument '%argumentName%' is invalid: expected value to be of type '%expectedType%', got '%actualType%' - key: Argument '%argumentName%' is invalid: expected value to be of type '%expectedType%', got '%actualType%' - src/lib/Base/Exceptions/InvalidArgumentType.php + + Argument '%argumentName%' is invalid: value must be of type '%expectedType%', not '%actualType%' + Argument '%argumentName%' is invalid: value must be of type '%expectedType%', not '%actualType%' + key: Argument '%argumentName%' is invalid: value must be of type '%expectedType%', not '%actualType%' Argument 'BinaryFile::id' is invalid: '%id%' is wrong value, binary file ids can not begin with a '/' Argument 'BinaryFile::id' is invalid: '%id%' is wrong value, binary file ids can not begin with a '/' key: Argument 'BinaryFile::id' is invalid: '%id%' is wrong value, binary file ids can not begin with a '/' - src/lib/IO/Exception/InvalidBinaryAbsolutePathException.php Argument 'BinaryFile::id' is invalid: '%id%' is wrong value, it does not contain prefix '%prefix%'. Is 'var_dir' config correct? Argument 'BinaryFile::id' is invalid: '%id%' is wrong value, it does not contain prefix '%prefix%'. Is 'var_dir' config correct? key: Argument 'BinaryFile::id' is invalid: '%id%' is wrong value, it does not contain prefix '%prefix%'. Is 'var_dir' config correct? - src/lib/IO/Exception/InvalidBinaryPrefixException.php + + + Content "%contentName%" fields did not validate: %errors% + Content "%contentName%" fields did not validate: %errors% + key: Content "%contentName%" fields did not validate: %errors% + + + Content Type Field definitions did not validate + Content Type Field definitions did not validate + key: Content Type Field definitions did not validate Content fields did not validate Content fields did not validate key: Content fields did not validate - src/lib/Base/Exceptions/ContentFieldValidationException.php - - - Content type cannot be unlinked from the only remaining group - Content type cannot be unlinked from the only remaining group - key: Content type cannot be unlinked from the only remaining group - src/lib/REST/Server/Controller/ContentType.php - - - Content type is already linked to provided group - Content type is already linked to provided group - key: Content type is already linked to provided group - src/lib/REST/Server/Controller/ContentType.php - - - ContentType FieldDefinitions did not validate - ContentType FieldDefinitions did not validate - key: ContentType FieldDefinitions did not validate - src/lib/Base/Exceptions/ContentTypeFieldDefinitionValidationException.php Could not find %classType% class '%className%' Could not find %classType% class '%className%' key: Could not find %classType% class '%className%' - src/lib/Base/Exceptions/MissingClass.php Could not find '%what%' with identifier '%identifier%' Could not find '%what%' with identifier '%identifier%' key: Could not find '%what%' with identifier '%identifier%' - src/lib/Base/Exceptions/NotFoundException.php Could not find class '%className%' Could not find class '%className%' key: Could not find class '%className%' - src/lib/Base/Exceptions/MissingClass.php - - - Current version is already in status DRAFT - Current version is already in status DRAFT - key: Current version is already in status DRAFT - src/lib/REST/Server/Controller/Content.php - - - Empty content type draft cannot be published - Empty content type draft cannot be published - key: Empty content type draft cannot be published - src/lib/REST/Server/Controller/ContentType.php - - - Field definition '%identifier%' does not exist in given ContentType - Field definition '%identifier%' does not exist in given ContentType - key: Field definition '%identifier%' does not exist in given ContentType - src/lib/Repository/ContentService.php - src/lib/Repository/ContentService.php - - - FieldType '%fieldType%' not found, needs to be implemented or configured to use FieldType\Null\Type - FieldType '%fieldType%' not found, needs to be implemented or configured to use FieldType\Null\Type - key: FieldType '%fieldType%' not found, needs to be implemented or configured to use FieldType\Null\Type - src/lib/Base/Exceptions/NotFound/FieldTypeNotFoundException.php - - - FieldType '%identifier%' is singular and can't be repeated in a ContentType - FieldType '%identifier%' is singular and can't be repeated in a ContentType - key: FieldType '%identifier%' is singular and can't be repeated in a ContentType - - - Limitation '%limitation%' not found, needs to be implemented or configured to use Limitation\BlockingLimitationType - Limitation '%limitation%' not found, needs to be implemented or configured to use Limitation\BlockingLimitationType - key: Limitation '%limitation%' not found, needs to be implemented or configured to use Limitation\BlockingLimitationType - src/lib/Base/Exceptions/NotFound/LimitationNotFoundException.php + + + Field Type '%fieldType%' not found. It must be implemented or configured to use %nullType% + Field Type '%fieldType%' not found. It must be implemented or configured to use %nullType% + key: Field Type '%fieldType%' not found. It must be implemented or configured to use %nullType% + + + Field definition '%identifier%' does not exist in given Content Type + Field definition '%identifier%' does not exist in given Content Type + key: Field definition '%identifier%' does not exist in given Content Type + + + Field definition '%identifier%' does not exist in the given Content Type + Field definition '%identifier%' does not exist in the given Content Type + key: Field definition '%identifier%' does not exist in the given Content Type + + + Invalid URL wildcards provided. + Invalid URL wildcards provided. + key: Invalid URL wildcards provided. + + + Limitation '%limitation%' not found. It must be implemented or configured to use %blockingLimitation% + Limitation '%limitation%' not found. It must be implemented or configured to use %blockingLimitation% + key: Limitation '%limitation%' not found. It must be implemented or configured to use %blockingLimitation% Limitations did not validate Limitations did not validate key: Limitations did not validate - src/lib/Base/Exceptions/LimitationValidationException.php - - - Only empty content type groups can be deleted - Only empty content type groups can be deleted - key: Only empty content type groups can be deleted - src/lib/REST/Server/Controller/ContentType.php - - - Only version in status DRAFT can be published - Only version in status DRAFT can be published - key: Only version in status DRAFT can be published - src/lib/REST/Server/Controller/Content.php - - - Only version in status DRAFT can be updated - Only version in status DRAFT can be updated - key: Only version in status DRAFT can be updated - src/lib/REST/Server/Controller/Content.php - - + + Path '%path%' already exists for the given context Path '%path%' already exists for the given context key: Path '%path%' already exists for the given context - src/lib/Persistence/Legacy/Content/UrlAlias/Handler.php - - - Placeholders are not matching with wildcards. - Placeholders are not matching with wildcards. - key: Placeholders are not matching with wildcards. - src/lib/Repository/URLWildcardService.php - - - Provided content type does not contain ezuser field type - Provided content type does not contain ezuser field type - key: Provided content type does not contain ezuser field type - src/lib/Repository/UserService.php - - - Relation is not of type COMMON - Relation is not of type COMMON - key: Relation is not of type COMMON - src/lib/REST/Server/Controller/Content.php - - - Relation of type COMMON can only be added to drafts - Relation of type COMMON can only be added to drafts - key: Relation of type COMMON can only be added to drafts - src/lib/REST/Server/Controller/Content.php - - - Relation of type COMMON can only be removed from drafts - Relation of type COMMON can only be removed from drafts - key: Relation of type COMMON can only be removed from drafts - src/lib/REST/Server/Controller/Content.php - - - Relation of type COMMON to selected destination content ID already exists - Relation of type COMMON to selected destination content ID already exists - key: Relation of type COMMON to selected destination content ID already exists - src/lib/REST/Server/Controller/Content.php - - - User does not have access to '%function%' '%module%' - User does not have access to '%function%' '%module%' - key: User does not have access to '%function%' '%module%' - src/lib/Base/Exceptions/UnauthorizedException.php - - - User does not have access to '%function%' '%module%' with: %with%' - User does not have access to '%function%' '%module%' with: %with%' - key: User does not have access to '%function%' '%module%' with: %with%' - src/lib/Base/Exceptions/UnauthorizedException.php - - - Version in status PUBLISHED cannot be deleted - Version in status PUBLISHED cannot be deleted - key: Version in status PUBLISHED cannot be deleted - src/lib/REST/Server/Controller/Content.php - - - expected value to be of type '%expectedType%' - expected value to be of type '%expectedType%' - key: expected value to be of type '%expectedType%' - - - expected value to be of type '%expectedType%', got '%actualType%' - expected value to be of type '%expectedType%', got '%actualType%' - key: expected value to be of type '%expectedType%', got '%actualType%' - - - An error has occurred. Please try again later or contact your Administrator. - An error has occurred. Please try again later or contact your Administrator. - key: non_verbose_error + + + Placeholders do not match the wildcards. + Placeholders do not match the wildcards. + key: Placeholders do not match the wildcards. + + + The User does not have the '%function%' '%module%' permission + The User does not have the '%function%' '%module%' permission + key: The User does not have the '%function%' '%module%' permission + + + The User does not have the '%function%' '%module%' permission with: %with% + The User does not have the '%function%' '%module%' permission with: %with% + key: The User does not have the '%function%' '%module%' permission with: %with% + + + User "%login%" already exists + User "%login%" already exists + key: User "%login%" already exists + + + You cannot set a value for the non-translatable Field definition '%identifier%' in language '%languageCode%' + You cannot set a value for the non-translatable Field definition '%identifier%' in language '%languageCode%' + key: You cannot set a value for the non-translatable Field definition '%identifier%' in language '%languageCode%'
diff --git a/src/lib/Base/Exceptions/ContentTypeValidationException.php b/src/lib/Base/Exceptions/ContentTypeValidationException.php index ee690ff60f..43f2e768db 100644 --- a/src/lib/Base/Exceptions/ContentTypeValidationException.php +++ b/src/lib/Base/Exceptions/ContentTypeValidationException.php @@ -9,6 +9,7 @@ use Ibexa\Contracts\Core\Repository\Exceptions\ContentTypeValidationException as APIContentTypeValidationException; use Ibexa\Core\Base\Translatable; use Ibexa\Core\Base\TranslatableBase; +use JMS\TranslationBundle\Annotation\Ignore; /** * This Exception is thrown on create or update content type when content type is not valid. @@ -25,8 +26,7 @@ class ContentTypeValidationException extends APIContentTypeValidationException i */ public function __construct($messageTemplate, array $parameters = []) { - /** @Ignore */ - $this->setMessageTemplate($messageTemplate); + $this->setMessageTemplate(/** @Ignore */$messageTemplate); $this->setParameters($parameters); parent::__construct($this->getBaseTranslation()); diff --git a/src/lib/Base/Exceptions/ContentValidationException.php b/src/lib/Base/Exceptions/ContentValidationException.php index 4254aeb81d..83ba4aa0c4 100644 --- a/src/lib/Base/Exceptions/ContentValidationException.php +++ b/src/lib/Base/Exceptions/ContentValidationException.php @@ -9,6 +9,7 @@ use Ibexa\Contracts\Core\Repository\Exceptions\ContentValidationException as APIContentValidationException; use Ibexa\Core\Base\Translatable; use Ibexa\Core\Base\TranslatableBase; +use JMS\TranslationBundle\Annotation\Ignore; /** * This Exception is thrown on create or update content one or more given fields are not valid. @@ -25,8 +26,7 @@ class ContentValidationException extends APIContentValidationException implement */ public function __construct($messageTemplate, array $parameters = []) { - /** @Ignore */ - $this->setMessageTemplate($messageTemplate); + $this->setMessageTemplate(/** @Ignore */$messageTemplate); $this->setParameters($parameters); parent::__construct($this->getBaseTranslation()); diff --git a/src/lib/Helper/FieldsGroups/ArrayTranslatorFieldsGroupsList.php b/src/lib/Helper/FieldsGroups/ArrayTranslatorFieldsGroupsList.php index 9a1fc74999..baf4e0dc1a 100644 --- a/src/lib/Helper/FieldsGroups/ArrayTranslatorFieldsGroupsList.php +++ b/src/lib/Helper/FieldsGroups/ArrayTranslatorFieldsGroupsList.php @@ -7,6 +7,7 @@ namespace Ibexa\Core\Helper\FieldsGroups; use Ibexa\Contracts\Core\Repository\Values\ContentType\FieldDefinition; +use JMS\TranslationBundle\Annotation\Ignore; use Symfony\Contracts\Translation\TranslatorInterface; /** @@ -39,6 +40,7 @@ public function getGroups() foreach ($this->groups as $groupIdentifier) { $translatedGroups[$groupIdentifier] = $this->translator->trans( + /** @Ignore */ $groupIdentifier, [], 'ezplatform_fields_groups' diff --git a/src/lib/MVC/Symfony/Templating/Twig/Extension/FileSizeExtension.php b/src/lib/MVC/Symfony/Templating/Twig/Extension/FileSizeExtension.php index 56a0f81d0f..9c0d700ec7 100644 --- a/src/lib/MVC/Symfony/Templating/Twig/Extension/FileSizeExtension.php +++ b/src/lib/MVC/Symfony/Templating/Twig/Extension/FileSizeExtension.php @@ -8,6 +8,7 @@ use Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface; use Ibexa\Core\MVC\Symfony\Locale\LocaleConverterInterface; +use JMS\TranslationBundle\Annotation\Ignore; use Locale; use NumberFormatter; use Symfony\Contracts\Translation\TranslatorInterface; @@ -110,7 +111,9 @@ public function sizeFilter($number, $precision) $i = ($index - 1); } $formatter = new NumberFormatter($this->getLocale(), NumberFormatter::PATTERN_DECIMAL); - $formatter->setPattern($formatter->getPattern() . ' ' . $this->translator->trans($this->suffixes[$i])); + $formatter->setPattern( + $formatter->getPattern() . ' ' . $this->translator->trans(/** @Ignore */$this->suffixes[$i]) + ); $formatter->setAttribute(NumberFormatter::MAX_FRACTION_DIGITS, $precision); return $formatter->format($number); diff --git a/src/lib/MVC/Symfony/Translation/ExceptionMessageTemplateFileVisitor.php b/src/lib/MVC/Symfony/Translation/ExceptionMessageTemplateFileVisitor.php index d24f43964c..6aaaf5438f 100644 --- a/src/lib/MVC/Symfony/Translation/ExceptionMessageTemplateFileVisitor.php +++ b/src/lib/MVC/Symfony/Translation/ExceptionMessageTemplateFileVisitor.php @@ -7,6 +7,7 @@ namespace Ibexa\Core\MVC\Symfony\Translation; use Doctrine\Common\Annotations\DocParser; +use JMS\TranslationBundle\Annotation\Ignore; use JMS\TranslationBundle\Model\Message; use JMS\TranslationBundle\Model\MessageCatalogue; use JMS\TranslationBundle\Translation\Extractor\File\DefaultPhpFileExtractor; @@ -34,10 +35,15 @@ class ExceptionMessageTemplateFileVisitor extends DefaultPhpFileExtractor private MessageCatalogue $catalogue; + private Node $previousNode; + + private DocParser $docParser; + public function __construct(DocParser $docParser, FileSourceFactory $fileSourceFactory) { parent::__construct($docParser, $fileSourceFactory); $this->fileSourceFactory = $fileSourceFactory; + $this->docParser = $docParser; $this->traverser = new NodeTraverser(); $this->traverser->addVisitor($this); } @@ -52,10 +58,18 @@ public function enterNode(Node $node): void !is_string($methodCallNodeName) || !array_key_exists($methodCallNodeName, $this->methodsToExtractFrom) ) { + $this->previousNode = $node; + return; } + $ignore = $this->isIgnore($node); + if (!$node->args[0]->value instanceof String_) { + if ($ignore) { + return; + } + $message = sprintf('Can only extract the translation id from a scalar string, but got "%s". Please refactor your code to make it extractable, or add the doc comment /** @Ignore */ to this code element (in %s on line %d).', get_class($node->args[0]->value), $this->file, $node->args[0]->value->getLine()); $this->logger->error($message); @@ -76,6 +90,42 @@ public function visitPhpFile(SplFileInfo $file, MessageCatalogue $catalogue, arr $this->catalogue = $catalogue; $this->traverser->traverse($ast); } + + private function getDocCommentForNode(Node $node): ?string + { + if (null !== $comment = $node->args[0]->getDocComment()) { + return $comment->getText(); + } + + if (null !== $comment = $node->getDocComment()) { + return $comment->getText(); + } + + if (null !== $this->previousNode && $this->previousNode->getDocComment() !== null) { + $comment = $this->previousNode->getDocComment(); + + return is_object($comment) ? $comment->getText() : $comment; + } + + return null; + } + + private function isIgnore($node): bool + { + if (null !== $docComment = $this->getDocCommentForNode($node)) { + $annotations = $this->docParser->parse( + $docComment, + 'file ' . $this->file . ' near line ' . $node->getLine() + ); + foreach ($annotations as $annot) { + if ($annot instanceof Ignore) { + return true; + } + } + } + + return false; + } } class_alias(ExceptionMessageTemplateFileVisitor::class, 'eZ\Publish\Core\MVC\Symfony\Translation\ExceptionMessageTemplateFileVisitor');