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

chore: Prepare 3.0.0 release #752

Merged
merged 1 commit into from
May 2, 2024
Merged

chore: Prepare 3.0.0 release #752

merged 1 commit into from
May 2, 2024

Conversation

susnux
Copy link
Contributor

@susnux susnux commented May 2, 2024

3.0.0 - 2024-05-02

Breaking changes

Instead of also sanitizing the replacing variables, now only the result is sanitized, see pull request #648.

This will improve the performance if multiple placeholders are used and it allows this,
while the string is still sanitized:

t(
	`See {linkstart}documentation{linkend}`,
	{
		linkstart: '<a ...>',
		linkend: '</a>',
	},
	// No number
	undefined,
	{
		// Do not escape the result as we want the HTML anchor element
		escape: false,
	}
)

Added

  • feat: export aliases t and n for translate and translatePlural

Fixed

  • fix!: Only sanitize the result string when replacing variables

Changed

  • Update NPM to latest LTS v10
  • Migrate to vite for transpiling and vitest for testing
  • chore: Added more tests for special cases on plural forms
  • chore(deps): Bump tough-cookie to 4.1.3
  • chore(deps): Bump postcss to 8.4.31
  • chore(deps): Bump @nextcloud/typings to 1.8.0
  • chore(deps): Bump dompurify to 3.1.1
  • chore(deps): Bump @nextcloud/router to 3.0.1

CHANGELOG.md Outdated Show resolved Hide resolved
[Full Changelog](https://github.com/nextcloud-libraries/nextcloud-l10n/compare/v2.2.0...v3.0.0)

### Breaking changes
Instead of also sanitizing the replacing variables, now only the result is sanitized, see [pull request #648](https://github.com/nextcloud-libraries/nextcloud-l10n/pull/648).
Copy link
Contributor

Choose a reason for hiding this comment

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

While I see the usecase, it's very problematic when a string contains 2 inputs that are user input 🙈
Maybe a second option would be better? 🤔

Copy link
Contributor Author

@susnux susnux May 2, 2024

Choose a reason for hiding this comment

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

We can also add e.g. this API:

const userinput = '...'
t(
    'foo',
    '{a}link to {userinput}{end_a}',
    {
        a: {
            value: '<a>',
            escape: false,
        },
        end_a: {
            value: '</a>',
            escape: false,
        },
        userinput,
    },
)

Meaning options per placeholder

Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
@skjnldsv skjnldsv merged commit d5e0897 into main May 2, 2024
12 checks passed
@skjnldsv skjnldsv deleted the chore/3-0-0 branch May 2, 2024 16:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants