Skip to content

Add translation capability + French translations + Fix build #25

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 16 commits into
base: master
Choose a base branch
from
Open
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
16 changes: 16 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# EditorConfig <https://EditorConfig.org>
root = true

# elementary defaults
[*]
charset = utf-8
end_of_line = lf
indent_size = tab
indent_style = space
insert_final_newline = true
max_line_length = 80
tab_width = 4

# Markup files
[{*.html,*.xml,*.xml.in,*.yml}]
tab_width = 2
4 changes: 0 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
*.swp
*~

build
.ninja_*
build.ninja
data/writeas
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8" ?>
<component type="desktop-application">
<id>@app_id@</id>
<id>com.github.writeas.writeas-gtk</id>
<project_license>GPL-3.0+</project_license>
<metadata_license>CC0</metadata_license>
<name>Write.as</name>
Expand All @@ -16,7 +16,7 @@
<li>Work on a single local draft, then publish or save as another file when you're finished</li>
<li>Choose from three different fonts: serif, sans-serif, or monospace</li>
<li>Dark mode on platforms that support it</li>
<li>Publish to Write.as and share your post (<a href="https://write.as/l23z7d6yb0dd5v4c.md">example</a>)</li>
<li>Publish to Write.as and share your post</li>
<li>Manage published posts with the built-in command-line interface</li>
</ul>
</description>
Expand All @@ -28,7 +28,7 @@
<update_contact>[email protected]</update_contact>

<provides>
<binary>@app_id@</binary>
<binary>com.github.writeas.writeas-gtk</binary>
</provides>

<screenshots>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
Type=Application
Name=Write.as
Comment=Publish a thought in seconds.
Exec=@app_id@
Icon=@app_id@
Exec=com.github.writeas.writeas-gtk
Icon=com.github.writeas.writeas-gtk
Terminal=false
MimeType=
Categories=GTK;Office;Publishing;
Expand Down
40 changes: 24 additions & 16 deletions data/meson.build
Original file line number Diff line number Diff line change
@@ -1,24 +1,32 @@
# Install icons
icon_sizes = ['16', '24', '32', '48', '64', '128']

foreach i : icon_sizes
install_data(
join_paths('icons', i, meson.project_name() + '.png'),
install_dir: join_paths(get_option('datadir'), 'icons', 'hicolor', i + 'x' + i, 'apps'),
rename: '@[email protected]'.format(app_id)
install_data (
join_paths ('icons', i, meson.project_name () + '.png'),
install_dir: join_paths (get_option ('datadir'), 'icons', 'hicolor', i + 'x' + i, 'apps')
)
install_data (
join_paths ('icons', i, meson.project_name () + '.png'),
install_dir: join_paths (get_option ('datadir'), 'icons', 'hicolor', i + 'x' + i + '@2', 'apps')
)
endforeach

data_conf = configuration_data()
data_conf.set('app_id', app_id)
configure_file(
input: 'writeas-gtk.desktop.in',
output: '@[email protected]'.format(app_id),
configuration: data_conf,
install_dir: join_paths(get_option('datadir'), 'applications')
# Translate and install our .desktop file so the Applications Menu will see it
i18n.merge_file (
input: meson.project_name () + '.desktop.in',
output: meson.project_name () + '.desktop',
po_dir: join_paths (meson.source_root (), 'po', 'extra'),
type: 'desktop',
install: true,
install_dir: join_paths (get_option ('datadir'), 'applications')
)
configure_file(
input: 'writeas-gtk.appdata.xml.in',
output: '@[email protected]'.format(app_id),
configuration: data_conf,
install_dir: join_paths(get_option('datadir'), 'metainfo')

# Translate and install our .appdata.xml file so AppCenter will see it
i18n.merge_file (
input: meson.project_name () + '.appdata.xml.in',
output: meson.project_name () + '.appdata.xml',
po_dir: join_paths (meson.source_root (), 'po', 'extra'),
install: true,
install_dir: join_paths (get_option ('datadir'), 'metainfo')
)
File renamed without changes
File renamed without changes
File renamed without changes
56 changes: 36 additions & 20 deletions meson.build
Original file line number Diff line number Diff line change
@@ -1,29 +1,45 @@
project('writeas-gtk', ['vala', 'c'],
# Project name, programming language and version
project (
'com.github.writeas.writeas-gtk',
'c', 'vala',
version: '1.0.2',
license: 'GPL',
meson_version: '>=0.46.0')
)

i18n = import('i18n')

build_platform = get_option('platform')
if build_platform == 'elementary'
app_id = 'com.github.writeas.writeas-gtk'
else
app_id = 'writeas-gtk'
endif
# GNOME module
gnome = import ('gnome')

conf = configuration_data()
conf.set_quoted('GETTEXT_PACKAGE', app_id)
conf.set_quoted('APP_ID', app_id)
conf.set_quoted('BUILD_PLATFORM', build_platform)
config_h = configure_file(output: 'config.h', configuration: conf)
config_h_dir = include_directories('.')
# Translation module
i18n = import ('i18n')


# Project arguments
add_project_arguments (
'-DGETTEXT_PACKAGE="@0@"'.format (meson.project_name ()),
language: 'c'
)

# Listing dependencies
dependencies = [
dependency ('gtk+-3.0'),
dependency ('gtksourceview-3.0')
]

run_target('build', command: 'meson/build-cli.sh')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does the CLI still get built when building the app now?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added this line back but don't see it in action. Any idea?

Copy link
Author

@NathanBnm NathanBnm Nov 19, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Writeas CLI is not being installed


subdir('data')
subdir('src')
subdir('fonts/lora')
subdir ('src')

# Define executable
executable (
meson.project_name (),
sources,
dependencies: dependencies,
install: true
)

subdir ('data')
subdir ('po')

meson.add_install_script('meson/post_install.py')
subdir ('fonts/lora')

meson.add_install_script ('meson/post_install.py')
6 changes: 1 addition & 5 deletions meson/build-cli.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
#!/bin/bash

exec_name=writeas

echo "Building $exec_name CLI..."
echo "Building $exec_name CLI…"
gb build github.com/writeas/writeas-cli/cmd/writeas &&
echo "Success."
25 changes: 9 additions & 16 deletions meson/post_install.py
Original file line number Diff line number Diff line change
@@ -1,22 +1,15 @@
#!/usr/bin/env python3

import os
from os import path, environ
import subprocess

prefix = os.environ.get('MESON_INSTALL_PREFIX', '/usr/local')
datadir = os.path.join(prefix, 'share')
prefix = environ.get('MESON_INSTALL_PREFIX', '/usr/local')
schemadir = path.join(environ['MESON_INSTALL_PREFIX'], 'share', 'glib-2.0', 'schemas')
datadir = path.join(prefix, 'share')
desktop_database_dir = path.join(datadir, 'applications')

# Packaging tools define DESTDIR and this isn't needed for them
if 'DESTDIR' not in os.environ:
print('Updating icon cache...')
icon_cache_dir = os.path.join(datadir, 'icons', 'hicolor')
if not os.path.exists(icon_cache_dir):
os.makedirs(icon_cache_dir)
subprocess.call(['gtk-update-icon-cache', '-qtf', icon_cache_dir])

print('Updating desktop database...')
desktop_database_dir = os.path.join(datadir, 'applications')
if not os.path.exists(desktop_database_dir):
os.makedirs(desktop_database_dir)
if not environ.get('DESTDIR'):
print('Updating desktop database…')
subprocess.call(['update-desktop-database', '-q', desktop_database_dir])

print('Updating icon cache…')
subprocess.call(['gtk-update-icon-cache', '-qtf', path.join(datadir, 'icons', 'hicolor')])
1 change: 0 additions & 1 deletion meson_options.txt

This file was deleted.

1 change: 1 addition & 0 deletions po/LINGUAS
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
fr
2 changes: 2 additions & 0 deletions po/POTFILES
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
src/Granite/Accels.vala
src/Window.vala
97 changes: 97 additions & 0 deletions po/com.github.writeas.writeas-gtk.pot
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the com.github.writeas.writeas-gtk package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: com.github.writeas.writeas-gtk\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-11-19 15:58+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"

#: src/Granite/Accels.vala:42
msgid "Shift"
msgstr ""

#: src/Granite/Accels.vala:46
msgid "Ctrl"
msgstr ""

#: src/Granite/Accels.vala:50
msgid "Alt"
msgstr ""

#. TRANSLATORS: This is a non-symbol representation of the "-" key
#: src/Granite/Accels.vala:69
msgid "Minus"
msgstr ""

#. TRANSLATORS: This is a non-symbol representation of the "+" key
#: src/Granite/Accels.vala:74
msgid "Plus"
msgstr ""

#: src/Granite/Accels.vala:78
msgid "Enter"
msgstr ""

#. TRANSLATORS: This is a delimiter that separates two keyboard shortcut labels like "⌘ + →, Control + A"
#: src/Granite/Accels.vala:124
msgid ", "
msgstr ""

#: src/Window.vala:56
#, c-format
msgid "%i word"
msgid_plural "%i words"
msgstr[0] ""
msgstr[1] ""

#: src/Window.vala:144
msgid "Publish to Write.as on the web"
msgstr ""

#: src/Window.vala:154
msgid "Light theme"
msgstr ""

#: src/Window.vala:155
msgid "Dark theme"
msgstr ""

#: src/Window.vala:158
msgid "Toggle light/dark theme"
msgstr ""

#: src/Window.vala:172
msgid "Change document font"
msgstr ""

#: src/Window.vala:177
msgid "Serif"
msgstr ""

#: src/Window.vala:178
msgid "Sans-serif"
msgstr ""

#: src/Window.vala:180
msgid "Monospace"
msgstr ""

#: src/Window.vala:374
msgid "Save as"
msgstr ""

#: src/Window.vala:387
msgid "Cancel"
msgstr ""
1 change: 1 addition & 0 deletions po/extra/LINGUAS
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
fr
2 changes: 2 additions & 0 deletions po/extra/POTFILES
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
data/com.github.writeas.writeas-gtk.desktop.in
data/com.github.writeas.writeas-gtk.appdata.xml.in
Loading