mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2024-11-28 09:24:24 +01:00
[bug] invoices are not generated in test/development if the configured locale is composed
Eg. If locale is fr-CA, it was crashing. If locale was only fr, is was working. Now, composed locales print the watermark using the base locale and hour_minute format is fetched from the base locale
This commit is contained in:
parent
ff40c98dcb
commit
7ac119d4cf
@ -9,6 +9,7 @@
|
||||
- Fix a bug: the event themes are not kept when editing the event again
|
||||
- Fix a bug: the count of successfully updated events was not correct
|
||||
- Fix a bug: german watermark was missing
|
||||
- Fix a bug: invoices are not generated in test/development if the configured locale is composed (eg. fr-CA)
|
||||
- Fix a security issue: updated underscore to 1.12.1 to fix [CVE-2021-23358](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-23358)
|
||||
- Fix a security issue: updated lodash to 4.17.21 to fix [CVE-2021-23337](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-23337)
|
||||
- Fix a security issue: updated url-parse to 1.5.1 to fix [CVE-2021-27515](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-27515)
|
||||
|
@ -4,7 +4,6 @@
|
||||
class API::TranslationsController < API::ApiController
|
||||
before_action :set_locale
|
||||
|
||||
|
||||
def show
|
||||
translations = I18n.t params[:state]
|
||||
if translations.class.name == String.name && translations.start_with?('translation missing')
|
||||
@ -16,6 +15,8 @@ class API::TranslationsController < API::ApiController
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def set_locale
|
||||
I18n.locale = params[:locale] || I18n.default_locale
|
||||
end
|
||||
|
@ -353,7 +353,7 @@ class PDF::Invoice < Prawn::Document
|
||||
|
||||
transparent(0.1) do
|
||||
rotate(45, origin: [0, 0]) do
|
||||
image "#{Rails.root}/app/pdfs/data/watermark-#{I18n.locale}.png", at: [90, 150]
|
||||
image "#{Rails.root}/app/pdfs/data/watermark-#{I18n.default_locale}.png", at: [90, 150]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -126,7 +126,7 @@ class PDF::PaymentSchedule < Prawn::Document
|
||||
|
||||
transparent(0.1) do
|
||||
rotate(45, origin: [0, 0]) do
|
||||
image "#{Rails.root}/app/pdfs/data/watermark-#{I18n.locale}.png", at: [90, 150]
|
||||
image "#{Rails.root}/app/pdfs/data/watermark-#{I18n.default_locale}.png", at: [90, 150]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -1,7 +1,9 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
json.title notification.notification_type
|
||||
amount = notification.attached_object.amount
|
||||
json.description t('.wallet_is_credited',
|
||||
AMOUNT: number_to_currency(amount),
|
||||
USER: notification.attached_object.wallet.user&.profile&.full_name || t('api.notifications.deleted_user'),
|
||||
ADMIN: notification.attached_object.user&.profile&.full_name || t('api.notifications.deleted_user'))
|
||||
AMOUNT: number_to_currency(amount),
|
||||
USER: notification.attached_object.wallet.user&.profile&.full_name || t('api.notifications.deleted_user'),
|
||||
ADMIN: notification.attached_object.user&.profile&.full_name || t('api.notifications.deleted_user'))
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
# List of all allowed values for RAILS_LOCALE
|
||||
I18n.config.available_locales += %i[de de-AT de-CH de-DE
|
||||
en en-AU-CA en-GB en-IE en-IN en-NZ en-US en-ZA
|
||||
en en-AU en-CA en-GB en-IE en-IN en-NZ en-US en-ZA
|
||||
fr fa-CA fr-CH fr-CM fr-FR
|
||||
es es-419 es-AR es-CL es-CO es-CR es-DO es-EC es-ES es-MX es-PA es-PE es-US es-VE
|
||||
pt pt-BR
|
||||
@ -14,5 +14,5 @@ I18n.config.available_locales += %i[de de-AT de-CH de-DE
|
||||
#
|
||||
# /!\ ALL locales SHOULD be configured accordingly with the default_locale. /!\
|
||||
#
|
||||
I18n.config.default_locale = Rails.application.secrets.rails_locale
|
||||
I18n.config.default_locale = Rails.application.secrets.rails_locale.to_s.split('-')[0]
|
||||
I18n.config.locale = Rails.application.secrets.rails_locale
|
||||
|
5
config/locales/base.de.yml
Normal file
5
config/locales/base.de.yml
Normal file
@ -0,0 +1,5 @@
|
||||
de:
|
||||
time:
|
||||
formats:
|
||||
# See http://apidock.com/ruby/DateTime/strftime for a list of available directives
|
||||
hour_minute: "%I:%M %p"
|
@ -77,6 +77,9 @@ You will also need to translate the invoice watermark, located in `app/pdfs/data
|
||||
You'll find there the [GIMP source of the image](app/pdfs/data/watermark.xcf), which is using [Rubik Mono One](https://fonts.google.com/specimen/Rubik+Mono+One) as font.
|
||||
Use it to generate a similar localised PNG image which keep the default image size, as PDF are not responsive.
|
||||
|
||||
Also, please create a [base.LOCALE.yml](../config/locales/base.en.yml) and fill it with the time-only format in use in your locale.
|
||||
|
||||
Finally, add your new locale and its derivatives to the `available_locales` array in [initializers/locale.rb](../config/initializers/locale.rb) to make it available in Fab-manager.
|
||||
|
||||
<a name="configuration"></a>
|
||||
## Configuration
|
||||
|
Loading…
Reference in New Issue
Block a user