Merge remote-tracking branch 'origin/28433-internationalise-cycle-analytics-page' into js-translations

This commit is contained in:
Phil Hughes 2017-04-21 09:16:05 +01:00
commit dc5136a70d
15 changed files with 175 additions and 22 deletions

View File

@ -13,7 +13,7 @@ global.cycleAnalytics.TotalTimeComponent = Vue.extend({
<span class="total-time">
<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.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.seconds && Object.keys(time).length === 1 || time.seconds === 0">{{ time.seconds }} <span>s</span></template>
</template>

View File

@ -1 +1 @@
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.":[""]}}};

View File

@ -1 +1 @@
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.":[""]}}};

View File

@ -1 +1 @@
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.":[""]}}};

View File

@ -1,7 +1,7 @@
import Jed from 'jed';
import de from './de/app';
import es from './es/app';
import en from './en/app';
import { de } from './de/app';
import { es } from './es/app';
import { en } from './en/app';
const locales = {
de,

View File

@ -5,13 +5,4 @@ export default (Vue) => {
Vue.filter('translate-plural', (text, pluralText, 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);
},
});
};

View File

@ -4,6 +4,7 @@ class Projects::CycleAnalyticsController < Projects::ApplicationController
include CycleAnalyticsParams
before_action :authorize_read_cycle_analytics!
before_action :set_locale, only: :show
def show
@cycle_analytics = ::CycleAnalytics.new(@project, options(cycle_analytics_params))

View File

@ -1,3 +1,3 @@
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_available_locales = Gitlab::I18n::AVAILABLE_LANGUAGES.keys

View File

@ -0,0 +1,16 @@
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

View File

@ -36,6 +36,7 @@ var config = {
issuable: './issuable/issuable_bundle.js',
locale: './locale/index.js',
issue_show: './issue_show/index.js',
locale: './locale/index.js',
main: './main.js',
merge_conflicts: './merge_conflicts/merge_conflicts_bundle.js',
merge_request_widget: './merge_request_widget/ci_bundle.js',

View File

@ -1,9 +1,9 @@
module Gitlab
module I18n
AVAILABLE_LANGUAGES = {
'en' => 'English',
'es' => 'Spanish',
'de' => 'Deutsch'
'en' => N_('English'),
'es' => N_('Spanish'),
'de' => N_('Deutsch')
}.freeze
end
end

View File

@ -17,11 +17,47 @@ msgstr ""
"Plural-Forms: nplurals=2; plural=n != 1;\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"
msgstr ""
msgid "English"
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"
msgstr ""
msgid "Stage"
msgstr ""
msgid "Total Time"
msgstr ""
msgid "Want to see the data? Please ask administrator for access."
msgstr ""

View File

@ -17,11 +17,47 @@ msgstr ""
"Plural-Forms: nplurals=2; plural=n != 1;\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"
msgstr ""
msgid "English"
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"
msgstr ""
msgid "Stage"
msgstr ""
msgid "Total Time"
msgstr ""
msgid "Want to see the data? Please ask administrator for access."
msgstr ""

View File

@ -17,11 +17,47 @@ msgstr ""
"Last-Translator: \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"
msgstr "Alemán"
msgid "English"
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"
msgstr "Español"
msgid "Stage"
msgstr ""
msgid "Total Time"
msgstr ""
msgid "Want to see the data? Please ask administrator for access."
msgstr ""

View File

@ -8,8 +8,8 @@ msgid ""
msgstr ""
"Project-Id-Version: gitlab 1.0.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-04-13 00:01-0500\n"
"PO-Revision-Date: 2017-04-13 00:01-0500\n"
"POT-Creation-Date: 2017-04-21 09:01+0100\n"
"PO-Revision-Date: 2017-04-21 09:01+0100\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n"
@ -18,11 +18,47 @@ msgstr ""
"Content-Transfer-Encoding: 8bit\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"
msgstr ""
msgid "English"
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"
msgstr ""
msgid "Stage"
msgstr ""
msgid "Total Time"
msgstr ""
msgid "Want to see the data? Please ask administrator for access."
msgstr ""