From 66753999a933a0d27ca88a256b78b3ffd4e19ddb Mon Sep 17 00:00:00 2001 From: Ali G Date: Thu, 21 Dec 2023 18:18:24 -0600 Subject: [PATCH] =?UTF-8?q?atualizou=20scrips=20para=20mudan=C3=A7a=20de?= =?UTF-8?q?=20idioma?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/secrets.yml | 2 +- db/seeds.rb | 16 ++++++++-------- lib/tasks/local_to_pt_br.rake | 17 ++++++++++++----- 3 files changed, 21 insertions(+), 14 deletions(-) diff --git a/config/secrets.yml b/config/secrets.yml index dd0fa0b..11b046d 100644 --- a/config/secrets.yml +++ b/config/secrets.yml @@ -14,7 +14,7 @@ decidim_default: &decidim_default application_name: <%= Decidim::Env.new("DECIDIM_APPLICATION_NAME", "My Application Name").to_json %> mailer_sender: <%= Decidim::Env.new("DECIDIM_MAILER_SENDER", "change-me@example.org").to_s %> available_locales: <%= Decidim::Env.new("DECIDIM_AVAILABLE_LOCALES", "ca,cs,de,en,es,eu,fi,fr,it,ja,nl,pl,pt,ro,pt-BR").to_array.to_json %> - default_locale: <%= Decidim::Env.new("DECIDIM_DEFAULT_LOCALE", "pt-BR").to_s %> + default_locale: <%= Decidim::Env.new("DECIDIM_DEFAULT_LOCALE", "en").to_s %> force_ssl: <%= Decidim::Env.new("DECIDIM_FORCE_SSL", "auto").default_or_present_if_exists.to_s %> enable_html_header_snippets: <%= Decidim::Env.new("DECIDIM_ENABLE_HTML_HEADER_SNIPPETS").to_boolean_string %> currency_unit: <%= Decidim::Env.new("DECIDIM_CURRENCY_UNIT", "€").to_s %> diff --git a/db/seeds.rb b/db/seeds.rb index 869a941..d06ec54 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -53,12 +53,12 @@ send_welcome_notification: true, file_upload_settings: Decidim::OrganizationSettings.default(:upload), enable_omnipresent_banner: true, - cta_button_text: {"pt"=>"participar"}, + cta_button_text: {"pt-BR"=>"participar"}, cta_button_path: "pages/help", official_url: "https://ok.org.br", omnipresent_banner_url: "https://minutas.ok.org.br/pages/help", - omnipresent_banner_title: {"pt": "Aviso"}, - omnipresent_banner_short_description: {"pt": "Aqui vão os avisos da plataforma sobre minutas mais recentes, status de operações no site, etc."}, + omnipresent_banner_title: {"pt-BR": "Aviso"}, + omnipresent_banner_short_description: {"pt-BR": "Aqui vão os avisos da plataforma sobre minutas mais recentes, status de operações no site, etc."}, ) # Add branding to the organization. @@ -68,7 +68,7 @@ organization.save! # Create "terms & conditions" and "help" pages. -organization.static_pages || +organization.static_pages.present? || Decidim::System::CreateDefaultPages.call(organization) && Decidim::System::PopulateHelp.call(organization) @@ -110,7 +110,7 @@ nickname: "admin", organization: organization, confirmed_at: Time.current, - locale: :pt, + locale: :"pt-BR", admin: true, tos_agreement: true, personal_url: "https://example.org", @@ -129,9 +129,9 @@ slug: "politica-de-dados-abertos-#{city.parameterize}", organization: organization, title: {"pt": "Decreto para instituição de Política de Dados Abertos do #{city}"}, - subtitle: {"pt": "A prefeita de um município mais transparente decreta"}, - short_description: {"pt": "

Minuta colaborativa para os municípios

"}, - description: {"pt": "

This is a long description

"}, + subtitle: {"pt-BR": "A prefeita de um município mais transparente decreta"}, + short_description: {"pt-BR": "

Minuta colaborativa para os municípios

"}, + description: {"pt-BR": "

This is a long description

"}, weight: (index + 1) * 10, published_at: Time.current, start_date: Time.current, diff --git a/lib/tasks/local_to_pt_br.rake b/lib/tasks/local_to_pt_br.rake index 0c8e575..f47f10d 100644 --- a/lib/tasks/local_to_pt_br.rake +++ b/lib/tasks/local_to_pt_br.rake @@ -5,14 +5,21 @@ namespace :cominutas do desc "Run this once to update organization to pt-BR" puts "Following this guide: https://docs.decidim.org/en/v0.27/develop/fixing_locales.html" - - puts "Updating organization locale's to pt-BR" + LANG = "pt-BR" + puts "Updating organization locale's to #{LANG}" org = Decidim::Organization.first - org.available_locales = ["pt-BR"] - org.default_locale = "pt-BR" - org.save! + org.update!( + available_locales: [LANG], + default_locale: LANG, + cta_button_text: {LANG =>"participar"}, + omnipresent_banner_title: {LANG => "Aviso"}, + omnipresent_banner_short_description: {LANG => "Aqui vão os avisos da plataforma sobre minutas mais recentes, status de operações no site, etc."} + ) + puts "updated locale to #{org.available_locales.to_s}" puts "updated locale to #{org.default_locale}" + puts "updating users locales to #{LANG}" + Decidim::User.update_all locale: LANG.to_sym puts "Synchronizing all locales" Rake::Task["decidim:locales:sync_all"].invoke