mirror of
https://github.com/Lapikud/lapikud.github.io.git
synced 2026-08-09 03:49:14 +00:00
lang changes, new pages, data changes
This commit is contained in:
17
src/lib/langHelpers.js
Normal file
17
src/lib/langHelpers.js
Normal file
@@ -0,0 +1,17 @@
|
||||
// Helper function to get text with fallback to Estonian
|
||||
export function getLangText(item, key, lang = 'est') {
|
||||
const value = item[key];
|
||||
|
||||
// If it's a simple string, return it
|
||||
if (typeof value === 'string') {
|
||||
return value;
|
||||
}
|
||||
|
||||
// If it's an object with language keys
|
||||
if (value && typeof value === 'object') {
|
||||
// Try to get the requested language, fallback to Estonian
|
||||
return value[lang] || value.est || '';
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
Reference in New Issue
Block a user