Skip to content
This repository has been archived by the owner on Jun 17, 2021. It is now read-only.

Commit

Permalink
Update language logic & styles
Browse files Browse the repository at this point in the history
  • Loading branch information
miyacorata committed Jan 20, 2020
1 parent 74e0285 commit ceb9cfd
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 17 deletions.
1 change: 1 addition & 0 deletions app/Http/Controllers/IdolController.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ public function show($name_r)
case 'ja':
break;
case 'en':
case 'zh-CN':
$name .= '_r'; break;
default:
$name .= '_'.mb_substr(\App::getLocale(),0,2);
Expand Down
1 change: 1 addition & 0 deletions public/css/idol.css
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
background-repeat: no-repeat;
background-size: 32px;
background-position: top 5px left;
font-family: 'VL PGothic',sans-serif;
}
#idolname.Fairy{
background-image: url("../image/fairy_symbol.png");
Expand Down
11 changes: 9 additions & 2 deletions public/css/style.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
@import url("https://fonts.googleapis.com/css?family=Gothic+A1:400,700&display=swap&subset=korean");
@import url("https://fonts.googleapis.com/css?family=Open+Sans:400,700&display=swap");
@import url('https://fonts.googleapis.com/css?family=Noto+Sans+TC:400,700&display=swap');

@font-face {
font-family: "VL PGothic";
Expand All @@ -15,16 +16,22 @@ body{
box-sizing: border-box;
min-height: 99vh;

font-family: 'Open Sans','VL PGothic','Gothic A1','Segoe UI',sans-serif;
font-family: 'Open Sans','VL PGothic','Gothic A1',sans-serif;
}
*:focus{
outline: none;
}

.ja{
font-family: 'VL PGothic',sans-serif;
}
.zh_TW{
font-family: 'Noto Sans TC',sans-serif;
}

html{
min-width: 1300px;
margin: 0;
font-family: "VL PGothic", sans-serif;
font-weight: 500;
background:
repeating-linear-gradient(45deg, rgba(255,255,255,0.5), rgba(255,255,255,0.5) 1px, rgba(255,255,255,0) 2px, rgba(255,255,255,0) 40px),
Expand Down
5 changes: 2 additions & 3 deletions resources/views/idol/index.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,17 @@
<?php
$current_lang = App::getLocale();
$ja_flag = App::isLocale('ja');
$en_flag = App::isLocale('en');
?>
@foreach ($idols as $idol)
<?php
/** @var App\Idol $idol */
$icon = asset('image/icon/'.$idol->name_r.'/0.png');
if(!$ja_flag){
$name = 'name_'.($en_flag ? 'r' : mb_substr($current_lang,0,2));
$name = 'name_'.((App::isLocale('en') || App::isLocale('zh-CN')) ? 'r' : mb_substr($current_lang,0,2));
if(empty($idol->$name)) $name = 'name_r'; //fallback
$separate = $name.'_separate';
$text = e(ucwords(separateString($idol->$name,$idol->$separate)));
$text .= "<span style='font-size: 15px;color: dimgray;margin-left: 15px'>".e(ucwords(separateString($idol->name,$idol->name_separate)))."</span>";
$text .= "<span class='ja' style='font-size: 15px;color: dimgray;margin-left: 15px'>".e(ucwords(separateString($idol->name,$idol->name_separate)))."</span>";
}
$dateflag = $ja_flag ? 'ja' : 'slash';
?>
Expand Down
16 changes: 8 additions & 8 deletions resources/views/idol/show.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,12 @@
if(!empty($idol->subname)) $namestr .= ' ('.$idol->subname.')';
$dateflag = App::isLocale('ja') ? 'ja' : 'slash';
$urlname = urlencode($idol->name) ?>
<th>{{ __fb('Name') }}</th><td colspan="2">{{ $namestr }}</td>
<th>{{ __fb('CV') }}</th><td colspan="2">{{ $idol->cv }}</td>
<th>{{ __fb('Name') }}</th><td colspan="2" class="ja">{{ $namestr }}</td>
<th>{{ __fb('CV') }}</th><td colspan="2" class="ja">{{ $idol->cv }}</td>
</tr>
<tr>
<th>{{ __fb('Hiragana') }}</th><td colspan="2">{{ separateString($idol->name_y,$idol->name_y_separate) }}</td>
<th>{{ __fb('Chinese') }}</th><td colspan="2">{{ $idol->name_zh ? separateString($idol->name_zh,$idol->name_zh_separate) : __fb('N/A') }}</td>
<th>{{ __fb('Hiragana') }}</th><td colspan="2" class="ja">{{ separateString($idol->name_y,$idol->name_y_separate) }}</td>
<th>{{ __fb('Chinese') }}</th><td colspan="2" class="zh_TW">{{ $idol->name_zh ? separateString($idol->name_zh,$idol->name_zh_separate) : __fb('N/A') }}</td>
</tr>
<tr>
<th>Alphabet</th><td colspan="2">{{ ucwords(separateString($idol->name_r,$idol->name_r_separate)) }}</td>
Expand All @@ -67,27 +67,27 @@
<th>{{ __fb('Handedness') }}</th><td>{{ __fb(translateHandedness($idol->handedness)) ?: __fb('N/A') }}</td>
</tr>
<tr>
<th>{{ __fb('Birthplace') }}</th><td><a href="{{ url('/search').'?birthplace='.$idol->birthplace }}">{{ $idol->birthplace ?: '不明' }}</a></td>
<th>{{ __fb('Birthplace') }}</th><td class="ja"><a href="{{ url('/search').'?birthplace='.$idol->birthplace }}">{{ $idol->birthplace ?: '不明' }}</a></td>
<th>BMI</th><td>{{ calcBmi($idol->height,$idol->weight) ?: __fb('N/A') }}</td>
<th>{{ __fb('3 size') }}</th><td>{{ $idol->bust ? $idol->bust.' / '.$idol->waist.' / '.$idol->hip : __fb('N/A') }}</td>
</tr>
<tr>
<th>{{ __fb('Hobby') }}</th>
<td colspan="5">
<td colspan="5" class="ja">
<?php if(!App::isLocale('ja')) echo genTranslationLink($idol->hobby,App::getLocale()) ?>
{{ $idol->hobby ?: __fb('N/A') }}
</td>
</tr>
<tr>
<th>{{ __fb('Skill') }}</th>
<td colspan="5">
<td colspan="5" class="ja">
<?php if(!App::isLocale('ja')) echo genTranslationLink($idol->skill,App::getLocale()) ?>
{{ $idol->skill ?: __fb('N/A') }}
</td>
</tr>
<tr>
<th>{{ __fb('Favorite') }}</th>
<td colspan="5">
<td colspan="5" class="ja">
<?php if(!App::isLocale('ja')) echo genTranslationLink($idol->favorite,App::getLocale()) ?>
{{ $idol->favorite ?: __fb('N/A') }}
</td>
Expand Down
1 change: 0 additions & 1 deletion resources/views/layouts/app.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ function gtag(){dataLayer.push(arguments);}
</style>
@elseif(\App::isLocale('zh-TW'))
<style>
@import url('https://fonts.googleapis.com/css?family=Noto+Sans+TC:400,700&display=swap');
body{
font-family: 'Noto Sans TC','Open Sans','VL PGothic','Gothic A1','Segoe UI',sans-serif;
}
Expand Down
5 changes: 2 additions & 3 deletions resources/views/search/result.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,17 @@
<?php
$current_lang = App::getLocale();
$ja_flag = App::isLocale('ja');
$en_flag = App::isLocale('en');
?>
@forelse ($search as $idol)
<?php
/** @var App\Idol $idol */
$icon = asset('image/icon/'.$idol->name_r.'/0.png');
if(!$ja_flag){
$name = 'name_'.($en_flag ? 'r' : mb_substr($current_lang,0,2));
$name = 'name_'.((App::isLocale('en') || App::isLocale('zh-CN')) ? 'r' : mb_substr($current_lang,0,2));
if(empty($idol->$name)) $name = 'name_r'; //fallback
$separate = $name.'_separate';
$text = e(ucwords(separateString($idol->$name,$idol->$separate)));
$text .= "<span style='font-size: 15px;color: dimgray;margin-left: 15px'>".e(ucwords(separateString($idol->name,$idol->name_separate)))."</span>";
$text .= "<span class='ja' style='font-size: 15px;color: dimgray;margin-left: 15px'>".e(ucwords(separateString($idol->name,$idol->name_separate)))."</span>";
}
$dateflag = $ja_flag ? 'ja' : 'slash';
?>
Expand Down

0 comments on commit ceb9cfd

Please sign in to comment.