Skip to content
This repository has been archived by the owner on Mar 16, 2024. It is now read-only.

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
nd1012 committed Mar 10, 2024
1 parent c2c50e7 commit f147c50
Show file tree
Hide file tree
Showing 39 changed files with 2,373 additions and 2 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/docfx.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: docfx

on:
push:
branches: [ "main" ]

jobs:
build:

runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 8.0.x
- name: Setup docfx
run: dotnet tool update -g docfx
- name: Copy README
run: cp README.md "./src/wan24-Poedit Docs/index.md"
- name: Build docs
run: docfx "./src/wan24-Poedit Docs/docfx.json" -t default,templates/singulinkfx
- name: Commit
uses: stefanzweifel/git-auto-commit-action@v5
26 changes: 26 additions & 0 deletions .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# This workflow will build a .NET project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net

name: .NET

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 8.0.x
- name: Restore dependencies
run: dotnet restore ./src/wan24-Poedit.sln --ignore-failed-sources
- name: Build lib
run: dotnet build "./src/wan24-Poedit/wan24-Poedit.csproj" --no-restore
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -396,3 +396,10 @@ FodyWeavers.xsd

# JetBrains Rider
*.sln.iml

# NuGetconfig
nuget.config
nuget-publish.bat

# Others
**/log.txt
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2024 nd
Copyright (c) 2024 Andreas Zimmermann, wan24.de

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
47 changes: 46 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,47 @@
# wan24-Poedit
Poedit translation helper

This library contains an adapter for using Poedit PO files with `wan24-Core`
translation helpers. [Karambolo.PO](https://github.com/adams85/po) is being
referenced for that, 'cause no PO format parsing is implemented in
`wan24-Poedit`.

## Usage

### How to get it

This library is available as
[NuGet package "wan24-Poedit"](https://www.nuget.org/packages/wan24-Poedit/).

### Loading a translation from Poedit PO format

```cs
// From a PO file
PoeditTranslationTerms terms = PoeditTranslationTerms.FromFile("/path/to/file.po");
PoeditTranslationTerms terms = await PoeditTranslationTerms.FromFileAsync("/path/to/file.po");

// From a PO stream
PoeditTranslationTerms terms = PoeditTranslationTerms.FromStream(poStream);
PoeditTranslationTerms terms = await PoeditTranslationTerms.FromStreamAsync(poStream);

// From a PO string
PoeditTranslationTerms terms = PoeditTranslationTerms.FromString(poString);

// From a byte array (UTF-8 encoded PO string)
PoeditTranslationTerms terms = PoeditTranslationTerms.FromBytes(poData);

// From a POCatalog
PoeditTranslationTerms terms = new(poCatalog);
```

The created `terms` instance can be used for the `wan24-Core` `Translation`.
Please refer to the `wan24-Core` documentation for more details about that.

### Creating a PO file from source code

This library only contains PO reading helpers for working with the
`wan24-Core` translation helpers. For creating a PO file you might want to use
the dotnet tool
[wan24-PoeditParser](https://github.com/nd1012/wan24-PoeditParser), which is
able to parse C# source code (and any other source language code) and create a
PO file, which can be used with Poedit. Also the `wan24-PoeditParser` can be
used as custom extractor for the Poedit GUI.
3 changes: 3 additions & 0 deletions src/wan24-Poedit Docs/api/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# API reference

Choose a type from the left to start browsing.
1 change: 1 addition & 0 deletions src/wan24-Poedit Docs/articles/intro.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# wan24-Poedit Wiki
2 changes: 2 additions & 0 deletions src/wan24-Poedit Docs/articles/toc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- name: Introduction
href: intro.md
79 changes: 79 additions & 0 deletions src/wan24-Poedit Docs/docfx.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
{
"metadata": [
{
"src": [
{
"files": [
"**.csproj"
],
"exclude": [
"**/*Tests.csproj"
],
"src": ".."
}
],
"dest": "api",
"disableGitFeatures": false,
"disableDefaultFilter": false
}
],
"build": {
"content": [
{
"files": [
"api/**.yml",
"api/index.md"
]
},
{
"files": [
"articles/**.md",
"articles/**/toc.yml",
"toc.yml",
"*.md"
]
}
],
"resource": [
{
"files": [
"images/**"
]
}
],
"overwrite": [
{
"files": [
],
"exclude": [
"obj/**"
]
}
],
"dest": "../../docs",
"globalMetadataFiles": [],
"globalMetadata": {
"_appTitle": "wan24-Poedit",
"_appFooter": "(c) 2024 Andreas Zimmermann, wan24.de",
"_copyrightFooter": "(c) 2024 Andreas Zimmermann, wan24.de",
//"_appLogoPath": "custom/logo.png",
//"_appFaviconPath": "custom/favicon.ico",
"_enableSearch": true,
"_disableSideFilter": false,
"_enableNewTab": true,
"_disableContribution": false,
"_disableBreadcrumb": false,
},
"fileMetadataFiles": [],
"template": [
"default",
"templates/singulinkfx"
],
"postProcessors": [],
"markdownEngineName": "markdig",
"noLangKeyword": false,
"keepFileLink": false,
"cleanupCacheHistory": false,
"disableGitFeatures": false
}
}
1 change: 1 addition & 0 deletions src/wan24-Poedit Docs/docs/getting-started.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Getting Started
1 change: 1 addition & 0 deletions src/wan24-Poedit Docs/docs/introduction.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Introduction
4 changes: 4 additions & 0 deletions src/wan24-Poedit Docs/docs/toc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
- name: Introduction
href: introduction.md
- name: Getting Started
href: getting-started.md
1 change: 1 addition & 0 deletions src/wan24-Poedit Docs/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# wan24-Poedit
74 changes: 74 additions & 0 deletions src/wan24-Poedit Docs/templates/singulinkfx/layout/_master.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
{{!Copyright (c) Microsoft. All rights reserved. Licensed under the MIT license. See LICENSE file in the project root for full license information.}}
{{!include(/^styles/.*/)}}
{{!include(/^fonts/.*/)}}
{{!include(favicon.ico)}}
{{!include(logo.svg)}}
{{!include(search-stopwords.json)}}
<!DOCTYPE html>
<!--[if IE]><![endif]-->
<html>
{{>partials/head}}

<body>
<!-- Header required for docfx anchor scroll to work -->
<header id="head"></header>
<div class="top-navbar">
<a class="burger-icon" onclick="toggleMenu()">
<svg name="Hamburger"
style="vertical-align: middle;"
width="34" height="34" viewBox="0 0 24 24"><path fill="currentColor" fill-rule="evenodd" clip-rule="evenodd" d="M20 6H4V9H20V6ZM4 10.999H20V13.999H4V10.999ZM4 15.999H20V18.999H4V15.999Z"></path></svg>
</a>

{{>partials/logo}}
</div>

<div class="body-content">
<div id="blackout" class="blackout" onclick="toggleMenu()"></div>

<nav id="sidebar" role="navigation">
<div class="sidebar">
{{>partials/navbar}}
<div class="sidebar-item-separator"></div>
{{^_disableToc}}
{{>partials/toc}}
{{/_disableToc}}
</div>
{{>partials/footer}}
</nav>

<main class="main-panel">
{{#_enableSearch}}
{{>partials/searchResults}}
{{/_enableSearch}}



<div role="main" class="hide-when-search" >
{{^_disableBreadcrumb}}
{{>partials/breadcrumb}}
{{/_disableBreadcrumb}}

{{^_disableContribution}}
<div id="contribution">
{{#docurl}}
<a href="{{docurl}}" class="contribution-link">{{__global.improveThisDoc}}</a>
{{/docurl}}
</div>
{{/_disableContribution}}

<article class="content wrap" id="_content" data-uid="{{uid}}">
{{!body}}
</article>
</div>

{{#_copyrightFooter}}
<div class="copyright-footer">
<span>{{_copyrightFooter}}</span>
</div>
{{/_copyrightFooter}}
</main>
</div>

{{>partials/scripts}}
</body>
</html>
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<div class="footer">
{{{_appFooter}}}
{{^_appFooter}}<strong><a href='https://dotnet.github.io/docfx/'>DocFX</a> + <a href='https://www.singulink.com'>Singulink</a> = ♥</strong>{{/_appFooter}}
</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{{!Copyright (c) Microsoft. All rights reserved. Licensed under the MIT license. See LICENSE file in the project root for full license information.}}

<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>{{#title}}{{title}}{{/title}}{{^title}}{{>partials/title}}{{/title}} {{#_appTitle}}| {{_appTitle}} {{/_appTitle}}</title>
<meta name="viewport" content="width=device-width">
<meta name="title" content="{{#title}}{{title}}{{/title}}{{^title}}{{>partials/title}}{{/title}} {{#_appTitle}}| {{_appTitle}} {{/_appTitle}}">
<meta name="generator" content="docfx {{_docfxVersion}}">
{{#_description}}<meta name="description" content="{{_description}}">{{/_description}}
<link rel="shortcut icon" href="{{_rel}}{{{_appFaviconPath}}}{{^_appFaviconPath}}favicon.ico{{/_appFaviconPath}}">
<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500;700&display=swap" rel="stylesheet">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.7.0/styles/night-owl.min.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.7.2/font/bootstrap-icons.css" integrity="sha384-EvBWSlnoFgZlXJvpzS+MAUEjvN7+gcCwH+qh7GRFOGgZO0PuwOFro7qPOJnLfe7l" crossorigin="anonymous">
<link rel="stylesheet" href="{{_rel}}styles/config.css">
<link rel="stylesheet" href="{{_rel}}styles/singulink.css">
<link rel="stylesheet" href="{{_rel}}styles/main.css">
<meta property="docfx:navrel" content="{{_navRel}}">
<meta property="docfx:tocrel" content="{{_tocRel}}">
{{#_noindex}}<meta name="searchOption" content="noindex">{{/_noindex}}
{{#_enableSearch}}<meta property="docfx:rel" content="{{_rel}}">{{/_enableSearch}}
{{#_enableNewTab}}<meta property="docfx:newtab" content="true">{{/_enableNewTab}}
</head>
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{{!Copyright (c) Microsoft. All rights reserved. Licensed under the MIT license. See LICENSE file in the project root for full license information.}}

<ul class="nav level{{level}}">
{{#items}}
{{^dropdown}}
<li>
{{^leaf}}
<span class="expand-stub"></span>
{{/leaf}}
{{#topicHref}}
<a href="{{topicHref}}" class="sidebar-item" name="{{tocHref}}" title="{{name}}">{{name}}</a>
{{/topicHref}}
{{^topicHref}}
<a>{{{name}}}</a>
{{/topicHref}}

{{^leaf}}
{{>partials/li}}
{{/leaf}}
</li>
{{/dropdown}}
{{#dropdown}}
<li class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" href="#" role="button" aria-haspopup="true" aria-expanded="false">{{name}} <span class="caret"></span></a>
<ul class="dropdown-menu level{{level}}">
{{>partials/dd-li}}
</ul>
</li>
{{/dropdown}}
{{/items}}
</ul>
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{{!Copyright (c) Microsoft. All rights reserved. Licensed under the MIT license. See LICENSE file in the project root for full license information.}}

<a class="brand" href="{{_rel}}index.html">
<img src="{{_rel}}{{{_appLogoPath}}}{{^_appLogoPath}}logo.svg{{/_appLogoPath}}" alt="{{_appName}}" class="logomark">
<span class="brand-title">{{_appName}}</span>
</a>
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{{!Copyright (c) Microsoft. All rights reserved. Licensed under the MIT license. See LICENSE file in the project root for full license information.}}

<h1 id="{{id}}" data-uid="{{uid}}" class="text-break">{{>partials/title}}</h1>
<div class="markdown level0 summary">{{{summary}}}</div>
<div class="markdown level0 conceptual">{{{conceptual}}}</div>
<div class="markdown level0 remarks">{{{remarks}}}</div>
{{#children}}
<h3 id="{{id}}">{{>partials/namespaceSubtitle}}</h3>
{{#children}}
<h5><xref uid="{{uid}}" altProperty="fullName" displayProperty="name"/></h5>
<section>{{{summary}}}</section>
{{/children}}
{{/children}}
Loading

0 comments on commit f147c50

Please sign in to comment.