-
Notifications
You must be signed in to change notification settings - Fork 182
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
Baked data for icu_plurals
, icu_timezone
#3462
Changes from 16 commits
e2338fd
e99a921
c7128fd
2e5ef2d
63be9f0
961b6c1
a8983bf
9e3612a
60191cf
9004450
186f0f7
574f68d
524d04c
6e265e1
13399cc
c87537c
526634b
9648532
5eaf807
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# This file is part of ICU4X. For terms of use, please see the file | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. oh I see, you implemented separate crates but distributed them inside the individual components instead of in a centralized location There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's please not block on where in the repo these will live |
||
# called LICENSE at the top level of the ICU4X source tree | ||
# (online at: https://github.com/unicode-org/icu4x/blob/main/LICENSE ). | ||
[package] | ||
name = "icu_plurals_data" | ||
version = "43.0.0" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Suggestion: how about starting at "0.1.0" and incrementing to "0.1.1", "0.1.2", ... for CLDR updates and new data structs and "0.2.0" when there is a breaking data struct change. Then it's clearly a different versioning scheme than the rest of ICU4X. (Maybe put new data structs also in a new channel, like breaking changes, so that minor releases are reserved for CLDR and we can continue to update old channels if desired) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we bikeshed versioning later? |
||
description = "Data for the icu_plurals crate" | ||
rust-version = "1.61.0" | ||
authors = ["The ICU4X Project Developers"] | ||
edition = "2021" | ||
readme = "README.md" | ||
repository = "https://github.com/unicode-org/icu4x" | ||
homepage = "https://icu4x.unicode.org" | ||
license = "Unicode-DFS-2016" | ||
categories = ["internationalization"] | ||
# Keep this in sync with other crates unless there are exceptions | ||
include = [ | ||
"data/**/*", | ||
"src/**/*", | ||
"examples/**/*", | ||
"benches/**/*", | ||
"tests/**/*", | ||
"Cargo.toml", | ||
"LICENSE", | ||
"README.md" | ||
] | ||
|
||
[dependencies] |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
UNICODE, INC. LICENSE AGREEMENT - DATA FILES AND SOFTWARE | ||
|
||
See Terms of Use <https://www.unicode.org/copyright.html> | ||
for definitions of Unicode Inc.’s Data Files and Software. | ||
|
||
NOTICE TO USER: Carefully read the following legal agreement. | ||
BY DOWNLOADING, INSTALLING, COPYING OR OTHERWISE USING UNICODE INC.'S | ||
DATA FILES ("DATA FILES"), AND/OR SOFTWARE ("SOFTWARE"), | ||
YOU UNEQUIVOCALLY ACCEPT, AND AGREE TO BE BOUND BY, ALL OF THE | ||
TERMS AND CONDITIONS OF THIS AGREEMENT. | ||
IF YOU DO NOT AGREE, DO NOT DOWNLOAD, INSTALL, COPY, DISTRIBUTE OR USE | ||
THE DATA FILES OR SOFTWARE. | ||
|
||
COPYRIGHT AND PERMISSION NOTICE | ||
|
||
Copyright © 1991-2022 Unicode, Inc. All rights reserved. | ||
Distributed under the Terms of Use in https://www.unicode.org/copyright.html. | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining | ||
a copy of the Unicode data files and any associated documentation | ||
(the "Data Files") or Unicode software and any associated documentation | ||
(the "Software") to deal in the Data Files or Software | ||
without restriction, including without limitation the rights to use, | ||
copy, modify, merge, publish, distribute, and/or sell copies of | ||
the Data Files or Software, and to permit persons to whom the Data Files | ||
or Software are furnished to do so, provided that either | ||
(a) this copyright and permission notice appear with all copies | ||
of the Data Files or Software, or | ||
(b) this copyright and permission notice appear in associated | ||
Documentation. | ||
|
||
THE DATA FILES AND SOFTWARE ARE PROVIDED "AS IS", WITHOUT WARRANTY OF | ||
ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE | ||
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | ||
NONINFRINGEMENT OF THIRD PARTY RIGHTS. | ||
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN THIS | ||
NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL | ||
DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, | ||
DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | ||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR | ||
PERFORMANCE OF THE DATA FILES OR SOFTWARE. | ||
|
||
Except as contained in this notice, the name of a copyright holder | ||
shall not be used in advertising or otherwise to promote the sale, | ||
use or other dealings in these Data Files or Software without prior | ||
written authorization of the copyright holder. | ||
|
||
— | ||
|
||
Portions of ICU4X may have been adapted from ICU4C and/or ICU4J. | ||
ICU 1.8.1 to ICU 57.1 © 1995-2016 International Business Machines Corporation and others. |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// This file is part of ICU4X. For terms of use, please see the file | ||
// called LICENSE at the top level of the ICU4X source tree | ||
// (online at: https://github.com/unicode-org/icu4x/blob/main/LICENSE ). | ||
|
||
fn main() { | ||
if std::env::var("CARGO_FEATURE_DATA").is_ok() { | ||
robertbastian marked this conversation as resolved.
Show resolved
Hide resolved
|
||
if std::env::var("ICU4X_DATA_DIR").is_ok() { | ||
println!("cargo:rustc-cfg=icu4x_custom_data"); | ||
} | ||
println!("cargo:rerun-if-env-changed=ICU4X_DATA_DIR"); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
{ | ||
"keys": { | ||
"Explicit": [ | ||
"plurals/ordinal@1", | ||
"plurals/cardinal@1" | ||
] | ||
}, | ||
"locales": { | ||
"CldrSet": [ | ||
"modern" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Need to discuss the CldrSet to use (doesn't need to block this PR) |
||
] | ||
}, | ||
"cldr": "Latest", | ||
"icu_export": "Latest", | ||
"segmenter_lstm": "Latest", | ||
"export": { | ||
"Baked": { | ||
"output_path": "data", | ||
"use_separate_crates": true, | ||
"pretty": true | ||
} | ||
}, | ||
"overwrite": true | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
// @generated | ||
impl_any_provider!(BakedDataProvider); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
// @generated | ||
#[macro_use] | ||
#[path = "macros/plurals_cardinal_v1.data.rs"] | ||
mod plurals_cardinal_v1; | ||
#[doc(inline)] | ||
pub use __impl_plurals_cardinal_v1 as impl_plurals_cardinal_v1; | ||
#[macro_use] | ||
#[path = "macros/plurals_ordinal_v1.data.rs"] | ||
mod plurals_ordinal_v1; | ||
#[doc(inline)] | ||
pub use __impl_plurals_ordinal_v1 as impl_plurals_ordinal_v1; | ||
/// Implement [`DataProvider<M>`](icu_provider::DataProvider) on the given struct using the data | ||
/// hardcoded in this file. This allows the struct to be used with | ||
/// `icu`'s `_unstable` constructors. | ||
/// | ||
/// ```compile_fail | ||
/// struct MyDataProvider; | ||
/// include!("/path/to/generated/macros.rs"); | ||
/// impl_data_provider(MyDataProvider); | ||
/// ``` | ||
#[doc(hidden)] | ||
#[macro_export] | ||
macro_rules! __impl_data_provider { | ||
($ provider : path) => { | ||
impl_plurals_cardinal_v1!($provider); | ||
impl_plurals_ordinal_v1!($provider); | ||
}; | ||
} | ||
#[doc(inline)] | ||
pub use __impl_data_provider as impl_data_provider; | ||
/// Implement [`AnyProvider`](icu_provider::AnyProvider) on the given struct using the data | ||
/// hardcoded in this module. This allows the struct to be used with | ||
/// `icu`'s `_any` constructors. | ||
/// | ||
/// ```compile_fail | ||
/// struct MyAnyProvider; | ||
/// include!("/path/to/generated/macros.rs"); | ||
/// impl_any_provider(MyAnyProvider); | ||
/// ``` | ||
#[doc(hidden)] | ||
#[macro_export] | ||
macro_rules! __impl_any_provider { | ||
($ provider : path) => { | ||
#[clippy::msrv = "1.61"] | ||
impl icu_provider::AnyProvider for $provider { | ||
fn load_any(&self, key: icu_provider::DataKey, req: icu_provider::DataRequest) -> Result<icu_provider::AnyResponse, icu_provider::DataError> { | ||
const PLURALS_CARDINAL_V1: icu_provider::DataKeyHash = <icu_plurals::provider::CardinalV1Marker as icu_provider::KeyedDataMarker>::KEY.hashed(); | ||
const PLURALS_ORDINAL_V1: icu_provider::DataKeyHash = <icu_plurals::provider::OrdinalV1Marker as icu_provider::KeyedDataMarker>::KEY.hashed(); | ||
match key.hashed() { | ||
PLURALS_CARDINAL_V1 => icu_provider::DataProvider::<icu_plurals::provider::CardinalV1Marker>::load(self, req).and_then(|r| r.take_metadata_and_payload()).map(|(metadata, payload)| icu_provider::AnyResponse { payload: Some(payload.wrap_into_any_payload()), metadata }), | ||
PLURALS_ORDINAL_V1 => icu_provider::DataProvider::<icu_plurals::provider::OrdinalV1Marker>::load(self, req).and_then(|r| r.take_metadata_and_payload()).map(|(metadata, payload)| icu_provider::AnyResponse { payload: Some(payload.wrap_into_any_payload()), metadata }), | ||
_ => Err(icu_provider::DataErrorKind::MissingDataKey.with_req(key, req)), | ||
} | ||
} | ||
} | ||
}; | ||
} | ||
#[doc(inline)] | ||
pub use __impl_any_provider as impl_any_provider; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As noted elsewhere, we need to bikeshed the feature name (not a landing blocker)