View MR for information: https://activitypub.software/TransFem-org/Sharkey/-/merge_requests/692 Closes #732 Approved-by: dakkar <dakkar@thenautilus.net> Approved-by: Marie <github@yuugi.dev>
This commit is contained in:
commit
68b90df00b
8 changed files with 41 additions and 31 deletions
1
locales/version.d.ts
vendored
Normal file
1
locales/version.d.ts
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
export const localesVersion: string;
|
||||
14
locales/version.js
Normal file
14
locales/version.js
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
import { createHash } from 'crypto';
|
||||
import locales from './index.js';
|
||||
|
||||
// MD5 is acceptable because we don't need cryptographic security.
|
||||
const hash = createHash('md5');
|
||||
|
||||
// Derive the version hash from locale content exclusively.
|
||||
// This avoids the problem of "stuck" translations after modifying locale files.
|
||||
const localesText = JSON.stringify(locales);
|
||||
hash.update(localesText, 'utf8');
|
||||
|
||||
// We can't use regular base64 since this becomes part of a filename.
|
||||
// Base64URL avoids special characters that would cause an issue.
|
||||
export const localesVersion = hash.digest().toString('base64url');
|
||||
Loading…
Add table
Add a link
Reference in a new issue