From d08d0f9f3335b2edbacf1febd4584eed9a7d1a11 Mon Sep 17 00:00:00 2001 From: kibigo! Date: Thu, 7 Dec 2017 14:42:21 -0800 Subject: Ruby intl8n for themes --- app/javascript/flavours/glitch/names.yml | 6 ++++++ app/javascript/flavours/vanilla/names.yml | 6 ++++++ app/javascript/skins/vanilla/win95.scss | 1 - app/javascript/skins/vanilla/win95/common.scss | 1 + app/javascript/skins/vanilla/win95/names.yml | 4 ++++ app/views/settings/preferences/show.html.haml | 4 ++-- config/initializers/locale.rb | 6 ++++++ 7 files changed, 25 insertions(+), 3 deletions(-) create mode 100644 app/javascript/flavours/glitch/names.yml create mode 100644 app/javascript/flavours/vanilla/names.yml delete mode 100644 app/javascript/skins/vanilla/win95.scss create mode 100644 app/javascript/skins/vanilla/win95/common.scss create mode 100644 app/javascript/skins/vanilla/win95/names.yml create mode 100644 config/initializers/locale.rb diff --git a/app/javascript/flavours/glitch/names.yml b/app/javascript/flavours/glitch/names.yml new file mode 100644 index 000000000..b3d579cb2 --- /dev/null +++ b/app/javascript/flavours/glitch/names.yml @@ -0,0 +1,6 @@ +en: + flavours: + glitch: Glitch Edition + skins: + glitch: + default: Default diff --git a/app/javascript/flavours/vanilla/names.yml b/app/javascript/flavours/vanilla/names.yml new file mode 100644 index 000000000..8816fcb3a --- /dev/null +++ b/app/javascript/flavours/vanilla/names.yml @@ -0,0 +1,6 @@ +en: + flavours: + vanilla: Vanilla Mastodon + skins: + vanilla: + default: Default diff --git a/app/javascript/skins/vanilla/win95.scss b/app/javascript/skins/vanilla/win95.scss deleted file mode 100644 index 298f6ee9d..000000000 --- a/app/javascript/skins/vanilla/win95.scss +++ /dev/null @@ -1 +0,0 @@ -@import 'styles/win95'; diff --git a/app/javascript/skins/vanilla/win95/common.scss b/app/javascript/skins/vanilla/win95/common.scss new file mode 100644 index 000000000..298f6ee9d --- /dev/null +++ b/app/javascript/skins/vanilla/win95/common.scss @@ -0,0 +1 @@ +@import 'styles/win95'; diff --git a/app/javascript/skins/vanilla/win95/names.yml b/app/javascript/skins/vanilla/win95/names.yml new file mode 100644 index 000000000..2083084a2 --- /dev/null +++ b/app/javascript/skins/vanilla/win95/names.yml @@ -0,0 +1,4 @@ +en: + skins: + vanilla: + win95: Masto95 diff --git a/app/views/settings/preferences/show.html.haml b/app/views/settings/preferences/show.html.haml index 9564c0399..e2e48a699 100644 --- a/app/views/settings/preferences/show.html.haml +++ b/app/views/settings/preferences/show.html.haml @@ -27,8 +27,8 @@ .fields-group - if Themes.instance.flavours.size > 1 - = f.input :setting_flavour, collection: Themes.instance.flavours, label_method: lambda { |flavour| I18n.t("themes.#{flavour}", default: flavour) }, wrapper: :with_label, include_blank: false - = f.input :setting_skin, collection: Themes.instance.skins_for(current_flavour), label_method: lambda { |skin| I18n.t("themes.#{current_flavour}.skins.#{skin}", default: skin) }, wrapper: :with_label, include_blank: false + = f.input :setting_flavour, collection: Themes.instance.flavours, label_method: lambda { |flavour| I18n.t("flavours.#{flavour}", default: flavour) }, wrapper: :with_label, include_blank: false + = f.input :setting_skin, collection: Themes.instance.skins_for(current_flavour), label_method: lambda { |skin| I18n.t("skins.#{current_flavour}.#{skin}", default: skin) }, wrapper: :with_label, include_blank: false = f.input :setting_unfollow_modal, as: :boolean, wrapper: :with_label = f.input :setting_boost_modal, as: :boolean, wrapper: :with_label diff --git a/config/initializers/locale.rb b/config/initializers/locale.rb new file mode 100644 index 000000000..04ed31646 --- /dev/null +++ b/config/initializers/locale.rb @@ -0,0 +1,6 @@ +# frozen_string_literal: true + +I18n.load_path += Dir[Rails.root.join('app', 'javascript', 'flavours', '*', 'names.{rb,yml}').to_s] +I18n.load_path += Dir[Rails.root.join('app', 'javascript', 'flavours', '*', 'names', '*.{rb,yml}').to_s] +I18n.load_path += Dir[Rails.root.join('app', 'javascript', 'skins', '*', '*', 'names.{rb,yml}').to_s] +I18n.load_path += Dir[Rails.root.join('app', 'javascript', 'skins', '*', '*', 'names', '*.{rb,yml}').to_s] -- cgit From 83944300815cda2cd67c93ec7ca7f3d981b561fa Mon Sep 17 00:00:00 2001 From: kibigo! Date: Thu, 7 Dec 2017 14:57:49 -0800 Subject: Removed unused theme localization key --- config/locales/en.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/config/locales/en.yml b/config/locales/en.yml index 0ca320e1a..c8acc237a 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -687,8 +687,6 @@ en:

Originally adapted from the Discourse privacy policy.

title: "%{instance} Terms of Service and Privacy Policy" - themes: - default: Mastodon time: formats: default: "%b %d, %Y, %H:%M" -- cgit From b28cd6769c77190160e4ffefde78b324c7aad269 Mon Sep 17 00:00:00 2001 From: kibigo! Date: Thu, 7 Dec 2017 19:07:47 -0800 Subject: Javascript intl8n flavour support --- app/controllers/application_controller.rb | 2 + app/javascript/flavours/glitch/locales/ar.js | 7 + app/javascript/flavours/glitch/locales/bg.js | 7 + app/javascript/flavours/glitch/locales/ca.js | 7 + app/javascript/flavours/glitch/locales/de.js | 7 + app/javascript/flavours/glitch/locales/en.js | 50 +++++ app/javascript/flavours/glitch/locales/eo.js | 7 + app/javascript/flavours/glitch/locales/es.js | 7 + app/javascript/flavours/glitch/locales/fa.js | 7 + app/javascript/flavours/glitch/locales/fi.js | 7 + app/javascript/flavours/glitch/locales/fr.js | 7 + app/javascript/flavours/glitch/locales/he.js | 7 + app/javascript/flavours/glitch/locales/hr.js | 7 + app/javascript/flavours/glitch/locales/hu.js | 7 + app/javascript/flavours/glitch/locales/id.js | 7 + app/javascript/flavours/glitch/locales/io.js | 7 + app/javascript/flavours/glitch/locales/it.js | 7 + app/javascript/flavours/glitch/locales/ja.js | 7 + app/javascript/flavours/glitch/locales/ko.js | 7 + app/javascript/flavours/glitch/locales/nl.js | 7 + app/javascript/flavours/glitch/locales/no.js | 7 + app/javascript/flavours/glitch/locales/oc.js | 7 + app/javascript/flavours/glitch/locales/pl.js | 48 +++++ app/javascript/flavours/glitch/locales/pt-BR.js | 7 + app/javascript/flavours/glitch/locales/pt.js | 7 + app/javascript/flavours/glitch/locales/ru.js | 7 + app/javascript/flavours/glitch/locales/sv.js | 7 + app/javascript/flavours/glitch/locales/th.js | 7 + app/javascript/flavours/glitch/locales/tr.js | 7 + app/javascript/flavours/glitch/locales/uk.js | 7 + app/javascript/flavours/glitch/locales/zh-CN.js | 7 + app/javascript/flavours/glitch/locales/zh-HK.js | 7 + app/javascript/flavours/glitch/locales/zh-TW.js | 7 + app/javascript/flavours/glitch/theme.yml | 6 + app/javascript/flavours/vanilla/theme.yml | 10 +- app/javascript/glitch/locales/en.json | 46 ----- app/javascript/glitch/locales/pl.json | 44 ---- app/javascript/locales/locale-data/README.md | 221 +++++++++++++++++++++ app/javascript/locales/locale-data/oc.js | 108 ++++++++++ .../mastodon/locales/locale-data/README.md | 221 --------------------- app/javascript/mastodon/locales/locale-data/oc.js | 108 ---------- app/lib/themes.rb | 8 + app/views/layouts/application.html.haml | 5 +- config/webpack/configuration.js | 5 +- config/webpack/generateLocalePacks.js | 108 +++++----- config/webpack/shared.js | 8 +- 46 files changed, 722 insertions(+), 486 deletions(-) create mode 100644 app/javascript/flavours/glitch/locales/ar.js create mode 100644 app/javascript/flavours/glitch/locales/bg.js create mode 100644 app/javascript/flavours/glitch/locales/ca.js create mode 100644 app/javascript/flavours/glitch/locales/de.js create mode 100644 app/javascript/flavours/glitch/locales/en.js create mode 100644 app/javascript/flavours/glitch/locales/eo.js create mode 100644 app/javascript/flavours/glitch/locales/es.js create mode 100644 app/javascript/flavours/glitch/locales/fa.js create mode 100644 app/javascript/flavours/glitch/locales/fi.js create mode 100644 app/javascript/flavours/glitch/locales/fr.js create mode 100644 app/javascript/flavours/glitch/locales/he.js create mode 100644 app/javascript/flavours/glitch/locales/hr.js create mode 100644 app/javascript/flavours/glitch/locales/hu.js create mode 100644 app/javascript/flavours/glitch/locales/id.js create mode 100644 app/javascript/flavours/glitch/locales/io.js create mode 100644 app/javascript/flavours/glitch/locales/it.js create mode 100644 app/javascript/flavours/glitch/locales/ja.js create mode 100644 app/javascript/flavours/glitch/locales/ko.js create mode 100644 app/javascript/flavours/glitch/locales/nl.js create mode 100644 app/javascript/flavours/glitch/locales/no.js create mode 100644 app/javascript/flavours/glitch/locales/oc.js create mode 100644 app/javascript/flavours/glitch/locales/pl.js create mode 100644 app/javascript/flavours/glitch/locales/pt-BR.js create mode 100644 app/javascript/flavours/glitch/locales/pt.js create mode 100644 app/javascript/flavours/glitch/locales/ru.js create mode 100644 app/javascript/flavours/glitch/locales/sv.js create mode 100644 app/javascript/flavours/glitch/locales/th.js create mode 100644 app/javascript/flavours/glitch/locales/tr.js create mode 100644 app/javascript/flavours/glitch/locales/uk.js create mode 100644 app/javascript/flavours/glitch/locales/zh-CN.js create mode 100644 app/javascript/flavours/glitch/locales/zh-HK.js create mode 100644 app/javascript/flavours/glitch/locales/zh-TW.js delete mode 100644 app/javascript/glitch/locales/en.json delete mode 100644 app/javascript/glitch/locales/pl.json create mode 100644 app/javascript/locales/locale-data/README.md create mode 100644 app/javascript/locales/locale-data/oc.js delete mode 100644 app/javascript/mastodon/locales/locale-data/README.md delete mode 100644 app/javascript/mastodon/locales/locale-data/oc.js diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index c6d148c8c..3b2070f39 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -62,6 +62,7 @@ class ApplicationController < ActionController::Base pack: pack_name, preload: nil, skin: nil, + supported_locales: data['locales'], } if data['pack'][pack_name].is_a?(Hash) pack_data[:common] = nil if data['pack'][pack_name]['use_common'] == false @@ -93,6 +94,7 @@ class ApplicationController < ActionController::Base pack: nil, preload: nil, skin: nil, + supported_locales: data['locales'], } end diff --git a/app/javascript/flavours/glitch/locales/ar.js b/app/javascript/flavours/glitch/locales/ar.js new file mode 100644 index 000000000..1081147d5 --- /dev/null +++ b/app/javascript/flavours/glitch/locales/ar.js @@ -0,0 +1,7 @@ +import inherited from 'mastodon/locales/ar.json'; + +const messages = { + // No translations available. +}; + +export default Object.assign({}, inherited, messages); diff --git a/app/javascript/flavours/glitch/locales/bg.js b/app/javascript/flavours/glitch/locales/bg.js new file mode 100644 index 000000000..979039376 --- /dev/null +++ b/app/javascript/flavours/glitch/locales/bg.js @@ -0,0 +1,7 @@ +import inherited from 'mastodon/locales/bg.json'; + +const messages = { + // No translations available. +}; + +export default Object.assign({}, inherited, messages); diff --git a/app/javascript/flavours/glitch/locales/ca.js b/app/javascript/flavours/glitch/locales/ca.js new file mode 100644 index 000000000..baf76bd6f --- /dev/null +++ b/app/javascript/flavours/glitch/locales/ca.js @@ -0,0 +1,7 @@ +import inherited from 'mastodon/locales/ca.json'; + +const messages = { + // No translations available. +}; + +export default Object.assign({}, inherited, messages); diff --git a/app/javascript/flavours/glitch/locales/de.js b/app/javascript/flavours/glitch/locales/de.js new file mode 100644 index 000000000..ce6453623 --- /dev/null +++ b/app/javascript/flavours/glitch/locales/de.js @@ -0,0 +1,7 @@ +import inherited from 'mastodon/locales/de.json'; + +const messages = { + // No translations available. +}; + +export default Object.assign({}, inherited, messages); diff --git a/app/javascript/flavours/glitch/locales/en.js b/app/javascript/flavours/glitch/locales/en.js new file mode 100644 index 000000000..96182196e --- /dev/null +++ b/app/javascript/flavours/glitch/locales/en.js @@ -0,0 +1,50 @@ +import inherited from 'mastodon/locales/en.json'; + +const messages = { + "getting_started.open_source_notice": "Glitchsoc is free open source software forked from {Mastodon}. You can contribute or report issues on GitHub at {github}.", + "layout.auto": "Auto", + "layout.current_is": "Your current layout is:", + "layout.desktop": "Desktop", + "layout.mobile": "Mobile", + "navigation_bar.app_settings": "App settings", + "getting_started.onboarding": "Show me around", + "onboarding.page_one.federation": "{domain} is an 'instance' of Mastodon. Mastodon is a network of independent servers joining up to make one larger social network. We call these servers instances.", + "onboarding.page_one.welcome": "Welcome to {domain}!", + "onboarding.page_six.github": "{domain} runs on Glitchsoc. Glitchsoc is a friendly {fork} of {Mastodon}, and is compatible with any Mastodon instance or app. Glitchsoc is entirely free and open-source. You can report bugs, request features, or contribute to the code on {github}.", + "settings.auto_collapse": "Automatic collapsing", + "settings.auto_collapse_all": "Everything", + "settings.auto_collapse_lengthy": "Lengthy toots", + "settings.auto_collapse_media": "Toots with media", + "settings.auto_collapse_notifications": "Notifications", + "settings.auto_collapse_reblogs": "Boosts", + "settings.auto_collapse_replies": "Replies", + "settings.close": "Close", + "settings.collapsed_statuses": "Collapsed toots", + "settings.enable_collapsed": "Enable collapsed toots", + "settings.general": "General", + "settings.image_backgrounds": "Image backgrounds", + "settings.image_backgrounds_media": "Preview collapsed toot media", + "settings.image_backgrounds_users": "Give collapsed toots an image background", + "settings.media": "Media", + "settings.media_letterbox": "Letterbox media", + "settings.media_fullwidth": "Full-width media previews", + "settings.preferences": "User preferences", + "settings.wide_view": "Wide view (Desktop mode only)", + "settings.navbar_under": "Navbar at the bottom (Mobile only)", + "status.collapse": "Collapse", + "status.uncollapse": "Uncollapse", + + "home.column_settings.show_direct": "Show DMs", + + "notification.markForDeletion": "Mark for deletion", + "notifications.clear": "Clear all my notifications", + "notifications.marked_clear_confirmation": "Are you sure you want to permanently clear all selected notifications?", + "notifications.marked_clear": "Clear selected notifications", + + "notification_purge.btn_all": "Select\nall", + "notification_purge.btn_none": "Select\nnone", + "notification_purge.btn_invert": "Invert\nselection", + "notification_purge.btn_apply": "Clear\nselected", +}; + +export default Object.assign({}, inherited, messages); diff --git a/app/javascript/flavours/glitch/locales/eo.js b/app/javascript/flavours/glitch/locales/eo.js new file mode 100644 index 000000000..04192f506 --- /dev/null +++ b/app/javascript/flavours/glitch/locales/eo.js @@ -0,0 +1,7 @@ +import inherited from 'mastodon/locales/eo.json'; + +const messages = { + // No translations available. +}; + +export default Object.assign({}, inherited, messages); diff --git a/app/javascript/flavours/glitch/locales/es.js b/app/javascript/flavours/glitch/locales/es.js new file mode 100644 index 000000000..456df3c47 --- /dev/null +++ b/app/javascript/flavours/glitch/locales/es.js @@ -0,0 +1,7 @@ +import inherited from 'mastodon/locales/es.json'; + +const messages = { + // No translations available. +}; + +export default Object.assign({}, inherited, messages); diff --git a/app/javascript/flavours/glitch/locales/fa.js b/app/javascript/flavours/glitch/locales/fa.js new file mode 100644 index 000000000..d82461a1a --- /dev/null +++ b/app/javascript/flavours/glitch/locales/fa.js @@ -0,0 +1,7 @@ +import inherited from 'mastodon/locales/fa.json'; + +const messages = { + // No translations available. +}; + +export default Object.assign({}, inherited, messages); diff --git a/app/javascript/flavours/glitch/locales/fi.js b/app/javascript/flavours/glitch/locales/fi.js new file mode 100644 index 000000000..11c3cd082 --- /dev/null +++ b/app/javascript/flavours/glitch/locales/fi.js @@ -0,0 +1,7 @@ +import inherited from 'mastodon/locales/fi.json'; + +const messages = { + // No translations available. +}; + +export default Object.assign({}, inherited, messages); diff --git a/app/javascript/flavours/glitch/locales/fr.js b/app/javascript/flavours/glitch/locales/fr.js new file mode 100644 index 000000000..8562f5594 --- /dev/null +++ b/app/javascript/flavours/glitch/locales/fr.js @@ -0,0 +1,7 @@ +import inherited from 'mastodon/locales/fr.json'; + +const messages = { + // No translations available. +}; + +export default Object.assign({}, inherited, messages); diff --git a/app/javascript/flavours/glitch/locales/he.js b/app/javascript/flavours/glitch/locales/he.js new file mode 100644 index 000000000..99516ee0c --- /dev/null +++ b/app/javascript/flavours/glitch/locales/he.js @@ -0,0 +1,7 @@ +import inherited from 'mastodon/locales/he.json'; + +const messages = { + // No translations available. +}; + +export default Object.assign({}, inherited, messages); diff --git a/app/javascript/flavours/glitch/locales/hr.js b/app/javascript/flavours/glitch/locales/hr.js new file mode 100644 index 000000000..dbf9b4b9f --- /dev/null +++ b/app/javascript/flavours/glitch/locales/hr.js @@ -0,0 +1,7 @@ +import inherited from 'mastodon/locales/hr.json'; + +const messages = { + // No translations available. +}; + +export default Object.assign({}, inherited, messages); diff --git a/app/javascript/flavours/glitch/locales/hu.js b/app/javascript/flavours/glitch/locales/hu.js new file mode 100644 index 000000000..1f0849af3 --- /dev/null +++ b/app/javascript/flavours/glitch/locales/hu.js @@ -0,0 +1,7 @@ +import inherited from 'mastodon/locales/hu.json'; + +const messages = { + // No translations available. +}; + +export default Object.assign({}, inherited, messages); diff --git a/app/javascript/flavours/glitch/locales/id.js b/app/javascript/flavours/glitch/locales/id.js new file mode 100644 index 000000000..07e5f7e56 --- /dev/null +++ b/app/javascript/flavours/glitch/locales/id.js @@ -0,0 +1,7 @@ +import inherited from 'mastodon/locales/id.json'; + +const messages = { + // No translations available. +}; + +export default Object.assign({}, inherited, messages); diff --git a/app/javascript/flavours/glitch/locales/io.js b/app/javascript/flavours/glitch/locales/io.js new file mode 100644 index 000000000..74ea6fae6 --- /dev/null +++ b/app/javascript/flavours/glitch/locales/io.js @@ -0,0 +1,7 @@ +import inherited from 'mastodon/locales/io.json'; + +const messages = { + // No translations available. +}; + +export default Object.assign({}, inherited, messages); diff --git a/app/javascript/flavours/glitch/locales/it.js b/app/javascript/flavours/glitch/locales/it.js new file mode 100644 index 000000000..90f543093 --- /dev/null +++ b/app/javascript/flavours/glitch/locales/it.js @@ -0,0 +1,7 @@ +import inherited from 'mastodon/locales/it.json'; + +const messages = { + // No translations available. +}; + +export default Object.assign({}, inherited, messages); diff --git a/app/javascript/flavours/glitch/locales/ja.js b/app/javascript/flavours/glitch/locales/ja.js new file mode 100644 index 000000000..cc7143443 --- /dev/null +++ b/app/javascript/flavours/glitch/locales/ja.js @@ -0,0 +1,7 @@ +import inherited from 'mastodon/locales/ja.json'; + +const messages = { + // No translations available. +}; + +export default Object.assign({}, inherited, messages); diff --git a/app/javascript/flavours/glitch/locales/ko.js b/app/javascript/flavours/glitch/locales/ko.js new file mode 100644 index 000000000..3b55f89b9 --- /dev/null +++ b/app/javascript/flavours/glitch/locales/ko.js @@ -0,0 +1,7 @@ +import inherited from 'mastodon/locales/ko.json'; + +const messages = { + // No translations available. +}; + +export default Object.assign({}, inherited, messages); diff --git a/app/javascript/flavours/glitch/locales/nl.js b/app/javascript/flavours/glitch/locales/nl.js new file mode 100644 index 000000000..17c371c58 --- /dev/null +++ b/app/javascript/flavours/glitch/locales/nl.js @@ -0,0 +1,7 @@ +import inherited from 'mastodon/locales/nl.json'; + +const messages = { + // No translations available. +}; + +export default Object.assign({}, inherited, messages); diff --git a/app/javascript/flavours/glitch/locales/no.js b/app/javascript/flavours/glitch/locales/no.js new file mode 100644 index 000000000..794b1da25 --- /dev/null +++ b/app/javascript/flavours/glitch/locales/no.js @@ -0,0 +1,7 @@ +import inherited from 'mastodon/locales/no.json'; + +const messages = { + // No translations available. +}; + +export default Object.assign({}, inherited, messages); diff --git a/app/javascript/flavours/glitch/locales/oc.js b/app/javascript/flavours/glitch/locales/oc.js new file mode 100644 index 000000000..8f161fd8c --- /dev/null +++ b/app/javascript/flavours/glitch/locales/oc.js @@ -0,0 +1,7 @@ +import inherited from 'mastodon/locales/oc.json'; + +const messages = { + // No translations available. +}; + +export default Object.assign({}, inherited, messages); diff --git a/app/javascript/flavours/glitch/locales/pl.js b/app/javascript/flavours/glitch/locales/pl.js new file mode 100644 index 000000000..ab96dec60 --- /dev/null +++ b/app/javascript/flavours/glitch/locales/pl.js @@ -0,0 +1,48 @@ +import inherited from 'mastodon/locales/pl.json'; + +const messages = { + "getting_started.open_source_notice": "Glitchsoc jest wolnym i otwartoźródłowym forkiem oprogramowania {Mastodon}. Możesz współtworzyć projekt lub zgłaszać błędy na GitHubie pod adresem {github}.", + "layout.auto": "Automatyczny", + "layout.current_is": "Twój obecny układ to:", + "layout.desktop": "Desktopowy", + "layout.mobile": "Mobilny", + "navigation_bar.app_settings": "Ustawienia aplikacji", + "getting_started.onboarding": "Rozejrzyj się", + "onboarding.page_one.federation": "{domain} jest 'instancją' Mastodona. Mastodon to sieć działających niezależnie serwerów tworzących jedną sieć społecznościową. Te serwery nazywane są instancjami.", + "onboarding.page_one.welcome": "Witamy na {domain}!", + "onboarding.page_six.github": "{domain} jest oparty na Glitchsoc. Glitchsoc jest {forkiem} {Mastodon}a kompatybilnym z każdym klientem i aplikacją Mastodona. Glitchsoc jest całkowicie wolnym i otwartoźródłowym oprogramowaniem. Możesz zgłaszać błędy i sugestie funkcji oraz współtworzyć projekt na {github}.", + "settings.auto_collapse": "Automatyczne zwijanie", + "settings.auto_collapse_all": "Wszystko", + "settings.auto_collapse_lengthy": "Długie wpisy", + "settings.auto_collapse_media": "Wpisy z zawartością multimedialną", + "settings.auto_collapse_notifications": "Powiadomienia", + "settings.auto_collapse_reblogs": "Podbicia", + "settings.auto_collapse_replies": "Odpowiedzi", + "settings.close": "Zamknij", + "settings.collapsed_statuses": "Zwijanie wpisów", + "settings.enable_collapsed": "Włącz zwijanie wpisów", + "settings.general": "Ogólne", + "settings.image_backgrounds": "Obrazy w tle", + "settings.image_backgrounds_media": "Wyświetlaj zawartość multimedialną zwiniętych wpisów", + "settings.image_backgrounds_users": "Nadaj tło zwiniętym wpisom", + "settings.media": "Zawartość multimedialna", + "settings.media_letterbox": "Letterbox media", + "settings.media_fullwidth": "Podgląd zawartości multimedialnej o pełnej szerokości", + "settings.preferences": "Preferencje użyytkownika", + "settings.wide_view": "Szeroki widok (tylko w trybie desktopowym)", + "settings.navbar_under": "Pasek nawigacji na dole (tylko w trybie mobilnym)", + "status.collapse": "Zwiń", + "status.uncollapse": "Rozwiń", + + "notification.markForDeletion": "Oznacz do usunięcia", + "notifications.clear": "Wyczyść wszystkie powiadomienia", + "notifications.marked_clear_confirmation": "Czy na pewno chcesz bezpowrtonie usunąć wszystkie powiadomienia?", + "notifications.marked_clear": "Usuń zaznaczone powiadomienia", + + "notification_purge.btn_all": "Zaznacz\nwszystkie", + "notification_purge.btn_none": "Odznacz\nwszystkie", + "notification_purge.btn_invert": "Odwróć\nzaznaczenie", + "notification_purge.btn_apply": "Usuń\nzaznaczone" +}; + +export default Object.assign({}, inherited, messages); diff --git a/app/javascript/flavours/glitch/locales/pt-BR.js b/app/javascript/flavours/glitch/locales/pt-BR.js new file mode 100644 index 000000000..6fed635f8 --- /dev/null +++ b/app/javascript/flavours/glitch/locales/pt-BR.js @@ -0,0 +1,7 @@ +import inherited from 'mastodon/locales/pt-BR.json'; + +const messages = { + // No translations available. +}; + +export default Object.assign({}, inherited, messages); diff --git a/app/javascript/flavours/glitch/locales/pt.js b/app/javascript/flavours/glitch/locales/pt.js new file mode 100644 index 000000000..0156f55ff --- /dev/null +++ b/app/javascript/flavours/glitch/locales/pt.js @@ -0,0 +1,7 @@ +import inherited from 'mastodon/locales/pt.json'; + +const messages = { + // No translations available. +}; + +export default Object.assign({}, inherited, messages); diff --git a/app/javascript/flavours/glitch/locales/ru.js b/app/javascript/flavours/glitch/locales/ru.js new file mode 100644 index 000000000..0e9f1de71 --- /dev/null +++ b/app/javascript/flavours/glitch/locales/ru.js @@ -0,0 +1,7 @@ +import inherited from 'mastodon/locales/ru.json'; + +const messages = { + // No translations available. +}; + +export default Object.assign({}, inherited, messages); diff --git a/app/javascript/flavours/glitch/locales/sv.js b/app/javascript/flavours/glitch/locales/sv.js new file mode 100644 index 000000000..b62c353fe --- /dev/null +++ b/app/javascript/flavours/glitch/locales/sv.js @@ -0,0 +1,7 @@ +import inherited from 'mastodon/locales/sv.json'; + +const messages = { + // No translations available. +}; + +export default Object.assign({}, inherited, messages); diff --git a/app/javascript/flavours/glitch/locales/th.js b/app/javascript/flavours/glitch/locales/th.js new file mode 100644 index 000000000..e939f8631 --- /dev/null +++ b/app/javascript/flavours/glitch/locales/th.js @@ -0,0 +1,7 @@ +import inherited from 'mastodon/locales/th.json'; + +const messages = { + // No translations available. +}; + +export default Object.assign({}, inherited, messages); diff --git a/app/javascript/flavours/glitch/locales/tr.js b/app/javascript/flavours/glitch/locales/tr.js new file mode 100644 index 000000000..c2b740617 --- /dev/null +++ b/app/javascript/flavours/glitch/locales/tr.js @@ -0,0 +1,7 @@ +import inherited from 'mastodon/locales/tr.json'; + +const messages = { + // No translations available. +}; + +export default Object.assign({}, inherited, messages); diff --git a/app/javascript/flavours/glitch/locales/uk.js b/app/javascript/flavours/glitch/locales/uk.js new file mode 100644 index 000000000..ab6d9a7dc --- /dev/null +++ b/app/javascript/flavours/glitch/locales/uk.js @@ -0,0 +1,7 @@ +import inherited from 'mastodon/locales/uk.json'; + +const messages = { + // No translations available. +}; + +export default Object.assign({}, inherited, messages); diff --git a/app/javascript/flavours/glitch/locales/zh-CN.js b/app/javascript/flavours/glitch/locales/zh-CN.js new file mode 100644 index 000000000..944588e02 --- /dev/null +++ b/app/javascript/flavours/glitch/locales/zh-CN.js @@ -0,0 +1,7 @@ +import inherited from 'mastodon/locales/zh-CN.json'; + +const messages = { + // No translations available. +}; + +export default Object.assign({}, inherited, messages); diff --git a/app/javascript/flavours/glitch/locales/zh-HK.js b/app/javascript/flavours/glitch/locales/zh-HK.js new file mode 100644 index 000000000..b71c81f2b --- /dev/null +++ b/app/javascript/flavours/glitch/locales/zh-HK.js @@ -0,0 +1,7 @@ +import inherited from 'mastodon/locales/zh-HK.json'; + +const messages = { + // No translations available. +}; + +export default Object.assign({}, inherited, messages); diff --git a/app/javascript/flavours/glitch/locales/zh-TW.js b/app/javascript/flavours/glitch/locales/zh-TW.js new file mode 100644 index 000000000..de2b7769c --- /dev/null +++ b/app/javascript/flavours/glitch/locales/zh-TW.js @@ -0,0 +1,7 @@ +import inherited from 'mastodon/locales/zh-TW.json'; + +const messages = { + // No translations available. +}; + +export default Object.assign({}, inherited, messages); diff --git a/app/javascript/flavours/glitch/theme.yml b/app/javascript/flavours/glitch/theme.yml index fe09fa105..9437e2c04 100644 --- a/app/javascript/flavours/glitch/theme.yml +++ b/app/javascript/flavours/glitch/theme.yml @@ -20,6 +20,12 @@ pack: settings: share: packs/share.js +# (OPTIONAL) The directory which contains localization files for +# the flavour, relative to this directory. The contents of this +# directory must be `.js` or `.json` files whose names correspond to +# language tags and whose default exports are a messages object. +locales: locales + # (OPTIONAL) The directory which contains the pack files. # Defaults to the theme directory (`app/javascript/themes/[theme]`), # which should be sufficient for like 99% of use-cases lol. diff --git a/app/javascript/flavours/vanilla/theme.yml b/app/javascript/flavours/vanilla/theme.yml index 67fd9723e..491ea173b 100644 --- a/app/javascript/flavours/vanilla/theme.yml +++ b/app/javascript/flavours/vanilla/theme.yml @@ -20,13 +20,17 @@ pack: settings: share: share.js +# (OPTIONAL) The directory which contains localization files for +# the flavour, relative to this directory. +locales: ../../mastodon/locales + # (OPTIONAL) The directory which contains the pack files. -# Defaults to the theme directory (`app/javascript/themes/[theme]`), -# but in the case of the vanilla Mastodon theme the pack files are +# Defaults to this directory (`app/javascript/flavour/[flavour]`), +# but in the case of the vanilla Mastodon flavour the pack files are # somewhere else. pack_directory: app/javascript/packs -# (OPTIONAL) By default the theme will fallback to the default theme +# (OPTIONAL) By default the theme will fallback to the default flavour # if a particular pack is not provided. You can specify different # fallbacks here, or disable fallback behaviours altogether by # specifying a `null` value. diff --git a/app/javascript/glitch/locales/en.json b/app/javascript/glitch/locales/en.json deleted file mode 100644 index 0276cb837..000000000 --- a/app/javascript/glitch/locales/en.json +++ /dev/null @@ -1,46 +0,0 @@ -{ - "getting_started.open_source_notice": "Glitchsoc is free open source software forked from {Mastodon}. You can contribute or report issues on GitHub at {github}.", - "layout.auto": "Auto", - "layout.current_is": "Your current layout is:", - "layout.desktop": "Desktop", - "layout.mobile": "Mobile", - "navigation_bar.app_settings": "App settings", - "getting_started.onboarding": "Show me around", - "onboarding.page_one.federation": "{domain} is an 'instance' of Mastodon. Mastodon is a network of independent servers joining up to make one larger social network. We call these servers instances.", - "onboarding.page_one.welcome": "Welcome to {domain}!", - "onboarding.page_six.github": "{domain} runs on Glitchsoc. Glitchsoc is a friendly {fork} of {Mastodon}, and is compatible with any Mastodon instance or app. Glitchsoc is entirely free and open-source. You can report bugs, request features, or contribute to the code on {github}.", - "settings.auto_collapse": "Automatic collapsing", - "settings.auto_collapse_all": "Everything", - "settings.auto_collapse_lengthy": "Lengthy toots", - "settings.auto_collapse_media": "Toots with media", - "settings.auto_collapse_notifications": "Notifications", - "settings.auto_collapse_reblogs": "Boosts", - "settings.auto_collapse_replies": "Replies", - "settings.close": "Close", - "settings.collapsed_statuses": "Collapsed toots", - "settings.enable_collapsed": "Enable collapsed toots", - "settings.general": "General", - "settings.image_backgrounds": "Image backgrounds", - "settings.image_backgrounds_media": "Preview collapsed toot media", - "settings.image_backgrounds_users": "Give collapsed toots an image background", - "settings.media": "Media", - "settings.media_letterbox": "Letterbox media", - "settings.media_fullwidth": "Full-width media previews", - "settings.preferences": "User preferences", - "settings.wide_view": "Wide view (Desktop mode only)", - "settings.navbar_under": "Navbar at the bottom (Mobile only)", - "status.collapse": "Collapse", - "status.uncollapse": "Uncollapse", - - "home.column_settings.show_direct": "Show DMs", - - "notification.markForDeletion": "Mark for deletion", - "notifications.clear": "Clear all my notifications", - "notifications.marked_clear_confirmation": "Are you sure you want to permanently clear all selected notifications?", - "notifications.marked_clear": "Clear selected notifications", - - "notification_purge.btn_all": "Select\nall", - "notification_purge.btn_none": "Select\nnone", - "notification_purge.btn_invert": "Invert\nselection", - "notification_purge.btn_apply": "Clear\nselected" -} diff --git a/app/javascript/glitch/locales/pl.json b/app/javascript/glitch/locales/pl.json deleted file mode 100644 index 1481b6a2a..000000000 --- a/app/javascript/glitch/locales/pl.json +++ /dev/null @@ -1,44 +0,0 @@ -{ - "getting_started.open_source_notice": "Glitchsoc jest wolnym i otwartoźródłowym forkiem oprogramowania {Mastodon}. Możesz współtworzyć projekt lub zgłaszać błędy na GitHubie pod adresem {github}.", - "layout.auto": "Automatyczny", - "layout.current_is": "Twój obecny układ to:", - "layout.desktop": "Desktopowy", - "layout.mobile": "Mobilny", - "navigation_bar.app_settings": "Ustawienia aplikacji", - "getting_started.onboarding": "Rozejrzyj się", - "onboarding.page_one.federation": "{domain} jest 'instancją' Mastodona. Mastodon to sieć działających niezależnie serwerów tworzących jedną sieć społecznościową. Te serwery nazywane są instancjami.", - "onboarding.page_one.welcome": "Witamy na {domain}!", - "onboarding.page_six.github": "{domain} jest oparty na Glitchsoc. Glitchsoc jest {forkiem} {Mastodon}a kompatybilnym z każdym klientem i aplikacją Mastodona. Glitchsoc jest całkowicie wolnym i otwartoźródłowym oprogramowaniem. Możesz zgłaszać błędy i sugestie funkcji oraz współtworzyć projekt na {github}.", - "settings.auto_collapse": "Automatyczne zwijanie", - "settings.auto_collapse_all": "Wszystko", - "settings.auto_collapse_lengthy": "Długie wpisy", - "settings.auto_collapse_media": "Wpisy z zawartością multimedialną", - "settings.auto_collapse_notifications": "Powiadomienia", - "settings.auto_collapse_reblogs": "Podbicia", - "settings.auto_collapse_replies": "Odpowiedzi", - "settings.close": "Zamknij", - "settings.collapsed_statuses": "Zwijanie wpisów", - "settings.enable_collapsed": "Włącz zwijanie wpisów", - "settings.general": "Ogólne", - "settings.image_backgrounds": "Obrazy w tle", - "settings.image_backgrounds_media": "Wyświetlaj zawartość multimedialną zwiniętych wpisów", - "settings.image_backgrounds_users": "Nadaj tło zwiniętym wpisom", - "settings.media": "Zawartość multimedialna", - "settings.media_letterbox": "Letterbox media", - "settings.media_fullwidth": "Podgląd zawartości multimedialnej o pełnej szerokości", - "settings.preferences": "Preferencje użyytkownika", - "settings.wide_view": "Szeroki widok (tylko w trybie desktopowym)", - "settings.navbar_under": "Pasek nawigacji na dole (tylko w trybie mobilnym)", - "status.collapse": "Zwiń", - "status.uncollapse": "Rozwiń", - - "notification.markForDeletion": "Oznacz do usunięcia", - "notifications.clear": "Wyczyść wszystkie powiadomienia", - "notifications.marked_clear_confirmation": "Czy na pewno chcesz bezpowrtonie usunąć wszystkie powiadomienia?", - "notifications.marked_clear": "Usuń zaznaczone powiadomienia", - - "notification_purge.btn_all": "Zaznacz\nwszystkie", - "notification_purge.btn_none": "Odznacz\nwszystkie", - "notification_purge.btn_invert": "Odwróć\nzaznaczenie", - "notification_purge.btn_apply": "Usuń\nzaznaczone" -} diff --git a/app/javascript/locales/locale-data/README.md b/app/javascript/locales/locale-data/README.md new file mode 100644 index 000000000..83368fae7 --- /dev/null +++ b/app/javascript/locales/locale-data/README.md @@ -0,0 +1,221 @@ +# Custom Locale Data + +This folder is used to store custom locale data. These custom locale data are +not yet provided by [Unicode Common Locale Data Repository](http://cldr.unicode.org/development/new-cldr-developers) +and hence not provided in [react-intl/locale-data/*](https://github.com/yahoo/react-intl). + +The locale data should support [Locale Data APIs](https://github.com/yahoo/react-intl/wiki/API#locale-data-apis) +of the react-intl library. + +It is recommended to start your custom locale data from this sample English +locale data ([*](#plural-rules)): + +```javascript +/*eslint eqeqeq: "off"*/ +/*eslint no-nested-ternary: "off"*/ + +export default [ + { + locale: "en", + pluralRuleFunction: function(e, a) { + var n = String(e).split("."), + l = !n[1], + o = Number(n[0]) == e, + t = o && n[0].slice(-1), + r = o && n[0].slice(-2); + return a ? 1 == t && 11 != r ? "one" : 2 == t && 12 != r ? "two" : 3 == t && 13 != r ? "few" : "other" : 1 == e && l ? "one" : "other" + }, + fields: { + year: { + displayName: "year", + relative: { + 0: "this year", + 1: "next year", + "-1": "last year" + }, + relativeTime: { + future: { + one: "in {0} year", + other: "in {0} years" + }, + past: { + one: "{0} year ago", + other: "{0} years ago" + } + } + }, + month: { + displayName: "month", + relative: { + 0: "this month", + 1: "next month", + "-1": "last month" + }, + relativeTime: { + future: { + one: "in {0} month", + other: "in {0} months" + }, + past: { + one: "{0} month ago", + other: "{0} months ago" + } + } + }, + day: { + displayName: "day", + relative: { + 0: "today", + 1: "tomorrow", + "-1": "yesterday" + }, + relativeTime: { + future: { + one: "in {0} day", + other: "in {0} days" + }, + past: { + one: "{0} day ago", + other: "{0} days ago" + } + } + }, + hour: { + displayName: "hour", + relativeTime: { + future: { + one: "in {0} hour", + other: "in {0} hours" + }, + past: { + one: "{0} hour ago", + other: "{0} hours ago" + } + } + }, + minute: { + displayName: "minute", + relativeTime: { + future: { + one: "in {0} minute", + other: "in {0} minutes" + }, + past: { + one: "{0} minute ago", + other: "{0} minutes ago" + } + } + }, + second: { + displayName: "second", + relative: { + 0: "now" + }, + relativeTime: { + future: { + one: "in {0} second", + other: "in {0} seconds" + }, + past: { + one: "{0} second ago", + other: "{0} seconds ago" + } + } + } + } + } +] + +``` + +## Notes + +### Plural Rules + +The function `pluralRuleFunction()` should return the key to proper string of +a plural form(s). The purpose of the function is to provide key of translate +strings of correct plural form according. The different forms are described in +[CLDR's Plural Rules][cldr-plural-rules], + +[cldr-plural-rules]: http://cldr.unicode.org/index/cldr-spec/plural-rules + +#### Quick Overview on CLDR Rules + +Let's take English as an example. + +When you describe a number, you can be either describe it as: +* Cardinals: 1st, 2nd, 3rd ... 11th, 12th ... 21st, 22nd, 23nd .... +* Ordinals: 1, 2, 3 ... + +In any of these cases, the nouns will reflect the number with singular or plural +form. For example: +* in 0 days +* in 1 day +* in 2 days + +The `pluralRuleFunction` receives 2 parameters: +* `e`: a string representation of the number. Such as, "`1`", "`2`", "`2.1`". +* `a`: `true` if this is "cardinal" type of description. `false` for ordinal and other case. + +#### How you should write `pluralRuleFunction` + +The first rule to write pluralRuleFunction is never translate the output string +into your language. [Plural Rules][cldr-plural-rules] specified you should use +these as the return values: + + * "`zero`" + * "`one`" (singular) + * "`two`" (dual) + * "`few`" (paucal) + * "`many`" (also used for fractions if they have a separate class) + * "`other`" (required—general plural form—also used if the language only has a single form) + +Again, we'll use English as the example here. + +Let's read the `return` statement in the pluralRuleFunction above: +```javascript + return a ? 1 == t && 11 != r ? "one" : 2 == t && 12 != r ? "two" : 3 == t && 13 != r ? "few" : "other" : 1 == e && l ? "one" : "other" +``` + +This nested ternary is hard to read. It basically means: +```javascript +// e: the number variable to examine +// a: "true" if cardinals +// l: "true" if the variable e has nothin after decimal mark (e.g. "1.0" would be false) +// o: "true" if the variable e is an integer +// t: the "ones" of the number. e.g. "3" for number "9123" +// r: the "ones" and "tens" of the number. e.g. "23" for number "9123" +if (a == true) { + if (t == 1 && r != 11) { + return "one"; // i.e. 1st, 21st, 101st, 121st ... + } else if (t == 2 && r != 12) { + return "two"; // i.e. 2nd, 22nd, 102nd, 122nd ... + } else if (t == 3 && r != 13) { + return "few"; // i.e. 3rd, 23rd, 103rd, 123rd ... + } else { + return "other"; // i.e. 4th, 11th, 12th, 24th ... + } +} else { + if (e == 1 && l) { + return "one"; // i.e. 1 day + } else { + return "other"; // i.e. 0 days, 2 days, 3 days + } +} +``` + +If your language, like French, do not have complicated cardinal rules, you may +use the French's version of it: +```javascript +function (e, a) { + return a ? 1 == e ? "one" : "other" : e >= 0 && e < 2 ? "one" : "other"; +} +``` + +If your language, like Chinese, do not have any pluralization rule at all you +may use the Chinese's version of it: +```javascript +function (e, a) { + return "other"; +} +``` diff --git a/app/javascript/locales/locale-data/oc.js b/app/javascript/locales/locale-data/oc.js new file mode 100644 index 000000000..c4b56350b --- /dev/null +++ b/app/javascript/locales/locale-data/oc.js @@ -0,0 +1,108 @@ +/*eslint eqeqeq: "off"*/ +/*eslint no-nested-ternary: "off"*/ +/*eslint quotes: "off"*/ + +export default [{ + locale: "oc", + pluralRuleFunction: function (e, a) { + return a ? 1 == e ? "one" : "other" : e >= 0 && e < 2 ? "one" : "other"; + }, + fields: { + year: { + displayName: "an", + relative: { + 0: "ongan", + 1: "l'an que ven", + "-1": "l'an passat", + }, + relativeTime: { + future: { + one: "dins {0} an", + other: "dins {0} ans", + }, + past: { + one: "fa {0} an", + other: "fa {0} ans", + }, + }, + }, + month: { + displayName: "mes", + relative: { + 0: "aqueste mes", + 1: "lo mes que ven", + "-1": "lo mes passat", + }, + relativeTime: { + future: { + one: "dins {0} mes", + other: "dins {0} meses", + }, + past: { + one: "fa {0} mes", + other: "fa {0} meses", + }, + }, + }, + day: { + displayName: "jorn", + relative: { + 0: "uèi", + 1: "deman", + "-1": "ièr", + }, + relativeTime: { + future: { + one: "dins {0} jorn", + other: "dins {0} jorns", + }, + past: { + one: "fa {0} jorn", + other: "fa {0} jorns", + }, + }, + }, + hour: { + displayName: "ora", + relativeTime: { + future: { + one: "dins {0} ora", + other: "dins {0} oras", + }, + past: { + one: "fa {0} ora", + other: "fa {0} oras", + }, + }, + }, + minute: { + displayName: "minuta", + relativeTime: { + future: { + one: "dins {0} minuta", + other: "dins {0} minutas", + }, + past: { + one: "fa {0} minuta", + other: "fa {0} minutas", + }, + }, + }, + second: { + displayName: "segonda", + relative: { + 0: "ara", + }, + relativeTime: { + future: { + one: "dins {0} segonda", + other: "dins {0} segondas", + }, + past: { + one: "fa {0} segonda", + other: "fa {0} segondas", + }, + }, + }, + }, +}]; diff --git a/app/javascript/mastodon/locales/locale-data/README.md b/app/javascript/mastodon/locales/locale-data/README.md deleted file mode 100644 index 83368fae7..000000000 --- a/app/javascript/mastodon/locales/locale-data/README.md +++ /dev/null @@ -1,221 +0,0 @@ -# Custom Locale Data - -This folder is used to store custom locale data. These custom locale data are -not yet provided by [Unicode Common Locale Data Repository](http://cldr.unicode.org/development/new-cldr-developers) -and hence not provided in [react-intl/locale-data/*](https://github.com/yahoo/react-intl). - -The locale data should support [Locale Data APIs](https://github.com/yahoo/react-intl/wiki/API#locale-data-apis) -of the react-intl library. - -It is recommended to start your custom locale data from this sample English -locale data ([*](#plural-rules)): - -```javascript -/*eslint eqeqeq: "off"*/ -/*eslint no-nested-ternary: "off"*/ - -export default [ - { - locale: "en", - pluralRuleFunction: function(e, a) { - var n = String(e).split("."), - l = !n[1], - o = Number(n[0]) == e, - t = o && n[0].slice(-1), - r = o && n[0].slice(-2); - return a ? 1 == t && 11 != r ? "one" : 2 == t && 12 != r ? "two" : 3 == t && 13 != r ? "few" : "other" : 1 == e && l ? "one" : "other" - }, - fields: { - year: { - displayName: "year", - relative: { - 0: "this year", - 1: "next year", - "-1": "last year" - }, - relativeTime: { - future: { - one: "in {0} year", - other: "in {0} years" - }, - past: { - one: "{0} year ago", - other: "{0} years ago" - } - } - }, - month: { - displayName: "month", - relative: { - 0: "this month", - 1: "next month", - "-1": "last month" - }, - relativeTime: { - future: { - one: "in {0} month", - other: "in {0} months" - }, - past: { - one: "{0} month ago", - other: "{0} months ago" - } - } - }, - day: { - displayName: "day", - relative: { - 0: "today", - 1: "tomorrow", - "-1": "yesterday" - }, - relativeTime: { - future: { - one: "in {0} day", - other: "in {0} days" - }, - past: { - one: "{0} day ago", - other: "{0} days ago" - } - } - }, - hour: { - displayName: "hour", - relativeTime: { - future: { - one: "in {0} hour", - other: "in {0} hours" - }, - past: { - one: "{0} hour ago", - other: "{0} hours ago" - } - } - }, - minute: { - displayName: "minute", - relativeTime: { - future: { - one: "in {0} minute", - other: "in {0} minutes" - }, - past: { - one: "{0} minute ago", - other: "{0} minutes ago" - } - } - }, - second: { - displayName: "second", - relative: { - 0: "now" - }, - relativeTime: { - future: { - one: "in {0} second", - other: "in {0} seconds" - }, - past: { - one: "{0} second ago", - other: "{0} seconds ago" - } - } - } - } - } -] - -``` - -## Notes - -### Plural Rules - -The function `pluralRuleFunction()` should return the key to proper string of -a plural form(s). The purpose of the function is to provide key of translate -strings of correct plural form according. The different forms are described in -[CLDR's Plural Rules][cldr-plural-rules], - -[cldr-plural-rules]: http://cldr.unicode.org/index/cldr-spec/plural-rules - -#### Quick Overview on CLDR Rules - -Let's take English as an example. - -When you describe a number, you can be either describe it as: -* Cardinals: 1st, 2nd, 3rd ... 11th, 12th ... 21st, 22nd, 23nd .... -* Ordinals: 1, 2, 3 ... - -In any of these cases, the nouns will reflect the number with singular or plural -form. For example: -* in 0 days -* in 1 day -* in 2 days - -The `pluralRuleFunction` receives 2 parameters: -* `e`: a string representation of the number. Such as, "`1`", "`2`", "`2.1`". -* `a`: `true` if this is "cardinal" type of description. `false` for ordinal and other case. - -#### How you should write `pluralRuleFunction` - -The first rule to write pluralRuleFunction is never translate the output string -into your language. [Plural Rules][cldr-plural-rules] specified you should use -these as the return values: - - * "`zero`" - * "`one`" (singular) - * "`two`" (dual) - * "`few`" (paucal) - * "`many`" (also used for fractions if they have a separate class) - * "`other`" (required—general plural form—also used if the language only has a single form) - -Again, we'll use English as the example here. - -Let's read the `return` statement in the pluralRuleFunction above: -```javascript - return a ? 1 == t && 11 != r ? "one" : 2 == t && 12 != r ? "two" : 3 == t && 13 != r ? "few" : "other" : 1 == e && l ? "one" : "other" -``` - -This nested ternary is hard to read. It basically means: -```javascript -// e: the number variable to examine -// a: "true" if cardinals -// l: "true" if the variable e has nothin after decimal mark (e.g. "1.0" would be false) -// o: "true" if the variable e is an integer -// t: the "ones" of the number. e.g. "3" for number "9123" -// r: the "ones" and "tens" of the number. e.g. "23" for number "9123" -if (a == true) { - if (t == 1 && r != 11) { - return "one"; // i.e. 1st, 21st, 101st, 121st ... - } else if (t == 2 && r != 12) { - return "two"; // i.e. 2nd, 22nd, 102nd, 122nd ... - } else if (t == 3 && r != 13) { - return "few"; // i.e. 3rd, 23rd, 103rd, 123rd ... - } else { - return "other"; // i.e. 4th, 11th, 12th, 24th ... - } -} else { - if (e == 1 && l) { - return "one"; // i.e. 1 day - } else { - return "other"; // i.e. 0 days, 2 days, 3 days - } -} -``` - -If your language, like French, do not have complicated cardinal rules, you may -use the French's version of it: -```javascript -function (e, a) { - return a ? 1 == e ? "one" : "other" : e >= 0 && e < 2 ? "one" : "other"; -} -``` - -If your language, like Chinese, do not have any pluralization rule at all you -may use the Chinese's version of it: -```javascript -function (e, a) { - return "other"; -} -``` diff --git a/app/javascript/mastodon/locales/locale-data/oc.js b/app/javascript/mastodon/locales/locale-data/oc.js deleted file mode 100644 index c4b56350b..000000000 --- a/app/javascript/mastodon/locales/locale-data/oc.js +++ /dev/null @@ -1,108 +0,0 @@ -/*eslint eqeqeq: "off"*/ -/*eslint no-nested-ternary: "off"*/ -/*eslint quotes: "off"*/ - -export default [{ - locale: "oc", - pluralRuleFunction: function (e, a) { - return a ? 1 == e ? "one" : "other" : e >= 0 && e < 2 ? "one" : "other"; - }, - fields: { - year: { - displayName: "an", - relative: { - 0: "ongan", - 1: "l'an que ven", - "-1": "l'an passat", - }, - relativeTime: { - future: { - one: "dins {0} an", - other: "dins {0} ans", - }, - past: { - one: "fa {0} an", - other: "fa {0} ans", - }, - }, - }, - month: { - displayName: "mes", - relative: { - 0: "aqueste mes", - 1: "lo mes que ven", - "-1": "lo mes passat", - }, - relativeTime: { - future: { - one: "dins {0} mes", - other: "dins {0} meses", - }, - past: { - one: "fa {0} mes", - other: "fa {0} meses", - }, - }, - }, - day: { - displayName: "jorn", - relative: { - 0: "uèi", - 1: "deman", - "-1": "ièr", - }, - relativeTime: { - future: { - one: "dins {0} jorn", - other: "dins {0} jorns", - }, - past: { - one: "fa {0} jorn", - other: "fa {0} jorns", - }, - }, - }, - hour: { - displayName: "ora", - relativeTime: { - future: { - one: "dins {0} ora", - other: "dins {0} oras", - }, - past: { - one: "fa {0} ora", - other: "fa {0} oras", - }, - }, - }, - minute: { - displayName: "minuta", - relativeTime: { - future: { - one: "dins {0} minuta", - other: "dins {0} minutas", - }, - past: { - one: "fa {0} minuta", - other: "fa {0} minutas", - }, - }, - }, - second: { - displayName: "segonda", - relative: { - 0: "ara", - }, - relativeTime: { - future: { - one: "dins {0} segonda", - other: "dins {0} segondas", - }, - past: { - one: "fa {0} segonda", - other: "fa {0} segondas", - }, - }, - }, - }, -}]; diff --git a/app/lib/themes.rb b/app/lib/themes.rb index 863326e2d..49e9ebbc3 100644 --- a/app/lib/themes.rb +++ b/app/lib/themes.rb @@ -15,6 +15,14 @@ class Themes Dir.glob(Rails.root.join('app', 'javascript', 'flavours', '*', 'theme.yml')) do |path| data = YAML.load_file(path) name = File.basename(File.dirname(path)) + if data['locales'] + locales = [] + Dir.glob(File.join(File.dirname(path), data['locales'], '*.{js,json}')) do |locale| + localeName = File.basename(locale, File.extname(locale)) + locales.push(localeName) unless localeName.match(/defaultMessages|whitelist|index/) + end + data['locales'] = locales + end if data['pack'] data['name'] = name data['skin'] = { 'default' => [] } diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml index 99ae7d90d..4d32c5035 100755 --- a/app/views/layouts/application.html.haml +++ b/app/views/layouts/application.html.haml @@ -19,7 +19,10 @@ = title = javascript_pack_tag "locales", integrity: true, crossorigin: 'anonymous' - = javascript_pack_tag "locale_#{I18n.locale}", integrity: true, crossorigin: 'anonymous' + - if @theme[:supported_locales].include? I18n.locale.to_s + = javascript_pack_tag "locales/#{@theme[:flavour]}/#{I18n.locale}", integrity: true, crossorigin: 'anonymous' + - elsif @theme[:supported_locales].include? 'en' + = javascript_pack_tag "locales/#{@theme[:flavour]}/en", integrity: true, crossorigin: 'anonymous' = csrf_meta_tags = yield :header_tags diff --git a/config/webpack/configuration.js b/config/webpack/configuration.js index 9cdd6f934..852185eb9 100644 --- a/config/webpack/configuration.js +++ b/config/webpack/configuration.js @@ -30,6 +30,9 @@ for (let i = 0; i < flavourFiles.length; i++) { if (!data.pack_directory) { data.pack_directory = dirname(flavourFile); } + if (data.locales) { + data.locales = join(dirname(flavourFile), data.locales); + } if (data.pack && typeof data.pack === 'object') { flavours[data.name] = data; } @@ -45,7 +48,7 @@ for (let i = 0; i < skinFiles.length; i++) { const data = flavours[name].skin; if (lstatSync(skinFile).isDirectory()) { data[skin] = {}; - const skinPacks = glob.sync(resolve(skinFile, '*.{css,scss}')); + const skinPacks = glob.sync(join(skinFile, '*.{css,scss}')); for (let j = 0; j < skinPacks.length; j++) { const pack = skinPacks[i]; data[skin][basename(pack, extname(pack))] = pack; diff --git a/config/webpack/generateLocalePacks.js b/config/webpack/generateLocalePacks.js index a943589f7..09fba4a18 100644 --- a/config/webpack/generateLocalePacks.js +++ b/config/webpack/generateLocalePacks.js @@ -1,70 +1,66 @@ +// A message from upstream: +// ======================== // To avoid adding a lot of boilerplate, locale packs are // automatically generated here. These are written into the tmp/ // directory and then used to generate locale_en.js, locale_fr.js, etc. -const fs = require('fs'); -const path = require('path'); +// Glitch note: +// ============ +// This code has been entirely rewritten to support glitch flavours. +// However, the underlying process is exactly the same. + +const { existsSync, readdirSync, writeFileSync } = require('fs'); +const { join, resolve } = require('path'); const rimraf = require('rimraf'); const mkdirp = require('mkdirp'); +const { flavours } = require('./configuration.js'); -const localesJsonPath = path.join(__dirname, '../../app/javascript/mastodon/locales'); -const locales = fs.readdirSync(localesJsonPath).filter(filename => { - return /\.json$/.test(filename) && - !/defaultMessages/.test(filename) && - !/whitelist/.test(filename); -}).map(filename => filename.replace(/\.json$/, '')); - -const outPath = path.join(__dirname, '../../tmp/packs'); - -rimraf.sync(outPath); -mkdirp.sync(outPath); - -const outPaths = []; - -locales.forEach(locale => { - const localePath = path.join(outPath, `locale_${locale}.js`); - const baseLocale = locale.split('-')[0]; // e.g. 'zh-TW' -> 'zh' - const localeDataPath = [ - // first try react-intl - `../../node_modules/react-intl/locale-data/${baseLocale}.js`, - // then check locales/locale-data - `../../app/javascript/mastodon/locales/locale-data/${baseLocale}.js`, - // fall back to English (this is what react-intl does anyway) - '../../node_modules/react-intl/locale-data/en.js', - ].filter(filename => fs.existsSync(path.join(outPath, filename))) - .map(filename => filename.replace(/..\/..\/node_modules\//, ''))[0]; - - let glitchInject = ` -const mergedMessages = messages; -`; - - const glitchPath = `../../app/javascript/glitch/locales/${locale}.json`; - if (fs.existsSync(path.join(outPath, glitchPath))) { - glitchInject = ` -import glitchMessages from ${JSON.stringify(glitchPath)}; - -let mergedMessages = messages; -Object.keys(glitchMessages).forEach(function (key) { - mergedMessages[key] = glitchMessages[key]; -}); - -`; +module.exports = Object.keys(flavours).reduce(function (map, entry) { + const flavour = flavours[entry]; + if (!flavour.locales) { + return map; } + const locales = readdirSync(flavour.locales).filter( + filename => /\.js(?:on)?$/.test(filename) && !/defaultMessages|whitelist|index/.test(filename) + ); + const outPath = resolve('tmp', 'locales', entry); + + rimraf.sync(outPath); + mkdirp.sync(outPath); - const localeContent = `// -// locale_${locale}.js + locales.forEach(function (locale) { + const localeName = locale.replace(/\.js(?:on)?$/, ''); + const localePath = join(outPath, `${localeName}.js`); + const baseLocale = localeName.split('-')[0]; // e.g. 'zh-TW' -> 'zh' + const localeDataPath = [ + // first try react-intl + `node_modules/react-intl/locale-data/${baseLocale}.js`, + // then check locales/locale-data + `app/javascript/locales/locale-data/${baseLocale}.js`, + // fall back to English (this is what react-intl does anyway) + 'node_modules/react-intl/locale-data/en.js', + ].filter( + filename => existsSync(filename) + ).map( + filename => filename.replace(/(?:node_modules|app\/javascript)\//, '') + )[0]; + const localeContent = `// +// locales/${entry}/${localeName}.js // automatically generated by generateLocalePacks.js // -import messages from '../../app/javascript/mastodon/locales/${locale}.json'; -import localeData from ${JSON.stringify(localeDataPath)}; -import { setLocale } from 'locales'; -${glitchInject} -setLocale({messages: mergedMessages, localeData: localeData}); -`; - fs.writeFileSync(localePath, localeContent, 'utf8'); - outPaths.push(localePath); -}); -module.exports = outPaths; +import messages from '../../../${flavour.locales}/${locale.replace(/\.js$/, '')}'; +import localeData from '${localeDataPath}'; +import { setLocale } from 'locales'; +setLocale({ + localeData, + messages, +}); +`; + writeFileSync(localePath, localeContent, 'utf8'); + map[`locales/${entry}/${localeName}`] = localePath; + }); + return map; +}, {}); diff --git a/config/webpack/shared.js b/config/webpack/shared.js index e4b057ffb..62d96c3a2 100644 --- a/config/webpack/shared.js +++ b/config/webpack/shared.js @@ -7,7 +7,7 @@ const ExtractTextPlugin = require('extract-text-webpack-plugin'); const ManifestPlugin = require('webpack-manifest-plugin'); const extname = require('path-complete-extname'); const { env, settings, core, flavours, output, loadersDir } = require('./configuration.js'); -const localePackPaths = require('./generateLocalePacks'); +const localePacks = require('./generateLocalePacks'); function reducePacks (data, into = {}) { if (!data.pack) { @@ -48,11 +48,7 @@ function reducePacks (data, into = {}) { module.exports = { entry: Object.assign( { locales: resolve('app', 'javascript', 'locales') }, - localePackPaths.reduce((map, entry) => { - const localMap = map; - localMap[basename(entry, extname(entry, extname(entry)))] = resolve(entry); - return localMap; - }, {}), + localePacks, reducePacks(core), Object.keys(flavours).reduce((map, entry) => reducePacks(flavours[entry], map), {}) ), -- cgit From 1c728df92e46bda2d6823052d2cd7a019246b329 Mon Sep 17 00:00:00 2001 From: kibigo! Date: Thu, 7 Dec 2017 19:41:57 -0800 Subject: Only localize js when there's a theme --- app/views/layouts/application.html.haml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml index 4d32c5035..20603678b 100755 --- a/app/views/layouts/application.html.haml +++ b/app/views/layouts/application.html.haml @@ -19,10 +19,11 @@ = title = javascript_pack_tag "locales", integrity: true, crossorigin: 'anonymous' - - if @theme[:supported_locales].include? I18n.locale.to_s - = javascript_pack_tag "locales/#{@theme[:flavour]}/#{I18n.locale}", integrity: true, crossorigin: 'anonymous' - - elsif @theme[:supported_locales].include? 'en' - = javascript_pack_tag "locales/#{@theme[:flavour]}/en", integrity: true, crossorigin: 'anonymous' + - if @theme + - if @theme[:supported_locales].include? I18n.locale.to_s + = javascript_pack_tag "locales/#{@theme[:flavour]}/#{I18n.locale}", integrity: true, crossorigin: 'anonymous' + - elsif @theme[:supported_locales].include? 'en' + = javascript_pack_tag "locales/#{@theme[:flavour]}/en", integrity: true, crossorigin: 'anonymous' = csrf_meta_tags = yield :header_tags -- cgit From 6b7085a33e509e0619a67fa8b6721eb89b785773 Mon Sep 17 00:00:00 2001 From: kibigo! Date: Thu, 7 Dec 2017 19:59:31 -0800 Subject: Linting fixes --- app/javascript/flavours/glitch/locales/en.js | 82 ++++++++++++++-------------- app/javascript/flavours/glitch/locales/pl.js | 80 +++++++++++++-------------- config/webpack/shared.js | 3 +- 3 files changed, 82 insertions(+), 83 deletions(-) diff --git a/app/javascript/flavours/glitch/locales/en.js b/app/javascript/flavours/glitch/locales/en.js index 96182196e..1d2e0ecf4 100644 --- a/app/javascript/flavours/glitch/locales/en.js +++ b/app/javascript/flavours/glitch/locales/en.js @@ -1,50 +1,50 @@ import inherited from 'mastodon/locales/en.json'; const messages = { - "getting_started.open_source_notice": "Glitchsoc is free open source software forked from {Mastodon}. You can contribute or report issues on GitHub at {github}.", - "layout.auto": "Auto", - "layout.current_is": "Your current layout is:", - "layout.desktop": "Desktop", - "layout.mobile": "Mobile", - "navigation_bar.app_settings": "App settings", - "getting_started.onboarding": "Show me around", - "onboarding.page_one.federation": "{domain} is an 'instance' of Mastodon. Mastodon is a network of independent servers joining up to make one larger social network. We call these servers instances.", - "onboarding.page_one.welcome": "Welcome to {domain}!", - "onboarding.page_six.github": "{domain} runs on Glitchsoc. Glitchsoc is a friendly {fork} of {Mastodon}, and is compatible with any Mastodon instance or app. Glitchsoc is entirely free and open-source. You can report bugs, request features, or contribute to the code on {github}.", - "settings.auto_collapse": "Automatic collapsing", - "settings.auto_collapse_all": "Everything", - "settings.auto_collapse_lengthy": "Lengthy toots", - "settings.auto_collapse_media": "Toots with media", - "settings.auto_collapse_notifications": "Notifications", - "settings.auto_collapse_reblogs": "Boosts", - "settings.auto_collapse_replies": "Replies", - "settings.close": "Close", - "settings.collapsed_statuses": "Collapsed toots", - "settings.enable_collapsed": "Enable collapsed toots", - "settings.general": "General", - "settings.image_backgrounds": "Image backgrounds", - "settings.image_backgrounds_media": "Preview collapsed toot media", - "settings.image_backgrounds_users": "Give collapsed toots an image background", - "settings.media": "Media", - "settings.media_letterbox": "Letterbox media", - "settings.media_fullwidth": "Full-width media previews", - "settings.preferences": "User preferences", - "settings.wide_view": "Wide view (Desktop mode only)", - "settings.navbar_under": "Navbar at the bottom (Mobile only)", - "status.collapse": "Collapse", - "status.uncollapse": "Uncollapse", + 'getting_started.open_source_notice': 'Glitchsoc is free open source software forked from {Mastodon}. You can contribute or report issues on GitHub at {github}.', + 'layout.auto': 'Auto', + 'layout.current_is': 'Your current layout is:', + 'layout.desktop': 'Desktop', + 'layout.mobile': 'Mobile', + 'navigation_bar.app_settings': 'App settings', + 'getting_started.onboarding': 'Show me around', + 'onboarding.page_one.federation': '{domain} is an \'instance\' of Mastodon. Mastodon is a network of independent servers joining up to make one larger social network. We call these servers instances.', + 'onboarding.page_one.welcome': 'Welcome to {domain}!', + 'onboarding.page_six.github': '{domain} runs on Glitchsoc. Glitchsoc is a friendly {fork} of {Mastodon}, and is compatible with any Mastodon instance or app. Glitchsoc is entirely free and open-source. You can report bugs, request features, or contribute to the code on {github}.', + 'settings.auto_collapse': 'Automatic collapsing', + 'settings.auto_collapse_all': 'Everything', + 'settings.auto_collapse_lengthy': 'Lengthy toots', + 'settings.auto_collapse_media': 'Toots with media', + 'settings.auto_collapse_notifications': 'Notifications', + 'settings.auto_collapse_reblogs': 'Boosts', + 'settings.auto_collapse_replies': 'Replies', + 'settings.close': 'Close', + 'settings.collapsed_statuses': 'Collapsed toots', + 'settings.enable_collapsed': 'Enable collapsed toots', + 'settings.general': 'General', + 'settings.image_backgrounds': 'Image backgrounds', + 'settings.image_backgrounds_media': 'Preview collapsed toot media', + 'settings.image_backgrounds_users': 'Give collapsed toots an image background', + 'settings.media': 'Media', + 'settings.media_letterbox': 'Letterbox media', + 'settings.media_fullwidth': 'Full-width media previews', + 'settings.preferences': 'User preferences', + 'settings.wide_view': 'Wide view (Desktop mode only)', + 'settings.navbar_under': 'Navbar at the bottom (Mobile only)', + 'status.collapse': 'Collapse', + 'status.uncollapse': 'Uncollapse', - "home.column_settings.show_direct": "Show DMs", + 'home.column_settings.show_direct': 'Show DMs', - "notification.markForDeletion": "Mark for deletion", - "notifications.clear": "Clear all my notifications", - "notifications.marked_clear_confirmation": "Are you sure you want to permanently clear all selected notifications?", - "notifications.marked_clear": "Clear selected notifications", + 'notification.markForDeletion': 'Mark for deletion', + 'notifications.clear': 'Clear all my notifications', + 'notifications.marked_clear_confirmation': 'Are you sure you want to permanently clear all selected notifications?', + 'notifications.marked_clear': 'Clear selected notifications', - "notification_purge.btn_all": "Select\nall", - "notification_purge.btn_none": "Select\nnone", - "notification_purge.btn_invert": "Invert\nselection", - "notification_purge.btn_apply": "Clear\nselected", + 'notification_purge.btn_all': 'Select\nall', + 'notification_purge.btn_none': 'Select\nnone', + 'notification_purge.btn_invert': 'Invert\nselection', + 'notification_purge.btn_apply': 'Clear\nselected', }; export default Object.assign({}, inherited, messages); diff --git a/app/javascript/flavours/glitch/locales/pl.js b/app/javascript/flavours/glitch/locales/pl.js index ab96dec60..818436710 100644 --- a/app/javascript/flavours/glitch/locales/pl.js +++ b/app/javascript/flavours/glitch/locales/pl.js @@ -1,48 +1,48 @@ import inherited from 'mastodon/locales/pl.json'; const messages = { - "getting_started.open_source_notice": "Glitchsoc jest wolnym i otwartoźródłowym forkiem oprogramowania {Mastodon}. Możesz współtworzyć projekt lub zgłaszać błędy na GitHubie pod adresem {github}.", - "layout.auto": "Automatyczny", - "layout.current_is": "Twój obecny układ to:", - "layout.desktop": "Desktopowy", - "layout.mobile": "Mobilny", - "navigation_bar.app_settings": "Ustawienia aplikacji", - "getting_started.onboarding": "Rozejrzyj się", - "onboarding.page_one.federation": "{domain} jest 'instancją' Mastodona. Mastodon to sieć działających niezależnie serwerów tworzących jedną sieć społecznościową. Te serwery nazywane są instancjami.", - "onboarding.page_one.welcome": "Witamy na {domain}!", - "onboarding.page_six.github": "{domain} jest oparty na Glitchsoc. Glitchsoc jest {forkiem} {Mastodon}a kompatybilnym z każdym klientem i aplikacją Mastodona. Glitchsoc jest całkowicie wolnym i otwartoźródłowym oprogramowaniem. Możesz zgłaszać błędy i sugestie funkcji oraz współtworzyć projekt na {github}.", - "settings.auto_collapse": "Automatyczne zwijanie", - "settings.auto_collapse_all": "Wszystko", - "settings.auto_collapse_lengthy": "Długie wpisy", - "settings.auto_collapse_media": "Wpisy z zawartością multimedialną", - "settings.auto_collapse_notifications": "Powiadomienia", - "settings.auto_collapse_reblogs": "Podbicia", - "settings.auto_collapse_replies": "Odpowiedzi", - "settings.close": "Zamknij", - "settings.collapsed_statuses": "Zwijanie wpisów", - "settings.enable_collapsed": "Włącz zwijanie wpisów", - "settings.general": "Ogólne", - "settings.image_backgrounds": "Obrazy w tle", - "settings.image_backgrounds_media": "Wyświetlaj zawartość multimedialną zwiniętych wpisów", - "settings.image_backgrounds_users": "Nadaj tło zwiniętym wpisom", - "settings.media": "Zawartość multimedialna", - "settings.media_letterbox": "Letterbox media", - "settings.media_fullwidth": "Podgląd zawartości multimedialnej o pełnej szerokości", - "settings.preferences": "Preferencje użyytkownika", - "settings.wide_view": "Szeroki widok (tylko w trybie desktopowym)", - "settings.navbar_under": "Pasek nawigacji na dole (tylko w trybie mobilnym)", - "status.collapse": "Zwiń", - "status.uncollapse": "Rozwiń", + 'getting_started.open_source_notice': 'Glitchsoc jest wolnym i otwartoźródłowym forkiem oprogramowania {Mastodon}. Możesz współtworzyć projekt lub zgłaszać błędy na GitHubie pod adresem {github}.', + 'layout.auto': 'Automatyczny', + 'layout.current_is': 'Twój obecny układ to:', + 'layout.desktop': 'Desktopowy', + 'layout.mobile': 'Mobilny', + 'navigation_bar.app_settings': 'Ustawienia aplikacji', + 'getting_started.onboarding': 'Rozejrzyj się', + 'onboarding.page_one.federation': '{domain} jest \'instancją\' Mastodona. Mastodon to sieć działających niezależnie serwerów tworzących jedną sieć społecznościową. Te serwery nazywane są instancjami.', + 'onboarding.page_one.welcome': 'Witamy na {domain}!', + 'onboarding.page_six.github': '{domain} jest oparty na Glitchsoc. Glitchsoc jest {forkiem} {Mastodon}a kompatybilnym z każdym klientem i aplikacją Mastodona. Glitchsoc jest całkowicie wolnym i otwartoźródłowym oprogramowaniem. Możesz zgłaszać błędy i sugestie funkcji oraz współtworzyć projekt na {github}.', + 'settings.auto_collapse': 'Automatyczne zwijanie', + 'settings.auto_collapse_all': 'Wszystko', + 'settings.auto_collapse_lengthy': 'Długie wpisy', + 'settings.auto_collapse_media': 'Wpisy z zawartością multimedialną', + 'settings.auto_collapse_notifications': 'Powiadomienia', + 'settings.auto_collapse_reblogs': 'Podbicia', + 'settings.auto_collapse_replies': 'Odpowiedzi', + 'settings.close': 'Zamknij', + 'settings.collapsed_statuses': 'Zwijanie wpisów', + 'settings.enable_collapsed': 'Włącz zwijanie wpisów', + 'settings.general': 'Ogólne', + 'settings.image_backgrounds': 'Obrazy w tle', + 'settings.image_backgrounds_media': 'Wyświetlaj zawartość multimedialną zwiniętych wpisów', + 'settings.image_backgrounds_users': 'Nadaj tło zwiniętym wpisom', + 'settings.media': 'Zawartość multimedialna', + 'settings.media_letterbox': 'Letterbox media', + 'settings.media_fullwidth': 'Podgląd zawartości multimedialnej o pełnej szerokości', + 'settings.preferences': 'Preferencje użyytkownika', + 'settings.wide_view': 'Szeroki widok (tylko w trybie desktopowym)', + 'settings.navbar_under': 'Pasek nawigacji na dole (tylko w trybie mobilnym)', + 'status.collapse': 'Zwiń', + 'status.uncollapse': 'Rozwiń', - "notification.markForDeletion": "Oznacz do usunięcia", - "notifications.clear": "Wyczyść wszystkie powiadomienia", - "notifications.marked_clear_confirmation": "Czy na pewno chcesz bezpowrtonie usunąć wszystkie powiadomienia?", - "notifications.marked_clear": "Usuń zaznaczone powiadomienia", + 'notification.markForDeletion': 'Oznacz do usunięcia', + 'notifications.clear': 'Wyczyść wszystkie powiadomienia', + 'notifications.marked_clear_confirmation': 'Czy na pewno chcesz bezpowrtonie usunąć wszystkie powiadomienia?', + 'notifications.marked_clear': 'Usuń zaznaczone powiadomienia', - "notification_purge.btn_all": "Zaznacz\nwszystkie", - "notification_purge.btn_none": "Odznacz\nwszystkie", - "notification_purge.btn_invert": "Odwróć\nzaznaczenie", - "notification_purge.btn_apply": "Usuń\nzaznaczone" + 'notification_purge.btn_all': 'Zaznacz\nwszystkie', + 'notification_purge.btn_none': 'Odznacz\nwszystkie', + 'notification_purge.btn_invert': 'Odwróć\nzaznaczenie', + 'notification_purge.btn_apply': 'Usuń\nzaznaczone', }; export default Object.assign({}, inherited, messages); diff --git a/config/webpack/shared.js b/config/webpack/shared.js index 62d96c3a2..35b9bbd1c 100644 --- a/config/webpack/shared.js +++ b/config/webpack/shared.js @@ -1,11 +1,10 @@ // Note: You must restart bin/webpack-dev-server for changes to take effect const webpack = require('webpack'); -const { basename, join, resolve } = require('path'); +const { join, resolve } = require('path'); const { sync } = require('glob'); const ExtractTextPlugin = require('extract-text-webpack-plugin'); const ManifestPlugin = require('webpack-manifest-plugin'); -const extname = require('path-complete-extname'); const { env, settings, core, flavours, output, loadersDir } = require('./configuration.js'); const localePacks = require('./generateLocalePacks'); -- cgit From cd107e92cb179b875b119ab869e106e22afb2e77 Mon Sep 17 00:00:00 2001 From: kibigo! Date: Sun, 10 Dec 2017 11:09:59 -0800 Subject: Move ja localization to new locaiton --- app/javascript/flavours/glitch/locales/ja.js | 43 ++++++++++++++++++++++++++- app/javascript/glitch/locales/ja.json | 44 ---------------------------- 2 files changed, 42 insertions(+), 45 deletions(-) delete mode 100644 app/javascript/glitch/locales/ja.json diff --git a/app/javascript/flavours/glitch/locales/ja.js b/app/javascript/flavours/glitch/locales/ja.js index cc7143443..2b55da1da 100644 --- a/app/javascript/flavours/glitch/locales/ja.js +++ b/app/javascript/flavours/glitch/locales/ja.js @@ -1,7 +1,48 @@ import inherited from 'mastodon/locales/ja.json'; const messages = { - // No translations available. + 'getting_started.open_source_notice': 'Glitchsocは{Mastodon}によるフリーなオープンソースソフトウェアです。誰でもGitHub({github})から開発に參加したり、問題を報告したりできます。', + 'layout.auto': '自動', + 'layout.current_is': 'あなたの現在のレイアウト:', + 'layout.desktop': 'デスクトップ', + 'layout.mobile': 'モバイル', + 'navigation_bar.app_settings': 'アプリ設定', + 'getting_started.onboarding': '解説', + 'onboarding.page_one.federation': '{domain}はMastodonのインスタンスです。Mastodonとは、独立したサーバが連携して作るソーシャルネットワークです。これらのサーバーをインスタンスと呼びます。', + 'onboarding.page_one.welcome': '{domain}へようこそ!', + 'onboarding.page_six.github': '{domain}はGlitchsocを使用しています。Glitchsocは{Mastodon}のフレンドリーな{fork}で、どんなMastodonアプリやインスタンスとも互換性があります。Glitchsocは完全に無料で、オープンソースです。{github}でバグ報告や機能要望あるいは貢獻をすることが可能です。', + 'settings.auto_collapse': '自動折りたたみ', + 'settings.auto_collapse_all': 'すべて', + 'settings.auto_collapse_lengthy': '長いトゥート', + 'settings.auto_collapse_media': 'メディア付きトゥート', + 'settings.auto_collapse_notifications': '通知', + 'settings.auto_collapse_reblogs': 'ブースト', + 'settings.auto_collapse_replies': '返信', + 'settings.close': '閉じる', + 'settings.collapsed_statuses': 'トゥート', + 'settings.enable_collapsed': 'トゥート折りたたみを有効にする', + 'settings.general': '一般', + 'settings.image_backgrounds': '画像背景', + 'settings.image_backgrounds_media': '折りたまれたメディア付きテゥートをプレビュー', + 'settings.image_backgrounds_users': '折りたまれたトゥートの背景を変更する', + 'settings.media': 'メディア', + 'settings.media_letterbox': 'メディアをレターボックス式で表示', + 'settings.media_fullwidth': '全幅メディアプリビュー', + 'settings.preferences': 'ユーザー設定', + 'settings.wide_view': 'ワイドビュー(デスクトップレイアウトのみ)', + 'settings.navbar_under': 'ナビを画面下部に移動させる(モバイルレイアウトのみ)', + 'status.collapse': '折りたたむ', + 'status.uncollapse': '折りたたみを解除', + + 'notification.markForDeletion': '選択', + 'notifications.clear': '通知を全てクリアする', + 'notifications.marked_clear_confirmation': '削除した全ての通知を完全に削除してもよろしいですか?', + 'notifications.marked_clear': '選択した通知を削除する', + + 'notification_purge.btn_all': 'すべて\n選択', + 'notification_purge.btn_none': '選択\n解除', + 'notification_purge.btn_invert': '選択を\n反転', + 'notification_purge.btn_apply': '選択したものを\n削除', }; export default Object.assign({}, inherited, messages); diff --git a/app/javascript/glitch/locales/ja.json b/app/javascript/glitch/locales/ja.json deleted file mode 100644 index 70091268f..000000000 --- a/app/javascript/glitch/locales/ja.json +++ /dev/null @@ -1,44 +0,0 @@ -{ - "getting_started.open_source_notice": "Glitchsocは{Mastodon}によるフリーなオープンソースソフトウェアです。誰でもGitHub({github})から開発に參加したり、問題を報告したりできます。", - "layout.auto": "自動", - "layout.current_is": "あなたの現在のレイアウト:", - "layout.desktop": "デスクトップ", - "layout.mobile": "モバイル", - "navigation_bar.app_settings": "アプリ設定", - "getting_started.onboarding": "解説", - "onboarding.page_one.federation": "{domain}はMastodonのインスタンスです。Mastodonとは、独立したサーバが連携して作るソーシャルネットワークです。これらのサーバーをインスタンスと呼びます。", - "onboarding.page_one.welcome": "{domain}へようこそ!", - "onboarding.page_six.github": "{domain}はGlitchsocを使用しています。Glitchsocは{Mastodon}のフレンドリーな{fork}で、どんなMastodonアプリやインスタンスとも互換性があります。Glitchsocは完全に無料で、オープンソースです。{github}でバグ報告や機能要望あるいは貢獻をすることが可能です。", - "settings.auto_collapse": "自動折りたたみ", - "settings.auto_collapse_all": "すべて", - "settings.auto_collapse_lengthy": "長いトゥート", - "settings.auto_collapse_media": "メディア付きトゥート", - "settings.auto_collapse_notifications": "通知", - "settings.auto_collapse_reblogs": "ブースト", - "settings.auto_collapse_replies": "返信", - "settings.close": "閉じる", - "settings.collapsed_statuses": "トゥート", - "settings.enable_collapsed": "トゥート折りたたみを有効にする", - "settings.general": "一般", - "settings.image_backgrounds": "画像背景", - "settings.image_backgrounds_media": "折りたまれたメディア付きテゥートをプレビュー", - "settings.image_backgrounds_users": "折りたまれたトゥートの背景を変更する", - "settings.media": "メディア", - "settings.media_letterbox": "メディアをレターボックス式で表示", - "settings.media_fullwidth": "全幅メディアプリビュー", - "settings.preferences": "ユーザー設定", - "settings.wide_view": "ワイドビュー(デスクトップレイアウトのみ)", - "settings.navbar_under": "ナビを画面下部に移動させる(モバイルレイアウトのみ)", - "status.collapse": "折りたたむ", - "status.uncollapse": "折りたたみを解除", - - "notification.markForDeletion": "選択", - "notifications.clear": "通知を全てクリアする", - "notifications.marked_clear_confirmation": "削除した全ての通知を完全に削除してもよろしいですか?", - "notifications.marked_clear": "選択した通知を削除する", - - "notification_purge.btn_all": "すべて\n選択", - "notification_purge.btn_none": "選択\n解除", - "notification_purge.btn_invert": "選択を\n反転", - "notification_purge.btn_apply": "選択したものを\n削除" -} -- cgit From 64b839b76907e87c57d71762a81a9a8660f1df83 Mon Sep 17 00:00:00 2001 From: kibigo! Date: Sun, 10 Dec 2017 11:38:30 -0800 Subject: Removed MORE theme localizns --- config/locales/ca.yml | 2 -- config/locales/es.yml | 2 -- config/locales/fr.yml | 2 -- config/locales/pl.yml | 2 -- 4 files changed, 8 deletions(-) diff --git a/config/locales/ca.yml b/config/locales/ca.yml index 357e39e31..05c08c01a 100644 --- a/config/locales/ca.yml +++ b/config/locales/ca.yml @@ -678,8 +678,6 @@ ca:

Originalment adaptat a la política de privadesa del Discurs.

title: "%{instance} Condicions del servei i política de privadesa" - themes: - default: Mastodont time: formats: default: "%b %d, %Y, %H:%M" diff --git a/config/locales/es.yml b/config/locales/es.yml index 18b93b08e..d9084787d 100644 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -678,8 +678,6 @@ es:

Adaptado originalmente del discurso de las políticas de privacidad.

title: Términos del Servicio y Políticas de Privacidad de %{instance} - themes: - default: Mastodon time: formats: default: "%d de %b del %Y, %H:%M" diff --git a/config/locales/fr.yml b/config/locales/fr.yml index cd97f5967..45243d07e 100644 --- a/config/locales/fr.yml +++ b/config/locales/fr.yml @@ -677,8 +677,6 @@ fr:

Originellement adapté à partir de la politique de confidentialité de Discourse.

title: "%{instance} Conditions d’utilisations et politique de confidentialité" - themes: - default: Mastodon time: formats: default: "%d %b %Y, %H:%M" diff --git a/config/locales/pl.yml b/config/locales/pl.yml index baa26f1dc..582a2cd03 100644 --- a/config/locales/pl.yml +++ b/config/locales/pl.yml @@ -693,8 +693,6 @@ pl:

Tekst bazuje na polityce prywatności Discourse.

title: Zasady korzystania i polityka prywatności %{instance} - themes: - default: Mastodon time: formats: default: "%b %d, %Y, %H:%M" -- cgit