Skip to content

Commit 9cb65e0

Browse files
committed
Merge branch 'fix-ie8-uppercase-fix' of https://github.com/maxpeterson/angular-gettext
Conflicts: dist/angular-gettext.js dist/angular-gettext.min.js src/catalog.js
2 parents c84d3bb + e953d8b commit 9cb65e0

3 files changed

Lines changed: 25 additions & 1 deletion

File tree

dist/angular-gettext.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,12 @@ angular.module('gettext').factory('gettextCatalog', ["gettextPlurals", "$http",
1414
var catalog;
1515
var noContext = '$$noContext';
1616

17+
// IE8 returns UPPER CASE tags, even though the source is lower case.
18+
// This can causes the (key) string in the DOM to have a different case to
19+
// the string in the `po` files.
20+
var test = '<span>test</span>';
21+
var isUpperCaseTags = (angular.element('<span>' + test + '</span>').html() !== test);
22+
1723
var prefixDebug = function (string) {
1824
if (catalog.debug && catalog.currentLanguage !== catalog.baseLanguage) {
1925
return catalog.debugPrefix + string;
@@ -57,6 +63,12 @@ angular.module('gettext').factory('gettextCatalog', ["gettextPlurals", "$http",
5763

5864
for (var key in strings) {
5965
var val = strings[key];
66+
67+
if (isUpperCaseTags) {
68+
// Use the DOM engine to uppercase any tags in the key (#131).
69+
key = angular.element('<span>' + key + '</span>').html();
70+
}
71+
6072
if (angular.isString(val) || angular.isArray(val)) {
6173
// No context, wrap it in $$noContext.
6274
var obj = {};

dist/angular-gettext.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/catalog.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@ angular.module('gettext').factory('gettextCatalog', function (gettextPlurals, $h
22
var catalog;
33
var noContext = '$$noContext';
44

5+
// IE8 returns UPPER CASE tags, even though the source is lower case.
6+
// This can causes the (key) string in the DOM to have a different case to
7+
// the string in the `po` files.
8+
var test = '<span>test</span>';
9+
var isUpperCaseTags = (angular.element('<span>' + test + '</span>').html() !== test);
10+
511
var prefixDebug = function (string) {
612
if (catalog.debug && catalog.currentLanguage !== catalog.baseLanguage) {
713
return catalog.debugPrefix + string;
@@ -45,6 +51,12 @@ angular.module('gettext').factory('gettextCatalog', function (gettextPlurals, $h
4551

4652
for (var key in strings) {
4753
var val = strings[key];
54+
55+
if (isUpperCaseTags) {
56+
// Use the DOM engine to uppercase any tags in the key (#131).
57+
key = angular.element('<span>' + key + '</span>').html();
58+
}
59+
4860
if (angular.isString(val) || angular.isArray(val)) {
4961
// No context, wrap it in $$noContext.
5062
var obj = {};

0 commit comments

Comments
 (0)