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

Localized blackberry.app.name and blackberry.app.description #277

Closed
wants to merge 1 commit into from

Conversation

jamesjhedley
Copy link
Member

Fixes blackberry#378

Testing scenarios;
-Test blackberry.app API's and ensure nothing is broken.
-Test blackberry.app.name and blackberry.app.description returns localized values when language is changed on the device
-Confirm tests are passing in functional test app

@jamesjhedley
Copy link
Member Author

@jeffheifetz Code review please.

@jamesjhedley
Copy link
Member Author

Going to update the automatic tests as well, so this doesn't happen again. But putting pull request up now so it can begin being reviewed etc.

@jeffheifetz
Copy link

Looks good James, r+ with the automated changes

@jeffheifetz jeffheifetz reopened this Nov 20, 2012
@jamesjhedley
Copy link
Member Author

@jeffheifetz Updated blackberry.app functional tests to include localization tests for name&description
Please review and r+.

@nukulb
Copy link

nukulb commented Nov 20, 2012

kills our non-localized test. :(

Can this be included in as a separate app? hate that we are not testing the most common case of blackberry.app

@jamesjhedley
Copy link
Member Author

@nukulb Why does it "kill our non-localized test"? The existing name&description elements that contain the non-localized values are still there. I'm simply including additional localized values as well.

@nukulb
Copy link

nukulb commented Nov 20, 2012

@jkeshavarzi you are correct, I didn't read your tests properly, its a good test but I don't know why it works.
If you set the language to {} in the webview out of process why does it on the controller side, which is where I assume you check navigator.language, right?

@nukulb
Copy link

nukulb commented Nov 20, 2012

@tracyli - can you give this a quick test, we need respin the SCM bundle with this fix

@tracyli
Copy link

tracyli commented Nov 20, 2012

tested in 10.0.9.1103: blackberry.app works as before;blackberry.app.name and blackberry.app.description change with localized values; app test suite got passed in functional test app.

There's an observation:
1.in config.xml, there's xml:lang="fr-fr" for app name 'App-FR'
expected: app name shows up in screen as 'App-FR' and 'blackberry.app.name' returns 'App-FR' when the localized language is Fr
fact: app name shows up in screen as expected but 'blackberry.app.name' returns default value
question: I need to change xml:lang="fr-fr" to be xml:lang="fr-FR" to make it work, is it what expected?

@jamesjhedley
Copy link
Member Author

@tracyli I think you mean " I need to change xml:lang="fr" to be xml:lang="fr-FR" to make it work, is it what expected?".
Currently there is no logic to default to the parent locale [fr] if the specific locale isn't available [fr-CA].

Working on it.

@jamesjhedley
Copy link
Member Author

Fixed two issues;

  1. Case sensitive locale strings
  2. Default to language locale data [fr] if region isn't available [fr-CA]

Please use blackberry-webworks/BB10-Webworks-Packager#111 when testing.
As it contains part of the fix for 1) and uses this Framework.

@jeffheifetz Can you please take a look at the new changes?
When he's done, can you please retest @tracyli.

@jeffheifetz
Copy link

Please add unit tests to cover the locale generaliztion (fr when fr-CA is not available)

@jeffheifetz
Copy link

r+

return data[locale];
} else if (data[locale.split("-")[0]]) {
//Region specific locale [i.e. fr-CA]
return data[locale.split("-")[0]];

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't this comment misleading, isn't this the "region unspefic" locale?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this returns fr for fr-CA?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup

From: Eric Pearson [mailto:notifications@github.com]
Sent: Tuesday, November 20, 2012 07:21 PM
To: blackberry-webworks/BB10-WebWorks-Framework BB10-WebWorks-Framework@noreply.github.com
Cc: James Keshavarzi
Subject: Re: [BB10-WebWorks-Framework] Localized blackberry.app.name and blackberry.app.description (#277)

In ext/app/client.js:

 value = readOnlyValues ? readOnlyValues[field] : null;
 Object.defineProperty(_self, field, {"value": value, "writable": false});

}

+function getLocalizedText(data) {

  • var locale = navigator.language.toLowerCase();
  • if (data[locale]) {
  •    return data[locale];
    
  • } else if (data[locale.split("-")[0]]) {
  •    //Region specific locale [i.e. fr-CA]
    
  •    return data[locale.split("-")[0]];
    

this returns fr for fr-CA?


Reply to this email directly or view it on GitHubhttps://github.com//pull/277/files#r2189016.


This transmission (including any attachments) may contain confidential information, privileged material (including material protected by the solicitor-client or other applicable privileges), or constitute non-public information. Any use of this information by anyone other than the intended recipient is prohibited. If you have received this transmission in error, please immediately reply to the sender and delete this information from your system. Use, dissemination, distribution, or reproduction of this transmission by unintended recipients is not authorized and may be unlawful.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right. I shall fix it.

From: Jeffrey Heifetz [mailto:notifications@github.com]
Sent: Tuesday, November 20, 2012 07:07 PM
To: blackberry-webworks/BB10-WebWorks-Framework BB10-WebWorks-Framework@noreply.github.com
Cc: James Keshavarzi
Subject: Re: [BB10-WebWorks-Framework] Localized blackberry.app.name and blackberry.app.description (#277)

In ext/app/client.js:

 value = readOnlyValues ? readOnlyValues[field] : null;
 Object.defineProperty(_self, field, {"value": value, "writable": false});

}

+function getLocalizedText(data) {

  • var locale = navigator.language.toLowerCase();
  • if (data[locale]) {
  •    return data[locale];
    
  • } else if (data[locale.split("-")[0]]) {
  •    //Region specific locale [i.e. fr-CA]
    
  •    return data[locale.split("-")[0]];
    

Isn't this comment misleading, isn't this the "region unspefic" locale?


Reply to this email directly or view it on GitHubhttps://github.com//pull/277/files#r2188880.


This transmission (including any attachments) may contain confidential information, privileged material (including material protected by the solicitor-client or other applicable privileges), or constitute non-public information. Any use of this information by anyone other than the intended recipient is prohibited. If you have received this transmission in error, please immediately reply to the sender and delete this information from your system. Use, dissemination, distribution, or reproduction of this transmission by unintended recipients is not authorized and may be unlawful.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you sure this is ok? If this is portuguese and you return pt for pt-BR a lot of people are going to be confused as the language is pretty different. Same goes for mandarin and cantonese with zh-CN and zh-HK.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nevermind disregard my comments, it's probably good enough

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be interesting to see what the os does in these situations. I know, tracy and I were seeing it default to the language locale (fr) when the region wasn't available.

From: Eric Pearson [mailto:notifications@github.com]
Sent: Tuesday, November 20, 2012 07:27 PM
To: blackberry-webworks/BB10-WebWorks-Framework BB10-WebWorks-Framework@noreply.github.com
Cc: James Keshavarzi
Subject: Re: [BB10-WebWorks-Framework] Localized blackberry.app.name and blackberry.app.description (#277)

In ext/app/client.js:

 value = readOnlyValues ? readOnlyValues[field] : null;
 Object.defineProperty(_self, field, {"value": value, "writable": false});

}

+function getLocalizedText(data) {

  • var locale = navigator.language.toLowerCase();
  • if (data[locale]) {
  •    return data[locale];
    
  • } else if (data[locale.split("-")[0]]) {
  •    //Region specific locale [i.e. fr-CA]
    
  •    return data[locale.split("-")[0]];
    

Are you sure this is ok? If this is portuguese and you return pt for pt-BR a lot of people are going to be confused as the language is pretty different. Same goes for mandarin and cantonese with zh-CN and zh-HK.


Reply to this email directly or view it on GitHubhttps://github.com//pull/277/files#r2189066.


This transmission (including any attachments) may contain confidential information, privileged material (including material protected by the solicitor-client or other applicable privileges), or constitute non-public information. Any use of this information by anyone other than the intended recipient is prohibited. If you have received this transmission in error, please immediately reply to the sender and delete this information from your system. Use, dissemination, distribution, or reproduction of this transmission by unintended recipients is not authorized and may be unlawful.

@tracyli
Copy link

tracyli commented Nov 21, 2012

tested in 10.0.9.1103 with packager build http://ci0000003863287:8080/hudson/job/BB10-Webworks-Packager-next-fix-case-sensitive/3/ and framework build http://ci0000003863287:8080/hudson/job/BB10-Webworks-Framework-next-issue378/4/: blackberry.app works as before;blackberry.app.name and blackberry.app.description change with localized values; app test suite got passed in functional test app

@nukulb
Copy link

nukulb commented Nov 21, 2012

@jkeshavarzi can I get a squash so we can commit this?

Fixes blackberry#378

Reviewed By: Jeffrey Heifetz <jheifetz@rim.com>
Tested By: Tracy Li <tli@rim.com>
@jamesjhedley
Copy link
Member Author

-Comment fixed
-Squashed commits
-Merged manually [https://github.com/blackberry-webworks/BB10-WebWorks-Framework/commit/9d756e5f29e2df4ed0aafbe3672e773a784d5f4a]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants