Closed SoftVienka closed 7 months ago
Seems the new pluralization here: https://github.com/emsesp/EMS-ESP32/blob/8ef8eeb9ec45c1080b9164ba5ef87e85252d4c19/interface/src/i18n/sk/index.ts#L94-L100 is wrong. Can you help to fix it? In dev-build it is: https://github.com/emsesp/EMS-ESP32/blob/6cab0202415a6f145297812dbd2be46aefe664f1/interface/src/i18n/sk/index.ts#L94-L100
I tried this too, but it also didn't work. So I solved it my way.
NUM_DEVICES: 'Zariadenia - {num} ', NUM_TEMP_SENSORS: 'Teplotné snímače - {num} ', NUM_ANALOG_SENSORS: 'Analógové snímače - {num} ', NUM_DAYS: '{num} d.', NUM_SECONDS: '{num} sek.', NUM_HOURS: '{num} hod.', NUM_MINUTES: '{num} min.',
I slightly adjusted the SK translations. Nothing major, it just reads better.
These plurals
NUM_DEVICES: '{num} Zariaden{{í|ie|ia|ia|í}}', NUM_TEMP_SENSORS: '{num} Teplotn{{ých|ý|é|é|ých}} snímač{{ov||e|e|ov}}', NUM_ANALOG_SENSORS: '{num} Analogov{ých|ý|é|é|ých}} snímač{{ov||e|e|ov}}', NUM_DAYS: '{num} d{{ní|eň|ní|ní|ní}}', NUM_SECONDS: '{num} sek{{únd|unda|undy|undy|únd}}', NUM_HOURS: '{num} hod{{ín|ina|iny|iny|ín}}', NUM_MINUTES: '{num} minú{{t|ta|ty|ty|t}}',
should be correct. I don't know why it doesn't work.
In the Polish translation it is functional.
NUM_DEVICES: '{num} urządze{{ń|nie|nia|nia|ń}} EMS', NUM_TEMP_SENSORS: '{num} czujni{{ków|k|ki|ki|ków}} temperatury', NUM_ANALOG_SENSORS: '{num} inn{{ych|e|e|e|ych}} urządze{{ń|nie|nia(two)|nia|ń}} podłączon{{ych|e|e|e|ych}} do EMS-ESP', NUM_DAYS: '{num} d{{ni|zień|ni|ni|ni}}', NUM_SECONDS: '{num} sekun{{d|da|dy|dy|d}}', NUM_HOURS: '{num} godzi{{n|na|ny|ny|n}}', NUM_MINUTES: '{num} minu{{t|ta|ty|ty|t}}',
It does not like the empty field, it's working with:
NUM_TEMP_SENSORS: '{num} Teplotn{{ých|ý|é|é|ých}} sníma{{čov|č|če|če|čov}}',
NUM_ANALOG_SENSORS: '{num} Analogov{ých|ý|é|é|ých}} sníma{{čov|č|če|če|čov}}',
So there was a dog buried here. Moreover was missing there one compound parenthesis ...Analogov{ých... ...Analogov{{ých... Now it doesn't throw the error anymore.
But ...
It will probably be the same with other plurals.
I tried to transcribe this part of the translation from the Polish translation. Same error. 0-1-2-3-4 OK, 5 or more NO OK.
Could this be a bug in the i18n library that we should report? or is the "dog" somewhere else?
The plurals here have 5 fields, but full spec is 6 fields {{zero, one, two, few, many, other}}
, see https://github.com/ivanhofer/typesafe-i18n/tree/main/packages/runtime#plural
But not all are used, language specific it is matched to fewer cases: https://www.unicode.org/cldr/charts/43/supplemental/language_plural_rules.html
For sk we have {{one, few, may, others}}
, with few
matches 2-4, many
matches flowts and others
matches 0 and 5-up
Please check with 4 cases or use all 6.
Tested: 4 does not work, we have to use all 6 cases. As we have only int numbers, the many
does not matter here, we have only to add the other
for 5 and up.
NUM_DEVICES: '{num} Zariaden{{í|ie|ia|ia|í|í}}',
NUM_TEMP_SENSORS: '{num} Teplotn{{ých|ý|é|é|ých|ých}} sníma{{čov|č|če|če|čov|čov}}',
NUM_ANALOG_SENSORS: '{num} Analogov{{ých|ý|é|é|ých|ých}} sníma{{čov|č|če|če|čov|čov}}',
NUM_DAYS: '{num} d{{ní|eň|ní|ní|ní|ní}}',
NUM_SECONDS: '{num} sek{{únd|unda|undy|undy|únd|únd}}',
NUM_HOURS: '{num} hod{{ín|ina|iny|iny|ín|ín}}',
NUM_MINUTES: '{num} minú{{t|ta|ty|ty|t|t}}',
Good work. Embedded. index.ts.SK2.txt
@SoftVienka Your latest changes are now in the official dev, please check and close this issue if ok.
PROBLEM DESCRIPTION
After clicking Menu -> System, an error message is displayed (only SK language):
3.7.0-dev.0 (ESP32) - no problem.
REQUESTED INFORMATION
Make sure your have performed every step and checked the applicable boxes before submitting your issue. Thank you!
TO REPRODUCE
Set SK language for WebUI
EXPECTED BEHAVIOUR
SCREENSHOTS
ADDITIONAL CONTEXT
(Please, remember to close the issue when the problem has been addressed)