Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 27 additions & 9 deletions src/features/help/components/HelpDrawer.vue
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
<script setup lang="ts">
import { computed, PropType, ref, Ref, watch } from "vue";

// pre-parsing glob
const HELP_FILES = import.meta.glob("@/assets/help/**/*.md", {
query: "?raw",
import: "default",
}) as Record<string, () => Promise<string>>;

import { useI18n } from "vue-i18n";
const { t } = useI18n({ useScope: "global" });
const { t, locale } = useI18n({ useScope: "global" });

import { PButton } from "@/ui";
import { NDrawer, NDrawerContent } from "naive-ui";
Expand All @@ -11,15 +17,27 @@
const showDrawer: Ref<boolean> = ref(false);

async function loadMarkdown(): Promise<string> {
const markdownFiles = import.meta.glob("@/assets/help/en_US/*.md", {
query: "?raw",
import: "default",
}) as Record<string, () => Promise<string>>;
const fileName = props.fileName;
const currentLocale = locale.value;
const fallbackLocale = "en_US";

const targetPath = `/src/assets/help/${currentLocale}/${fileName}.md`;
const fallbackPath = `/src/assets/help/${fallbackLocale}/${fileName}.md`;

let loader = HELP_FILES[targetPath];

// fallback
if (!loader) {
loader = HELP_FILES[fallbackPath];
}

// error if fallback unavailable
if (!loader) {
throw new Error(
`Markdown file "${fileName}" not found in ${currentLocale} or ${fallbackLocale}.`
);
}

const path = `/src/assets/help/en_US/${props.fileName}.md`;
const loader = markdownFiles[path];
if (!loader)
throw new Error(`Markdown file "${props.fileName}" not found.`);
return await loader();
}

Expand Down
15 changes: 15 additions & 0 deletions src/features/profile/components/UserPreferences.vue
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,21 @@
:options="SupportedLanguages"
class="w-full" />
</PFormItem>
<PFormSeperator>
<i18n-t
keypath="profile.preferences.form.language_note"
tag="div"
class="text-xs text-white/60 pt-1 pb-2">
<template #link>
<a
href="https://crowdin.com/project/prunplanner"
target="_blank"
class="hover:underline text-prunplanner">
Crowdin</a
>
</template>
</i18n-t>
</PFormSeperator>
<PFormItem :label="t('profile.preferences.form.default_empire')">
<PSelect
v-model:value="defaultEmpireUuid"
Expand Down
3 changes: 2 additions & 1 deletion src/locales/en_US/profile.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"title": "What is FIO & Why should you use it?",
"help": {
"title": "5 Easy Steps to Integrate FIO and PRUNplanner",
"p1": "FIO is a community developed {link} that collects your game data, makes it available outside of @:terms.prosperous_universe and is completely free to use.",
"p1": "FIO is a community developed {link} that collects your game data, makes it available outside of Prosperous Universe and is completely free to use.",
"p2": "Just go ahead and install the Chrome or Firefox extension, reload your browser with APEX open and click the extension button in the upper-right in your browser to create an account. FIO will automatically collect (only) your game data while you keep playing.",
"p3": "You can now login to the {link} to see your data and create an API-Key PRUNplanner will use to import your storage (materials you have somewhere) and sites (planets, ships, warehouses) data.",
"p4": "Creating the key is easy, if you head to the {link} page and click the \"Create API Key\" button. Enter a name for your key (e.g., \"PRUNplanner\") and your FIO password. You don't need to \"Allow Writes\" as PRUNplanner will not manipulate any of your data, the tool just reads and uses it.",
Expand Down Expand Up @@ -71,6 +71,7 @@
"form": {
"tool_preferences": "Tool Preferences",
"language": "Language",
"language_note": "We want to make PRUNplanner accessible to everyone. If you'd like to see the tool in your native language - or help us polish an existing translation - join our localization project on {link}.",
"default_empire": "Default Empire",
"default_cx": "Default CX",
"fio_burn": "FIO Burn",
Expand Down
Loading