@autobusal/operator-routes 1.3.2 → 1.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +10 -0
- package/Manage.tsx +1 -1
- package/package.json +1 -1
- package/utilities.tsx +32 -10
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.3.3
|
|
4
|
+
|
|
5
|
+
### Fixed
|
|
6
|
+
|
|
7
|
+
- **The ticket-language dropdown offered a country code and three options.**
|
|
8
|
+
It listed the two content languages plus Greek as `gr` - the code for the
|
|
9
|
+
country; the language is `el` - so an operator choosing it got English
|
|
10
|
+
tickets and no error to say so. Now all fifteen languages the API can
|
|
11
|
+
print, under their own names and their real codes.
|
|
12
|
+
|
|
3
13
|
## 1.3.2
|
|
4
14
|
|
|
5
15
|
### Added
|
package/Manage.tsx
CHANGED
|
@@ -155,7 +155,7 @@ const Manage = ({ url, t }: Props): JSX.Element => {
|
|
|
155
155
|
label: t('operator_routes.manage.language', { ns: 'common' }),
|
|
156
156
|
name: 'language',
|
|
157
157
|
type: 'select',
|
|
158
|
-
values: getLanguagesExtended(),
|
|
158
|
+
values: getLanguagesExtended(t),
|
|
159
159
|
value: data?.language ?? 'en',
|
|
160
160
|
rules: 'required'
|
|
161
161
|
}, {
|
package/package.json
CHANGED
package/utilities.tsx
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { TFunction } from 'i18next';
|
|
2
2
|
import { IoGlobeOutline } from 'react-icons/io5';
|
|
3
|
-
import { getLanguages } from '@autobusal/utilities';
|
|
4
3
|
import { DropdownData } from '@autobusal/providers/types/other';
|
|
5
4
|
import { ViewData } from '@autobusal/common/Viewer/types';
|
|
6
5
|
|
|
@@ -34,16 +33,39 @@ const getOptionsTypes = (t: TFunction<'common'>): DropdownData[] => ([
|
|
|
34
33
|
}
|
|
35
34
|
]);
|
|
36
35
|
|
|
37
|
-
|
|
38
|
-
|
|
36
|
+
/**
|
|
37
|
+
* The languages a TICKET can be printed in.
|
|
38
|
+
*
|
|
39
|
+
* Edited: Ferjolt Ozuni - Date: 2026-08-07
|
|
40
|
+
*
|
|
41
|
+
* This used to be the two CONTENT languages plus Greek bolted on as 'gr'.
|
|
42
|
+
* Two things were wrong with that.
|
|
43
|
+
*
|
|
44
|
+
* 'gr' is the country code for Greece; the language code is 'el'. The API
|
|
45
|
+
* resolves this value to a directory under lang/, there is no lang/gr, so an
|
|
46
|
+
* operator who picked "Gr" got English tickets and no error anywhere to say
|
|
47
|
+
* so. One route in the database had the same fault spelled 'al' for Albanian
|
|
48
|
+
* (which is 'sq') - see the 2026_08_07_150000 migration.
|
|
49
|
+
*
|
|
50
|
+
* And the list was three long while the API ships ticket translations in
|
|
51
|
+
* fifteen. An operator running a Tirana-Milan coach could not choose Italian
|
|
52
|
+
* for a document their passengers have to read at a border.
|
|
53
|
+
*
|
|
54
|
+
* Named from `languages.*`, which already holds all fifteen under their
|
|
55
|
+
* correct codes and in their own language - so the codes cannot drift from
|
|
56
|
+
* the ones the API accepts, and an operator picks "Italiano" rather than
|
|
57
|
+
* decoding "It".
|
|
58
|
+
*/
|
|
59
|
+
const TICKET_LANGUAGES = [
|
|
60
|
+
'sq', 'en', 'bg', 'bs', 'de', 'el', 'es', 'fr', 'hr', 'it', 'me', 'mk', 'ro', 'sl', 'sr'
|
|
61
|
+
];
|
|
39
62
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
id
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
};
|
|
63
|
+
export const getLanguagesExtended = (t: TFunction<'normal'>): DropdownData[] => (
|
|
64
|
+
TICKET_LANGUAGES.map(id => ({
|
|
65
|
+
id,
|
|
66
|
+
name: t(`languages.${ id }`, { ns: 'common' })
|
|
67
|
+
}))
|
|
68
|
+
);
|
|
47
69
|
|
|
48
70
|
export const getTemplates = (t: TFunction<'normal'>): DropdownData[] => ([
|
|
49
71
|
{
|