Skip to content
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

Draft: Feat/occ 59/translations import #872

Open
wants to merge 7 commits into
base: development
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
4 changes: 4 additions & 0 deletions dev-ops/docker/actions/.translations-import.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env bash
#DESCRIPTION: wrapper script to run .translations-import.sh with the env settings for docker

INCLUDE: ../../local.team-opencaching.de/actions/.translations-import.sh
10 changes: 10 additions & 0 deletions dev-ops/docker/actions/crowdin-import.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/usr/bin/env bash
#DESCRIPTION: Import translations from crowdin (see https://opencaching.atlassian.net/wiki/spaces/TRA/pages/5734402/Translation+Handling+Legacy#Import-translations-with-Crowdin-CLI-V3 for setup instructions)

# Avoid error "Downloaded translations don't match the current project configuration."
mkdir -p htdocs/app/Resources/translations/legacycode
touch htdocs/app/Resources/translations/legacycode/oc_legacy.csv

cd htdocs && crowdin download

docker exec -u __USERKEY__ -t __PHP_FPM_ID__ ./psh.phar docker:.translations-import
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/usr/bin/env bash
#DESCRIPTION: download and extract translation file from opencaching.de

cd htdocs && curl -o translations.zip "https://www.opencaching.de/translations.zip"
cd htdocs && unzip -o translations.zip
cd htdocs && rm translations.zip
13 changes: 13 additions & 0 deletions dev-ops/local.team-opencaching.de/actions/.translations-import.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/usr/bin/env bash
#DESCRIPTION: import locally available translations

./htdocs/bin/console translation:update de --force
./htdocs/bin/console translation:update el --force
./htdocs/bin/console translation:update en --force
./htdocs/bin/console translation:update es --force
./htdocs/bin/console translation:update fr --force
./htdocs/bin/console translation:update it --force
./htdocs/bin/console translation:update nl --force
./htdocs/bin/console translation:update pl --force
./htdocs/bin/console translation:update ru --force
./htdocs/bin/console translation:import-legacy-translation
16 changes: 2 additions & 14 deletions dev-ops/local.team-opencaching.de/actions/import-translations.sh
Original file line number Diff line number Diff line change
@@ -1,17 +1,5 @@
#!/usr/bin/env bash
#DESCRIPTION: import translation file from opencaching.de

cd htdocs && curl -o translations.zip "https://www.opencaching.de/translations.zip"
cd htdocs && unzip -o translations.zip
cd htdocs && rm translations.zip

./htdocs/bin/console translation:update de --force
./htdocs/bin/console translation:update el --force
./htdocs/bin/console translation:update en --force
./htdocs/bin/console translation:update es --force
./htdocs/bin/console translation:update fr --force
./htdocs/bin/console translation:update it --force
./htdocs/bin/console translation:update nl --force
./htdocs/bin/console translation:update pl --force
./htdocs/bin/console translation:update ru --force
./htdocs/bin/console translation:import-legacy-translation
INCLUDE: ./.translations-download.sh
INCLUDE: ./.translations-import.sh
5 changes: 3 additions & 2 deletions htdocs/crowdin.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# crowdin.yaml for Crowdin CLI 2
project_identifier: opencaching
base_url: https://api.crowdin.com #Your personal key can be found at https://crowdin.com/project/opencaching/settings#api
api_key:
base_url: https://api.crowdin.com
api_key: # Your personal key can be found at https://crowdin.com/settings
base_path: /var/www/html/htdocs/

files:
Expand Down
29 changes: 29 additions & 0 deletions htdocs/crowdin.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# crowdin.yml for Crowdin CLI 3
# see https://opencaching.atlassian.net/wiki/spaces/TRA/pages/5734402/Translation+Handling+Legacy#Import-translations-with-Crowdin-CLI-V3

"project_id" : "186510"
"base_path" : "."
"base_url" : "https://api.crowdin.com"

"api_token_env": "CROWDIN_PERSONAL_TOKEN"

"preserve_hierarchy": true

files: [
{
"source": "/app/Resources/translations/constants.en.yml",
"translation": "/app/Resources/translations/constants.%two_letters_code%.yml",
},
{
"source": "/app/Resources/translations/messages.en.yml",
"translation": "/app/Resources/translations/messages.%two_letters_code%.yml",
},
{
"source": "/app/Resources/translations/validators.en.yml",
"translation": "/app/Resources/translations/validators.%two_letters_code%.yml",
},
{
"source": "/app/Resources/translations/legacycode/oc_legacy.csv",
"translation": "/app/Resources/translations/legacycode/oc_legacy.%two_letters_code%.csv",
}
]
13 changes: 0 additions & 13 deletions htdocs/templates2/ocstyle/sys_topmenu.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,6 @@
***************************************************************************}
{* OCSTYLE *}
{strip}
{* OC Premium :P *}
{assign var=dateDay value=$smarty.now|date_format:"%d"}
{assign var=dateMonth value=$smarty.now|date_format:"%m"}

{if ($dateDay == "01" && $dateMonth == "04") || $smarty.get.premium}
<li>
<a style="background: #AA0000;" href='{literal}javascript:(function(){function c(){var e=document.createElement("link");e.setAttribute("type","text/css");e.setAttribute("rel","stylesheet");e.setAttribute("href",f);e.setAttribute("class",l);document.body.appendChild(e)}function h(){var e=document.getElementsByClassName(l);for(var t=0;t<e.length;t++){document.body.removeChild(e[t])}}function p(){var e=document.createElement("div");e.setAttribute("class",a);document.body.appendChild(e);setTimeout(function(){document.body.removeChild(e)},100)}function d(e){return{height:e.offsetHeight,width:e.offsetWidth}}function v(i){var s=d(i);return s.height>e&&s.height<n&&s.width>t&&s.width<r}function m(e){var t=e;var n=0;while(!!t){n+=t.offsetTop;t=t.offsetParent}return n}function g(){var e=document.documentElement;if(!!window.innerWidth){return window.innerHeight}else if(e&&!isNaN(e.clientHeight)){return e.clientHeight}return 0}function y(){if(window.pageYOffset){return window.pageYOffset}return Math.max(document.documentElement.scrollTop,document.body.scrollTop)}function E(e){var t=m(e);return t>=w&&t<=b+w}function S(){var e=document.createElement("audio");e.setAttribute("class",l);e.src=i;e.loop=false;e.addEventListener("canplay",function(){setTimeout(function(){x(k)},500);setTimeout(function(){N();p();for(var e=0;e<O.length;e++){T(O[e])}},15500)},true);e.addEventListener("ended",function(){N();h()},true);e.innerHTML=" <p>If you are reading this, it is because your browser does not support the audio element. We recommend that you get a new browser.</p> <p>";document.body.appendChild(e);e.play()}function x(e){e.className+=" "+s+" "+o}function T(e){e.className+=" "+s+" "+u[Math.floor(Math.random()*u.length)]}function N(){var e=document.getElementsByClassName(s);var t=new RegExp("\\b"+s+"\\b");for(var n=0;n<e.length;){e[n].className=e[n].className.replace(t,"")}}var e=30;var t=30;var n=350;var r=350;var i="//s3.amazonaws.com/moovweb-marketing/playground/harlem-shake.mp3";var s="mw-harlem_shake_me";var o="im_first";var u=["im_drunk","im_baked","im_trippin","im_blown"];var a="mw-strobe_light";var f="//s3.amazonaws.com/moovweb-marketing/playground/harlem-shake-style.css";var l="mw_added_css";var b=g();var w=y();var C=document.getElementsByTagName("*");var k=null;for(var L=0;L<C.length;L++){var A=C[L];if(v(A)){if(E(A)){k=A;break}}}if(A===null){console.warn("Could not find a node of the right size. Please try a different page.");return}c();S();var O=[];for(var L=0;L<C.length;L++){var A=C[L];if(v(A)){O.push(A)}}})(){/literal}'>
Premium
</a>
</li>
{/if}
{* OC Premium :P *}

{foreach name=topmenu from=$items item=menuitem}
<li><a href="{$menuitem.href}" {$menuitem.target} {if $menuitem.selected} class="selected bg-green06"{/if}>{$menuitem.menustring|escape}</a></li>
{/foreach}
Expand Down