{"action":"created","issue":{"url":"https://api.github.com/repos/WeblateOrg/weblate/issues/1897","repository_url":"https://api.github.com/repos/WeblateOrg/weblate","labels_url":"https://api.github.com/repos/WeblateOrg/weblate/issues/1897/labels{/name}","comments_url":"https://api.github.com/repos/WeblateOrg/weblate/issues/1897/comments","events_url":"https://api.github.com/repos/WeblateOrg/weblate/issues/1897/events","html_url":"https://github.com/WeblateOrg/weblate/issues/1897","id":304182420,"number":1897,"title":"Parameters for File formats","user":{"login":"BhaaLseN","id":826052,"avatar_url":"https://avatars1.githubusercontent.com/u/826052?v=4","gravatar_id":"","url":"https://api.github.com/users/BhaaLseN","html_url":"https://github.com/BhaaLseN","followers_url":"https://api.github.com/users/BhaaLseN/followers","following_url":"https://api.github.com/users/BhaaLseN/following{/other_user}","gists_url":"https://api.github.com/users/BhaaLseN/gists{/gist_id}","starred_url":"https://api.github.com/users/BhaaLseN/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BhaaLseN/subscriptions","organizations_url":"https://api.github.com/users/BhaaLseN/orgs","repos_url":"https://api.github.com/users/BhaaLseN/repos","events_url":"https://api.github.com/users/BhaaLseN/events{/privacy}","received_events_url":"https://api.github.com/users/BhaaLseN/received_events","type":"User","site_admin":false},"labels":[{"id":363998,"url":"https://api.github.com/repos/WeblateOrg/weblate/labels/enhancement","name":"enhancement","color":"84b6eb","default":true},{"id":10161278,"url":"https://api.github.com/repos/WeblateOrg/weblate/labels/undecided","name":"undecided","color":"02d7e1","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2018-03-11T18:43:06Z","updated_at":"2018-03-12T22:01:54Z","closed_at":null,"author_association":"NONE","body":"There are a few file formats in translate-toolkit that accept parameters and/or allow for customization, for example the JSON format which at this point has pre-commit hooks to change indentation etc.\r\nI'm also working on a XML format that would currently require hardcoding certain parameters and duplicating the `FileFormat`/`FileUnit` (and to some degree even the translate-toolkit `TranslationStore` depending on the kind of parameter/customization) for every specialization.\r\n\r\nIt would be nice if the `FileFormat` could expose optional/required parameters as list/map, which would then be presented to the admin when configuring a component (by showing/hiding new textboxes below the format combobox). Internally they could either be passed/unpacked into the `FileFormat.loader.__init__` or pass through a dedicated factory method in case `__init__` is not enough.\r\n\r\nThere is one caveat I can think of: Autodetection wouldn't really work depending on the kind of parameter/customization. But to be fair, I never used autodetection (primarily because I know what format it should be; but also because it may not find a unique/correct match in some cases); so this might be a non-issue.\r\n\r\n<bountysource-plugin>\r\n\r\n---\r\nWant to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/56082264-parameters-for-file-formats?utm_campaign=plugin&utm_content=tracker%2F253393&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F253393&utm_medium=issues&utm_source=github).\r\n</bountysource-plugin>"},"comment":{"url":"https://api.github.com/repos/WeblateOrg/weblate/issues/comments/372477643","html_url":"https://github.com/WeblateOrg/weblate/issues/1897#issuecomment-372477643","issue_url":"https://api.github.com/repos/WeblateOrg/weblate/issues/1897","id":372477643,"user":{"login":"nijel","id":212189,"avatar_url":"https://avatars0.githubusercontent.com/u/212189?v=4","gravatar_id":"","url":"https://api.github.com/users/nijel","html_url":"https://github.com/nijel","followers_url":"https://api.github.com/users/nijel/followers","following_url":"https://api.github.com/users/nijel/following{/other_user}","gists_url":"https://api.github.com/users/nijel/gists{/gist_id}","starred_url":"https://api.github.com/users/nijel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nijel/subscriptions","organizations_url":"https://api.github.com/users/nijel/orgs","repos_url":"https://api.github.com/users/nijel/repos","events_url":"https://api.github.com/users/nijel/events{/privacy}","received_events_url":"https://api.github.com/users/nijel/received_events","type":"User","site_admin":false},"created_at":"2018-03-12T22:01:54Z","updated_at":"2018-03-12T22:01:54Z","author_association":"OWNER","body":"Needing configuration at parse time is maybe good reason to revisit decision to doing such configuration in addons and do that really on the file format layer instead. The problem is how to integrate that into Django admin interface when creating new components..."}}
{"actor":{"display_login":"nijel"}}