-
Notifications
You must be signed in to change notification settings - Fork 22
Loco tags management #45
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
base: master
Are you sure you want to change the base?
Changes from 3 commits
39e498d
2de6661
4ace850
42379fd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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) { | ||
| $query_tags = $this->getExportQueryParams($config['api_key'], $config['tags']); | ||
|
|
||
| // 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()); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What is the purpose of the tags?
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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). |
||
|
|
||
| $data[$url] = $fileName; | ||
| } | ||
| } | ||
| } | ||
|
|
||
|
|
@@ -437,13 +447,18 @@ protected function getUrls(array &$data, array $config, $domain, $useDomainAsFil | |
| * | ||
| * @return array | ||
| */ | ||
| private function getExportQueryParams($key) | ||
| private function getExportQueryParams($key, $tags=null) | ||
| { | ||
| $data = array( | ||
| 'index' => 'id', | ||
| 'status' => 'translated', | ||
| 'key' => $key, | ||
| ); | ||
|
|
||
| if ($tags !== null) { | ||
| $data['filter'] = implode($tags, ','); | ||
| } | ||
|
|
||
| switch ($this->filesystemService->getFileExtension()) { | ||
| case 'php': | ||
| $data['format'] = 'zend'; // 'Zend' will give us a flat array | ||
|
|
||
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