Common words
Print-form snippets that write an amount of money out in words, in Ukrainian, English or German: «одна тисяча двісті тридцять чотири гривні 56 копійок». Other modules' print templates include them; the languages and the currency names live here, so a fix is a module update, not a platform release.
v0.2.0 · 23 installs · free
Print-form snippets that write an amount of money, or a plain quantity, out in words, in Ukrainian, Russian, English or German.
The platform has no number-to-words filter on purpose: the languages and the currency names live in this module, so a fix or a new currency is a module update, not a platform release. A worked template is in common-words-demo.
| Amount, currency | Language | Result |
|---|---|---|
| 1234.56 UAH | uk |
одна тисяча двісті тридцять чотири гривні 56 копійок |
| 1234.56 RUB | ru |
одна тысяча двести тридцать четыре рубля 56 копеек |
| 1234.56 USD | en |
one thousand two hundred thirty-four US dollars 56 cents |
| 1234.56 EUR | de |
eintausendzweihundertvierunddreißig Euro 56 Cent |
Use it in a print template
Set the inputs, then include the snippet. Both lines go into the template that prints the document (an invoice, a receipt, ...), not into this module:
{% assign words_amount = total %}
{% assign words_currency = currency_cd %}
{% assign words_lang = 'en' %}
{% include 'common-words.money' %}
| Input | Required | Meaning |
|---|---|---|
words_amount |
yes | The amount. A numeric field, not text: the server's Liquid engine does not turn a string into a number. A negative amount starts with «мінус» / «минус» / «minus». |
words_currency |
yes | An ISO 4217 code, any case (UAH, usd). |
words_lang |
no | uk (default), ru, en or de. Any other value prints [common-words: unknown language xx] instead of silently writing another language. |
words_cap |
no | true starts the text with a capital letter (One thousand ...). Liquid's own capitalize lowercases the rest of the text, so use this. |
The snippet prints the text and nothing else, so it can sit inside a paragraph or a table cell: <p>Total: {% include 'common-words.money' %}</p>.
Where the values come from
- Amount and currency are fields of the document you print. Use their column codes.
- Language is whatever your document knows: a fixed word (
'de'), a dropdown on the document, a setting. A dropdown prints as its label ("Deutsch"), not its code, so read the code from_raw:{% assign words_lang = _raw.lang %}. - A reference column (a currency picked from a list) prints as its display text. That is the code only if the referenced entity's
toStringis the code; otherwise keep the code in a plain column of the document.
One fixed language
When a form is always in one language, include that snippet directly and skip words_lang:
{% include 'common-words.money_uk' %}
money_uk, money_ru, money_en and money_de take the same words_amount, words_currency and words_cap.
A quantity in words
For a count of things rather than money: «двадцять одна штука», «twenty-one pieces», «einundzwanzig Stück».
{% assign words_number = qty %}
{% assign words_unit = 'штука|штуки|штук' %}
{% assign words_gender = 'f' %}
{% assign words_lang = 'uk' %}
{% include 'common-words.quantity' %}
| Input | Required | Meaning |
|---|---|---|
words_number |
yes | The quantity, a numeric field. A fraction is rounded half up to a whole number; a negative one starts with «мінус» / «минус» / «minus». |
words_unit |
no | The unit's forms joined by |: three for Ukrainian and Russian (1, 2–4, 5+), two for English and German (1, other). One form is used for every number. Without it only the number is written. |
words_gender |
no | m (default), f or n: «один / одна / одне», «один / одна / одно», «ein / eine / ein». English ignores it. |
words_lang, words_cap |
no | As for money. |
words_minor, words_minor_digits, words_minor_gender |
no | Ukrainian and Russian. The fraction in words with its own unit, as 1C's ЧислоПрописью: see below. |
words_decimal, words_unit_fraction |
no | Ukrainian and Russian. The number as a decimal fraction in words: see below. |
| Quantity | Language | Result |
|---|---|---|
21, штука|штуки|штук, f |
uk |
двадцять одна штука |
2, кілограм|кілограми|кілограмів, m |
uk |
два кілограми |
21, штука|штуки|штук, f |
ru |
двадцать одна штука |
21, piece|pieces |
en |
twenty-one pieces |
21, Stück |
de |
einundzwanzig Stück |
quantity_uk, quantity_ru, quantity_en and quantity_de can be included directly, like the money ones. A thousand is always feminine in Ukrainian and Russian («дві тисячі», «две тысячи»), whatever words_gender says.
A fraction with its own unit (Ukrainian, Russian)
A weight is written as 1C's ЧислоПрописью(weight, , "кг.,кг.,кг.,м,г.,г.,г.,м,3") writes it: the whole number with its unit, then the fraction in words with its own:
{% assign words_number = weight %}
{% assign words_unit = 'кг.' %}
{% assign words_minor = 'г.' %}
{% assign words_minor_digits = 3 %}
{% assign words_cap = true %}
{% include 'common-words.quantity_ru' %}
| Input | Meaning |
|---|---|
words_minor |
The fraction's unit, forms as for words_unit: 'г.', 'грамм|грамма|граммов'. |
words_minor_digits |
1 to 6: the fraction is rounded half up to that many digits and written in words. Without it the number is rounded to a whole and words_minor is ignored. |
words_minor_gender |
The fraction unit's gender, as words_gender. |
| Quantity | Result |
|---|---|
1250.5, кг. / г., 3, cap |
Одна тысяча двести пятьдесят кг. пятьсот г. |
12, кг. / г., 3 |
двенадцать кг. ноль г. |
2.002, килограмм|… / грамм|…, 3 |
два килограмма два грамма |
A zero fraction is written («ноль г.»), as 1C does. A fraction that rounds up to a whole carries: 0.9996 with 3 digits is «один кг. ноль г.». quantity_uk takes the same inputs: «одна тисяча двісті п'ятдесят кг п'ятсот г».
A decimal fraction (Ukrainian, Russian)
A weight in tonnes on a consignment note, «масою брутто, т (словами)», is a decimal fraction in words:
{% assign words_number = gross_t %}
{% assign words_unit = 'тонна|тонни|тонн' %}
{% assign words_gender = 'f' %}
{% assign words_decimal = true %}
{% include 'common-words.quantity_uk' %}
| Input | Meaning |
|---|---|
words_decimal |
true: up to three digits, rounded half up, trailing zeros dropped. The whole part reads «ціла / цілих» («целая / целых»), the fraction «десята / сота / тисячна» («десятая / сотая / тысячная»), both feminine. A whole number is written as without it. Wins over words_minor. |
words_unit_fraction |
The unit after a fraction, which takes the genitive singular. By default the 2–4 form of words_unit, right for «тонни», «килограмма»; a Ukrainian masculine unit needs it: 'кілограма'. |
| Quantity | Language | Result |
|---|---|---|
21.12, тонна|тонни|тонн, f |
uk |
двадцять одна ціла дванадцять сотих тонни |
| 0.345 | uk |
нуль цілих триста сорок п'ять тисячних |
| 1.001 | uk |
одна ціла одна тисячна |
3, тонна|тонни|тонн, f |
uk |
три тонни |
2.5, килограмм|килограмма|килограммов |
ru |
две целых пять десятых килограмма |
The text follows the grammar, not 1C's own: 1C writes 1.001 as «одна ціла один тисячна».
What it does
- Minor units are written as two digits with their name («56 копійок», «56 cents», «56 Cent»). A currency with no minor unit (JPY) has none, and the amount is rounded half up to a whole number: 1234.56 JPY is «one thousand two hundred thirty-five yen».
- Rounding is half up to the minor unit, on the decimal value: 960.015 is «… 02 копійки» in print and in the preview alike, although 960.015 is 960.01499… as a binary float in the browser.
- Zero is spelled («нуль гривень 00 копійок», «ноль рублей 00 копеек», «zero ...», «null ...»).
- Grammar follows each language: Ukrainian picks the singular, the 2–4 form or the plural by the last digits and the noun's gender («одна гривня», «дві гривні», «п'ять гривень», «дві тисячі»), and Russian the same way («один рубль», «два рубля», «пять рублей», «две тысячи»); English pluralises except for 1; German writes below a million as one word, uses «eine Million», and says «ein Euro» / «eine Hrywnja» for 1.
- Up to 999 trillion. With a fraction, exact up to 100 trillion: above that the server's
moduloloses the fraction. - A currency the module does not list prints the number and its code, minor units in digits: «three SEK 00».
Currencies
UAH, USD, EUR, GBP, PLN, CHF, CAD, AUD, JPY, RUB.
Add a currency
Each language file starts with a case on the currency code. Add a branch to each of print_templates/money_uk.html, money_en.html and money_de.html:
{%- when 'CZK' -%}
{%- assign w_unit = 'koruna|koruny|korun' -%}
{%- assign w_minor = 'halíř|haléře|haléřů' -%}
w_unit/w_minorare the noun forms joined by|. Ukrainian takes three (one / few / many: 1, 2–4, 5+), English and German two (one / other). A noun that never changes takes one form («євро», «Euro»).w_fem = true(Ukrainian) orw_gender = 'f'/'n'(German) when the unit is feminine / neuter: it decides «одна» / «eine» and «ein».w_dec = 0when the currency has no minor unit.- Leave
w_minorout when there is no minor-unit word to print.
Bump the module version in manifest.json and add a changelog/{version}.md. Tenants get the new text on the next module upgrade.
Add a language
- Copy
print_templates/money_en.html(two noun forms) ormoney_uk.html(three) tomoney_xx.htmland rewrite the number words, the group assembly and the currencycasefor that language. The skeleton (splitting the amount into whole and minor units, the sign, the loop over the thousands groups, the capital letter) stays; the grammar is what changes. - Do the same for
quantity_xx.html, fromquantity_en.htmlorquantity_uk.html. - Declare both in
ui/print_templates.jsonas asnippetwith"file": "money_xx.html"/"quantity_xx.html". - Add a
when 'xx'line toprint_templates/money.htmlandquantity.html. - Add cases for it to
clients/packages/data-ui/test/common-words.cases.json(lang,v,cur,expected) andcommon-words.quantity-cases.json(lang,v,unit,gender,expected) and run both test suites below. Check everyexpectedagainst the language's grammar by hand: a wrong value in the file is a wrong value in both engines.
Write snippets for both engines
A snippet runs in two Liquid engines: Scriban on the server (print) and LiquidJS in the browser (preview and print from a card). Output must be identical, so:
- No
flooron the amount. Scriban'sfloorgoes through a double and rounds a big amount up. Split withmodulo, snap the whole part withroundand take the fraction again by subtraction; LiquidJS 10.30 computesmoduloas((v % 1) + 1) % 1, so 0.44 | modulo: 1 is 0.43999999999999995. Round the fraction on its digits, not by arithmetic. Take the number's text (append: '', a comma read as a point,5e-7expanded) and round half up on the digit after the last one kept: a double's text is the shortest decimal that stands for it, so 960.015 (960.01499… as a double) reads «015» and rounds to 02, 1000000000.0049999 reads «0049999» and rounds to 00, and the server's decimals print exactly. No correction for float noise, since none is added — any epsilon that rescues a tie also lifts a value just below one (see the top of anymoney_xx.html). - No number from
splitorslice. Scriban keeps it a string and"1000" | plus: 0concatenates. Branch withcase/if, or useforloopand(0..n)ranges. - No
{%- comment -%}with trim dashes. Scriban prints the comment. Use{% comment %}...{% endcomment -%}. - No parentheses in conditions; Liquid has none. Use nested
if. - Trim whitespace with
{%- ... -%}so the snippet prints only the text.
Tests
The same case list runs against both engines:
# server: Scriban
cd server && dotnet test tests/dForge.Api.Tests --filter "FullyQualifiedName~CommonWords"
# client: LiquidJS
cd clients/packages/data-ui && pnpm exec vitest run src/lib/print/common-words.test.ts
The server run also installs the module into a fresh tenant and checks that every stored snippet is the file shipped here.
0.2.0Oct 29, 2026
Russian, fractions in words
For users
- Print forms can write an amount and a quantity out in Russian: «одна тысяча двести тридцать четыре рубля 56 копеек», «двадцать одна штука».
- A Ukrainian or Russian quantity can write its fraction in words with its own unit, as 1C's ЧислоПрописью does for a weight: «одна тысяча двести пятьдесят кг. пятьсот г.».
- A Ukrainian or Russian quantity can be written as a decimal fraction, up to three digits, as the gross weight of a consignment note: «двадцять одна ціла дванадцять сотих тони». The text follows the grammar where 1C does not: 1.001 is «одна ціла одна тисячна», 1C writes «один тисячна».
For developers
words_lang = 'ru'incommon-words.moneyandcommon-words.quantity;money_ruandquantity_rucan be included directly. Inputs as for Ukrainian, three noun forms (1, 2–4, 5+).quantity_ukandquantity_rualso takewords_minor(the fraction's unit forms),words_minor_digits(1 to 6) andwords_minor_gender. Withwords_minor_digitsset the fraction is rounded half up to those digits and written in words, «ноль г.» when it is zero; without it the number is rounded to a whole as before:{% assign words_number = weight %}{% assign words_unit = 'кг.' %}{% assign words_minor = 'г.' %}{% assign words_minor_digits = 3 %}{% assign words_cap = true %}{% include 'common-words.quantity_ru' %}words_decimal = truewrites the number as a decimal fraction: rounded half up to three digits, trailing zeros dropped (0.340 is «тридцять чотири сотих»), «ціла / цілих» after the whole and «десята / сота / тисячна» after the fraction, both feminine; a whole number stays «три». The unit comes once at the end, in the 2–4 form, orwords_unit_fractionwhen the genitive singular differs (Ukrainian masculine: 'кілограма'). It wins overwords_minor.English and German take neither the minor-unit nor the decimal inputs yet.
Fixed
- An amount below one printed «трильйонів гривень 44 копійки» or nothing for its whole part, instead of «нуль гривень 44 копійки», in every language on LiquidJS 10.30 (the preview and print from a card): that version computes
moduloas((v % 1) + 1) % 1, which leaves float noise. The whole part is now snapped withround. - Kopecks rounded down on an exact tie in the browser: 960.015 printed «01 копійка» instead of «02 копійки», because 960.015 is 960.01499… as a binary float. The fraction is now rounded on the digits of the number's text, the shortest decimal a double stands for, so print and preview agree with the decimal value both on a tie and just below one: 1000000000.0049999 is «00», 1000000000.005 is «01», and a whole number keeps a zero fraction at any number of digits.
0.1.1Oct 18, 2026
Quantity in words
For users
- Print forms can write a quantity out in words, in Ukrainian, English or German: «двадцять одна штука», «twenty-one pieces», «einundzwanzig Stück». The unit's name agrees with the number.
For developers
Snippet
common-words.quantitypicks the language bywords_lang(ukby default);quantity_uk,quantity_enandquantity_decan be included directly. Inputs:words_number(a number; a fraction is rounded half up), optionallywords_unit(the unit's forms joined by|: three for Ukrainian, two for English and German),words_gender(mdefault,f,n— «один / одна / одне», «ein / eine») andwords_cap:{% assign words_number = qty %}{% assign words_unit = 'штука|штуки|штук' %}{% assign words_gender = 'f' %}{% include 'common-words.quantity_uk' %}Without
words_unitonly the number is written. Cases live inclients/packages/data-ui/test/common-words.quantity-cases.json, run by both engines.
0.1.0Oct 18, 2026
Amounts in words
For users
- Print forms can write an amount out in words, in Ukrainian, English or German: «одна тисяча двісті тридцять чотири гривні 56 копійок», «one thousand two hundred thirty-four hryvnias 56 kopiykas», «eintausendzweihundertvierunddreißig Hrywnja 56 Kopeken».
- UAH, USD, EUR, GBP, PLN, CHF, CAD, AUD, JPY and RUB have their names; another currency prints its code after the number.
For developers
Snippet
common-words.moneypicks the language bywords_lang(ukby default);money_uk,money_enandmoney_decan be included directly. Inputs:words_amount(a number),words_currency(an ISO 4217 code, any case), optionallywords_capfor a capital first letter:{% assign words_amount = total %}{% assign words_currency = currency_cd %}{% assign words_lang = 'en' %}{% include 'common-words.money' %}Plain Liquid, no platform filter: the server (Scriban) and the preview (LiquidJS) run the same files, and one case list in
clients/packages/data-ui/test/common-words.cases.jsonholds both to the same output in all three languages.Up to 999 trillion; the minor units are two digits (none for JPY), rounded half up. A currency is added or renamed in the
caseat the top of eachprint_templates/money_xx.html. The modulecommon-words-demois a worked example.
Browse the full
module catalog.
Every module is metadata — install it in one click, then change anything.