- <%= form.label :phone_number %>
+ <%= form.label :phone_number, t('reservations.form.phone_number') %>
<%= form.telephone_field :customer_original_phone,
class: "block shadow rounded-md border border-gray-400 outline-none px-3 py-2 mt-2 w-full",
data: { customer_search_target: "phoneField" } %>
@@ -37,21 +37,21 @@
- <%= form.label :first_name %>
+ <%= form.label :first_name, t('reservations.form.first_name') %>
<%= form.text_field :customer_first_name,
class: "block shadow rounded-md border border-gray-400 outline-none px-3 py-2 mt-2 w-full",
data: { customer_search_target: "firstNameField" } %>
- <%= form.label :surname %>
+ <%= form.label :surname, t('reservations.form.surname') %>
<%= form.text_field :customer_surname,
class: "block shadow rounded-md border border-gray-400 outline-none px-3 py-2 mt-2 w-full",
data: { customer_search_target: "surnameField" } %>
- <%= form.label :birth_year %>
+ <%= form.label :birth_year, t('reservations.form.birth_year') %>
<%= form.number_field :customer_birth_year,
class: "block shadow rounded-md border border-gray-400 outline-none px-3 py-2 mt-2 w-full",
data: { customer_search_target: "birthYearField" } %>
@@ -59,30 +59,34 @@
- <%= form.label :team_id %>
+ <%= form.label :team_id, t('reservations.form.team') %>
<%= form.collection_select :team_id,
@company.teams,
:id,
:name,
- { prompt: "Select a team" },
+ { prompt: t('reservations.form.select_team') },
class: "block shadow rounded-md border border-gray-400 outline-none px-3 py-2 mt-2 w-full" %>
- <%= form.label :start_time %>
+ <%= form.label :start_time, t('reservations.form.start_time') %>
<%= form.datetime_field :start_time,
class: "block shadow rounded-md border border-gray-400 outline-none px-3 py-2 mt-2 w-full",
id: "start_time_field" %>
- <%= form.label :end_time %>
+ <%= form.label :end_time, t('reservations.form.end_time') %>
<%= form.datetime_field :end_time,
class: "block shadow rounded-md border border-gray-400 outline-none px-3 py-2 mt-2 w-full",
id: "end_time_field" %>
- <%= form.submit class: "rounded-lg py-3 px-5 bg-blue-600 text-white inline-block font-medium cursor-pointer" %>
+ <% if reservation.new_record? %>
+ <%= form.submit t('reservations.form.create'), class: "rounded-lg py-3 px-5 bg-blue-600 text-white inline-block font-medium cursor-pointer" %>
+ <% else %>
+ <%= form.submit t('reservations.form.update'), class: "rounded-lg py-3 px-5 bg-blue-600 text-white inline-block font-medium cursor-pointer" %>
+ <% end %>
<% end %>
diff --git a/app/views/reservations/edit.html.erb b/app/views/reservations/edit.html.erb
index 05edde3..5ec6d44 100644
--- a/app/views/reservations/edit.html.erb
+++ b/app/views/reservations/edit.html.erb
@@ -1,8 +1,8 @@
-
Editing reservation
+ <%= t('.title') %>
<%= render "form", reservation: @reservation %>
- <%= link_to "Show this reservation", @reservation, class: "ml-2 rounded-lg py-3 px-5 bg-gray-100 inline-block font-medium" %>
- <%= link_to "Back to reservations", reservations_path, class: "ml-2 rounded-lg py-3 px-5 bg-gray-100 inline-block font-medium" %>
+ <%= link_to t('.show'), @reservation, class: "ml-2 rounded-lg py-3 px-5 bg-gray-100 inline-block font-medium" %>
+ <%= link_to t('.back'), reservations_path, class: "ml-2 rounded-lg py-3 px-5 bg-gray-100 inline-block font-medium" %>
diff --git a/app/views/reservations/index.html.erb b/app/views/reservations/index.html.erb
index d957cef..f595860 100644
--- a/app/views/reservations/index.html.erb
+++ b/app/views/reservations/index.html.erb
@@ -2,35 +2,53 @@
- <%= tag.div nil, data: {reservations: @reservations.to_json}, id: "main-calendar", style: "height: 100%; width: 100%;" %>
+ <%
+ calendar_translations = {
+ hours: t('reservations.calendar.hours'),
+ delete_confirm: t('reservations.calendar.delete_confirm'),
+ delete_success: t('reservations.calendar.delete_success'),
+ delete_error: t('reservations.calendar.delete_error'),
+ network_error: t('reservations.calendar.network_error'),
+ edit: t('reservations.calendar.edit'),
+ delete: t('reservations.calendar.delete')
+ }.to_json
+ %>
+ <%= tag.div nil,
+ data: {
+ reservations: @reservations.to_json,
+ translations: calendar_translations
+ },
+ id: "main-calendar",
+ style: "height: 100%; width: 100%;"
+ %>
\ No newline at end of file
diff --git a/app/views/reservations/new.html.erb b/app/views/reservations/new.html.erb
index 9c7b7c5..c64d719 100644
--- a/app/views/reservations/new.html.erb
+++ b/app/views/reservations/new.html.erb
@@ -1,7 +1,7 @@
-
New reservation
+ <%= t('.title') %>
<%= render "form", reservation: @reservation %>
- <%= link_to "Back to reservations", reservations_path, class: "ml-2 rounded-lg py-3 px-5 bg-gray-100 inline-block font-medium" %>
+ <%= link_to t('.back'), reservations_path, class: "ml-2 rounded-lg py-3 px-5 bg-gray-100 inline-block font-medium" %>
diff --git a/app/views/teams/_form.html.erb b/app/views/teams/_form.html.erb
index 6bd390e..d215d07 100644
--- a/app/views/teams/_form.html.erb
+++ b/app/views/teams/_form.html.erb
@@ -1,7 +1,7 @@
<%= form_with(model: team, class: "contents") do |form| %>
<% if team.errors.any? %>
-
<%= pluralize(team.errors.count, "error") %> prohibited this team from being saved:
+
<%= t('teams.form.errors.header', count: team.errors.count) %>
<% team.errors.each do |error| %>
<%= error.full_message %>
@@ -11,11 +11,15 @@
<% end %>
- <%= form.label :name %>
+ <%= form.label :name, t('teams.form.name') %>
<%= form.text_field :name, class: "block shadow rounded-md border border-gray-400 outline-none px-3 py-2 mt-2 w-full" %>
- <%= form.submit class: "rounded-lg py-3 px-5 bg-blue-600 text-white inline-block font-medium cursor-pointer" %>
+ <% if team.new_record? %>
+ <%= form.submit t('teams.form.create'), class: "rounded-lg py-3 px-5 bg-blue-600 text-white inline-block font-medium cursor-pointer" %>
+ <% else %>
+ <%= form.submit t('teams.form.update'), class: "rounded-lg py-3 px-5 bg-blue-600 text-white inline-block font-medium cursor-pointer" %>
+ <% end %>
<% end %>
diff --git a/app/views/teams/_team.html.erb b/app/views/teams/_team.html.erb
index 086c2a2..3cdf5d3 100644
--- a/app/views/teams/_team.html.erb
+++ b/app/views/teams/_team.html.erb
@@ -1,2 +1,12 @@
-
+
+
+
+
<%= team.name %>
+
+
+
diff --git a/app/views/teams/edit.html.erb b/app/views/teams/edit.html.erb
index b28f46a..95e7bdc 100644
--- a/app/views/teams/edit.html.erb
+++ b/app/views/teams/edit.html.erb
@@ -1,8 +1,8 @@
-
Editing team
+ <%= t('.title') %>
<%= render "form", team: @team %>
- <%= link_to "Show this team", @team, class: "ml-2 rounded-lg py-3 px-5 bg-gray-100 inline-block font-medium" %>
- <%= link_to "Back to teams", teams_path, class: "ml-2 rounded-lg py-3 px-5 bg-gray-100 inline-block font-medium" %>
+ <%= link_to t('.show'), @team, class: "ml-2 rounded-lg py-3 px-5 bg-gray-100 inline-block font-medium" %>
+ <%= link_to t('.back'), teams_path, class: "ml-2 rounded-lg py-3 px-5 bg-gray-100 inline-block font-medium" %>
diff --git a/app/views/teams/index.html.erb b/app/views/teams/index.html.erb
index 61bbffa..2e032e3 100644
--- a/app/views/teams/index.html.erb
+++ b/app/views/teams/index.html.erb
@@ -1,21 +1,27 @@
-
+
<% if notice.present? %>
-
<%= notice %>
+
<% end %>
- <% content_for :title, "Teams" %>
+ <% content_for :title, t('.title') %>
-
-
Teams
- <%= link_to "New team", new_team_path, class: "rounded-lg py-3 px-5 bg-blue-600 text-white block font-medium" %>
+
+
<%= t('.title') %>
+ <%= link_to new_team_path, class: "rounded-lg py-3 px-5 bg-blue-600 text-white font-medium hover:bg-blue-700 transition-colors duration-200 flex items-center" do %>
+
+
+
+ <%= t('.new_team') %>
+ <% end %>
-
+
<% @teams.each do |team| %>
- <%= render team %>
-
- <%= link_to "Show this team", team, class: "ml-2 rounded-lg py-3 px-5 bg-gray-100 inline-block font-medium" %>
-
+ <%= link_to team, class: "block transition-all duration-200 hover:shadow-lg hover:-translate-y-1" do %>
+ <%= render team %>
+ <% end %>
<% end %>
diff --git a/app/views/teams/new.html.erb b/app/views/teams/new.html.erb
index de77350..bee8d73 100644
--- a/app/views/teams/new.html.erb
+++ b/app/views/teams/new.html.erb
@@ -1,7 +1,7 @@
-
New team
+ <%= t('.title') %>
<%= render "form", team: @team %>
- <%= link_to "Back to teams", teams_path, class: "ml-2 rounded-lg py-3 px-5 bg-gray-100 inline-block font-medium" %>
+ <%= link_to t('.back'), teams_path, class: "ml-2 rounded-lg py-3 px-5 bg-gray-100 inline-block font-medium" %>
diff --git a/app/views/teams/show.html.erb b/app/views/teams/show.html.erb
index 2f12a4f..8390aa7 100644
--- a/app/views/teams/show.html.erb
+++ b/app/views/teams/show.html.erb
@@ -6,10 +6,10 @@
<%= render @team %>
- <%= link_to "Edit this team", edit_team_path(@team), class: "mt-2 rounded-lg py-3 px-5 bg-gray-100 inline-block font-medium" %>
- <%= link_to "Back to teams", teams_path, class: "ml-2 rounded-lg py-3 px-5 bg-gray-100 inline-block font-medium" %>
+ <%= link_to t('.edit'), edit_team_path(@team), class: "mt-2 rounded-lg py-3 px-5 bg-gray-100 inline-block font-medium" %>
+ <%= link_to t('.back'), teams_path, class: "ml-2 rounded-lg py-3 px-5 bg-gray-100 inline-block font-medium" %>
- <%= button_to "Destroy this team", @team, method: :delete, class: "mt-2 rounded-lg py-3 px-5 bg-gray-100 font-medium" %>
+ <%= button_to t('.destroy'), @team, method: :delete, class: "mt-2 rounded-lg py-3 px-5 bg-gray-100 font-medium" %>
diff --git a/config/application.rb b/config/application.rb
index 90e949d..ca63fcb 100644
--- a/config/application.rb
+++ b/config/application.rb
@@ -16,6 +16,11 @@ module Terminator
# Common ones are `templates`, `generators`, or `middleware`, for example.
config.autoload_lib(ignore: %w(assets tasks))
+ # Set available locales and default locale
+ config.i18n.available_locales = [:en, :bs]
+ config.i18n.default_locale = :bs
+ config.i18n.load_path += Dir[Rails.root.join('config', 'locales', '**', '*.{rb,yml}')]
+
# Configuration for the application, engines, and railties goes here.
#
# These settings can be overridden in specific environments using the files
diff --git a/config/locales/bs.yml b/config/locales/bs.yml
new file mode 100644
index 0000000..7cde88c
--- /dev/null
+++ b/config/locales/bs.yml
@@ -0,0 +1,126 @@
+bs:
+ # Add Bosnian translations here
+ reservations:
+ index:
+ title: "Rezervacije"
+ prev: "« Prethodna"
+ today: "Danas"
+ next: "Sljedeća »"
+ new_reservation: "Nova rezervacija" # TODO: Translate to Bosnian
+ calendar:
+ hours: "sati"
+ delete_confirm: "Jeste li sigurni da želite izbrisati ovu rezervaciju?"
+ delete_success: "Rezervacija je izbrisana."
+ delete_error: "Greška prilikom brisanja rezervacije."
+ network_error: "Greška prilikom brisanja rezervacije zbog problema s mrežom ili skriptom."
+ edit: "Uredi"
+ delete: "Obriši"
+ # Keys for form and edit/new pages
+ edit:
+ title: "Uređivanje rezervacije"
+ show: "Prikaži ovu rezervaciju"
+ back: "Nazad na rezervacije"
+ new:
+ title: "Nova rezervacija"
+ back: "Nazad na rezervacije"
+ form:
+ customer: "Klijent"
+ search_prompt: "Unesite za pretragu klijenata..."
+ phone_number: "Broj telefona"
+ first_name: "Ime"
+ surname: "Prezime"
+ birth_year: "Godina rođenja"
+ team: "Tim"
+ select_team: "Odaberite tim"
+ start_time: "Vrijeme početka"
+ end_time: "Vrijeme završetka"
+ submit: "Pošalji"
+ update: "Ažuriraj rezervaciju"
+ create: "Kreiraj rezervaciju"
+ errors:
+ header: "%{count} greška/e spriječila/e je da se ova rezervacija sačuva:"
+ create:
+ reservation_created: "Rezervacija je uspješno kreirana."
+ update:
+ reservation_updated: "Rezervacija je uspješno ažurirana."
+ destroy:
+ reservation_destroyed: "Rezervacija je uspješno izbrisana."
+
+ teams:
+ create:
+ team_created: "Tim je uspješno kreiran."
+ update:
+ team_updated: "Tim je uspješno ažuriran."
+ destroy:
+ team_destroyed: "Tim je uspješno izbrisan."
+ index:
+ title: "Timovi"
+ new_team: "Novi tim"
+ show_team: "Prikaži ovaj tim"
+ new:
+ title: "Novi tim"
+ back: "Nazad na timove"
+ edit:
+ title: "Uređivanje tima"
+ show: "Prikaži ovaj tim"
+ back: "Nazad na timove"
+ show:
+ edit: "Uredi ovaj tim"
+ back: "Nazad na timove"
+ destroy: "Izbriši ovaj tim"
+ form:
+ name: "Naziv"
+ submit: "Pošalji"
+ update: "Ažuriraj tim"
+ create: "Kreiraj tim"
+ errors:
+ header: "%{count} greška/e spriječila/e je da se ovaj tim sačuva:"
+
+ companies:
+ create:
+ company_created: "Kompanija je uspješno kreirana."
+ update:
+ company_updated: "Kompanija je uspješno ažurirana."
+ destroy:
+ company_destroyed: "Kompanija je uspješno izbrisana."
+ index:
+ title: "Kompanije"
+ new_company: "Nova kompanija"
+ show_company: "Prikaži ovu kompaniju"
+ new:
+ title: "Nova kompanija"
+ back: "Nazad na kompanije"
+ edit:
+ title: "Uređivanje kompanije"
+ show: "Prikaži ovu kompaniju"
+ back: "Nazad na kompanije"
+ show:
+ edit: "Uredi ovu kompaniju"
+ back: "Nazad na kompanije"
+ destroy: "Izbriši ovu kompaniju"
+ form:
+ name: "Naziv"
+ id_number: "ID broj"
+ vat_number: "PDV broj"
+ address_line_one: "Adresa (prva linija)"
+ address_line_two: "Adresa (druga linija)"
+ postal_code: "Poštanski broj"
+ city: "Grad"
+ entity: "Entitet"
+ country: "Država"
+ submit: "Pošalji"
+ update: "Ažuriraj kompaniju"
+ create: "Kreiraj kompaniju"
+ errors:
+ header: "%{count} greška/e spriječila/e je da se ova kompanija sačuva:"
+ company:
+ name: "Naziv:"
+ id_number: "ID broj:"
+ vat_number: "PDV broj:"
+ address_line_one: "Adresa (prva linija):"
+ address_line_two: "Adresa (druga linija):"
+ postal_code: "Poštanski broj:"
+ city: "Grad:"
+ entity: "Entitet:"
+ country: "Država:"
+
\ No newline at end of file
diff --git a/config/locales/en.yml b/config/locales/en.yml
index 173cbbc..28b7ce0 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -28,6 +28,7 @@
# enabled: "ON"
en:
+ # Add English translations here
hello: "Hello world"
customers:
create:
@@ -45,6 +46,43 @@ en:
reservation_updated: "Reservation was successfully updated."
destroy:
reservation_destroyed: "Reservation was successfully destroyed."
+ index:
+ title: "Reservations"
+ prev: "« Prev"
+ today: "Today"
+ next: "Next »"
+ new_reservation: "New reservation"
+ calendar:
+ hours: "hours"
+ delete_confirm: "Are you sure you want to delete this reservation?"
+ delete_success: "Reservation deleted."
+ delete_error: "Error deleting reservation."
+ network_error: "Error deleting reservation due to a network or script issue."
+ edit: "Edit"
+ delete: "Delete"
+ edit:
+ title: "Editing reservation"
+ show: "Show this reservation"
+ back: "Back to reservations"
+ new:
+ title: "New reservation"
+ back: "Back to reservations"
+ form:
+ customer: "Customer"
+ search_prompt: "Type to search customers..."
+ phone_number: "Phone number"
+ first_name: "First name"
+ surname: "Surname"
+ birth_year: "Birth year"
+ team: "Team"
+ select_team: "Select a team"
+ start_time: "Start time"
+ end_time: "End time"
+ submit: "Submit"
+ update: "Update Reservation"
+ create: "Create Reservation"
+ errors:
+ header: "%{count} prohibited this reservation from being saved:"
teams:
create:
team_created: "Team was successfully created."
@@ -52,3 +90,72 @@ en:
team_updated: "Team was successfully updated."
destroy:
team_destroyed: "Team was successfully destroyed."
+ index:
+ title: "Teams"
+ new_team: "New team"
+ show_team: "Show this team"
+ new:
+ title: "New team"
+ back: "Back to teams"
+ edit:
+ title: "Editing team"
+ show: "Show this team"
+ back: "Back to teams"
+ show:
+ edit: "Edit this team"
+ back: "Back to teams"
+ destroy: "Destroy this team"
+ form:
+ name: "Name"
+ submit: "Submit"
+ update: "Update Team"
+ create: "Create Team"
+ errors:
+ header: "%{count} prohibited this team from being saved:"
+ companies:
+ create:
+ company_created: "Company was successfully created."
+ update:
+ company_updated: "Company was successfully updated."
+ destroy:
+ company_destroyed: "Company was successfully destroyed."
+ index:
+ title: "Companies"
+ new_company: "New company"
+ show_company: "Show this company"
+ new:
+ title: "New company"
+ back: "Back to companies"
+ edit:
+ title: "Editing company"
+ show: "Show this company"
+ back: "Back to companies"
+ show:
+ edit: "Edit this company"
+ back: "Back to companies"
+ destroy: "Destroy this company"
+ form:
+ name: "Name"
+ id_number: "ID number"
+ vat_number: "VAT number"
+ address_line_one: "Address line one"
+ address_line_two: "Address line two"
+ postal_code: "Postal code"
+ city: "City"
+ entity: "Entity"
+ country: "Country"
+ submit: "Submit"
+ update: "Update Company"
+ create: "Create Company"
+ errors:
+ header: "%{count} prohibited this company from being saved:"
+ company:
+ name: "Name:"
+ id_number: "ID number:"
+ vat_number: "VAT number:"
+ address_line_one: "Address line one:"
+ address_line_two: "Address line two:"
+ postal_code: "Postal code:"
+ city: "City:"
+ entity: "Entity:"
+ country: "Country:"