Skip to content

Commit

Permalink
Merge pull request #5 from sk8higher/add-belarussian
Browse files Browse the repository at this point in the history
Add belarussian
  • Loading branch information
sk8higher authored Nov 12, 2023
2 parents df4f0db + f52a875 commit 4e819f9
Show file tree
Hide file tree
Showing 48 changed files with 348 additions and 80 deletions.
44 changes: 0 additions & 44 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,55 +3,19 @@ git_source(:github) { |repo| "https://github.com/#{repo}.git" }

ruby '3.1.2'

# Bundle edge Rails instead: gem "rails", github: "rails/rails", branch: "main"
gem 'rails', '~> 7.0.4'

# The original asset pipeline for Rails [https://github.com/rails/sprockets-rails]
gem 'sprockets-rails'

# Use sqlite3 as the database for Active Record

# Use the Puma web server [https://github.com/puma/puma]
gem 'puma', '~> 5.0'

# Bundle and transpile JavaScript [https://github.com/rails/jsbundling-rails]
gem 'jsbundling-rails'

# Hotwire's SPA-like page accelerator [https://turbo.hotwired.dev]
gem 'turbo-rails'

# Hotwire's modest JavaScript framework [https://stimulus.hotwired.dev]
gem 'stimulus-rails'

# Bundle and process CSS [https://github.com/rails/cssbundling-rails]
gem 'cssbundling-rails'

# Build JSON APIs with ease [https://github.com/rails/jbuilder]
gem 'jbuilder'

# Use Redis adapter to run Action Cable in production
# gem "redis", "~> 4.0"

# Use Kredis to get higher-level data types in Redis [https://github.com/rails/kredis]
# gem "kredis"

# Use Active Model has_secure_password [https://guides.rubyonrails.org/active_model_basics.html#securepassword]
# gem "bcrypt", "~> 3.1.7"

# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: %i[mingw mswin x64_mingw jruby]

# Reduces boot times through caching; required in config/boot.rb
gem 'bootsnap', require: false

# Use Sass to process CSS
# gem "sassc-rails"

# Use Active Storage variants [https://guides.rubyonrails.org/active_storage_overview.html#transforming-images]
gem 'image_processing', '~> 1.2'

group :development, :test do
# See https://guides.rubyonrails.org/debugging_rails_applications.html#debugging-with-the-debug-gem
gem 'byebug'
gem 'debug', platforms: %i[mri mingw x64_mingw]
gem 'factory_bot_rails'
Expand All @@ -60,19 +24,11 @@ group :development, :test do
end

group :development do
# Use console on exceptions pages [https://github.com/rails/web-console]
gem 'web-console'

# Add speed badges [https://github.com/MiniProfiler/rack-mini-profiler]
# gem "rack-mini-profiler"

# Speed up commands on slow machines / big apps [https://github.com/rails/spring]
# gem "spring"
gem 'faker'
end

group :test do
# Use system testing [https://guides.rubyonrails.org/testing.html#system-testing]
gem 'capybara'
gem 'database_cleaner-active_record', '~> 2.1.0'
gem 'rails-controller-testing'
Expand Down
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ GEM
nokogiri (1.15.4-x86_64-linux)
racc (~> 1.4)
orm_adapter (0.5.0)
pagy (6.1.0)
pagy (6.2.0)
parallel (1.23.0)
parser (3.2.2.4)
ast (~> 2.4.1)
Expand Down
Binary file modified app/assets/images/flags.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions app/assets/stylesheets/application.bootstrap.scss
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,10 @@ body {
background-position: -1px -17px;
}

.be-flag {
background-position: -1px -34px;
}

.nav {
.flag {
position: relative;
Expand Down
5 changes: 4 additions & 1 deletion app/controllers/articles_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ def new

def create
@article = Article.new(article_params)
@article.images.attach(params[:article][:images]) if params[:article][:images].present?

if @article.save
redirect_to article_path(@article), notice: t('notice.create.success')
Expand All @@ -25,6 +26,8 @@ def create

def update
if @article.update(article_params)
@article.images.attach(params[:article][:images]) if params[:article][:images].present?

redirect_to article_path(@article), notice: t('notice.update.success')
else
render :edit, status: :unprocessable_entity
Expand All @@ -46,6 +49,6 @@ def set_article
def article_params
params.require(:article).permit(I18n.available_locales.map do |l|
[:"name_#{Mobility.normalize_locale(l)}", :"description_#{Mobility.normalize_locale(l)}"]
end.flatten, images: [])
end.flatten, :images)
end
end
1 change: 0 additions & 1 deletion app/models/article.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,5 @@ class Article < ApplicationRecord
has_many_attached :images

validates :name, presence: true, length: { minimum: 3, maximum: 250 }
validates :description, presence: true, length: { minimum: 5 }
validates :images, presence: true
end
4 changes: 2 additions & 2 deletions app/views/articles/_form.html.erb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<%= form_with(model: article, data: { turbo: false }, class: 'form-width-avg') do |form| %>
<% if article.errors.any? %>
<div style="color: red">
<div class="alert alert-danger">
<h2><%= t('.errors') %></h2>
<ul>
<% article.errors.each do |error| %>
Expand All @@ -25,7 +25,7 @@
<% end %>

<div class="form-group row mb-15">
<%= form.label :photo %>
<%= form.label :images %>
<%= form.file_field :images, multiple: true, class: 'form-control-file' %>
</div>

Expand Down
2 changes: 1 addition & 1 deletion app/views/artworks/_form.html.erb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<%= form_with(model: artwork, url: [person, artwork], data: { turbo: false }, class: 'form-width-avg') do |form| %>
<% if artwork.errors.any? %>
<div style="color: red">
<div class="alert alert-danger">
<h2><%= t('.errors') %></h2>
<ul>
<% artwork.errors.each do |error| %>
Expand Down
2 changes: 1 addition & 1 deletion app/views/buildings/_form.html.erb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<%= form_with(model: building, data: { turbo: false }, class: 'form-width-avg') do |form| %>
<% if building.errors.any? %>
<div style="color: red">
<div class="alert alert-danger">
<h2><%= t('.errors') %></h2>
<ul>
<% building.errors.each do |error| %>
Expand Down
2 changes: 1 addition & 1 deletion app/views/monuments/_form.html.erb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<%= form_with(model: monument, data: { turbo: false }, class: 'form-width-avg') do |form| %>
<% if monument.errors.any? %>
<div style="color: red">
<div class="alert alert-danger">
<h2><%= t('.errors') %></h2>
<ul>
<% monument.errors.each do |error| %>
Expand Down
2 changes: 1 addition & 1 deletion app/views/museums/_form.html.erb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<%= form_with(model: museum, data: { turbo: false }, class: 'form-width-avg') do |form| %>
<% if museum.errors.any? %>
<div style="color: red">
<div class="alert alert-danger">
<h2><%= t('.errors') %></h2>
<ul>
<% museum.errors.each do |error| %>
Expand Down
2 changes: 1 addition & 1 deletion app/views/people/_form.html.erb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<%= form_with(model: person, data: { turbo: false }, class: 'form-width-avg') do |form| %>
<% if person.errors.any? %>
<div style="color: red">
<div class="alert alert-danger">
<h2><%= t('.errors') %></h2>
<ul>
<% person.errors.each do |error| %>
Expand Down
2 changes: 1 addition & 1 deletion config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class Application < Rails::Application
config.active_storage.variable_content_type = %w(image/png image/jpg image/jpeg)
config.active_storage.silence_invalid_content_types_warning = true

config.i18n.available_locales = %i[ru en]
config.i18n.available_locales = %i[ru en be]
config.i18n.default_locale = :ru

config.i18n.load_path += Dir[Rails.root.join('config', 'locales', '**', '*.{rb,yml}')]
Expand Down
11 changes: 11 additions & 0 deletions config/locales/be.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
be:
en: 'Англійская'
ru: 'Руская'
be: 'Беларуская'
notice:
create:
success: 'Артыкул быў паспяхова створаны.'
update:
success: 'Артыкул быў паспяхова абноўлены.'
destroy:
success: 'Артыкул быў паспяхова знішчаны.'
3 changes: 2 additions & 1 deletion config/locales/en.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
en:
en: 'English'
ru: 'Russian'
be: 'Belarusian'
notice:
create:
success: 'The article was successfully created.'
update:
success: 'The article was successfully updated.'
destroy:
success: 'The article was succesully destroyed'
success: 'The article was succesully destroyed'
15 changes: 15 additions & 0 deletions config/locales/models/article/be.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
be:
activerecord:
models:
article: 'Артыкул'
attributes:
article:
name: 'Назва'
name_en: 'Назва (Англійская)'
name_ru: 'Назва (Руская)'
name_be: 'Назва (Беларуская)'
description: 'Змест'
description_en: 'Змест (Англійская)'
description_ru: 'Змест (Руская)'
description_be: 'Змест (Беларуская)'
images: 'Фота'
4 changes: 3 additions & 1 deletion config/locales/models/article/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ en:
name: 'Name'
name_en: 'Name (English)'
name_ru: 'Name (Russian)'
name_be: 'Name (Belarusian)'
description: 'Description'
description_en: 'Description (English)'
description_ru: 'Description (Russian)'
photo: 'Photo'
description_be: 'Description (Belarusian)'
images: 'Photo'
2 changes: 2 additions & 0 deletions config/locales/models/article/ru.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ ru:
name: 'Название'
name_en: 'Название (Английский)'
name_ru: 'Название (Русский)'
name_be: 'Название (Белорусский)'
description: 'Содержание'
description_en: 'Содержание (Английский)'
description_ru: 'Содержание (Русский)'
description_be: 'Содержание (Белорусский)'
images: 'Фото'
15 changes: 15 additions & 0 deletions config/locales/models/artwork/be.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
be:
activerecord:
models:
artwork: "Праца"
attributes:
artwork:
title: "Назва"
title_en: "Назва (Англійская)"
title_ru: "Назва (Руская)"
title_be: "Назва (Беларуская)"
description: "Апісанне"
description_en: "Апісанне (Англійская)"
description_ru: "Апісанне (Руская)"
description_be: "Апісанне (Беларуская)"
photo: "Фота"
2 changes: 2 additions & 0 deletions config/locales/models/artwork/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ en:
title: "Title"
title_en: "Title (English)"
title_ru: "Title (Russian)"
title_be: "Title (Belarusian)"
description: "Description"
description_en: "Description (English)"
description_ru: "Description (Russian)"
description_be: "Description (Belarusian)"
photo: "Photo"
2 changes: 2 additions & 0 deletions config/locales/models/artwork/ru.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ ru:
title: "Название"
title_en: "Название (Английский)"
title_ru: "Название (Русский)"
title_be: "Название (Белорусский)"
description: "Описание"
description_en: "Описание (Английский)"
description_ru: "Описание (Русский)"
description_be: "Описание (Белорусский)"
photo: "Фото"
15 changes: 15 additions & 0 deletions config/locales/models/building/be.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
be:
activerecord:
models:
building: 'Месца'
attributes:
building:
name: 'Назва'
name_en: 'Назва (Англійская)'
name_ru: 'Назва (Руская)'
name_be: 'Назва (Беларуская)'
description: 'Апicанне'
description_en: 'Апісанне (Англійская)'
description_ru: 'Апісанне (Руская)'
description_be: 'Апісанне (Беларуская)'
photo: 'Фота'
2 changes: 2 additions & 0 deletions config/locales/models/building/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ en:
name: 'Name'
name_en: 'Name (English)'
name_ru: 'Name (Russian)'
name_be: 'Name (Belarusian)'
description: 'Description'
description_en: 'Description (English)'
description_ru: 'Description (Russian)'
description_be: 'Description (Belarusian)'
photo: 'Photo'
2 changes: 2 additions & 0 deletions config/locales/models/building/ru.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ ru:
name: 'Название'
name_en: 'Название (Английский)'
name_ru: 'Название (Русский)'
name_be: 'Название (Белорусский)'
description: 'Описание'
description_en: 'Описание (Английский)'
description_ru: 'Описание (Русский)'
description_be: 'Описание (Белорусский)'
photo: 'Фото'
15 changes: 15 additions & 0 deletions config/locales/models/monument/be.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
be:
activerecord:
models:
monument: 'Помнік'
attributes:
monument:
name: 'Назва'
name_en: 'Назва (Англійская)'
name_ru: 'Назва (Руская)'
name_be: 'Назва (Беларуская)'
description: 'Апiсанне'
description_en: 'Апісанне (Англійская)'
description_ru: 'Апісанне (Руская)'
description_be: 'Апісанне (Беларуская)'
photo: 'Фота'
2 changes: 2 additions & 0 deletions config/locales/models/monument/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ en:
name: 'Name'
name_en: 'Name (English)'
name_ru: 'Name (Russian)'
name_be: 'Name (Belarusian)'
description: 'Description'
description_en: 'Description (English)'
description_ru: 'Description (Russian)'
description_be: 'Description (Belarusian)'
photo: 'Photo'
2 changes: 2 additions & 0 deletions config/locales/models/monument/ru.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ ru:
name: 'Название'
name_en: 'Название (Английский)'
name_ru: 'Название (Русский)'
name_be: 'Название (Белорусский)'
description: 'Описание'
description_en: 'Описание (Английский)'
description_ru: 'Описание (Русский)'
description_be: 'Описание (Белорусский)'
photo: 'Фото'
15 changes: 15 additions & 0 deletions config/locales/models/museum/be.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
be:
activerecord:
models:
museum: 'Музей'
attributes:
museum:
name: 'Назва'
name_en: 'Назва (Англійская)'
name_ru: 'Назва (Руская)'
name_be: 'Назва (Беларуская)'
description: 'Апicанне'
description_en: 'Апісанне (Англійская)'
description_ru: 'Апісанне (Руская)'
description_be: 'Апісанне (Беларуская)'
photo: 'Фота'
2 changes: 2 additions & 0 deletions config/locales/models/museum/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ en:
name: 'Name'
name_en: 'Name (English)'
name_ru: 'Name (Russian)'
name_be: 'Name (Belarusian)'
description: 'Description'
description_en: 'Description (English)'
description_ru: 'Description (Russian)'
description_be: 'Description (Belarusian)'
photo: 'Photo'
Loading

0 comments on commit 4e819f9

Please sign in to comment.