From 3ea02314b951b42b1d5ee0cfc0a7aa9104050665 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Hru=C5=A1ka?= Date: Sun, 16 Jul 2017 01:15:25 +0200 Subject: [PATCH] split added glitch locales from vanilla (#82) * Locale script now accepts overrides and new keys from glitch/locales * Revert glitchsoc changes to mastodon/locales to prevent future merge conflicts --- app/javascript/glitch/locales/en.json | 32 +++++ .../mastodon/locales/defaultMessages.json | 115 ++---------------- app/javascript/mastodon/locales/en.json | 34 +----- config/webpack/generateLocalePacks.js | 20 ++- 4 files changed, 62 insertions(+), 139 deletions(-) create mode 100644 app/javascript/glitch/locales/en.json diff --git a/app/javascript/glitch/locales/en.json b/app/javascript/glitch/locales/en.json new file mode 100644 index 000000000..80fdc3a39 --- /dev/null +++ b/app/javascript/glitch/locales/en.json @@ -0,0 +1,32 @@ +{ + "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", + "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_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)", + "status.collapse": "Collapse", + "status.uncollapse": "Uncollapse", + "status.dismiss_notification": "Dismiss notification" +} diff --git a/app/javascript/mastodon/locales/defaultMessages.json b/app/javascript/mastodon/locales/defaultMessages.json index 368f68193..5c4daa8e7 100644 --- a/app/javascript/mastodon/locales/defaultMessages.json +++ b/app/javascript/mastodon/locales/defaultMessages.json @@ -188,14 +188,6 @@ }, { "descriptors": [ - { - "defaultMessage": "Collapse", - "id": "status.collapse" - }, - { - "defaultMessage": "Uncollapse", - "id": "status.uncollapse" - }, { "defaultMessage": "{name} boosted", "id": "status.reblogged_by" @@ -660,28 +652,12 @@ "id": "navigation_bar.community_timeline" }, { - "defaultMessage": "App settings", - "id": "navigation_bar.app_settings" + "defaultMessage": "Preferences", + "id": "navigation_bar.preferences" }, { "defaultMessage": "Logout", "id": "navigation_bar.logout" - }, - { - "defaultMessage": "Your current layout is:", - "id": "layout.current_is" - }, - { - "defaultMessage": "Mobile", - "id": "layout.mobile" - }, - { - "defaultMessage": "Auto", - "id": "layout.auto" - }, - { - "defaultMessage": "Desktop", - "id": "layout.desktop" } ], "path": "app/javascript/mastodon/features/compose/index.json" @@ -751,10 +727,6 @@ "defaultMessage": "Preferences", "id": "navigation_bar.preferences" }, - { - "defaultMessage": "App settings", - "id": "navigation_bar.app_settings" - }, { "defaultMessage": "Follow requests", "id": "navigation_bar.follow_requests" @@ -792,7 +764,7 @@ "id": "getting_started.appsshort" }, { - "defaultMessage": "Glitchsoc is open source software, a friendly fork of {Mastodon}. You can contribute or report issues on GitHub at {github}.", + "defaultMessage": "Mastodon is open source software. You can contribute or report issues on GitHub at {github}.", "id": "getting_started.open_source_notice" } ], @@ -1111,11 +1083,11 @@ "id": "column.public" }, { - "defaultMessage": "Welcome to {domain}!", + "defaultMessage": "Welcome to Mastodon!", "id": "onboarding.page_one.welcome" }, { - "defaultMessage": "{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.", + "defaultMessage": "Mastodon is a network of independent servers joining up to make one larger social network. We call these servers instances.", "id": "onboarding.page_one.federation" }, { @@ -1163,7 +1135,7 @@ "id": "onboarding.page_six.almost_done" }, { - "defaultMessage": "{domain} runs on Glitchsoc. Glitchsoc is a friendly {fork} of {Mastodon}. Glitchsoc is fully compatible with all Mastodon apps and instances. Glitchsoc is free open-source software. You can report bugs, request features, or contribute to the code on {github}.", + "defaultMessage": "Mastodon is free open-source software. You can report bugs, request features, or contribute to the code on {github}.", "id": "onboarding.page_six.github" }, { @@ -1210,79 +1182,6 @@ ], "path": "app/javascript/mastodon/features/ui/components/report_modal.json" }, - { - "descriptors": [ - { - "defaultMessage": "General", - "id": "settings.general" - }, - { - "defaultMessage": "Wide view (Desktop mode only)", - "id": "settings.wide_view" - }, - { - "defaultMessage": "Collapsed toots", - "id": "settings.collapsed_statuses" - }, - { - "defaultMessage": "Enable collapsed toots", - "id": "settings.enable_collapsed" - }, - { - "defaultMessage": "Automatic collapsing", - "id": "settings.auto_collapse" - }, - { - "defaultMessage": "Everything", - "id": "settings.auto_collapse_all" - }, - { - "defaultMessage": "Notifications", - "id": "settings.auto_collapse_notifications" - }, - { - "defaultMessage": "Lengthy toots", - "id": "settings.auto_collapse_lengthy" - }, - { - "defaultMessage": "Replies", - "id": "settings.auto_collapse_replies" - }, - { - "defaultMessage": "Toots with media", - "id": "settings.auto_collapse_media" - }, - { - "defaultMessage": "Image backgrounds", - "id": "settings.image_backgrounds" - }, - { - "defaultMessage": "Give collapsed toots an image background", - "id": "settings.image_backgrounds_users" - }, - { - "defaultMessage": "Preview collapsed toot media", - "id": "settings.image_backgrounds_media" - }, - { - "defaultMessage": "Media", - "id": "settings.media" - }, - { - "defaultMessage": "Letterbox media", - "id": "settings.media_letterbox" - }, - { - "defaultMessage": "User preferences", - "id": "settings.preferences" - }, - { - "defaultMessage": "Close", - "id": "settings.close" - } - ], - "path": "app/javascript/mastodon/features/ui/components/settings_modal.json" - }, { "descriptors": [ { @@ -1326,4 +1225,4 @@ ], "path": "app/javascript/mastodon/features/ui/components/video_modal.json" } -] \ No newline at end of file +] diff --git a/app/javascript/mastodon/locales/en.json b/app/javascript/mastodon/locales/en.json index 1d553d514..15afe2309 100644 --- a/app/javascript/mastodon/locales/en.json +++ b/app/javascript/mastodon/locales/en.json @@ -77,7 +77,7 @@ "getting_started.appsshort": "Apps", "getting_started.faq": "FAQ", "getting_started.heading": "Getting started", - "getting_started.open_source_notice": "Glitchsoc is free open source software forked from {Mastodon}. You can contribute or report issues on GitHub at {github}.", + "getting_started.open_source_notice": "Mastodon is open source software. You can contribute or report issues on GitHub at {github}.", "getting_started.userguide": "User Guide", "home.column_settings.advanced": "Advanced", "home.column_settings.basic": "Basic", @@ -85,15 +85,10 @@ "home.column_settings.show_reblogs": "Show boosts", "home.column_settings.show_replies": "Show replies", "home.settings": "Column settings", - "layout.auto": "Auto", - "layout.current_is": "Your current layout is:", - "layout.desktop": "Desktop", - "layout.mobile": "Mobile", "lightbox.close": "Close", "loading_indicator.label": "Loading...", "media_gallery.toggle_visible": "Toggle visibility", "missing_indicator.label": "Not found", - "navigation_bar.app_settings": "App settings", "navigation_bar.blocks": "Blocked users", "navigation_bar.community_timeline": "Local timeline", "navigation_bar.edit_profile": "Edit profile", @@ -124,14 +119,14 @@ "onboarding.page_five.public_timelines": "The local timeline shows public posts from everyone on {domain}. The federated timeline shows public posts from everyone who people on {domain} follow. These are the Public Timelines, a great way to discover new people.", "onboarding.page_four.home": "The home timeline shows posts from people you follow.", "onboarding.page_four.notifications": "The notifications column shows when someone interacts with you.", - "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.federation": "Mastodon is a network of independent servers joining up to make one larger social network. We call these servers instances.", "onboarding.page_one.handle": "You are on {domain}, so your full handle is {handle}", - "onboarding.page_one.welcome": "Welcome to {domain}!", + "onboarding.page_one.welcome": "Welcome to Mastodon!", "onboarding.page_six.admin": "Your instance's admin is {admin}.", "onboarding.page_six.almost_done": "Almost done...", "onboarding.page_six.appetoot": "Bon Appetoot!", "onboarding.page_six.apps_available": "There are {apps} available for iOS, Android and other platforms.", - "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}.", + "onboarding.page_six.github": "Mastodon is free open-source software. You can report bugs, request features, or contribute to the code on {github}.", "onboarding.page_six.guidelines": "community guidelines", "onboarding.page_six.read_guidelines": "Please read {domain}'s {guidelines}!", "onboarding.page_six.various_app": "mobile apps", @@ -154,27 +149,8 @@ "report.target": "Reporting {target}", "search.placeholder": "Search", "search_results.total": "{count, number} {count, plural, one {result} other {results}}", - "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_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)", "standalone.public_title": "A look inside...", "status.cannot_reblog": "This post cannot be boosted", - "status.collapse": "Collapse", "status.delete": "Delete", "status.favourite": "Favourite", "status.load_more": "Load more", @@ -191,9 +167,7 @@ "status.sensitive_warning": "Sensitive content", "status.show_less": "Show less", "status.show_more": "Show more", - "status.uncollapse": "Uncollapse", "status.unmute_conversation": "Unmute conversation", - "status.dismiss_notification": "Dismiss notification", "tabs_bar.compose": "Compose", "tabs_bar.federated_timeline": "Federated", "tabs_bar.home": "Home", diff --git a/config/webpack/generateLocalePacks.js b/config/webpack/generateLocalePacks.js index b71cf2ade..cd3bed50c 100644 --- a/config/webpack/generateLocalePacks.js +++ b/config/webpack/generateLocalePacks.js @@ -34,6 +34,23 @@ locales.forEach(locale => { ].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]; +}); + +`; + } + const localeContent = `// // locale_${locale}.js // automatically generated by generateLocalePacks.js @@ -41,7 +58,8 @@ locales.forEach(locale => { import messages from '../../app/javascript/mastodon/locales/${locale}.json'; import localeData from ${JSON.stringify(localeDataPath)}; import { setLocale } from '../../app/javascript/mastodon/locales'; -setLocale({messages, localeData}); +${glitchInject} +setLocale({messages: mergedMessages, localeData: localeData}); `; fs.writeFileSync(localePath, localeContent, 'utf8'); outPaths.push(localePath);