remove redundant parameter from Lang()

This commit is contained in:
ari melody 2025-07-15 00:02:12 +01:00
parent 1b25e56d0a
commit 7db5ec7fae
Signed by: ari
GPG key ID: 60B5F0386E3DDB7E
24 changed files with 29 additions and 36 deletions

View file

@ -3,7 +3,7 @@ import { parseEmoji, renderEmoji } from '$lib/emoji.js';
import { get, writable } from 'svelte/store';
import Lang from '$lib/lang';
const lang = Lang('en_GB');
const lang = Lang();
const cache = writable({});

View file

@ -4,7 +4,7 @@ import { app_name } from '$lib/config.js';
import { browser } from "$app/environment";
import Lang from '$lib/lang';
const lang = Lang('en_GB');
const lang = Lang();
const server_types = {
UNSUPPORTED: "unsupported",

View file

@ -1,25 +1,18 @@
import * as en_GB from '@cf/lang/en_GB.json';
import * as ga_IE from '@cf/lang/ga_IE.json';
// import * as ga_IE from '@cf/lang/ga_IE.json';
/**
* @param {string} lang IETH language tag (i.e. en_GB)
* @returns Map<string, string | string[]>
*/
export default function init(lang) {
export default function init() {
let i18n = new Object();
let language;
// TODO: dynamic imports seem to fail here; it can't find the file.
// try {
// language = import(`../lang/${lang}.json`);
// } catch (error) {
// throw error;
// }
language = en_GB;
// TODO: dynamic loading of language files
let language = en_GB;
let lang_code = 'en_GB';
i18n.lang = language;
i18n.lang_code = lang;
i18n.lang_code = lang_code;
i18n.string = function(/* @type string */ key, ...args) {
const tokens = key.split('.');

View file

@ -1,6 +1,6 @@
import Lang from '$lib/lang';
const lang = Lang('en_GB');
const lang = Lang();
import sound_log from '../sound/log.ogg';
import sound_hello from '../sound/hello.ogg';

View file

@ -1,5 +1,5 @@
import Lang from '$lib/lang';
const lang = Lang('en_GB');
const lang = Lang();
const denoms = [
{ unit: lang.string('time.second'), min: 0 },

View file

@ -7,7 +7,7 @@ import Lang from '$lib/lang';
export const timeline = writable([]);
const lang = Lang('en_GB');
const lang = Lang();
let loading = false;

View file

@ -20,7 +20,7 @@
import FollowersVisIcon from '@cf/icons/followers.svg';
import PrivateVisIcon from '@cf/icons/dm.svg';
const lang = Lang('en_GB');
const lang = Lang();
export let reply_id;

View file

@ -7,7 +7,7 @@
import Logo from '$lib/../img/campfire-logo.svg';
const lang = Lang('en_GB');
const lang = Lang();
let display_error = false;
let logging_in = false;

View file

@ -28,7 +28,7 @@
import FollowersIcon from '../../img/icons/followers.svg';
const VERSION = APP_VERSION;
const lang = Lang('en_GB');
const lang = Lang();
const dispatch = createEventDispatcher();

View file

@ -11,7 +11,7 @@
import ActionBar from '$lib/ui/post/ActionBar.svelte';
import Lang from '$lib/lang';
const lang = Lang('en_GB');
const lang = Lang();
let mention = (accounts) => {
let res = `<a href="/${$server.host}/${account.fqn}">${account.rich_name}</a>`;

View file

@ -1,7 +1,7 @@
<script>
import Lang from '$lib/lang';
const lang = Lang('en_GB');
const lang = Lang();
</script>
<div id="widgets">

View file

@ -20,7 +20,7 @@
export let post;
const lang = Lang('en_GB');
const lang = Lang();
async function toggleBoost() {
if (!$app || !$app.token) return;

View file

@ -3,7 +3,7 @@
export let post;
const lang = Lang('en_GB');
const lang = Lang();
let open = false;
</script>

View file

@ -4,7 +4,7 @@
import RepostIcon from '@cf/icons/repost.svg';
import Lang from '$lib/lang';
const lang = Lang('en_GB');
const lang = Lang();
export let post;

View file

@ -15,7 +15,7 @@
export let focused = false;
export let pinned = false;
const lang = Lang('en_GB');
const lang = Lang();
let post_context = undefined;
let post = post_data;

View file

@ -3,7 +3,7 @@
import { server } from '$lib/client/server';
import Lang from '$lib/lang';
const lang = Lang('en_GB');
const lang = Lang();
export let post;
export let reply = undefined;

View file

@ -4,7 +4,7 @@
import Lang from '$lib/lang';
const dispatch = createEventDispatcher();
const lang = Lang('en_GB');
const lang = Lang();
export let type = "react";
export let label = lang.string('post.actions.react');

View file

@ -13,7 +13,7 @@
import Composer from '@cf/ui/Composer.svelte';
import Widgets from '$lib/ui/Widgets.svelte';
const lang = Lang('en_GB');
const lang = Lang();
let show_composer = false;

View file

@ -9,7 +9,7 @@
import Post from '$lib/ui/post/Post.svelte';
import PageHeader from '../lib/ui/core/PageHeader.svelte';
const lang = Lang('en_GB');
const lang = Lang();
account.subscribe(account => {
if (account) getTimeline();

View file

@ -18,7 +18,7 @@
export let data;
const lang = Lang('en_GB');
const lang = Lang();
let profile_pinned_posts = writable([]);
let profile_posts_max_id = null;

View file

@ -12,7 +12,7 @@
export let data;
const lang = Lang('en_GB');
const lang = Lang();
let post = fetchPost(data.post_id);
let error = false;

View file

@ -12,7 +12,7 @@
export let data;
const lang = Lang('en_GB');
const lang = Lang();
let auth_code = data.code;

View file

@ -11,7 +11,7 @@
import CrossIcon from '../../img/icons/cross.svg'
import { get } from 'svelte/store';
const lang = Lang('en_GB');
const lang = Lang();
async function actionRequest(account_id, approved) {
// remove item from array first - this updates the ui and

View file

@ -7,7 +7,7 @@
import PageHeader from '../../lib/ui/core/PageHeader.svelte';
import Lang from '$lib/lang';
const lang = Lang('en_GB');
const lang = Lang();
if (!$account) goto("/");