-
Notifications
You must be signed in to change notification settings - Fork 22
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
Loco tags management #45
base: master
Are you sure you want to change the base?
Conversation
…ssociated translation filtered by this tags. The generated translation filename is like 'domain-tag-tag...' Add this in your happyr_translation.yml config file : project: domain: tags: [LOCALE]: - '[TAG1]' - '[TAG2]'
Cool, I'll try to find some time to review and test this PR later this week. |
Thanks ! I changed the behavior for something like : I need to expose some translations in the front-end of my application. |
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.
I do not really understand the implementation. Some clarifications would be great =)
@@ -429,6 +429,16 @@ protected function getUrls(array &$data, array $config, $domain, $useDomainAsFil | |||
$fileName = sprintf('%s.%s.%s', $domain, $locale, $this->filesystemService->getFileExtension()); | |||
|
|||
$data[$url] = $fileName; | |||
|
|||
if (count($config['tags']) !== 0) { |
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.
use empty
|
||
// Build url | ||
$url = sprintf('%sexport/locale/%s.%s?%s', self::BASE_URL, $locale, $this->filesystemService->getFileExtension(), http_build_query($query_tags)); | ||
$fileName = sprintf('%s.%s.%s', $domain.'-'.(implode($config['tags'], '-')), $locale, $this->filesystemService->getFileExtension()); |
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.
What is the purpose of the tags?
It looks like you building another URL here. The result would be that you download all translations AND translation filtered with tags.
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.
For my project, i need two files per locale : one for back-end translations, where i take all translations, and one for front-end translations, where i select translations using tags (in order to have minify the file size).
With this patch, you can specify tags for loco, and it will get the associated translation filtered by this tags.