Skip to content

Commit

Permalink
Merge pull request #881 from openSUSE/localization
Browse files Browse the repository at this point in the history
Localization
  • Loading branch information
joseivanlopez authored Nov 30, 2023
2 parents c47fc31 + acb8aab commit 888aa22
Show file tree
Hide file tree
Showing 70 changed files with 3,156 additions and 877 deletions.
48 changes: 28 additions & 20 deletions doc/dbus/bus/org.opensuse.Agama1.Locale.bus.xml
Original file line number Diff line number Diff line change
Expand Up @@ -38,39 +38,47 @@
</interface>
<interface name="org.opensuse.Agama1.Locale">
<!--
Get labels for locales. The first pair is english language and territory
and second one is localized one to target language from locale.
Gets the supported locales information.
Each element of the list has these parts:
* The locale code (e.g., "es_ES.UTF-8").
* The name of the language according to the language defined by the
UILocale property.
* The name of the territory according to the language defined by the
UILocale property.
-->
<method name="LabelsForLocales">
<arg type="a((ss)(ss))" direction="out"/>
<method name="ListLocales">
<arg type="a(sss)" direction="out"/>
</method>
<!--
Gets list of locales available on system.
Returns a list of the supported keymaps.
# Examples
Each element of the list contains:
```
use agama_dbus_server::locale::Locale;
let locale = Locale::new();
assert!(locale.list_ui_locales().unwrap().len() > 0);
```
* The keymap identifier (e.g., "es" or "es(ast)").
* The name of the keyboard in language set by the UILocale property.
-->
<method name="ListUILocales">
<arg type="as" direction="out"/>
</method>
<method name="ListVConsoleKeyboards">
<arg type="as" direction="out"/>
<method name="ListKeymaps">
<arg type="a(ss)" direction="out"/>
</method>
<!--
Returns a list of the supported timezones.
Each element of the list contains:
* The timezone identifier (e.g., "Europe/Berlin").
* A list containing each part of the name in the language set by the
UILocale property.
-->
<method name="ListTimezones">
<arg name="locale" type="s" direction="in"/>
<arg type="a(ss)" direction="out"/>
<arg type="a(sas)" direction="out"/>
</method>
<method name="Commit">
</method>
<property name="Keymap" type="s" access="readwrite"/>
<property name="Locales" type="as" access="readwrite"/>
<property name="SupportedLocales" type="as" access="readwrite"/>
<property name="Timezone" type="s" access="readwrite"/>
<property name="UILocale" type="s" access="readwrite"/>
<property name="VConsoleKeyboard" type="s" access="readwrite"/>
</interface>
</node>
61 changes: 31 additions & 30 deletions doc/dbus/org.opensuse.Agama1.Locale.doc.xml
Original file line number Diff line number Diff line change
@@ -1,47 +1,48 @@

<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"
"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
<?xml version="1.0" encoding="UTF-8"?>
<node>
<!--
org.opensuse.Agama1.Locale:
Implementation note about language identifiers:
Maybe use <ulink url="https://www.rubydoc.info/github/yast/yast-packager/master/LanguageTag">yast2-packager/LanguageTag</ulink>.
See <ulink url="https://lists.opensuse.org/archives/list/yast-devel&commat;lists.opensuse.org/message/D52PSZ7TRID2RVM6CE6K2C2RUNNGOS6Z/">its announcement on yast-devel</ulink>.
See also <ulink url="https://tools.ietf.org/html/rfc4647">RFC 4647 Matching of Language Tags</ulink>.
-->
<interface name="org.opensuse.Agama1.Locale">
<!--
Get labels for locales. The first pair is english language and territory
and second one is localized one to target language from locale.
Gets the supported locales information.
Each element of the list has these parts:
* The locale code (e.g., "es_ES.UTF-8").
* The name of the language according to the language defined by the
UILocale property.
* The name of the territory according to the language defined by the
UILocale property.
-->
<method name="LabelsForLocales">
<arg type="a((ss)(ss))" direction="out"/>
<method name="ListLocales">
<arg type="a(sss)" direction="out"/>
</method>
<!--
Gets list of locales available on system.
Returns a list of the supported keymaps.
Each element of the list contains:
* The keymap identifier (e.g., "es" or "es(ast)").
* The name of the keyboard in language set by the UILocale property.
-->
<method name="ListUILocales">
<arg type="as" direction="out"/>
</method>
<method name="ListVConsoleKeyboards">
<arg type="as" direction="out"/>
<method name="ListKeymaps">
<arg type="a(ss)" direction="out"/>
</method>
<!--
Returns a list of the supported timezones.
Each element of the list contains:
* The timezone identifier (e.g., "Europe/Berlin").
* A list containing each part of the name in the language set by the
UILocale property.
-->
<method name="ListTimezones">
<arg name="locale" type="s" direction="in"/>
<arg type="a(ss)" direction="out"/>
<arg type="a(sas)" direction="out"/>
</method>
<method name="Commit">
</method>
<property name="Keymap" type="s" access="readwrite"/>
<property name="Locales" type="as" access="readwrite"/>
<property name="SupportedLocales" type="as" access="readwrite"/>
<property name="Timezone" type="s" access="readwrite"/>
<!--
Property that controls in which localization human string from backend will come.
-->
<property name="UILocale" type="s" access="readwrite"/>
<property name="VConsoleKeyboard" type="s" access="readwrite"/>
</interface>
</node>

87 changes: 87 additions & 0 deletions rust/Cargo.lock

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

3 changes: 3 additions & 0 deletions rust/agama-dbus-server/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,6 @@ serde_yaml = "0.9.24"
cidr = { version = "0.2.2", features = ["serde"] }
tokio = { version = "1.33.0", features = ["macros", "rt-multi-thread"] }
tokio-stream = "0.1.14"
gettext-rs = { version = "0.7.0", features = ["gettext-system"] }
regex = "1.10.2"
once_cell = "1.18.0"
6 changes: 6 additions & 0 deletions rust/agama-dbus-server/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,9 @@ impl From<anyhow::Error> for Error {
Self::Anyhow(format!("{:#}", e))
}
}

impl From<Error> for zbus::fdo::Error {
fn from(value: Error) -> zbus::fdo::Error {
zbus::fdo::Error::Failed(format!("Localization error: {value}"))
}
}
Loading

0 comments on commit 888aa22

Please sign in to comment.