Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Conversation

manuelroemer
Copy link
Member

New Pull Request

For more information, see the CONTRIBUTING guide.

Prerequisites

Please make sure you can check the following boxes:

  • I have read the CONTRIBUTING document
  • My code follows the code style of this project
  • All new and existing tests passed

Type(s) of Changes

Contribution Type

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

  • Bug fix (non-breaking change which fixes an issue, please reference the issue id)
  • New feature (non-breaking change which adds functionality, make sure to open an associated issue first)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • I have updated the documentation accordingly
  • I have added tests to cover my changes

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..

Copy link

github-actions bot commented Dec 8, 2023

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%) 👻
Total (2) 30 kB (0 B / +0%) 👻
minimal-piral (no impact)
Files new size
Unmodified (2) 278 kB (0 B / +0%) 👻
Total (2) 278 kB (0 B / +0%) 👻
sample-cross-fx (no impact)
Files new size
Unmodified (3) 2.23 MB (0 B / +0%) 👻
Total (3) 2.23 MB (0 B / +0%) 👻
sample-piral (+0%)
Files new size
src/samples/sample-piral/dist/release/index.707f14.js 527 kB 👶
src/samples/sample-piral/dist/release/main.f11ab8.css 170 kB 👶
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%) 👻
Total (5) 697 kB (+30 B / +0%) ↗️
sample-piral-core (no impact)
Files new size
Unmodified (3) 355 kB (0 B / +0%) 👻
Total (3) 355 kB (0 B / +0%) 👻
Generated by @jsenv/file-size-impact during check-bundle-size#7142912021 on 00539e7

Copy link
Contributor

@FlorianRappl FlorianRappl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - thanks for the fix!

@FlorianRappl FlorianRappl added bug Something isn't working plugin Covered by an opt-in plugin for Piral. labels Dec 8, 2023
@FlorianRappl FlorianRappl added this to the 1.4.0 milestone Dec 8, 2023
@FlorianRappl FlorianRappl merged commit e6c8a51 into develop Dec 8, 2023
6 checks passed
@manuelroemer manuelroemer deleted the fix/piral-translate-do-not-replace-falsy-vars-with-empty-string branch December 8, 2023 17:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working plugin Covered by an opt-in plugin for Piral.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants