<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-GB">
	<id>https://wiki.socialstack.dev/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=2A02%3AC7C%3AC40C%3A2600%3A8C18%3AEA9F%3A289C%3A239D</id>
	<title>SocialStack - User contributions [en-gb]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.socialstack.dev/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=2A02%3AC7C%3AC40C%3A2600%3A8C18%3AEA9F%3A289C%3A239D"/>
	<link rel="alternate" type="text/html" href="https://wiki.socialstack.dev/index.php?title=Special:Contributions/2A02:C7C:C40C:2600:8C18:EA9F:289C:239D"/>
	<updated>2026-10-16T01:21:11Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.36.2</generator>
	<entry>
		<id>https://wiki.socialstack.dev/index.php?title=Translations&amp;diff=687</id>
		<title>Translations</title>
		<link rel="alternate" type="text/html" href="https://wiki.socialstack.dev/index.php?title=Translations&amp;diff=687"/>
		<updated>2024-12-11T14:15:40Z</updated>

		<summary type="html">&lt;p&gt;2A02:C7C:C40C:2600:8C18:EA9F:289C:239D: /* Embedding translations into UI Modules */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Getting Started =&lt;br /&gt;
&lt;br /&gt;
Translations can come from a variety of sources, this is meant as a getting started guide to adding and managing translations in social stack &lt;br /&gt;
&lt;br /&gt;
== Directly added to the database via the admin panel ==&lt;br /&gt;
&lt;br /&gt;
You can use the admin panel to add entries manually to any entities which have localised fields, there is also the translation table which holds translatable text from within UI modules.&lt;br /&gt;
&lt;br /&gt;
== Embedding translations into UI Modules == &lt;br /&gt;
&lt;br /&gt;
To add some translatable text to a module it needs to be wrapped in `` quotes like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;js&amp;quot;&amp;gt;&lt;br /&gt;
`Hello, world!`&lt;br /&gt;
&lt;br /&gt;
`Hello ${username}` &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It&amp;#039;s important to use variables inside your [https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals javascript template literals] rather than just joining the text together in a specific order because word order varies and sometimes quite a lot. That&amp;#039;s even in locales of English for example - &amp;quot;July 19th&amp;quot; (American English) and &amp;quot;19th of July&amp;quot; (British English).&lt;br /&gt;
&lt;br /&gt;
If you would like to add HTML formatting in your text, it can also move around and should therefore just be entirely within your template literal too, like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;js&amp;quot;&amp;gt;&lt;br /&gt;
import Html from &amp;#039;UI/Html&amp;#039;;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;Html&amp;gt;{`Hello &amp;lt;b&amp;gt;${username}&amp;lt;/b&amp;gt;`}&amp;lt;/Html&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Importantly, avoid performing logic inside your template literals. This is because often times such logic doesn&amp;#039;t actually translate to other languages anyway and you are effectively asking a translator to write code which they won&amp;#039;t and can&amp;#039;t do. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;js&amp;quot;&amp;gt;&lt;br /&gt;
// Don&amp;#039;t do this! E.g. German translators would have to understand and edit the code itself.&lt;br /&gt;
`Shoe${count &amp;gt; 1 ? `s` : ``}`&lt;br /&gt;
&lt;br /&gt;
// Instead, always do your logic outside the literal:&lt;br /&gt;
count&amp;gt;1 ? `Shoes` : `Shoe`&lt;br /&gt;
// Such that a German translator thus provides `Schuhe` and `Schuh`&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Socialstack has built in tools to collect all template literals in your code in order to get them in to e.g. a pot file for translation, as well as then importing them back in to the translation table whereby multiple versions of the .js file are built with the translations directly substituted in. This means all secondary languages obtain the same runtime performance as the primary language (the one that the code was written in).&lt;br /&gt;
&lt;br /&gt;
== Default translations for a module  (only available when hosted locally/DEV) ==&lt;br /&gt;
&lt;br /&gt;
You can add default translations into locale.xx.json files as part of UI modules where xx is the locale code, so for example &amp;#039;it&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;json&amp;quot;&amp;gt;&lt;br /&gt;
{&lt;br /&gt;
	&amp;quot;Feed&amp;quot; : &amp;quot;Attività&amp;quot;,&lt;br /&gt;
	&amp;quot;News&amp;quot; : &amp;quot;Notizia&amp;quot;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These files are processed when the page builder (UIBundle) is run locally to build the core page bundle and inject any translations.&lt;br /&gt;
&lt;br /&gt;
They are used as the default but may be replaced by values from the database translations table, this will only happen locally as when deployed these files will not be available, they can however be loaded into the database for deployment as explained below.&lt;br /&gt;
&lt;br /&gt;
These files allow baseline translations to be stored as part of the module itself and be imported into the database as explained below&lt;br /&gt;
&lt;br /&gt;
== Auto generating translation table entries (only available when hosted locally/DEV) == &lt;br /&gt;
&lt;br /&gt;
You can use the translation service to auto generate translation values from the application modules, this will locate any translatable elements in the current applications UI modules and add entries into the database, if there are &amp;#039;&amp;#039;&amp;#039;locale.xx.json&amp;#039;&amp;#039;&amp;#039; files for the module then these can also be optionally imported.&lt;br /&gt;
&lt;br /&gt;
This is useful when you have a new project or have created lots of new modules and want to extract the elements for translation.&lt;br /&gt;
&lt;br /&gt;
First you need to update the translation service config as below &lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;json&amp;quot;&amp;gt;&lt;br /&gt;
{&lt;br /&gt;
  &amp;quot;ReformatCanvasElements&amp;quot;: false,&lt;br /&gt;
  &amp;quot;AutoAddBaseLineTranslations&amp;quot;: true,&lt;br /&gt;
  &amp;quot;AutoAddTranslationElements&amp;quot;: true,&lt;br /&gt;
  &amp;quot;AutoAddExcludeModules&amp;quot; : [&lt;br /&gt;
        &amp;quot;Admin/Dashboards/Database&amp;quot;,&lt;br /&gt;
        &amp;quot;Admin/Layouts/MediaCenter&amp;quot;,&lt;br /&gt;
        &amp;quot;Admin/AutoList&amp;quot;,&lt;br /&gt;
        &amp;quot;Admin/AutoForm&amp;quot;,&lt;br /&gt;
        &amp;quot;Admin/CanvasEditor/RichEditor&amp;quot;,&lt;br /&gt;
        &amp;quot;Admin/Layouts/Dashboard&amp;quot;,&lt;br /&gt;
        &amp;quot;Admin/Dashboards/Developer&amp;quot;,&lt;br /&gt;
        &amp;quot;Admin/PermissionGrid&amp;quot;,&lt;br /&gt;
        &amp;quot;Admin/Dashboards/StressTest&amp;quot;&lt;br /&gt;
      ]&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If &amp;#039;&amp;#039;&amp;#039;AutoAddBaseLineTranslations&amp;#039;&amp;#039;&amp;#039; is true then any &amp;#039;&amp;#039;&amp;#039;locale.xx.json&amp;#039;&amp;#039;&amp;#039; files will be processed and their values added into the translations table.&lt;br /&gt;
&lt;br /&gt;
if &amp;#039;&amp;#039;&amp;#039;AutoAddTranslationElements&amp;#039;&amp;#039;&amp;#039; is true then any translatable items found when parsing the UI modules will be added, you can add exclusions as above to ignore any backend modules for example.&lt;br /&gt;
&lt;br /&gt;
To perform the auto generation, login as an admin user and run the following url &lt;br /&gt;
&amp;lt;syntaxhighlight&amp;gt;&lt;br /&gt;
/v1/translation/prepopulate&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Any generated messages will be written to stdout&lt;br /&gt;
&lt;br /&gt;
== Exporting po files for translation == &lt;br /&gt;
&lt;br /&gt;
Once you have your entries in the database you can export a pot file and use it to easily create the localised values for the languages supported by your application &lt;br /&gt;
&lt;br /&gt;
For each table you need to run a request to generate the po file&lt;br /&gt;
&lt;br /&gt;
To perform the auto generation, login as an admin user and run the following url &lt;br /&gt;
&amp;lt;syntaxhighlight&amp;gt;&lt;br /&gt;
/v1/{entityTypeName}/list.pot&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So for example with the translation table it would be &amp;#039;&amp;#039;&amp;#039;/v1/translation/list.pot&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
The output file can be opened in a suitable editor such as po edit which can be downloaded from https://poedit.net/&lt;br /&gt;
&lt;br /&gt;
Once translated the generated file can be loaded back into the platform&lt;br /&gt;
&lt;br /&gt;
== Importing translated po files == &lt;br /&gt;
&lt;br /&gt;
Once we have a translated po file it can be loaded into the platform, there are currently 2 options for this &lt;br /&gt;
&lt;br /&gt;
=== Mass import of translation files (only available when hosted locally/DEV) ===&lt;br /&gt;
&lt;br /&gt;
If it is just entries relating to the translation table they can be copied into the /translation folder in the root of the application and loaded using a helper url in the translation service (this may be get extended to other entities as time allows)&lt;br /&gt;
&lt;br /&gt;
copy any po files into the /Translations folder in the root of the solution (you may need to create this)&lt;br /&gt;
&lt;br /&gt;
To perform the load, login as an admin user and run the following url &lt;br /&gt;
&amp;lt;syntaxhighlight&amp;gt;&lt;br /&gt;
/v1/translation/potfiles&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The progress will get written to stdout&lt;br /&gt;
&lt;br /&gt;
=== Upload the po files via the admin UI ===&lt;br /&gt;
&lt;br /&gt;
The alternative is to use the admin panel to upload and process the po files, this is currently the ONLY option for non translation table entries and is useful if you need to update a remote site&lt;br /&gt;
&lt;br /&gt;
You may need to import the admin UI module &lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
socialstack install Admin/Translation/Upload&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To perform the import, login as an admin user and load the following page&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight&amp;gt;&lt;br /&gt;
/en-admin/translation/upload&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Enter the name of the entity you are loading (this is a safety check) so for example &amp;#039;&amp;#039;&amp;#039;translation&amp;#039;&amp;#039;&amp;#039; or &amp;#039;&amp;#039;&amp;#039;page&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
Upload the po file &lt;br /&gt;
&lt;br /&gt;
Click the button to start the process&lt;br /&gt;
&lt;br /&gt;
Once it has completed some stats will be returned showing how may items were updated etc&lt;/div&gt;</summary>
		<author><name>2A02:C7C:C40C:2600:8C18:EA9F:289C:239D</name></author>
	</entry>
	<entry>
		<id>https://wiki.socialstack.dev/index.php?title=Architecture&amp;diff=686</id>
		<title>Architecture</title>
		<link rel="alternate" type="text/html" href="https://wiki.socialstack.dev/index.php?title=Architecture&amp;diff=686"/>
		<updated>2024-12-11T14:00:06Z</updated>

		<summary type="html">&lt;p&gt;2A02:C7C:C40C:2600:8C18:EA9F:289C:239D: /* Consistency */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;SocialStack is primarily a fully open source dotnet core 6 API. By default it comes with a React frontend installed which can also be simply ignored or removed if you wish to use it headless instead.&lt;br /&gt;
&lt;br /&gt;
= Founding Pillars =&lt;br /&gt;
&lt;br /&gt;
SocialStack, like really any designed system, has foundational design pillars that it and all projects on it are built to follow.&lt;br /&gt;
&lt;br /&gt;
== Simplicity ==&lt;br /&gt;
&lt;br /&gt;
First and foremost, keep it simple. SocialStack is frequently used in fast iterating projects which often also have high performance requirements too. Dozens of layers of boilerplate are precisely what we want to eliminate at all times.&lt;br /&gt;
&lt;br /&gt;
== Consistency ==&lt;br /&gt;
&lt;br /&gt;
A handful of universally followed patterns help a team naturally produce compatible code, even if it is in different projects. There is nothing stating that you have to use SocialStack&amp;#039;s automated database entities in your new code, but doing so means you get a significant amount of features for free just simply because your code is fitting in with the norm. Better yet, the SocialStack generate command will spawn a new module which is perfectly consistent with every other module in a single line:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
socialstack generate Api/VehicleBrands&lt;br /&gt;
socialstack generate UI/Vehicle/Brand/View&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Modularity ==&lt;br /&gt;
&lt;br /&gt;
Grouping things by feature rather than some abstract functional type makes following and testing the code substantially easier. Working with something to do with Users? It&amp;#039;s probably in a folder called Users.&lt;br /&gt;
&lt;br /&gt;
== Generic and reusable ==&lt;br /&gt;
&lt;br /&gt;
Configuration such as feature flags, event based design, partial classes and avoiding project specific namespacing are all essential to how code can be easily reused between projects and within a project. Public MIT licensed reusable components are installable using the [https://www.npmjs.com/package/socialstack SocialStack command line tools] and ultimately originate from [https://github.com/socialstack-core/modules this GitHub repository].&lt;/div&gt;</summary>
		<author><name>2A02:C7C:C40C:2600:8C18:EA9F:289C:239D</name></author>
	</entry>
	<entry>
		<id>https://wiki.socialstack.dev/index.php?title=Architecture&amp;diff=685</id>
		<title>Architecture</title>
		<link rel="alternate" type="text/html" href="https://wiki.socialstack.dev/index.php?title=Architecture&amp;diff=685"/>
		<updated>2024-12-11T13:57:56Z</updated>

		<summary type="html">&lt;p&gt;2A02:C7C:C40C:2600:8C18:EA9F:289C:239D: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;SocialStack is primarily a fully open source dotnet core 6 API. By default it comes with a React frontend installed which can also be simply ignored or removed if you wish to use it headless instead.&lt;br /&gt;
&lt;br /&gt;
= Founding Pillars =&lt;br /&gt;
&lt;br /&gt;
SocialStack, like really any designed system, has foundational design pillars that it and all projects on it are built to follow.&lt;br /&gt;
&lt;br /&gt;
== Simplicity ==&lt;br /&gt;
&lt;br /&gt;
First and foremost, keep it simple. SocialStack is frequently used in fast iterating projects which often also have high performance requirements too. Dozens of layers of boilerplate are precisely what we want to eliminate at all times.&lt;br /&gt;
&lt;br /&gt;
== Consistency ==&lt;br /&gt;
&lt;br /&gt;
A handful of universally followed patterns help a team naturally produce compatible code, even if it is in different projects. There is nothing stating that you have to use SocialStack&amp;#039;s automated database entities in your new code, but doing so means you get a significant amount of features for free just simply because your code is fitting in with the norm.&lt;br /&gt;
&lt;br /&gt;
== Modularity ==&lt;br /&gt;
&lt;br /&gt;
Grouping things by feature rather than some abstract functional type makes following and testing the code substantially easier. Working with something to do with Users? It&amp;#039;s probably in a folder called Users.&lt;br /&gt;
&lt;br /&gt;
== Generic and reusable ==&lt;br /&gt;
&lt;br /&gt;
Configuration such as feature flags, event based design, partial classes and avoiding project specific namespacing are all essential to how code can be easily reused between projects and within a project. Public MIT licensed reusable components are installable using the [https://www.npmjs.com/package/socialstack SocialStack command line tools] and ultimately originate from [https://github.com/socialstack-core/modules this GitHub repository].&lt;/div&gt;</summary>
		<author><name>2A02:C7C:C40C:2600:8C18:EA9F:289C:239D</name></author>
	</entry>
</feed>