Skip to content
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

Localize the UWP UI #26665

Open
jdm opened this issue May 26, 2020 · 6 comments
Open

Localize the UWP UI #26665

jdm opened this issue May 26, 2020 · 6 comments
Assignees
Labels
Projects

Comments

@jdm
Copy link
Member

@jdm jdm commented May 26, 2020

There are two parts to this work:

Rather than building localization into the engine, if there are strings in Rust that should be localized, we should probably replace them with enum values that correspond with embedder strings, and modify the API to avoid string literals whenever possible.

@paulrouget
Copy link
Contributor

@paulrouget paulrouget commented Jun 10, 2020

Extract any hardcoded UI strings from XAML into strings files

#26840

Identify any UI strings present in Rust parts of the engine that need to be localized and choose a system for ensuring they are localized appropriately

I only found strings in libsimpleservo/api. A few prompts and how the title is formatted.

Also some resources need to be translated. The API to request the resources to the embedder is already in place, but not implemented on the C side.

@paulrouget
Copy link
Contributor

@paulrouget paulrouget commented Jun 10, 2020

diff --git a/ports/libsimpleservo/api/src/lib.rs b/ports/libsimpleservo/api/src/lib.rs
index 7dd1881243..7df706ba5e 100644
--- a/ports/libsimpleservo/api/src/lib.rs
+++ b/ports/libsimpleservo/api/src/lib.rs
@@ -585,12 +585,14 @@ impl ServoGlue {
                     let fallback_title: String = if let Some(ref current_url) = self.current_url {
                         current_url.to_string()
                     } else {
+                        // FIXME:L10N
                         String::from("Untitled")
                     };
                     let title = match title {
                         Some(ref title) if title.len() > 0 => &**title,
                         _ => &fallback_title,
                     };
+                    // FIXME:L10N
                     let title = format!("{} - Servo", title);
                     self.callbacks.host_callbacks.on_title_changed(title);
                 },
@@ -702,9 +704,11 @@ impl ServoGlue {
                 EmbedderMsg::PromptPermission(prompt, sender) => {
                     let message = match prompt {
                         PermissionPrompt::Request(permission_name) => {
+                            // FIXME:L10N
                             format!("Do you want to grant permission for {:?}?", permission_name)
                         },
                         PermissionPrompt::Insecure(permission_name) => {
+                            // FIXME:L10N
                             format!(
                                 "The {:?} feature is only safe to use in secure context, but servo can't guarantee\n\
                                 that the current context is secure. Do you want to proceed and grant permission?",
@@ -824,6 +828,7 @@ impl EmbedderMethods for ServoEmbedderCallbacks {
                 let (sender, receiver) = ipc::channel().unwrap();
                 self.0.send((
                     None,
+                    // FIXME:L10N
                     EmbedderMsg::ShowContextMenu(
                         sender,
                         Some("Would you like to exit the XR session?".into()),
@@ -870,6 +875,7 @@ impl EmbedderMethods for ServoEmbedderCallbacks {
             );
             registry.register(discovery);
         } else {
+            // FIXME:L10N
             let msg =
                 "Cannot initialize OpenXR - please ensure runtime is installed and enabled in \
                        the OpenXR developer portal app.\n\nImmersive mode will not function until \
@@ -956,6 +962,7 @@ impl ResourceReaderInstance {
 }
 
 impl ResourceReaderMethods for ResourceReaderInstance {
+    // FIXME:L10N
     fn read(&self, res: Resource) -> Vec<u8> {
         Vec::from(match res {
             Resource::Preferences => &include_bytes!("../../../../resources/prefs.json")[..],
@Manishearth
Copy link
Member

@Manishearth Manishearth commented Jun 10, 2020

Yeah for the rust side stuff I was thinking we'd have an embedder hook

bors-servo added a commit that referenced this issue Jun 11, 2020
UWP L10N

Partially addresses #26665.

This does not cover Rust strings and resources files.
@paulrouget
Copy link
Contributor

@paulrouget paulrouget commented Jun 11, 2020

There's also the replace($reason) code here:

Some(ref mime) if mime.type_() == mime::TEXT && mime.subtype() == mime::HTML => {

@paulrouget
Copy link
Contributor

@paulrouget paulrouget commented Jun 11, 2020

We display the NetworkError::SslValidation and NetworkError::Internal errors which come from the hyper and http crates. I'll see how we can handle these correctly. I think we can have a localized text + english error.

@Manishearth
Copy link
Member

@Manishearth Manishearth commented Jun 11, 2020

Yeah I wouldn't localize error messages themselves, just the text around it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
UWP port
  
To do
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.