Added translations to entire app

This commit is contained in:
2025-04-23 07:45:33 +02:00
parent ce947100c6
commit 58e78acbba
22 changed files with 450 additions and 132 deletions

View File

@@ -1,47 +1,51 @@
<div id="<%= dom_id company %>">
<p class="my-5">
<strong class="block font-medium mb-1">Name:</strong>
<%= company.name %>
</p>
<p class="my-5">
<strong class="block font-medium mb-1">Id number:</strong>
<%= company.id_number %>
</p>
<p class="my-5">
<strong class="block font-medium mb-1">Vat number:</strong>
<%= company.vat_number %>
</p>
<p class="my-5">
<strong class="block font-medium mb-1">Address line one:</strong>
<%= company.address_line_one %>
</p>
<p class="my-5">
<strong class="block font-medium mb-1">Address line two:</strong>
<%= company.address_line_two %>
</p>
<p class="my-5">
<strong class="block font-medium mb-1">Postal code:</strong>
<%= company.postal_code %>
</p>
<p class="my-5">
<strong class="block font-medium mb-1">City:</strong>
<%= company.city %>
</p>
<p class="my-5">
<strong class="block font-medium mb-1">Entity:</strong>
<%= company.entity %>
</p>
<p class="my-5">
<strong class="block font-medium mb-1">Country:</strong>
<%= company.country %>
</p>
<div id="<%= dom_id company %>" class="bg-white rounded-xl shadow-md overflow-hidden p-6">
<div class="flex justify-between items-start mb-4">
<h2 class="text-2xl font-bold text-gray-800"><%= company.name %></h2>
<div class="flex-shrink-0 bg-blue-100 text-blue-800 rounded-full p-3">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-6 h-6">
<path stroke-linecap="round" stroke-linejoin="round" d="M2.25 21h19.5m-18-18v18m10.5-18v18m6-13.5V21M6.75 6.75h.75m-.75 3h.75m-.75 3h.75m3-6h.75m-.75 3h.75m-.75 3h.75M6.75 21v-3.375c0-.621.504-1.125 1.125-1.125h2.25c.621 0 1.125.504 1.125 1.125V21M3 3h12m-.75 4.5H21m-3.75 3.75h.008v.008h-.008v-.008zm0 3h.008v.008h-.008v-.008zm0 3h.008v.008h-.008v-.008z" />
</svg>
</div>
</div>
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
<div>
<p class="text-sm">
<span class="font-medium text-gray-500"><%= t('companies.company.id_number') %></span>
<%= company.id_number %>
</p>
<p class="text-sm mt-2">
<span class="font-medium text-gray-500"><%= t('companies.company.vat_number') %></span>
<%= company.vat_number %>
</p>
<p class="text-sm mt-2">
<span class="font-medium text-gray-500"><%= t('companies.company.entity') %></span>
<%= company.entity %>
</p>
<p class="text-sm mt-2">
<span class="font-medium text-gray-500"><%= t('companies.company.country') %></span>
<%= company.country %>
</p>
</div>
<div>
<p class="text-sm">
<span class="font-medium text-gray-500"><%= t('companies.company.address_line_one') %></span>
<%= company.address_line_one %>
</p>
<% if company.address_line_two.present? %>
<p class="text-sm mt-2">
<span class="font-medium text-gray-500"><%= t('companies.company.address_line_two') %></span>
<%= company.address_line_two %>
</p>
<% end %>
<p class="text-sm mt-2">
<span class="font-medium text-gray-500"><%= t('companies.company.postal_code') %></span>
<%= company.postal_code %>
</p>
<p class="text-sm mt-2">
<span class="font-medium text-gray-500"><%= t('companies.company.city') %></span>
<%= company.city %>
</p>
</div>
</div>
</div>

View File

@@ -1,7 +1,7 @@
<%= form_with(model: company, class: "contents") do |form| %>
<% if company.errors.any? %>
<div id="error_explanation" class="bg-red-50 text-red-500 px-3 py-2 font-medium rounded-lg mt-3">
<h2><%= pluralize(company.errors.count, "error") %> prohibited this company from being saved:</h2>
<h2><%= t('companies.form.errors.header', count: company.errors.count) %></h2>
<ul>
<% company.errors.each do |error| %>
@@ -12,51 +12,55 @@
<% end %>
<div class="my-5">
<%= form.label :name %>
<%= form.label :name, t('companies.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" %>
</div>
<div class="my-5">
<%= form.label :id_number %>
<%= form.label :id_number, t('companies.form.id_number') %>
<%= form.text_field :id_number, class: "block shadow rounded-md border border-gray-400 outline-none px-3 py-2 mt-2 w-full" %>
</div>
<div class="my-5">
<%= form.label :vat_number %>
<%= form.label :vat_number, t('companies.form.vat_number') %>
<%= form.text_field :vat_number, class: "block shadow rounded-md border border-gray-400 outline-none px-3 py-2 mt-2 w-full" %>
</div>
<div class="my-5">
<%= form.label :address_line_one %>
<%= form.label :address_line_one, t('companies.form.address_line_one') %>
<%= form.text_field :address_line_one, class: "block shadow rounded-md border border-gray-400 outline-none px-3 py-2 mt-2 w-full" %>
</div>
<div class="my-5">
<%= form.label :address_line_two %>
<%= form.label :address_line_two, t('companies.form.address_line_two') %>
<%= form.text_field :address_line_two, class: "block shadow rounded-md border border-gray-400 outline-none px-3 py-2 mt-2 w-full" %>
</div>
<div class="my-5">
<%= form.label :postal_code %>
<%= form.label :postal_code, t('companies.form.postal_code') %>
<%= form.text_field :postal_code, class: "block shadow rounded-md border border-gray-400 outline-none px-3 py-2 mt-2 w-full" %>
</div>
<div class="my-5">
<%= form.label :city %>
<%= form.label :city, t('companies.form.city') %>
<%= form.text_field :city, class: "block shadow rounded-md border border-gray-400 outline-none px-3 py-2 mt-2 w-full" %>
</div>
<div class="my-5">
<%= form.label :entity %>
<%= form.label :entity, t('companies.form.entity') %>
<%= form.text_field :entity, class: "block shadow rounded-md border border-gray-400 outline-none px-3 py-2 mt-2 w-full" %>
</div>
<div class="my-5">
<%= form.label :country %>
<%= form.label :country, t('companies.form.country') %>
<%= form.text_field :country, class: "block shadow rounded-md border border-gray-400 outline-none px-3 py-2 mt-2 w-full" %>
</div>
<div class="inline">
<%= form.submit class: "rounded-lg py-3 px-5 bg-blue-600 text-white inline-block font-medium cursor-pointer" %>
<% if company.new_record? %>
<%= form.submit t('companies.form.create'), class: "rounded-lg py-3 px-5 bg-blue-600 text-white inline-block font-medium cursor-pointer" %>
<% else %>
<%= form.submit t('companies.form.update'), class: "rounded-lg py-3 px-5 bg-blue-600 text-white inline-block font-medium cursor-pointer" %>
<% end %>
</div>
<% end %>

View File

@@ -1,8 +1,8 @@
<div class="mx-auto md:w-2/3 w-full">
<h1 class="font-bold text-4xl">Editing company</h1>
<h1 class="font-bold text-4xl"><%= t('.title') %></h1>
<%= render "form", company: @company %>
<%= link_to "Show this company", @company, class: "ml-2 rounded-lg py-3 px-5 bg-gray-100 inline-block font-medium" %>
<%= link_to "Back to companies", companies_path, class: "ml-2 rounded-lg py-3 px-5 bg-gray-100 inline-block font-medium" %>
<%= link_to t('.show'), @company, class: "ml-2 rounded-lg py-3 px-5 bg-gray-100 inline-block font-medium" %>
<%= link_to t('.back'), companies_path, class: "ml-2 rounded-lg py-3 px-5 bg-gray-100 inline-block font-medium" %>
</div>

View File

@@ -1,21 +1,27 @@
<div class="w-full">
<div class="w-full max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
<% if notice.present? %>
<p class="py-2 px-3 bg-green-50 mb-5 text-green-500 font-medium rounded-lg inline-block" id="notice"><%= notice %></p>
<div class="mb-8 mt-4">
<p class="py-3 px-4 bg-green-50 text-green-700 font-medium rounded-lg inline-block" id="notice"><%= notice %></p>
</div>
<% end %>
<% content_for :title, "Companies" %>
<% content_for :title, t('.title') %>
<div class="flex justify-between items-center">
<h1 class="font-bold text-4xl">Companies</h1>
<%= link_to "New company", new_company_path, class: "rounded-lg py-3 px-5 bg-blue-600 text-white block font-medium" %>
<div class="flex justify-between items-center mb-12">
<h1 class="font-bold text-4xl text-gray-900"><%= t('.title') %></h1>
<%= link_to new_company_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 %>
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-5 h-5 mr-2">
<path stroke-linecap="round" stroke-linejoin="round" d="M12 4.5v15m7.5-7.5h-15" />
</svg>
<%= t('.new_company') %>
<% end %>
</div>
<div id="companies" class="min-w-full">
<div id="companies" class="grid gap-6 mb-8">
<% @companies.each do |company| %>
<%= render company %>
<p>
<%= link_to "Show this company", company, class: "ml-2 rounded-lg py-3 px-5 bg-gray-100 inline-block font-medium" %>
</p>
<%= link_to company, class: "block transition-all duration-200 hover:shadow-lg hover:-translate-y-1" do %>
<%= render company %>
<% end %>
<% end %>
</div>
</div>

View File

@@ -1,7 +1,7 @@
<div class="mx-auto md:w-2/3 w-full">
<h1 class="font-bold text-4xl">New company</h1>
<h1 class="font-bold text-4xl"><%= t('.title') %></h1>
<%= render "form", company: @company %>
<%= link_to "Back to companies", companies_path, class: "ml-2 rounded-lg py-3 px-5 bg-gray-100 inline-block font-medium" %>
<%= link_to t('.back'), companies_path, class: "ml-2 rounded-lg py-3 px-5 bg-gray-100 inline-block font-medium" %>
</div>

View File

@@ -6,10 +6,10 @@
<%= render @company %>
<%= link_to "Edit this company", edit_company_path(@company), class: "mt-2 rounded-lg py-3 px-5 bg-gray-100 inline-block font-medium" %>
<%= link_to "Back to companies", companies_path, class: "ml-2 rounded-lg py-3 px-5 bg-gray-100 inline-block font-medium" %>
<%= link_to t('.edit'), edit_company_path(@company), class: "mt-2 rounded-lg py-3 px-5 bg-gray-100 inline-block font-medium" %>
<%= link_to t('.back'), companies_path, class: "ml-2 rounded-lg py-3 px-5 bg-gray-100 inline-block font-medium" %>
<div class="inline-block ml-2">
<%= button_to "Destroy this company", @company, method: :delete, class: "mt-2 rounded-lg py-3 px-5 bg-gray-100 font-medium" %>
<%= button_to t('.destroy'), @company, method: :delete, class: "mt-2 rounded-lg py-3 px-5 bg-gray-100 font-medium" %>
</div>
</div>
</div>