Skip to content

Commit

Permalink
Merge pull request #181 from kellpossible/fix-macos-ci-gettext
Browse files Browse the repository at this point in the history
Create a mock for gettext-rs in order to fix the failing build on macos
  • Loading branch information
jgarzik authored Aug 8, 2024
2 parents 42b2ebc + 085aca5 commit 8f30271
Show file tree
Hide file tree
Showing 5 changed files with 61 additions and 81 deletions.
81 changes: 1 addition & 80 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ members = [
"display",
"file",
"fs",
"gettext-rs",
"misc",
"pathnames",
"plib",
Expand All @@ -25,6 +26,6 @@ members = [
atty = "0.2"
clap = { version = "4", default-features = false, features = ["std", "derive", "help", "usage"] }
chrono = { version = "0.4", default-features = false, features = ["clock"] }
gettext-rs = { version = "0.7", features = ["gettext-system"] }
libc = "0.2"
regex = "1.10"
gettext-rs = { path = "./gettext-rs" }
7 changes: 7 additions & 0 deletions gettext-rs/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[package]
name = "gettext-rs"
version = "0.1.0"
edition = "2021"

[lib]
name = "gettextrs"
3 changes: 3 additions & 0 deletions gettext-rs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# gettext-rs (mock)

This is a mock for `gettext-rs` crate that is being used temporarily to fix the build on macos while we figure out a resolution to https://github.com/gettext-rs/gettext-rs/issues/121
48 changes: 48 additions & 0 deletions gettext-rs/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
pub fn setlocale<T: Into<Vec<u8>>>(_category: LocaleCategory, locale: T) -> Option<Vec<u8>> {
Some(locale.into())
}

pub fn bind_textdomain_codeset<T, U>(
_domainname: T,
_codeset: U,
) -> Result<Option<String>, std::io::Error>
where
T: Into<Vec<u8>>,
U: Into<String>,
{
Ok(None)
}

pub fn textdomain<T: Into<Vec<u8>>>(domainname: T) -> Result<Vec<u8>, std::io::Error> {
Ok(domainname.into())
}

pub fn gettext<T: Into<String>>(msgid: T) -> String {
return msgid.into();
}

#[macro_export]
macro_rules! gettext {
($fmt:expr) => {
format!($fmt)
};
($fmt:expr, $($arg:tt)*) => {
format!($fmt, $($arg)*)
};
}

pub enum LocaleCategory {
LcCType,
LcNumeric,
LcTime,
LcCollate,
LcMonetary,
LcMessages,
LcAll,
LcPaper,
LcName,
LcAddress,
LcTelephone,
LcMeasurement,
LcIdentification,
}

0 comments on commit 8f30271

Please sign in to comment.