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

Update the lang attribute of the html tag when the locale changes #56

Merged

Conversation

tolbahadi
Copy link
Contributor

Angular-localization will now update the lang attribute
of the root html tag to match the current locale's language

This closes #22 because users can now use the lang
attribute in their css to change the direction of the
document and/or add any other language specific css

Example:

html[lang=ar] {
  direction: rtl;
}

Review on Reviewable

@tolbahadi tolbahadi changed the title feat(locale): Maintain <html>s lang attribute Update the lang attribute of the html tag when the locale changes Aug 17, 2015
@tolbahadi
Copy link
Contributor Author

Oops! I thought gulp default command runs kamra tests. Working on fixing the unit test. I'll update the PR.

@tolbahadi tolbahadi force-pushed the feat/locale/updateHtmlLangAttr branch from 9d7e06c to 96bddc2 Compare August 17, 2015 01:57
@@ -227,6 +228,12 @@ angular.module('ngLocalize')
return result;
}

function updateHtmlTagLangAttr(lang) {
lang = lang.replace(/\-.+/, '');
Copy link
Owner

Choose a reason for hiding this comment

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

lang = lang.split('-')[0] ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll do that

Angular-localization will now update the `lang` attribute
of the root `html` tag to match the current locale's language

This closes doshprompt#22 because users can now use the lang
attribute in their css to change the direction of the
document and/or add any other language specific css

Example:

```css
html[lang=ar] {
  direction: rtl;
}
```
@tolbahadi tolbahadi force-pushed the feat/locale/updateHtmlLangAttr branch from 96bddc2 to db2c2d2 Compare August 18, 2015 00:06
@tolbahadi
Copy link
Contributor Author

PR updated by the way.

doshprompt added a commit that referenced this pull request Aug 18, 2015
Update the lang attribute of the html tag when the locale changes
@doshprompt doshprompt merged commit ee1fff3 into doshprompt:master Aug 18, 2015
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.

rtl support
2 participants