From 6b1293da3e64fd74dbb9d765d3c877a39cac2027 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Barrag=C3=A1n=20Merino?= Date: Wed, 6 May 2015 11:44:46 +0200 Subject: [PATCH] [i18n] Fix translations in reports section --- .../modules/admin/project-profile.coffee | 30 ++++++++++++------- app/locales/locale-en.json | 23 +++++++------- app/partials/admin/admin-project-reports.jade | 5 ++-- app/partials/admin/project-csv.jade | 16 ++++++---- 4 files changed, 43 insertions(+), 31 deletions(-) diff --git a/app/coffee/modules/admin/project-profile.coffee b/app/coffee/modules/admin/project-profile.coffee index 64c00614..a002d344 100644 --- a/app/coffee/modules/admin/project-profile.coffee +++ b/app/coffee/modules/admin/project-profile.coffee @@ -58,14 +58,16 @@ class ProjectProfileController extends mixOf(taiga.Controller, taiga.PageMixin) promise.then => sectionName = @translate.instant( @scope.sectionName) - appTitle = @translate.instant("ADMIN.PROJECT_PROFILE.PAGE_TITLE", {sectionName: sectionName, projectName: @scope.project.name}) + appTitle = @translate.instant("ADMIN.PROJECT_PROFILE.PAGE_TITLE", { + sectionName: sectionName, projectName: @scope.project.name}) @appTitle.set(appTitle) promise.then null, @.onInitialDataError.bind(@) @scope.$on "project:loaded", => sectionName = @translate.instant(@scope.sectionName) - appTitle = @translate.instant("ADMIN.PROJECT_PROFILE.PAGE_TITLE", {sectionName: sectionName, projectName: @scope.project.name}) + appTitle = @translate.instant("ADMIN.PROJECT_PROFILE.PAGE_TITLE", { + sectionName: sectionName, projectName: @scope.project.name}) @appTitle.set(appTitle) loadProject: -> @@ -131,7 +133,8 @@ ProjectProfileDirective = ($repo, $confirm, $loading, $navurls, $location) -> return {link:link} -module.directive("tgProjectProfile", ["$tgRepo", "$tgConfirm", "$tgLoading", "$tgNavUrls", "$tgLocation", ProjectProfileDirective]) +module.directive("tgProjectProfile", ["$tgRepo", "$tgConfirm", "$tgLoading", "$tgNavUrls", "$tgLocation", + ProjectProfileDirective]) ############################################################################# ## Project Default Values Directive @@ -167,7 +170,8 @@ ProjectDefaultValuesDirective = ($repo, $confirm, $loading) -> return {link:link} -module.directive("tgProjectDefaultValues", ["$tgRepo", "$tgConfirm", "$tgLoading", ProjectDefaultValuesDirective]) +module.directive("tgProjectDefaultValues", ["$tgRepo", "$tgConfirm", "$tgLoading", + ProjectDefaultValuesDirective]) ############################################################################# ## Project Modules Directive @@ -243,7 +247,8 @@ ProjectExportDirective = ($window, $rs, $confirm, $translate) -> loading_msg = $translate.instant("ADMIN.PROJECT_EXPORT.LOADING_MESSAGE") dump_ready_text = -> resultTitleEl.html($translate.instant("ADMIN.PROJECT_EXPORT.DUMP_READY")) asyn_message = -> resultTitleEl.html($translate.instant("ADMIN.PROJECT_EXPORT.ASYN_MESSAGE")) - syn_message = (url) -> resultTitleEl.html($translate.instant("ADMIN.PROJECT_EXPORT.SYNC_MESSAGE", {url: url})) + syn_message = (url) -> resultTitleEl.html($translate.instant("ADMIN.PROJECT_EXPORT.SYNC_MESSAGE", { + url: url})) setLoadingTitle = -> resultTitleEl.html(loading_title) setAsyncTitle = -> resultTitleEl.html(loading_msg) @@ -295,7 +300,8 @@ ProjectExportDirective = ($window, $rs, $confirm, $translate) -> if result.status == 429 # TOO MANY REQUESTS errorMsg = $translate.instant("ADMIN.PROJECT_EXPORT.ERROR_BUSY") else if result.data?._error_message - errorMsg = $translate.instant("ADMIN.PROJECT_EXPORT.ERROR_BUSY", {message: result.data._error_message}) + errorMsg = $translate.instant("ADMIN.PROJECT_EXPORT.ERROR_BUSY", { + message: result.data._error_message}) $confirm.notify("error", errorMsg) @@ -304,7 +310,8 @@ ProjectExportDirective = ($window, $rs, $confirm, $translate) -> return {link:link} -module.directive("tgProjectExport", ["$window", "$tgResources", "$tgConfirm", "$translate", ProjectExportDirective]) +module.directive("tgProjectExport", ["$window", "$tgResources", "$tgConfirm", "$translate", + ProjectExportDirective]) ############################################################################# @@ -372,14 +379,13 @@ module.controller("CsvExporterTasksController", CsvExporterTasksController) module.controller("CsvExporterIssuesController", CsvExporterIssuesController) - ############################################################################# ## CSV Directive ############################################################################# CsvUsDirective = ($translate) -> link = ($scope) -> - $scope.csvType = $translate.instant("ADMIN.REPORTS.CSV_TYPE_USS") + $scope.sectionTitle = "ADMIN.CSV.SECTION_TITLE_US" return { controller: "CsvExporterUserstoriesController", @@ -390,9 +396,10 @@ CsvUsDirective = ($translate) -> module.directive("tgCsvUs", ["$translate", CsvUsDirective]) + CsvTaskDirective = ($translate) -> link = ($scope) -> - $scope.csvType = $translate.instant("ADMIN.REPORTS.CSV_TYPE_TASKS") + $scope.sectionTitle = "ADMIN.CSV.SECTION_TITLE_TASK" return { controller: "CsvExporterTasksController", @@ -403,9 +410,10 @@ CsvTaskDirective = ($translate) -> module.directive("tgCsvTask", ["$translate", CsvTaskDirective]) + CsvIssueDirective = ($translate) -> link = ($scope) -> - $scope.csvType = $translate.instant("ADMIN.REPORTS.CSV_TYPE_ISSUES") + $scope.sectionTitle = "ADMIN.CSV.SECTION_TITLE_ISSUE" return { controller: "CsvExporterIssuesController", diff --git a/app/locales/locale-en.json b/app/locales/locale-en.json index 9a45683c..8ed6e8b6 100644 --- a/app/locales/locale-en.json +++ b/app/locales/locale-en.json @@ -260,10 +260,17 @@ "DESCRIPTION": "Download a CSV file or copy the generated URL and open it in your favourite text editor or spreadsheet to make your own project data reports. You will be able to visualize and analize all your data easily.", "HELP": "How to use this on my own spreadsheet?", "REGENERATE_TITLE": "Change URL", - "REGENERATE_SUBTITLE": "You going to change the CSV data access url. The previous url will be disabled. Are you sure?", - "CSV_TYPE_US": "user stories", - "CSV_TYPE_TASK": "tasks", - "CSV_TYPE_ISSUE": "issues" + "REGENERATE_SUBTITLE": "You going to change the CSV data access url. The previous url will be disabled. Are you sure?" + }, + "CSV": { + "SECTION_TITLE_US": "user stories reports", + "SECTION_TITLE_TASK": "tasks reports", + "SECTION_TITLE_ISSUE": "issues reports", + "DOWNLOAD": "Download CSV", + "URL_FIELD_PLACEHOLDER": "Please regenerate CSV url", + "TITLE_REGENERATE_URL": "Regenerate CSV url", + "ACTION_GENERATE_URL": "Generate Url", + "ACTION_REGENERATE": "Regenerate" }, "CUSTOM_FIELDS": { "TITLE": "Custom Fields", @@ -396,14 +403,6 @@ "LABEL_ISSUE_TYPE": "Default value for issue type selector", "LABEL_ISSUE_STATUS": "Default value for issue status selector" }, - "CSV": { - "TITLE": "{{csvType}} reports", - "DOWNLOAD": "Download CSV", - "URL_FIELD_PLACEHOLDER": "Please regenerate CSV url", - "TITLE_REGENERATE_URL": "Regenerate CSV url", - "ACTION_GENERATE_URL": "Generate Url", - "ACTION_REGENERATE": "Regenerate" - }, "STATUS": { "PLACEHOLDER_WRITE_STATUS_NAME": "Write a name for the new status" }, diff --git a/app/partials/admin/admin-project-reports.jade b/app/partials/admin/admin-project-reports.jade index 7575d0cd..a4dffd1f 100644 --- a/app/partials/admin/admin-project-reports.jade +++ b/app/partials/admin/admin-project-reports.jade @@ -17,8 +17,9 @@ div.wrapper(ng-controller="ProjectProfileController as ctrl", div.admin-attributes-section(tg-csv-us) div.admin-attributes-section(tg-csv-task) - div.admin-attributes-section - div(tg-csv-issue) + div.admin-attributes-section(tg-csv-issue) + + div a.help-button(href="https://taiga.io/support/csv-reports/", target="_blank") span.icon.icon-help span(translate="ADMIN.REPORTS.HELP") diff --git a/app/partials/admin/project-csv.jade b/app/partials/admin/project-csv.jade index 15b7639e..8e709dd9 100644 --- a/app/partials/admin/project-csv.jade +++ b/app/partials/admin/project-csv.jade @@ -1,16 +1,20 @@ section.project-csv(tg-select-input-text) div.project-values-title - h2(translate="ADMIN.CSV.TITLE", translate-values='{ csvType: csvType}') - a.button.button-gray(title="{{'ADMIN.CSV.DOWNLOAD' | translate}}", ng-href="{{csvUrl}}", ng-show="csvUrl", target="_blank") + h2(translate="{{::sectionTitle}}") + a.button.button-gray(title="{{'ADMIN.CSV.DOWNLOAD' | translate}}", + ng-href="{{csvUrl}}", ng-show="csvUrl", target="_blank") span(translate="ADMIN.CSV.DOWNLOAD") div.csv-regenerate-field - .field-with-options - input(type="text", placeholder="{{'ADMIN.CSV.URL_FIELD_PLACEHOLDER' | translate}}", readonly, ng-model="csvUrl") - .option-wrapper.select-input-content - .icon.icon-copy + div.field-with-options + input(type="text", placeholder="{{'ADMIN.CSV.URL_FIELD_PLACEHOLDER' | translate}}", + readonly, ng-model="csvUrl") + div.option-wrapper.select-input-content + div.icon.icon-copy + a(href="", title="{{'ADMIN.CSV.TITLE_REGENERATE_URL' | translate}}", ng-click="ctrl.regenerateUuid()") span.icon.icon-plus(ng-hide="csvUrl") span(ng-hide="csvUrl", translate="ADMIN.CSV.ACTION_GENERATE_URL") + span.icon.icon-reload(ng-Show="csvUrl") span(ng-Show="csvUrl", translate="ADMIN.CSV.ACTION_REGENERATE")