Skip to content

Conversation

@saadb94
Copy link

@saadb94 saadb94 commented Sep 27, 2022

Required by i18n Initiative.

Multiple locales supported via array per template file. New fn is backward compatible as well for the old style of export.

If one locale, then template file is named according to that. If multiple, then its a hash of the locales array. Otherwise, if it is * then the template file is named anyLocale.

Things to consider:

  1. Ordering of the locales array before we hashing, as the hash will change otherwise.
  2. Publishing the node-utils package as we're using a new function added to the crypto library

SectionsCreated = [],
{ privatesAccessor } = require('@medable/mdctl-core-utils/privates')

let hashCode = function (str, seed = 0) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

you can add this function mdctl-node-utils package https://github.com/Medable/mdctl/blob/master/packages/mdctl-node-utils/crypto.js and use crypto that already exists.

}
}

extractTemplatesGrouped() {
Copy link
Collaborator

Choose a reason for hiding this comment

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

if extractTemplates is not longer used please remove or use the same method name.

@saadb94 saadb94 force-pushed the multiple_locales_support branch 2 times, most recently from 017d414 to 0e2b334 Compare September 27, 2022 14:12
@saadb94 saadb94 force-pushed the multiple_locales_support branch from 0e2b334 to c2db522 Compare September 27, 2022 14:13
return hash.digest('hex')
}

function hashCode(str, seed = 0) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

When I said you could use crypto I mean you could use this

const hash = createHash('md5')
hash.update(str)
return hash.digest('hex')

Copy link
Author

Choose a reason for hiding this comment

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

OK, I'll change it to this

@saadb94 saadb94 force-pushed the multiple_locales_support branch from 1748e82 to 44b13ad Compare October 26, 2022 08:56
gastonrobledo
gastonrobledo previously approved these changes Oct 26, 2022
@gastonrobledo gastonrobledo merged commit 94a8fbf into Medable:develop Oct 31, 2022
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.

2 participants