-
Notifications
You must be signed in to change notification settings - Fork 45
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
List formatting #79
Comments
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 Some open questions remain:
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. |
Besides basic example for social networks
as a game developer I'm stuck with localising complex quests descriptions. Example:
or
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: |
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:
|
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) |
By phrase "calculated at runtime" I meant exactly that. Elements themselves and their number can be changed.
👍 |
I ended up opening an issue in this repo, since it's more of a Fluent Design question. See #80. |
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 val = list(
{count($mylist) -> {
[1] $mylist,
[2] $mylist,
[3] $mylist
*[other] concat($mylist, {{count($mylist)} more})
}
}) (pardon my half-remembered fluent syntax) |
Support for list formatting would be extremely useful. I have noticed that you had dropped support for it with reason that it is too complex.
529600f
But complexity can't be a reason to drop it entirely. Now we haven't any alternative.
There is some proposal for list formatting API in ecma402.
https://github.com/tc39/proposal-intl-list-format
It can be an argument to think about reimplementing this functionality.
The text was updated successfully, but these errors were encountered: