Skip to content

Conversation

@Petrakeas
Copy link
Contributor

LocaleData.StringInfo class has now a "Meta" subclass
that contains "tags" in the form of a string array according to
the spec: https://github.com/transifex/transifex-delivery/#push-content

The following methods have been updated to take the "meta" field into account:
equals(), toString()

Added "--append-tags" option in CLI's MainClass. It is optional and can accept
zero to multiple tags. The tags are appended to the parsed strings.

@Petrakeas Petrakeas requested a review from dbendilas June 15, 2021 09:48
Copy link

@dbendilas dbendilas left a comment

Choose a reason for hiding this comment

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

I've added a couple of comments. Also I'm not sure what part of the code actually takes sends the tags to CDS. Will that be in another PR?

Comment on lines 174 to 178
// Append custom tags
if (tags != null && tags.length != 0) {
for (LocaleData.StringInfo stringInfo : sourceStringMap.values()) {
if (stringInfo.meta == null) {
stringInfo.meta = new LocaleData.StringInfo.Meta();
}
stringInfo.meta.tags = tags;
}
}

Choose a reason for hiding this comment

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

Is there a reason we're not always adding the Meta? It would make more sense to me to have it always and add the if just before setting stringInfo.meta.tags = tags;.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

At this moment in time, Meta only contains tags and tags can't be parsed by the XML converter (in the previous step). So yeah, we could always add it since it's always null.

But in the future, the Meta could also contain developer comments or other stuff (which are supported by the spec). So, why overwrite it since the XML Parser could have populated it?

Comment on lines 171 to 172
assertThat(parsedPostData.data.get("tx_test_key").meta.tags).asList().containsExactly("some_tag");
assertThat(parsedPostData.data.get("tx_plural_test_key").meta.tags).asList().containsExactly("some_tag");

Choose a reason for hiding this comment

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

Let's test with multiple tags, not just one at the time.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done!

@Petrakeas Petrakeas force-pushed the petrakeas/append-tags-cli branch from b23b4b2 to 266f8c7 Compare June 16, 2021 10:07
LocaleData.StringInfo class has now a "Meta" subclass
that contains "tags" in the form of a set according to
the spec: https://github.com/transifex/transifex-delivery/#push-content

Added appendTags() method for easier appending of tags.

The following methods have been updated to take the "meta" field into account:
equals(), toString()

Added "--append-tags" option in CLI's MainClass. It is optional and can accept
zero to multiple tags.
@Petrakeas Petrakeas force-pushed the petrakeas/append-tags-cli branch from 266f8c7 to 7f300d5 Compare June 16, 2021 10:10
Copy link

@dbendilas dbendilas left a comment

Choose a reason for hiding this comment

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

Looks great!

@Petrakeas Petrakeas merged commit a8a2378 into devel Jun 16, 2021
@Petrakeas Petrakeas deleted the petrakeas/append-tags-cli branch June 16, 2021 10:27
@wyngarde wyngarde mentioned this pull request Jun 22, 2021
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.

3 participants