mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2024-11-22 08:46:39 -06:00
f16498a8a7
Changes include: 1) Remove underscore-string and sprintf-js packages as we were using only %s. Instead, added a function to do the same. Also changed gettext to behave like sprintf directly. 2) backgrid.sizeable.columns was not used anywhere, removed. @babel/polyfill is deprecated, replaced it with core-js. 3) Moved few css to make sure they get minified and bundled. 4) Added Flask-Compress to send static files as compressed gzip. This will reduce network traffic and improve initial load time for pgAdmin. 5) Split few JS files to make code reusable. 6) Lazy load few modules like leaflet, wkx is required only if geometry viewer is opened. snapsvg loaded only when explain plan is executed. This will improve sqleditor initial opening time. Reviewed By: Khushboo Vashi Fixes #4701
52 lines
1.7 KiB
JavaScript
52 lines
1.7 KiB
JavaScript
//////////////////////////////////////////////////////////////////////////
|
|
//
|
|
// pgAdmin 4 - PostgreSQL Tools
|
|
//
|
|
// Copyright (C) 2013 - 2019, The pgAdmin Development Team
|
|
// This software is released under the PostgreSQL Licence
|
|
//
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
import gettext from 'sources/gettext';
|
|
import translations from 'translations';
|
|
|
|
describe('translate', function () {
|
|
describe('when there is no translation', function () {
|
|
it('returns the original string', function () {
|
|
expect(gettext('something else to be translated')).toEqual('something' +
|
|
' else to be translated');
|
|
});
|
|
|
|
describe('when there are substitutions', function () {
|
|
it('interpolates a substitution', function () {
|
|
expect(gettext('translate text for %s', 'Sarah')).toEqual('translate text for Sarah');
|
|
});
|
|
|
|
it('interpolates multiple substitutions', function () {
|
|
expect(
|
|
gettext('translate \'%s\' for %s', 'constitution', 'Sarah')
|
|
).toEqual('translate \'constitution\' for Sarah');
|
|
});
|
|
});
|
|
|
|
});
|
|
|
|
describe('when there is a translation', function () {
|
|
beforeEach(function () {
|
|
translations['something to be translated'] = 'etwas zum uebersetzen';
|
|
translations['another translation for %s'] = 'eine weitere Uebersetzung fuer %s';
|
|
});
|
|
|
|
it('returns the translation', function () {
|
|
expect(gettext('something to be translated')).toEqual('etwas zum uebersetzen');
|
|
});
|
|
|
|
describe('when there is a substitution', function () {
|
|
it('interpolates the substitution', function () {
|
|
expect(gettext('another translation for %s', 'Sarah'))
|
|
.toEqual('eine weitere Uebersetzung fuer Sarah');
|
|
});
|
|
});
|
|
});
|
|
});
|