Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--changelogs/unreleased/implement-i18n-support.yml4
-rw-r--r--config/locales/de.yml219
-rw-r--r--lib/gitlab/i18n.rb7
-rw-r--r--spec/features/cycle_analytics_spec.rb19
-rw-r--r--spec/lib/gitlab/i18n_spec.rb27
-rw-r--r--spec/models/user_spec.rb8
6 files changed, 281 insertions, 3 deletions
diff --git a/changelogs/unreleased/implement-i18n-support.yml b/changelogs/unreleased/implement-i18n-support.yml
new file mode 100644
index 00000000000..d304fbecf90
--- /dev/null
+++ b/changelogs/unreleased/implement-i18n-support.yml
@@ -0,0 +1,4 @@
+---
+title: Add support for i18n on Cycle Analytics page
+merge_request: 10669
+author:
diff --git a/config/locales/de.yml b/config/locales/de.yml
new file mode 100644
index 00000000000..533663a2704
--- /dev/null
+++ b/config/locales/de.yml
@@ -0,0 +1,219 @@
+---
+de:
+ activerecord:
+ errors:
+ messages:
+ record_invalid: 'Gültigkeitsprüfung ist fehlgeschlagen: %{errors}'
+ restrict_dependent_destroy:
+ has_one: Datensatz kann nicht gelöscht werden, da ein abhängiger %{record}-Datensatz
+ existiert.
+ has_many: Datensatz kann nicht gelöscht werden, da abhängige %{record} existieren.
+ date:
+ abbr_day_names:
+ - So
+ - Mo
+ - Di
+ - Mi
+ - Do
+ - Fr
+ - Sa
+ abbr_month_names:
+ -
+ - Jan
+ - Feb
+ - Mär
+ - Apr
+ - Mai
+ - Jun
+ - Jul
+ - Aug
+ - Sep
+ - Okt
+ - Nov
+ - Dez
+ day_names:
+ - Sonntag
+ - Montag
+ - Dienstag
+ - Mittwoch
+ - Donnerstag
+ - Freitag
+ - Samstag
+ formats:
+ default: "%d.%m.%Y"
+ long: "%e. %B %Y"
+ short: "%e. %b"
+ month_names:
+ -
+ - Januar
+ - Februar
+ - März
+ - April
+ - Mai
+ - Juni
+ - Juli
+ - August
+ - September
+ - Oktober
+ - November
+ - Dezember
+ order:
+ - :day
+ - :month
+ - :year
+ datetime:
+ distance_in_words:
+ about_x_hours:
+ one: etwa eine Stunde
+ other: etwa %{count} Stunden
+ about_x_months:
+ one: etwa ein Monat
+ other: etwa %{count} Monate
+ about_x_years:
+ one: etwa ein Jahr
+ other: etwa %{count} Jahre
+ almost_x_years:
+ one: fast ein Jahr
+ other: fast %{count} Jahre
+ half_a_minute: eine halbe Minute
+ less_than_x_minutes:
+ one: weniger als eine Minute
+ other: weniger als %{count} Minuten
+ less_than_x_seconds:
+ one: weniger als eine Sekunde
+ other: weniger als %{count} Sekunden
+ over_x_years:
+ one: mehr als ein Jahr
+ other: mehr als %{count} Jahre
+ x_days:
+ one: ein Tag
+ other: "%{count} Tage"
+ x_minutes:
+ one: eine Minute
+ other: "%{count} Minuten"
+ x_months:
+ one: ein Monat
+ other: "%{count} Monate"
+ x_seconds:
+ one: eine Sekunde
+ other: "%{count} Sekunden"
+ prompts:
+ day: Tag
+ hour: Stunden
+ minute: Minute
+ month: Monat
+ second: Sekunde
+ year: Jahr
+ errors:
+ format: "%{attribute} %{message}"
+ messages:
+ accepted: muss akzeptiert werden
+ blank: muss ausgefüllt werden
+ present: darf nicht ausgefüllt werden
+ confirmation: stimmt nicht mit %{attribute} überein
+ empty: muss ausgefüllt werden
+ equal_to: muss genau %{count} sein
+ even: muss gerade sein
+ exclusion: ist nicht verfügbar
+ greater_than: muss größer als %{count} sein
+ greater_than_or_equal_to: muss größer oder gleich %{count} sein
+ inclusion: ist kein gültiger Wert
+ invalid: ist nicht gültig
+ less_than: muss kleiner als %{count} sein
+ less_than_or_equal_to: muss kleiner oder gleich %{count} sein
+ model_invalid: 'Gültigkeitsprüfung ist fehlgeschlagen: %{errors}'
+ not_a_number: ist keine Zahl
+ not_an_integer: muss ganzzahlig sein
+ odd: muss ungerade sein
+ required: muss ausgefüllt werden
+ taken: ist bereits vergeben
+ too_long:
+ one: ist zu lang (mehr als 1 Zeichen)
+ other: ist zu lang (mehr als %{count} Zeichen)
+ too_short:
+ one: ist zu kurz (weniger als 1 Zeichen)
+ other: ist zu kurz (weniger als %{count} Zeichen)
+ wrong_length:
+ one: hat die falsche Länge (muss genau 1 Zeichen haben)
+ other: hat die falsche Länge (muss genau %{count} Zeichen haben)
+ other_than: darf nicht gleich %{count} sein
+ template:
+ body: 'Bitte überprüfen Sie die folgenden Felder:'
+ header:
+ one: 'Konnte %{model} nicht speichern: ein Fehler.'
+ other: 'Konnte %{model} nicht speichern: %{count} Fehler.'
+ helpers:
+ select:
+ prompt: Bitte wählen
+ submit:
+ create: "%{model} erstellen"
+ submit: "%{model} speichern"
+ update: "%{model} aktualisieren"
+ number:
+ currency:
+ format:
+ delimiter: "."
+ format: "%n %u"
+ precision: 2
+ separator: ","
+ significant: false
+ strip_insignificant_zeros: false
+ unit: "€"
+ format:
+ delimiter: "."
+ precision: 2
+ separator: ","
+ significant: false
+ strip_insignificant_zeros: false
+ human:
+ decimal_units:
+ format: "%n %u"
+ units:
+ billion:
+ one: Milliarde
+ other: Milliarden
+ million:
+ one: Million
+ other: Millionen
+ quadrillion:
+ one: Billiarde
+ other: Billiarden
+ thousand: Tausend
+ trillion:
+ one: Billion
+ other: Billionen
+ unit: ''
+ format:
+ delimiter: ''
+ precision: 3
+ significant: true
+ strip_insignificant_zeros: true
+ storage_units:
+ format: "%n %u"
+ units:
+ byte:
+ one: Byte
+ other: Bytes
+ gb: GB
+ kb: KB
+ mb: MB
+ tb: TB
+ percentage:
+ format:
+ delimiter: ''
+ format: "%n %"
+ precision:
+ format:
+ delimiter: ''
+ support:
+ array:
+ last_word_connector: " und "
+ two_words_connector: " und "
+ words_connector: ", "
+ time:
+ am: vormittags
+ formats:
+ default: "%A, %d. %B %Y, %H:%M Uhr"
+ long: "%A, %d. %B %Y, %H:%M Uhr"
+ short: "%d. %B, %H:%M Uhr"
+ pm: nachmittags
diff --git a/lib/gitlab/i18n.rb b/lib/gitlab/i18n.rb
index 9081ced0238..3411516319f 100644
--- a/lib/gitlab/i18n.rb
+++ b/lib/gitlab/i18n.rb
@@ -3,9 +3,9 @@ module Gitlab
extend self
AVAILABLE_LANGUAGES = {
- en: 'English',
- es: 'Español',
- de: 'Deutsch'
+ 'en' => 'English',
+ 'es' => 'Español',
+ 'de' => 'Deutsch'
}.freeze
def available_locales
@@ -19,6 +19,7 @@ module Gitlab
end
def reset_locale
+ FastGettext.set_locale(::I18n.default_locale)
::I18n.locale = ::I18n.default_locale
end
end
diff --git a/spec/features/cycle_analytics_spec.rb b/spec/features/cycle_analytics_spec.rb
index b93275c330b..7c9d522273b 100644
--- a/spec/features/cycle_analytics_spec.rb
+++ b/spec/features/cycle_analytics_spec.rb
@@ -62,6 +62,25 @@ feature 'Cycle Analytics', feature: true, js: true do
expect_issue_to_be_present
end
end
+
+ context "when my preferred language is Spanish" do
+ before do
+ user.update_attribute(:preferred_language, 'es')
+
+ project.team << [user, :master]
+ login_as(user)
+ visit namespace_project_cycle_analytics_path(project.namespace, project)
+ wait_for_ajax
+ end
+
+ it 'shows the content in Spanish' do
+ expect(page).to have_content('Estado del Pipeline')
+ end
+
+ it 'resets the language to English' do
+ expect(I18n.locale).to eq(:en)
+ end
+ end
end
context "as a guest" do
diff --git a/spec/lib/gitlab/i18n_spec.rb b/spec/lib/gitlab/i18n_spec.rb
new file mode 100644
index 00000000000..52f2614d5ca
--- /dev/null
+++ b/spec/lib/gitlab/i18n_spec.rb
@@ -0,0 +1,27 @@
+require 'spec_helper'
+
+module Gitlab
+ describe I18n, lib: true do
+ let(:user) { create(:user, preferred_language: 'es') }
+
+ describe '.set_locale' do
+ it 'sets the locale based on current user preferred language' do
+ Gitlab::I18n.set_locale(user)
+
+ expect(FastGettext.locale).to eq('es')
+ expect(::I18n.locale).to eq(:es)
+ end
+ end
+
+ describe '.reset_locale' do
+ it 'resets the locale to the default language' do
+ Gitlab::I18n.set_locale(user)
+
+ Gitlab::I18n.reset_locale
+
+ expect(FastGettext.locale).to eq('en')
+ expect(::I18n.locale).to eq(:en)
+ end
+ end
+ end
+end
diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb
index 1c2df4c9d97..13179174956 100644
--- a/spec/models/user_spec.rb
+++ b/spec/models/user_spec.rb
@@ -1663,4 +1663,12 @@ describe User, models: true do
expect(User.active.count).to eq(1)
end
end
+
+ describe 'preferred language' do
+ it 'is English by default' do
+ user = create(:user)
+
+ expect(user.preferred_language).to eq('en')
+ end
+ end
end