mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Currently the php function `number_format` is used to format currencies. This is problematic as we have to figure out different things for different currencies ourselves. These formats are determined based on the libc's locale functions. The issue arises where an OS doesn't have the proper locales installed, or, in some cases, it's not supported (see below on multiple issues). This addresses this issue by using the php-intl extensions to format the numbers based on the locale. The extension is already a requirement in `composer.json`. The solution does not rely on `LC_MONETARY` from the underlying libc (which in Alpine Linux's case, which uses musl, is not supported as of yet). List of issues that are related and would potentially be fixed using this PR: - #2298 - #2946 - #3070 - #3306 - #3519
66 lines
2.7 KiB
Twig
66 lines
2.7 KiB
Twig
// date ranges
|
|
var ranges = {}
|
|
{% for title, range in dateRangeConfig.ranges %}
|
|
ranges["{{ title }}"] = [moment("{{ range[0].format('Y-m-d') }}"), moment("{{ range[1].format('Y-m-d') }}")];
|
|
{% endfor %}
|
|
|
|
// date range meta configuration
|
|
var dateRangeMeta = {
|
|
title: "{{ dateRangeTitle }}",
|
|
uri: "{{ route('daterange') }}",
|
|
labels: {
|
|
apply: "{{ 'apply'|_ }}",
|
|
cancel: "{{ 'cancel'|_ }}",
|
|
from: "{{ 'from'|_ }}",
|
|
to: "{{ 'to'|_ }}",
|
|
customRange: "{{ 'customRange'|_ }}"
|
|
}
|
|
};
|
|
|
|
// date range actual configuration:
|
|
var dateRangeConfig = {
|
|
startDate: moment("{{ dateRangeConfig.start }}"),
|
|
endDate: moment("{{ dateRangeConfig.end }}"),
|
|
ranges: ranges
|
|
|
|
};
|
|
|
|
var uid = "{{ uid }}";
|
|
var language = "{{ language|escape }}";
|
|
var currencyCode = '{{ currencyCode|escape('js') }}';
|
|
var currencySymbol = '{{ currencySymbol|escape('js') }}';
|
|
var mon_decimal_point = "{{ accountingLocaleInfo.mon_decimal_point|escape('js') }}";
|
|
var mon_thousands_sep = "{{ accountingLocaleInfo.mon_thousands_sep|escape('js') }}";
|
|
var frac_digits = {{ accountingLocaleInfo.frac_digits }};
|
|
var noDataForChart = '{{ trans('firefly.no_data_for_chart')|escape('js') }}';
|
|
var showFullList = '{{ trans('firefly.show_full_list')|escape('js') }}';
|
|
var showOnlyTop = '{{ trans('firefly.show_only_top',{number:listLength})|escape('js') }}';
|
|
var accountingConfig = {{ accountingLocaleInfo.format|json_encode|raw }};
|
|
var token = '{{ csrf_token() }}';
|
|
var sessionStart = '{{ session('start').format('Y-m-d') }}';
|
|
var sessionEnd = '{{ session('end').format('Y-m-d') }}';
|
|
var todayText = ' {{ trans('firefly.today')|escape('js') }}';
|
|
|
|
// some formatting stuff:
|
|
var month_and_day_js = "{{ trans('config.month_and_day_js') }}";
|
|
var acc_config_new = {format: accountingConfig};
|
|
|
|
// strings and translations used often:
|
|
var helpPageTitle = "{{ trans('firefly.help_for_this_page')|escape('js') }}";
|
|
var noHelpForPage = "{{ trans('firefly.no_help_could_be_found')|escape('js') }}";
|
|
var noHelpForPageTitle = "{{ trans('firefly.no_help_title')|escape('js') }}";
|
|
|
|
var edit_selected_txt = "{{ trans('firefly.mass_edit')|escape('js') }}";
|
|
var edit_bulk_selected_txt = "{{ trans('firefly.bulk_edit')|escape('js') }}";
|
|
var delete_selected_txt = "{{ trans('firefly.mass_delete')|escape('js') }}";
|
|
|
|
var mass_edit_url = '{{ route('transactions.mass.edit', ['']) }}';
|
|
var bulk_edit_url = '{{ route('transactions.bulk.edit', ['']) }}';
|
|
var mass_delete_url = '{{ route('transactions.mass.delete', ['']) }}';
|
|
|
|
// for demo:
|
|
var nextLabel = "{{ trans('firefly.intro_next_label')|escape('js') }}";
|
|
var prevLabel = "{{ trans('firefly.intro_prev_label')|escape('js') }}";
|
|
var skipLabel = "{{ trans('firefly.intro_skip_label')|escape('js') }}";
|
|
var doneLabel = "{{ trans('firefly.intro_done_label')|escape('js') }}";
|