Commit dc5136a7 authored by Phil Hughes's avatar Phil Hughes

Merge remote-tracking branch...

Merge remote-tracking branch 'origin/28433-internationalise-cycle-analytics-page' into js-translations
parents b7b5bd4a 6fbc6bef
...@@ -13,7 +13,7 @@ global.cycleAnalytics.TotalTimeComponent = Vue.extend({ ...@@ -13,7 +13,7 @@ global.cycleAnalytics.TotalTimeComponent = Vue.extend({
<span class="total-time"> <span class="total-time">
<template v-if="Object.keys(time).length"> <template v-if="Object.keys(time).length">
<template v-if="time.days">{{ time.days }} <span>{{ 'day' | translate-plural('days', time.days) }}</span></template> <template v-if="time.days">{{ time.days }} <span>{{ 'day' | translate-plural('days', time.days) }}</span></template>
<template v-if="time.hours">{{ time.hours }} <span v-translate>hr</span></template> <template v-if="time.hours">{{ time.hours }} <span>{{ 'hr' | translate }}</span></template>
<template v-if="time.mins && !time.days">{{ time.mins }} <span>{{ 'min' | translate-plural('mins', time.mins) }}</span></template> <template v-if="time.mins && !time.days">{{ time.mins }} <span>{{ 'min' | translate-plural('mins', time.mins) }}</span></template>
<template v-if="time.seconds && Object.keys(time).length === 1 || time.seconds === 0">{{ time.seconds }} <span>s</span></template> <template v-if="time.seconds && Object.keys(time).length === 1 || time.seconds === 0">{{ time.seconds }} <span>s</span></template>
</template> </template>
......
var locales = locales || {}; locales['de'] = {"domain":"app","locale_data":{"app":{"":{"Project-Id-Version":"gitlab 1.0.0","Report-Msgid-Bugs-To":"","PO-Revision-Date":"2017-04-12 22:37-0500","Last-Translator":"FULL NAME <EMAIL@ADDRESS>","Language-Team":"German","Language":"de","MIME-Version":"1.0","Content-Type":"text/plain; charset=UTF-8","Content-Transfer-Encoding":"8bit","Plural-Forms":"nplurals=2; plural=n != 1;","lang":"de","domain":"app","plural_forms":"nplurals=2; plural=n != 1;"},"Deutsch":[""],"English":[""],"Spanish":[""]}}}; var locales = locales || {}; locales['de'] = {"domain":"app","locale_data":{"app":{"":{"Project-Id-Version":"gitlab 1.0.0","Report-Msgid-Bugs-To":"","PO-Revision-Date":"2017-04-12 22:37-0500","Last-Translator":"FULL NAME <EMAIL@ADDRESS>","Language-Team":"German","Language":"de","MIME-Version":"1.0","Content-Type":"text/plain; charset=UTF-8","Content-Transfer-Encoding":"8bit","Plural-Forms":"nplurals=2; plural=n != 1;","lang":"de","domain":"app","plural_forms":"nplurals=2; plural=n != 1;"},"Cycle Analytics gives an overview of how much time it takes to go from idea to production in your project.":[""],"Deutsch":[""],"English":[""],"Introducing Cycle Analytics":[""],"Last 30 days":[""],"Last 90 days":[""],"Median":[""],"Not available":[""],"Not enough data":[""],"Pipeline Health":[""],"Read more":[""],"Spanish":[""],"Stage":[""],"Total Time":[""],"Want to see the data? Please ask administrator for access.":[""]}}};
\ No newline at end of file \ No newline at end of file
var locales = locales || {}; locales['en'] = {"domain":"app","locale_data":{"app":{"":{"Project-Id-Version":"gitlab 1.0.0","Report-Msgid-Bugs-To":"","PO-Revision-Date":"2017-04-12 22:36-0500","Last-Translator":"FULL NAME <EMAIL@ADDRESS>","Language-Team":"English","Language":"en","MIME-Version":"1.0","Content-Type":"text/plain; charset=UTF-8","Content-Transfer-Encoding":"8bit","Plural-Forms":"nplurals=2; plural=n != 1;","lang":"en","domain":"app","plural_forms":"nplurals=2; plural=n != 1;"},"Deutsch":[""],"English":[""],"Spanish":[""]}}}; var locales = locales || {}; locales['en'] = {"domain":"app","locale_data":{"app":{"":{"Project-Id-Version":"gitlab 1.0.0","Report-Msgid-Bugs-To":"","PO-Revision-Date":"2017-04-12 22:36-0500","Last-Translator":"FULL NAME <EMAIL@ADDRESS>","Language-Team":"English","Language":"en","MIME-Version":"1.0","Content-Type":"text/plain; charset=UTF-8","Content-Transfer-Encoding":"8bit","Plural-Forms":"nplurals=2; plural=n != 1;","lang":"en","domain":"app","plural_forms":"nplurals=2; plural=n != 1;"},"Cycle Analytics gives an overview of how much time it takes to go from idea to production in your project.":[""],"Deutsch":[""],"English":[""],"Introducing Cycle Analytics":[""],"Last 30 days":[""],"Last 90 days":[""],"Median":[""],"Not available":[""],"Not enough data":[""],"Pipeline Health":[""],"Read more":[""],"Spanish":[""],"Stage":[""],"Total Time":[""],"Want to see the data? Please ask administrator for access.":[""]}}};
\ No newline at end of file
var locales = locales || {}; locales['es'] = {"domain":"app","locale_data":{"app":{"":{"Project-Id-Version":"gitlab 1.0.0","Report-Msgid-Bugs-To":"","PO-Revision-Date":"2017-04-13 00:07-0500","Language-Team":"Spanish","Language":"es","MIME-Version":"1.0","Content-Type":"text/plain; charset=UTF-8","Content-Transfer-Encoding":"8bit","Plural-Forms":"nplurals=2; plural=n != 1;","Last-Translator":"","X-Generator":"Poedit 2.0.1","lang":"es","domain":"app","plural_forms":"nplurals=2; plural=n != 1;"},"Deutsch":["Alemán"],"English":["Inglés"],"Spanish":["Español"]}}}; var locales = locales || {}; locales['es'] = {"domain":"app","locale_data":{"app":{"":{"Project-Id-Version":"gitlab 1.0.0","Report-Msgid-Bugs-To":"","PO-Revision-Date":"2017-04-13 00:07-0500","Language-Team":"Spanish","Language":"es","MIME-Version":"1.0","Content-Type":"text/plain; charset=UTF-8","Content-Transfer-Encoding":"8bit","Plural-Forms":"nplurals=2; plural=n != 1;","Last-Translator":"","X-Generator":"Poedit 2.0.1","lang":"es","domain":"app","plural_forms":"nplurals=2; plural=n != 1;"},"Cycle Analytics gives an overview of how much time it takes to go from idea to production in your project.":[""],"Deutsch":["Alemán"],"English":["Inglés"],"Introducing Cycle Analytics":[""],"Last 30 days":[""],"Last 90 days":[""],"Median":[""],"Not available":[""],"Not enough data":[""],"Pipeline Health":[""],"Read more":[""],"Spanish":["Español"],"Stage":[""],"Total Time":[""],"Want to see the data? Please ask administrator for access.":[""]}}};
\ No newline at end of file
import Jed from 'jed'; import Jed from 'jed';
import de from './de/app'; import { de } from './de/app';
import es from './es/app'; import { es } from './es/app';
import en from './en/app'; import { en } from './en/app';
const locales = { const locales = {
de, de,
......
...@@ -5,13 +5,4 @@ export default (Vue) => { ...@@ -5,13 +5,4 @@ export default (Vue) => {
Vue.filter('translate-plural', (text, pluralText, count) => Vue.filter('translate-plural', (text, pluralText, count) =>
locale.ngettext(text, pluralText, count).replace(/%d/g, count)); locale.ngettext(text, pluralText, count).replace(/%d/g, count));
Vue.directive('translate', {
bind(el) {
const $el = el;
const text = $el.textContent.trim();
$el.textContent = locale.gettext(text);
},
});
}; };
...@@ -4,6 +4,7 @@ class Projects::CycleAnalyticsController < Projects::ApplicationController ...@@ -4,6 +4,7 @@ class Projects::CycleAnalyticsController < Projects::ApplicationController
include CycleAnalyticsParams include CycleAnalyticsParams
before_action :authorize_read_cycle_analytics! before_action :authorize_read_cycle_analytics!
before_action :set_locale, only: :show
def show def show
@cycle_analytics = ::CycleAnalytics.new(@project, options(cycle_analytics_params)) @cycle_analytics = ::CycleAnalytics.new(@project, options(cycle_analytics_params))
......
FastGettext.add_text_domain 'gitlab', path: 'locale', type: :po FastGettext.add_text_domain 'gitlab', path: 'locale', type: :po
FastGettext.default_available_locales = Gitlab::I18n::AVAILABLE_LANGUAGES.keys
FastGettext.default_text_domain = 'gitlab' FastGettext.default_text_domain = 'gitlab'
FastGettext.default_available_locales = Gitlab::I18n::AVAILABLE_LANGUAGES.keys
module GettextI18nRails
class HamlParser
# singleton_class.send(:alias_method, :old_convert_to_code, :convert_to_code)
#
# # We need to convert text in Mustache format
# # to a format that can be parsed by Gettext scripts.
# # If we found a content like "{{ 'Stage' | translate }}"
# # in a HAML file we convert it to "= _('Stage')", that way
# # it can be processed by the "rake gettext:find" script.
# def self.convert_to_code(text)
# text.gsub!(/{{ (.*)( \| translate) }}/, "= _(\\1)")
#
# old_convert_to_code(text)
# end
end
end
...@@ -36,6 +36,7 @@ var config = { ...@@ -36,6 +36,7 @@ var config = {
issuable: './issuable/issuable_bundle.js', issuable: './issuable/issuable_bundle.js',
locale: './locale/index.js', locale: './locale/index.js',
issue_show: './issue_show/index.js', issue_show: './issue_show/index.js',
locale: './locale/index.js',
main: './main.js', main: './main.js',
merge_conflicts: './merge_conflicts/merge_conflicts_bundle.js', merge_conflicts: './merge_conflicts/merge_conflicts_bundle.js',
merge_request_widget: './merge_request_widget/ci_bundle.js', merge_request_widget: './merge_request_widget/ci_bundle.js',
......
module Gitlab module Gitlab
module I18n module I18n
AVAILABLE_LANGUAGES = { AVAILABLE_LANGUAGES = {
'en' => 'English', 'en' => N_('English'),
'es' => 'Spanish', 'es' => N_('Spanish'),
'de' => 'Deutsch' 'de' => N_('Deutsch')
}.freeze }.freeze
end end
end end
...@@ -17,11 +17,47 @@ msgstr "" ...@@ -17,11 +17,47 @@ msgstr ""
"Plural-Forms: nplurals=2; plural=n != 1;\n" "Plural-Forms: nplurals=2; plural=n != 1;\n"
"\n" "\n"
msgid "Cycle Analytics gives an overview of how much time it takes to go from idea to production in your project."
msgstr ""
msgid "Deutsch" msgid "Deutsch"
msgstr "" msgstr ""
msgid "English" msgid "English"
msgstr "" msgstr ""
msgid "Introducing Cycle Analytics"
msgstr ""
msgid "Last 30 days"
msgstr ""
msgid "Last 90 days"
msgstr ""
msgid "Median"
msgstr ""
msgid "Not available"
msgstr ""
msgid "Not enough data"
msgstr ""
msgid "Pipeline Health"
msgstr ""
msgid "Read more"
msgstr ""
msgid "Spanish" msgid "Spanish"
msgstr "" msgstr ""
msgid "Stage"
msgstr ""
msgid "Total Time"
msgstr ""
msgid "Want to see the data? Please ask administrator for access."
msgstr ""
...@@ -17,11 +17,47 @@ msgstr "" ...@@ -17,11 +17,47 @@ msgstr ""
"Plural-Forms: nplurals=2; plural=n != 1;\n" "Plural-Forms: nplurals=2; plural=n != 1;\n"
"\n" "\n"
msgid "Cycle Analytics gives an overview of how much time it takes to go from idea to production in your project."
msgstr ""
msgid "Deutsch" msgid "Deutsch"
msgstr "" msgstr ""
msgid "English" msgid "English"
msgstr "" msgstr ""
msgid "Introducing Cycle Analytics"
msgstr ""
msgid "Last 30 days"
msgstr ""
msgid "Last 90 days"
msgstr ""
msgid "Median"
msgstr ""
msgid "Not available"
msgstr ""
msgid "Not enough data"
msgstr ""
msgid "Pipeline Health"
msgstr ""
msgid "Read more"
msgstr ""
msgid "Spanish" msgid "Spanish"
msgstr "" msgstr ""
msgid "Stage"
msgstr ""
msgid "Total Time"
msgstr ""
msgid "Want to see the data? Please ask administrator for access."
msgstr ""
...@@ -17,11 +17,47 @@ msgstr "" ...@@ -17,11 +17,47 @@ msgstr ""
"Last-Translator: \n" "Last-Translator: \n"
"X-Generator: Poedit 2.0.1\n" "X-Generator: Poedit 2.0.1\n"
msgid "Cycle Analytics gives an overview of how much time it takes to go from idea to production in your project."
msgstr ""
msgid "Deutsch" msgid "Deutsch"
msgstr "Alemán" msgstr "Alemán"
msgid "English" msgid "English"
msgstr "Inglés" msgstr "Inglés"
msgid "Introducing Cycle Analytics"
msgstr ""
msgid "Last 30 days"
msgstr ""
msgid "Last 90 days"
msgstr ""
msgid "Median"
msgstr ""
msgid "Not available"
msgstr ""
msgid "Not enough data"
msgstr ""
msgid "Pipeline Health"
msgstr ""
msgid "Read more"
msgstr ""
msgid "Spanish" msgid "Spanish"
msgstr "Español" msgstr "Español"
msgid "Stage"
msgstr ""
msgid "Total Time"
msgstr ""
msgid "Want to see the data? Please ask administrator for access."
msgstr ""
...@@ -8,8 +8,8 @@ msgid "" ...@@ -8,8 +8,8 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: gitlab 1.0.0\n" "Project-Id-Version: gitlab 1.0.0\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-04-13 00:01-0500\n" "POT-Creation-Date: 2017-04-21 09:01+0100\n"
"PO-Revision-Date: 2017-04-13 00:01-0500\n" "PO-Revision-Date: 2017-04-21 09:01+0100\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n" "Language: \n"
...@@ -18,11 +18,47 @@ msgstr "" ...@@ -18,11 +18,47 @@ msgstr ""
"Content-Transfer-Encoding: 8bit\n" "Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n" "Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
msgid "Cycle Analytics gives an overview of how much time it takes to go from idea to production in your project."
msgstr ""
msgid "Deutsch" msgid "Deutsch"
msgstr "" msgstr ""
msgid "English" msgid "English"
msgstr "" msgstr ""
msgid "Introducing Cycle Analytics"
msgstr ""
msgid "Last 30 days"
msgstr ""
msgid "Last 90 days"
msgstr ""
msgid "Median"
msgstr ""
msgid "Not available"
msgstr ""
msgid "Not enough data"
msgstr ""
msgid "Pipeline Health"
msgstr ""
msgid "Read more"
msgstr ""
msgid "Spanish" msgid "Spanish"
msgstr "" msgstr ""
msgid "Stage"
msgstr ""
msgid "Total Time"
msgstr ""
msgid "Want to see the data? Please ask administrator for access."
msgstr ""
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment