Comments (4)
This escaping is intentional in the translate-toolkit code, see https://github.com/translate/translate/blob/bf3b519010fd6c0f3cd53b210b5e1eb6be33bd8c/translate/storage/fluent.py#L55-L88.
If you feel this behavior should be changed, please open up an issue there.
@henry-torproject might be interested in this as well as an author of the referenced code.
Yes, it is indeed intentional.
The first thing to note is that { "[" }
is a Fluent string literal, so
hud-init-stage-client-load-init-data = { "[" }{ -client }]: Loading
will produce exactly the same string as
hud-init-stage-client-load-init-data = [{ -client }]: Loading
so there should be no change in the end result.
The "[" at the start of a line is reserved in Fluent for selectors. E.g.
my-fluent-string = { $num ->
[one] { $num } item
*[other] { $num } items
}
In your example, the original source is:
my-fluent-string = [ other
Since the "[" does not appear at the start of a line, it is technically valid. But the following are not:
my-fluent-string =
[ other
my-fluent-string = first line
[ second line
my-fluent-string =
first line
[ second line
On weblate, the user does not see the my-fluent-string
line, and only sees everything after the "=" sign. You can think of the weblate input as everything that occurs after the "=" sign minus the indent. So
first line
second line
in the weblate input would become
my-fluent-string =
first line
second line
and simialrly
> [ other
would become
my-fluent-string =
[ other
which is invalid Fluent.
Whilst we could have allowed for exceptions for the special case, it would have appeared inconsistent in the weblate context.
Besides the fact that [ gets replaced with { "[" } in Weblate, after you translate this problematic string, you receive the following error (but it still saves the translation):
Fluent translation syntax
Fluent syntax error: E0005: Expected message "hud-init-stage-client-load-init-data" to have a value or attributes [line 1, column 1].
This is because you need to escape the special "[" character, as in the original string. It would need to be
{ "[" }{ -client }]: Cargando
instead.
In this case, you may prefer to explicitly use
{ "[" }{ -client }{ "]" }: Loading
to make the string more symmetric, even though it is not necessary.
from weblate.
This escaping is intentional in the translate-toolkit code, see https://github.com/translate/translate/blob/bf3b519010fd6c0f3cd53b210b5e1eb6be33bd8c/translate/storage/fluent.py#L55-L88.
If you feel this behavior should be changed, please open up an issue there.
@henry-torproject might be interested in this as well as an author of the referenced code.
from weblate.
The issue you've reported needs to be addressed in the translate-toolkit. Please file the issue there, and include links to any relevant specifications about the formats (if applicable).
from weblate.
Thank you for the clarification.
from weblate.
Related Issues (20)
- Redundant `Sign in to save the translation.` shown in the `Save and stay` button of the glossary term full editor HOT 1
- Lazy-commits not triggered on GET /api/.../file/ when using If-Modified-Since HOT 1
- Hosted weblate tries to push to the wrong repository HOT 5
- `wlc reset` always leads to 'Connection aborted' HOT 2
- Cannot revert the approved strings HOT 6
- The state of the string should be reverted too HOT 6
- CORS_URLS_REGEX in settings_docker.py doesn't make use of URL_PREFIX HOT 1
- Crash when changing review state to Approved HOT 2
- Placeholder mismatch detection HOT 2
- More optimization options HOT 2
- Problem creating new components. HOT 2
- Low Accessibility rate HOT 3
- Server error upon commit/push HOT 2
- Glossary screenshots enhancement HOT 3
- Time to use `build` from `setuptools` instead of `distutils`? HOT 3
- Cannot add project-wide Add-on 'Squash Git commits' HOT 2
- Word counter HOT 3
- Java Properties components fail with project-wide JSON Customize Add-on HOT 2
- Add support for Apple XLIFF HOT 5
- Had to disable Sentry when upgrading to Weblate 5.5 HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from weblate.