-
Notifications
You must be signed in to change notification settings - Fork 6
Add phosh gettext domain #147
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
base: main
Are you sure you want to change the base?
Changes from all commits
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.
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -189,7 +189,7 @@ mod imp { | |||||
| self.session.replace(user.clone()); | ||||||
| let username = user.unwrap(); | ||||||
| info!("creating greetd session for user {}", username); | ||||||
| self.obj().set_unlock_status("Please wait..."); | ||||||
| self.obj().set_unlock_status(&gettextrs::gettext("Please wait...")); | ||||||
| self.obj().set_sensitive(false); | ||||||
| let mut req = Some(Request::CreateSession { username }); | ||||||
| while let Some(next_req) = req.take() { | ||||||
|
|
@@ -248,7 +248,7 @@ mod imp { | |||||
|
|
||||||
| if let Err(err) = resp { | ||||||
| error!("failed to send greetd request: {:?}", err); | ||||||
| self.obj().set_unlock_status("Error, please try again"); | ||||||
| self.obj().set_unlock_status(&gettextrs::gettext("Error, please try again")); | ||||||
| self.obj().set_sensitive(true); | ||||||
| return None; | ||||||
| } | ||||||
|
|
@@ -286,7 +286,7 @@ mod imp { | |||||
| } | ||||||
| } | ||||||
| Response::Success => { | ||||||
| self.obj().set_unlock_status("Success. Logging in..."); | ||||||
| self.obj().set_unlock_status(&gettextrs::gettext("Success. Logging in...")); | ||||||
| self.start_session().await.unwrap(); | ||||||
| g_message!("phrog", "launched session, exiting in {}ms", QUIT_DELAY); | ||||||
| Shell::default().fade_out(0); | ||||||
|
|
@@ -300,7 +300,7 @@ mod imp { | |||||
| description, | ||||||
| } => { | ||||||
| warn!("auth error: '{}'", description); | ||||||
| self.obj().set_unlock_status("Login failed, please try again"); | ||||||
| self.obj().set_unlock_status(&gettextrs::gettext("Login failed, please try again")); | ||||||
| self.obj().shake_pin_entry(); | ||||||
| // Greetd IPC dox seem to suggest that this isn't necessary, but then agreety | ||||||
| // does this, and if we don't we get a "session is already being configured" | ||||||
|
|
@@ -329,7 +329,7 @@ mod imp { | |||||
| impl LockscreenImpl for Lockscreen { | ||||||
| fn unlock_submit(&self) { | ||||||
| glib::spawn_future_local(clone!(@weak self as this => async move { | ||||||
| this.obj().set_unlock_status("Please wait..."); | ||||||
| this.obj().set_unlock_status(&gettextrs::gettext("Please wait...")); | ||||||
| this.obj().set_sensitive(false); | ||||||
| let mut req = Some(Request::PostAuthMessageResponse { | ||||||
| response: Some(this.obj().pin_entry().to_string()) | ||||||
|
|
@@ -347,7 +347,7 @@ fn fake_greetd_interaction(req: Request) -> anyhow::Result<Response> { | |||||
| match req { | ||||||
| Request::CreateSession { .. } => anyhow::Ok(Response::AuthMessage { | ||||||
| auth_message_type: Secret, | ||||||
| auth_message: "Password:".into(), | ||||||
| auth_message: gettextrs::gettext("Password:").into(), | ||||||
|
Collaborator
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. If you add new translations you need to bind another gettext domain ( Phosh currently uses the gettext domain for lookups but I we could switch to using
Owner
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. The So I think this boils down to:
Suggested change
(but also note that I think clippy is complaining about this |
||||||
| }), | ||||||
| Request::PostAuthMessageResponse { response } => { | ||||||
| if response.is_none() || response.unwrap() != "0" { | ||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -24,6 +24,9 @@ struct Args { | |||||||||
| } | ||||||||||
|
|
||||||||||
| fn main() -> anyhow::Result<()> { | ||||||||||
| let _ = gettextrs::bindtextdomain("phosh", "/usr/share/locale"); | ||||||||||
| gettextrs::textdomain("phosh")?; | ||||||||||
|
Collaborator
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.
Owner
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. I would prefer the app start up with default English strings rather than not start up at all 😅 So how about:
Suggested change
(and move this init after the following logger lines so that the log works properly :) |
||||||||||
|
|
||||||||||
| log::set_logger(&GLIB_LOGGER).unwrap(); | ||||||||||
| log::set_max_level(log::LevelFilter::Debug); | ||||||||||
|
|
||||||||||
|
|
||||||||||
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.
In other projects we take that path from meson but idk what's @samcday 's preference is here.
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.
Let's just hardcode for now since this is what distros are gonna use anyway. Maybe @hustlerone could wander past here and let us know whether this would be an issue with Nix packaging. If so I'm sure (or hoping, at least) that we can still easily solve this with Cargo /
build.rsand not need to bring in the Meson bazooka.