-
Notifications
You must be signed in to change notification settings - Fork 7
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
feat: Add translation key prefixes for upload and download #687
feat: Add translation key prefixes for upload and download #687
Conversation
2dacc6a
to
3a6c754
Compare
@theSoenke & @jablan Let me know if I missed anything 🙏 |
hey @malvarezphrase can you please explain the logic with the truncating file name? I don't get it. |
@jablan The reason for the truncate of the file name is that we want to use the Now looking at the other usages of the prefix, is it also possible to add a limit on |
@malvarezphrase sorry, I need a bit more context. where does |
@jablan Yeah, it should be working like |
@malvarezphrase I would start with the ticket description 😄 and probably the PR description too, as that stays longer. especially knowing that this repo is public. if it can be specified only through the regarding the truncating, if I understand you correctly, we don't support prefixes longer than 255 chars? in that case we should probably error out rather than truncating them? |
@jablan Thanks a lot for the feedback! I already updated the ticket descriptions and also the description of this PR. Are the changes to https://github.com/SchemaStore/schemastore/blob/master/src/schemas/json/phrase.json being done manually? If so, I will prepare a PR for it.
|
perhaps then just passing whatever prefix is provided (either explicitly by the user or by using the filename) will be enough. is the error clear to the user? as for json schema, perhaps you could open a small ticket, I see couple other things that could be fixed there, so we will do it all together. just remember, we also have https://support.phrase.com/hc/en-us/articles/5808300599068-Using-the-CLI-Strings where we might want to describe this feature? |
@jablan & @theSoenke after changing to not truncate the length of the prefix and updating the description here, is there anything else missing? |
@@ -190,6 +191,9 @@ func TargetsFromConfig(config phrase.Config) (Targets, error) { | |||
if target.FileFormat == "" { | |||
target.FileFormat = fileFormat | |||
} | |||
if target.Params.TranslationKeyPrefix.Value() == "<file_path>" { | |||
target.Params.TranslationKeyPrefix = optional.NewString(target.File) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hm not 100% sure but I think at this point target.File can still contain other placeholders, i.e. it won't be the path to the actual file. can you double check this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's important! Really good catch and it does still contain placeholders at this point
@jablan @malvarezphrase I've changed the |
376ce90
to
f0a0ef4
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👌
Purpose: Provide documentation for the new params on import and export.
Pushing:
translation_key_prefix
which will be prepended to the name of the imported translation keys<file_name>
as thetranslation_key_prefix
to use the file path of the pushed file as a prefixPulling:
translation_key_prefix
which will be subtracted from the name of the exported translation keys. Warning: this may create duplicate key names if other keys share the same name after the prefix is removed<file_name>
as thetranslation_key_prefix
to use the file path of the pulled file as a prefixuse_translation_key_prefix_as_filter
totrue
for the prefix to work as a filter. In this case only translation keys including the provided prefix in their name will be exportedRelated tickets:
https://phrase.atlassian.net/browse/STRINGS-374
https://phrase.atlassian.net/browse/STRINGS-439