@atlassian/aui 9.13.0 → 9.13.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@atlassian/aui",
3
3
  "description": "Atlassian User Interface library",
4
- "version": "9.13.0",
4
+ "version": "9.13.2",
5
5
  "author": "Atlassian Pty Ltd.",
6
6
  "homepage": "https://aui.atlassian.com",
7
7
  "license": "Apache-2.0",
@@ -508,6 +508,12 @@ DatePicker.prototype.localisations = {
508
508
  yearSuffix: I18n.getText('ajs.datepicker.localisations.year-suffix'),
509
509
  };
510
510
 
511
+ // TODO Workaround a localisation issue in WRM related to empty strings not being considered as valid localisation values
512
+ // TODO Remove once this WRM PR is pulled in via platform (most probably) 8: https://bitbucket.org/atlassian/atlassian-plugins-webresource/pull-requests/1761/overview
513
+ if (DatePicker.prototype.localisations.yearSuffix === 'ajs.datepicker.localisations.year-suffix') {
514
+ DatePicker.prototype.localisations.yearSuffix = '';
515
+ }
516
+
511
517
  // -------------------------------------------------------------------------
512
518
  // finally, integrate with jQuery for convenience --------------------------
513
519
  // -------------------------------------------------------------------------
@@ -1,7 +1,7 @@
1
1
  // Import the I18n system from the WRM, webpack handles this
2
2
  import 'wrmI18n';
3
3
  import format from './format';
4
- import { putOnI18nIfAbsent } from './internal/globalize';
4
+ import { globalizeI18n } from './internal/globalize';
5
5
  import keys from './internal/i18n/aui';
6
6
 
7
7
  /**
@@ -9,7 +9,7 @@ import keys from './internal/i18n/aui';
9
9
  * the key is returned - this could occur in plugin mode if the I18n transform is not performed;
10
10
  * or in flatpack mode if the i18n JS file is not loaded.
11
11
  */
12
- const I18n = {
12
+ const auiI18n = {
13
13
  keys: keys,
14
14
  getText: function (key, ...params) {
15
15
  if (Object.prototype.hasOwnProperty.call(this.keys, key)) {
@@ -20,16 +20,12 @@ const I18n = {
20
20
  },
21
21
  };
22
22
 
23
- export { I18n, format };
24
-
25
23
  /**
26
24
  * Deprecated - do not use AJS.I18n.getText from global scope within AUI code. Use import { I18n } from '../i18n'
27
25
  * Also keep in mind that WRM is looking for patterns like "I18n.getText" so do not create
28
26
  * aliases for I18n or export it from here using 'default'. Webpack transforms it then to
29
27
  * 'd.default.getText' and it won't match.
30
28
  **/
31
- // eslint-disable-next-line guard-for-in
32
- for (const property in I18n) {
33
- // AUI-5431 Add to global namespace, but do not override what is set by the WRM
34
- putOnI18nIfAbsent(property, I18n[property]);
35
- }
29
+ const I18n = globalizeI18n(auiI18n);
30
+
31
+ export { I18n, format };
@@ -26,14 +26,21 @@ export default function globalize(name, value) {
26
26
  return (window[NAMESPACE][name] = value);
27
27
  }
28
28
 
29
- export function putOnI18nIfAbsent(name, value) {
29
+ export function globalizeI18n(localI18n) {
30
30
  initNamespace();
31
31
 
32
32
  if (typeof window[NAMESPACE][I18N_OBJECT_NAME] !== 'object') {
33
33
  window[NAMESPACE][I18N_OBJECT_NAME] = {};
34
34
  }
35
35
 
36
- if (typeof window[NAMESPACE][I18N_OBJECT_NAME][name] === 'undefined') {
37
- window[NAMESPACE][I18N_OBJECT_NAME][name] = value;
36
+ const globalI18n = window[NAMESPACE][I18N_OBJECT_NAME];
37
+
38
+ for (const property in localI18n) {
39
+ // AUI-5431 Add to global namespace, but do not override what is set by the WRM
40
+ if (typeof globalI18n[property] === 'undefined') {
41
+ globalI18n[property] = localI18n[property];
42
+ }
38
43
  }
44
+
45
+ return globalI18n;
39
46
  }