smapiot / piral

🚀 Framework for next generation web apps using micro frontends. ⭐️ Star to support our work!
https://piral.io
MIT License
1.68k stars 125 forks source link

`piral-translate`: Do not replace falsy variables with an empty string #651

Closed manuelroemer closed 9 months ago

manuelroemer commented 9 months ago

New Pull Request

For more information, see the CONTRIBUTING guide.

Prerequisites

Please make sure you can check the following boxes:

Type(s) of Changes

Contribution Type

What types of changes does your code introduce? Put an x in all the boxes that apply:

Description

Updates piral-translate so that falsy variables are not replaced with an empty string. This is currently causing issues in an application where we have text like "Number of items: {{number}}.". If the variable number is 0, the final translated text is Number of items: . instead of the expected Number of items: 0..

Remarks

I don't think that this should be breaking in a bad way for anyone, but am happy to be told otherwise..

github-actions[bot] commented 9 months ago

File size impact

Merging fix/piral-translate-do-not-replace-falsy-vars-with-empty-string into develop impact files as follow:

empty-piral (no impact)
Files new size
Unmodified (2) 30 kB (0 B / +0%) :ghost:
Total (2) 30 kB (0 B / +0%) :ghost:
minimal-piral (no impact)
Files new size
Unmodified (2) 278 kB (0 B / +0%) :ghost:
Total (2) 278 kB (0 B / +0%) :ghost:
sample-cross-fx (no impact)
Files new size
Unmodified (3) 2.23 MB (0 B / +0%) :ghost:
Total (3) 2.23 MB (0 B / +0%) :ghost:
sample-piral (+0%)
Files new size
src/samples/sample-piral/dist/release/index.707f14.js 527 kB :baby:
src/samples/sample-piral/dist/release/main.f11ab8.css 170 kB :baby:
src/samples/sample-piral/dist/release/main.27f8ea.css deleted (-170 kB)
src/samples/sample-piral/dist/release/index.1c4ce2.js deleted (-527 kB)
src/samples/sample-piral/dist/release/index.html 490 B (0 B / +0%) :ghost:
Total (5) 697 kB (+30 B / +0%) :arrow_upper_right:
sample-piral-core (no impact)
Files new size
Unmodified (3) 355 kB (0 B / +0%) :ghost:
Total (3) 355 kB (0 B / +0%) :ghost:

Generated by @jsenv/file-size-impact during check-bundle-size#7142912021 on 00539e7