mirror of
https://gitlab.com/fabinfra/fabaccess/fabaccess-api.git
synced 2025-03-12 23:01:47 +01:00
47 lines
2.4 KiB
Cap'n Proto
47 lines
2.4 KiB
Cap'n Proto
@0xed0c02f41fea6b5a;
|
|
|
|
interface L10NString {
|
|
# Any string type that is intended to be displayed to an user that is more than an identifier to
|
|
# be used as-is must be able to be localized into the users preferred language. This includes
|
|
# description, help messages, etc. but of course does not extend to usernames.
|
|
# TODO: Potentially make generic over the localized content (e.g. dates)? Can be done after the
|
|
# fact without braking protocol, so no big issue.
|
|
|
|
get @0 ( lang :Text ) -> ( lang :Text, content :Text );
|
|
# Retrieve the string in the given locale. The input parameter MUST be a RFC5646-formatted
|
|
# locale identifier (e.g: "en-US", "de-DE", "az-Arab-IR").
|
|
# A server MUST set the outputs `lang` to the exact tag that the content it sends was written in
|
|
# and `content` to the localized string.
|
|
# If a server can't find a localized version it SHOULD try to substitute it. Substitution SHOULD
|
|
# only search for close matches, e.g. returning "en-UK" for a string requested in "en-US" or
|
|
# returning "es-ES" for a requested "es-VE". Substitution MUST NOT return a localization that an
|
|
# user can not be expected to understand unless the server has a priori knowledge that the user
|
|
# can read and understand said language.
|
|
# If a server sends a substituted string it MUST set the output `lang` to the tag of the
|
|
# substitute it is sending.
|
|
# If a server can't find a suitable substitute or is not doing substitution it MUST set the
|
|
# output `content` to a NULL pointer and set the output `lang` to the input `lang` it was
|
|
# passed.
|
|
# If a server can't parse a given `lang` tag it MUST set the output `lang` to a NULL pointer.
|
|
|
|
available @1 () -> ( langs :List(Text) );
|
|
# Returns the list of locales this content is available in.
|
|
}
|
|
|
|
struct UUID {
|
|
# UUID type used to identify machines.
|
|
# Since the exact value has no meaning the encoding rules are not too relevant, but it is
|
|
# paramount that you are consistent when encoding and decoding this type.
|
|
#
|
|
# Consider using this algorithm for assembling the 128-bit integer:
|
|
# (assuming ISO9899:2018 shifting & casting rules)
|
|
# uint128_t num = (uuid1 << 64) + uuid0;
|
|
# And then respectively this code for deconstructing it:
|
|
# uint64_t uuid0 = (uint64_t) num;
|
|
# uint64_t uuid1 = (uint64_t) (num >> 64);
|
|
|
|
lower @0 :UInt64;
|
|
upper @1 :UInt64;
|
|
}
|
|
|