Skip to content

Commit

Permalink
Applied M. Adamczyk and J. Koralewicz code review suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
adamwojs committed May 28, 2024
1 parent 810c448 commit 458e5ff
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions src/bundle/Resources/config/translation.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ services:
arguments:
$customTags: '%ibexa.field_type.richtext.custom_tags%'
$domain: '%ibexa.field_type.richtext.custom_tags.translation_domain%'
$whitelist: ['ezyoutube', 'eztwitter', 'ezfacebook']
$allowlist: ['ezyoutube', 'eztwitter', 'ezfacebook']
tags:
- name: jms_translation.extractor
alias: ibexa.translation_extractor.field_type.ezrichtext.custom_tags
Expand All @@ -24,7 +24,7 @@ services:
arguments:
$customTags: '%ibexa.field_type.richtext.custom_tags%'
$domain: '%ibexa.field_type.richtext.custom_tags.translation_domain%'
$whitelist: ['ezyoutube', 'eztwitter', 'ezfacebook']
$allowlist: ['ezyoutube', 'eztwitter', 'ezfacebook']
tags:
- name: jms_translation.extractor
alias: ibexa.translation_extractor.field_type.ezrichtext.custom_tags.choices
4 changes: 2 additions & 2 deletions src/bundle/Resources/translations/custom_tags.en.xliff
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@
<note>key: ezrichtext.custom_tags.eztwitter.attributes.conversation.label</note>
</trans-unit>
<trans-unit id="7fa382eb492f241c0377d64e8ad5c8ab8aa740fb" resname="ezrichtext.custom_tags.eztwitter.attributes.dnt.label">
<source>Do not target</source>
<target>Do not target</target>
<source>Don't target</source>
<target>Don't target</target>
<note>key: ezrichtext.custom_tags.eztwitter.attributes.dnt.label</note>
</trans-unit>
<trans-unit id="df37139c5dd99f14d3e1390341bd49d11da3d5ba" resname="ezrichtext.custom_tags.eztwitter.attributes.lang.label">
Expand Down
10 changes: 5 additions & 5 deletions src/lib/Translation/Extractor/CustomTagExtractor.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,25 +26,25 @@ final class CustomTagExtractor implements ExtractorInterface
private string $domain;

/** @var string[] */
private array $whitelist;
private array $allowlist;

/**
* @param array<string, mixed> $customTags Custom tags definitions
* @param string $domain Target translation domain
* @param string[] $whitelist Whitelist of custom tags to extract
* @param string[] $allowlist Whitelist of custom tags to extract
*/
public function __construct(array $customTags, string $domain, array $whitelist = [])
public function __construct(array $customTags, string $domain, array $allowlist = [])
{
$this->customTags = $customTags;
$this->domain = $domain;
$this->whitelist = $whitelist;
$this->allowlist = $allowlist;
}

public function extract(): MessageCatalogue
{
$catalogue = new MessageCatalogueBuilder($this->domain);
foreach ($this->customTags as $tagName => $config) {
if (!in_array($tagName, $this->whitelist, true)) {
if (!in_array($tagName, $this->allowlist, true)) {
continue;
}

Expand Down

0 comments on commit 458e5ff

Please sign in to comment.