Comments (7)
Here's another example from Firefox (source). Thanks to @flodolo for helping me find it.
# %S is the website origin (e.g. www.mozilla.org)
getUserMedia.sharingMenuCamera = %S (camera)
getUserMedia.sharingMenuMicrophone = %S (microphone)
getUserMedia.sharingMenuAudioCapture = %S (tab audio)
getUserMedia.sharingMenuApplication = %S (application)
getUserMedia.sharingMenuScreen = %S (screen)
getUserMedia.sharingMenuWindow = %S (window)
getUserMedia.sharingMenuBrowser = %S (tab)
getUserMedia.sharingMenuCameraMicrophone = %S (camera and microphone)
getUserMedia.sharingMenuCameraMicrophoneApplication = %S (camera, microphone and application)
getUserMedia.sharingMenuCameraMicrophoneScreen = %S (camera, microphone and screen)
getUserMedia.sharingMenuCameraMicrophoneWindow = %S (camera, microphone and window)
getUserMedia.sharingMenuCameraMicrophoneBrowser = %S (camera, microphone and tab)
getUserMedia.sharingMenuCameraAudioCapture = %S (camera and tab audio)
getUserMedia.sharingMenuCameraAudioCaptureApplication = %S (camera, tab audio and application)
getUserMedia.sharingMenuCameraAudioCaptureScreen = %S (camera, tab audio and screen)
getUserMedia.sharingMenuCameraAudioCaptureWindow = %S (camera, tab audio and window)
getUserMedia.sharingMenuCameraAudioCaptureBrowser = %S (camera, tab audio and tab)
getUserMedia.sharingMenuCameraApplication = %S (camera and application)
getUserMedia.sharingMenuCameraScreen = %S (camera and screen)
getUserMedia.sharingMenuCameraWindow = %S (camera and window)
getUserMedia.sharingMenuCameraBrowser = %S (camera and tab)
getUserMedia.sharingMenuMicrophoneApplication = %S (microphone and application)
getUserMedia.sharingMenuMicrophoneScreen = %S (microphone and screen)
getUserMedia.sharingMenuMicrophoneWindow = %S (microphone and window)
getUserMedia.sharingMenuMicrophoneBrowser = %S (microphone and tab)
getUserMedia.sharingMenuAudioCaptureApplication = %S (tab audio and application)
getUserMedia.sharingMenuAudioCaptureScreen = %S (tab audio and screen)
getUserMedia.sharingMenuAudioCaptureWindow = %S (tab audio and window)
getUserMedia.sharingMenuAudioCaptureBrowser = %S (tab audio and tab)
from fluent.
Besides basic example for social networks
"Ann, Peter and other 5 other people liked your photo"
as a game developer I'm stuck with localising complex quests descriptions. Example:
"Collect meat from cows, pigs and sheep."
or
"New dungeons are unlocked on 10, 20 and 30 levels."
It is really hard to maintain such descriptions manually. Parameters are defined in config files or calculated at runtime and can be changed at any moment.
Concerning open questions:
Can lists be used as selectors? - At first glance this isn't a blocker for list formatting feature and can be or not implemented in the future.
If a list is passed in to a Function, should we toString its elements first? - Why not?
Can lists be used as values of named arguments to Functions? - I didn't find named arguments in documentation. Could you give some details?
from fluent.
Does the number of elements in a list vary? In other words, is it "cows, pigs and sheep" for some users and "cows and pigs" or just "cows" for others?
By phrase "calculated at runtime" I meant exactly that. Elements themselves and their number can be changed.
I'll open an issue in the fluent.js repo with a proposed solution.
๐
from fluent.
Thanks for filing this issue!
I removed the list data type because we didn't have clear use-cases for it, it was under-spec'ed and made the JS implementation more complex. The increased complexity stemmed from the fact that the elements of lists should also be valid types in Fluent which made lists monadic in nature.
It's helpful to see interest in bringing it back :) Can you describe your use-case in a little bit more detail?
Some of the recent changes in the implementation of MessageContext
(like projectfluent/fluent.js@8c419b1) should make it easier to implement list types at some point in the future. It hasn't been a priority for us for now.
Some open questions remain:
- Can lists be used as selectors?
- If so, we probably need to solve #4 first.
- If a list is passed in to a Function, should we
toString
its elements first? - Can lists be used as values of named arguments to Functions?
The author of the TC39 proposal you linked is @zbraniecki, Fluent's core contributor :) I'm positive he will be interested in this issue now or when the proposal advances to Stage 3 or 4.
from fluent.
Thanks for the real-life examples!
In your use-cases, does the number of elements in a list vary? In other words, is it "cows, pigs and sheep" for some users and "cows and pigs" or just "cows" for others? If so, the names of animals would likely come in form of a single external argument, like the following:
# The placeable could also be written as LIST($sources).
quest-desc = Collect meat from { $sources }.
This would require two additions to Fluent:
-
External arguments (like
$sources
) would need to accept list-typed data. As I mentioned before, we'd need to specify what happens if someone tries to use an argument like this as a selector. We could start by not supporting list-typed selectors and always choosing the default variant if they're used as selectors none the less. -
The values in
$sources
should be localized. Ideally, we'd have a way to resolve them to other messages in the sameMessageContext
. I think this is doable without any changes to the Fluent Syntax. I'll open an issue in thefluent.js
repo with a proposed solution.
from fluent.
I ended up opening an issue in this repo, since it's more of a Fluent Design question. See #80.
from fluent.
Rust is also finding a need for this. At the moment we pre-format lists using ICU4X, but it gets tricky if you want to sometimes format lists as a, b, c, d, and 5 more
, since ideally we'd be able to do something like:
val = list(
{count($mylist) -> {
[1] $mylist,
[2] $mylist,
[3] $mylist
*[other] concat($mylist, {{count($mylist)} more})
}
})
(pardon my half-remembered fluent syntax)
from fluent.
Related Issues (20)
- Korean markers (์กฐ์ฌ. e.g. ์/๋, ์ด/๊ฐ, ์/๋ฅผ, ์/๊ณผ, ...) support? HOT 2
- reusing terms to create more complex terms HOT 2
- Term's attributes can't be used as variable values HOT 2
- Term's attributes can't be used as placeable HOT 6
- `resolveVariableReference` enforces variables names to be own properties HOT 1
- Allow dots in message identifiers HOT 7
- Select expression breaks if you have dot character on the second line of any branch HOT 2
- Compiling fluent HOT 3
- Documentation on projectfluent.org is not updated HOT 1
- Let's reduce the gap between Fluent and MessageFormat 2
- EVAL builtin function
- Pass variables from app, to a fluent selector HOT 2
- Make `[]` legal in selector HOT 4
- Design a logo (square/circle) for *.ftl file associations HOT 3
- Qt (Linguist) support HOT 1
- Future of Fluent, MessageFormat 2, etc HOT 24
- Proper way to display ordinal numbers HOT 3
- Improve selector usages in the wiki HOT 1
- syntax guide seems to be down HOT 2
- Forward all variables to parameterized term
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 fluent.